aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGhaster <theghaster1@gmail.com>2019-01-03 16:52:22 +0100
committerTreeston <treeston.mmoc@gmail.com>2019-01-03 16:52:22 +0100
commit19791a35df11e2c5c42ee437bfc13466c708ea43 (patch)
treeb4918127cb8c4943a8f9a9fa2f3d3c2d881b9706 /src
parentb283565d8adb394862ea2affd2af497bac6cdbcb (diff)
Core/Creature: Profession trainer fixes (PR #22904)
Closes #22903
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;
}