Implemented Basic Creature Scaling

Trainer followup
Misc Fixes
This commit is contained in:
hondacrx
2017-07-31 14:18:07 -04:00
parent 890ce8d81a
commit 473cea0f06
26 changed files with 370 additions and 96 deletions
+10 -3
View File
@@ -18,7 +18,8 @@ namespace Game.Entities
public Array<uint> ReqAbility = new Array<uint>(3);
public byte ReqLevel;
public uint CastSpellId;
public uint LearnedSpellId;
public bool IsCastable() { return LearnedSpellId != SpellId; }
}
public class Trainer
@@ -84,8 +85,8 @@ namespace Game.Entities
player.SendPlaySpellVisualKit(362, 1, 0); // 113 EmoteSalute
// learn explicitly or cast explicitly
if (trainerSpell.CastSpellId != 0)
player.CastSpell(player, trainerSpell.CastSpellId, true);
if (trainerSpell.IsCastable())
player.CastSpell(player, trainerSpell.SpellId, true);
else
player.LearnSpell(trainerSpell.SpellId, false);
}
@@ -129,6 +130,12 @@ namespace Game.Entities
if (player.getLevel() < trainerSpell.ReqLevel)
return TrainerSpellState.Unavailable;
// check ranks
uint previousRankSpellId = Global.SpellMgr.GetPrevSpellInChain(trainerSpell.LearnedSpellId);
if (previousRankSpellId != 0)
if (!player.HasSpell(previousRankSpellId))
return TrainerSpellState.Unavailable;
// check additional spell requirement
foreach (var spellId in Global.SpellMgr.GetSpellsRequiredForSpellBounds(trainerSpell.SpellId))
if (!player.HasSpell(spellId))