Core/Creature: Profession trainer fixes (PR #22904)

Closes #22903
This commit is contained in:
Ghaster
2019-01-03 16:52:22 +01:00
committed by Treeston
parent b283565d8a
commit 19791a35df

View File

@@ -48,10 +48,15 @@ namespace Trainer
if (!player->IsSpellFitByClassAndRace(trainerSpell.SpellId))
continue;
SpellInfo const* trainerSpellInfo = sSpellMgr->AssertSpellInfo(trainerSpell.SpellId);
bool primaryProfessionFirstRank = false;
for (int32 reqAbility : trainerSpell.ReqAbility)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(reqAbility);
if (trainerSpellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
continue;
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpellInfo->Effects[i].TriggerSpell);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primaryProfessionFirstRank = true;
}
@@ -132,8 +137,16 @@ namespace Trainer
return false;
SpellInfo const* trainerSpellInfo = sSpellMgr->AssertSpellInfo(trainerSpell->SpellId);
if (trainerSpellInfo->IsPrimaryProfessionFirstRank() && !player->GetFreePrimaryProfessionPoints())
return false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (trainerSpellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
continue;
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpellInfo->Effects[i].TriggerSpell);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && !player->GetFreePrimaryProfessionPoints())
return false;
}
return true;
}