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

Closes #19408

(cherry picked from commit 5cb1555de6)
This commit is contained in:
ariel-
2017-04-06 20:38:27 -03:00
committed by funjoker
parent af3934e8ce
commit 7f64eaa3ee
2 changed files with 10 additions and 6 deletions

View File

@@ -2936,7 +2936,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
if (active)
{
if (spellInfo->IsPassive() && IsNeedCastPassiveSpellAtLearn(spellInfo))
if (spellInfo->IsPassive() && HandlePassiveSpellLearn(spellInfo))
CastSpell(this, spellId, true);
}
else if (IsInWorld())
@@ -3063,7 +3063,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
// 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(SPELL_EFFECT_SKILL_STEP))
@@ -3194,7 +3194,7 @@ void Player::RemoveTemporarySpell(uint32 spellId)
m_spells.erase(itr);
}
bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const
bool Player::HandlePassiveSpellLearn(SpellInfo const* 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
@@ -3206,12 +3206,16 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const
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)
{
for (SpellEffectInfo const* effectInfo : spellInfo->GetEffectsForDifficulty(DIFFICULTY_NONE))
if (effectInfo && effectInfo->IsAura())
{
if (!HasAura(spellInfo->Id) && HasItemFitToSpellRequirements(spellInfo))
AddAura(spellInfo->Id, this);
return false;
}
}
//Check CasterAuraStates

View File

@@ -1556,7 +1556,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool HasActiveSpell(uint32 spell) const; // show in spellbook
SpellInfo const* GetCastSpellInfo(SpellInfo const* spellInfo) const override;
bool IsSpellFitByClassAndRace(uint32 spell_id) const;
bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
bool HandlePassiveSpellLearn(SpellInfo const* spellInfo);
bool IsCurrentSpecMasterySpell(SpellInfo const* spellInfo) const;
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const;