Core/Player: fix weapon dependent aura talents not applied on talent learn

Port From (https://github.com/TrinityCore/TrinityCore/commit/7f64eaa3ee28d3eb29f602dd0f36435734014789)
This commit is contained in:
hondacrx
2020-05-06 18:07:27 -04:00
parent 03cb874825
commit dff455da9d
+11 -5
View File
@@ -2276,7 +2276,7 @@ namespace Game.Entities
SendPacket(unlearnedSpells);
}
}
bool IsNeedCastPassiveSpellAtLearn(SpellInfo spellInfo)
bool HandlePassiveSpellLearn(SpellInfo spellInfo)
{
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
@@ -2288,12 +2288,18 @@ namespace Game.Entities
need_cast &= IsCurrentSpecMasterySpell(spellInfo);
// Check EquippedItemClass
// passive spells which apply aura and have an item requirement are to be added in Player::ApplyItemDependentAuras
if (spellInfo.IsPassive() && spellInfo.EquippedItemClass >= 0)
// passive spells which apply aura and have an item requirement are to be added manually, instead of casted
if (spellInfo.EquippedItemClass >= 0)
{
foreach (SpellEffectInfo effectInfo in spellInfo.GetEffectsForDifficulty(Difficulty.None))
{
if (effectInfo != null && effectInfo.IsAura())
{
if (!HasAura(spellInfo.Id) && HasItemFitToSpellRequirements(spellInfo))
AddAura(spellInfo.Id, this);
return false;
}
}
}
//Check CasterAuraStates
@@ -2400,7 +2406,7 @@ namespace Game.Entities
if (active)
{
if (spellInfo.IsPassive() && IsNeedCastPassiveSpellAtLearn(spellInfo))
if (spellInfo.IsPassive() && HandlePassiveSpellLearn(spellInfo))
CastSpell(this, spellId, true);
}
else if (IsInWorld)
@@ -2528,7 +2534,7 @@ namespace Game.Entities
// also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
else if (spellInfo.IsPassive())
{
if (IsNeedCastPassiveSpellAtLearn(spellInfo))
if (HandlePassiveSpellLearn(spellInfo))
CastSpell(this, spellId, true);
}
else if (spellInfo.HasEffect(SpellEffectName.SkillStep))