diff options
author | Shauren <shauren.trinity@gmail.com> | 2018-12-08 00:06:36 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-12-08 00:06:36 +0100 |
commit | caad2f96d8c2a5135a4fec3d1a95d42b7a832d16 (patch) | |
tree | 2d5d4a7d51d5c5c5f65082fcc6a81f1a9761646d /src | |
parent | f272a78caab463988e0d244d92e4cb0fce2c942f (diff) |
Core/Trainers: Fixed trainer spells that are cast by trainer
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Trainer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/server/game/Entities/Creature/Trainer.cpp b/src/server/game/Entities/Creature/Trainer.cpp index 4f85599b74c..af59acb7496 100644 --- a/src/server/game/Entities/Creature/Trainer.cpp +++ b/src/server/game/Entities/Creature/Trainer.cpp @@ -141,21 +141,29 @@ namespace Trainer // check ranks bool hasLearnSpellEffect = false; + bool knowsAllLearnedSpells = true; for (SpellEffectInfo const* spellEffect : sSpellMgr->AssertSpellInfo(trainerSpell->SpellId)->GetEffectsForDifficulty(DIFFICULTY_NONE)) { if (!spellEffect || !spellEffect->IsEffect(SPELL_EFFECT_LEARN_SPELL)) continue; hasLearnSpellEffect = true; + if (!player->HasSpell(spellEffect->TriggerSpell)) + knowsAllLearnedSpells = false; + if (uint32 previousRankSpellId = sSpellMgr->GetPrevSpellInChain(spellEffect->TriggerSpell)) if (!player->HasSpell(previousRankSpellId)) return SpellState::Unavailable; } if (!hasLearnSpellEffect) + { if (uint32 previousRankSpellId = sSpellMgr->GetPrevSpellInChain(trainerSpell->SpellId)) if (!player->HasSpell(previousRankSpellId)) return SpellState::Unavailable; + } + else if (knowsAllLearnedSpells) + return SpellState::Known; // check additional spell requirement for (auto const& requirePair : sSpellMgr->GetSpellsRequiredForSpellBounds(trainerSpell->SpellId)) |