aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Trainer.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/server/game/Entities/Creature/Trainer.cpp b/src/server/game/Entities/Creature/Trainer.cpp
index 10a3a47571a..266e96df27f 100644
--- a/src/server/game/Entities/Creature/Trainer.cpp
+++ b/src/server/game/Entities/Creature/Trainer.cpp
@@ -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;
}