mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Trainers: Fixed trainer spells that are cast by trainer
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user