[11857] Fix sent level in trainer spell list - this fixes problems especially with druid trainers

* This allows to really  overwrite required level for spells
* Adds proper checks when buying
* Fixes default level requirement

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2011-12-04 19:17:00 +01:00
parent 20e2dddd6c
commit adfa88d236
6 changed files with 31 additions and 19 deletions

View file

@ -4003,7 +4003,7 @@ bool Player::HasActiveSpell(uint32 spell) const
itr->second.active && !itr->second.disabled);
}
TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell) const
TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell, uint32 reqLevel) const
{
if (!trainer_spell)
return TRAINER_SPELL_RED;
@ -4023,7 +4023,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
// check level requirement
if (!prof || GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_LEVEL)))
if (getLevel() < trainer_spell->reqLevel)
if (getLevel() < reqLevel)
return TRAINER_SPELL_RED;
if(SpellChainNode const* spell_chain = sSpellMgr.GetSpellChainNode(trainer_spell->learnedSpell))