From 462e1f34a19e8596e31a820b90e3bdf77254c1e0 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 18 Nov 2021 19:41:22 -0500 Subject: [PATCH] Core/Creature: Profession trainer fixes Port From (https://github.com/TrinityCore/TrinityCore/commit/f4d029b9523b35c38b80f0fb4aa9fb317a42e237) --- Source/Game/Entities/Creature/Trainer.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/Game/Entities/Creature/Trainer.cs b/Source/Game/Entities/Creature/Trainer.cs index c2b74582d..23c0f322b 100644 --- a/Source/Game/Entities/Creature/Trainer.cs +++ b/Source/Game/Entities/Creature/Trainer.cs @@ -102,6 +102,16 @@ namespace Game.Entities if (trainerSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0) return false; + foreach (SpellEffectInfo effect in trainerSpellInfo.GetEffects()) + { + if (!effect.IsEffect(SpellEffectName.LearnSpell)) + continue; + + SpellInfo learnedSpellInfo = Global.SpellMgr.GetSpellInfo(effect.TriggerSpell, Difficulty.None); + if (learnedSpellInfo != null && learnedSpellInfo.IsPrimaryProfessionFirstRank() && player.GetFreePrimaryProfessionPoints() == 0) + return false; + } + return true; }