Core/Player: recheck shapeshift bonus auras when switching spec.

- Fixes Leader of the Pack stuck when switching specs while shapeshifted

(cherry picked from commit 16c14593dc)
This commit is contained in:
ariel-
2016-11-19 22:39:29 +01:00
committed by joschiwald
parent 2c022a5aa8
commit 97980f4e0a
2 changed files with 16 additions and 9 deletions

View File

@@ -26652,6 +26652,13 @@ void Player::ActivateTalentGroup(ChrSpecializationEntry const* spec)
activeGlyphs.IsFullUpdate = true;
SendDirectMessage(activeGlyphs.Write());
Unit::AuraEffectList const& shapeshiftAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
for (AuraEffect* aurEff : shapeshiftAuras)
{
aurEff->HandleShapeshiftBoosts(this, false);
aurEff->HandleShapeshiftBoosts(this, true);
}
}
void Player::ResetTimeSync()

View File

@@ -1362,10 +1362,10 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
if (apply)
{
if (spellId)
target->CastSpell(target, spellId, true, NULL, this);
target->CastSpell(target, spellId, true, nullptr, this);
if (spellId2)
target->CastSpell(target, spellId2, true, NULL, this);
target->CastSpell(target, spellId2, true, nullptr, this);
if (spellId3)
target->CastSpell(target, spellId3, true, NULL, this);
@@ -1378,7 +1378,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
Player* plrTarget = target->ToPlayer();
PlayerSpellMap const& sp_list = plrTarget->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
for (auto itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
continue;
@@ -1395,7 +1395,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
continue;
if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1)))
target->CastSpell(target, itr->first, true, NULL, this);
target->CastSpell(target, itr->first, true, nullptr, this);
}
}
}
@@ -1411,19 +1411,19 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
target->RemoveOwnedAura(spellId4, target->GetGUID());
Unit::AuraEffectList const& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT);
AuraEffect* newAura = NULL;
AuraEffect const* newAura = nullptr;
// Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied
for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr)
for (AuraEffect const* aurEff : shapeshifts)
{
if ((*itr) != this)
if (aurEff != this)
{
newAura = *itr;
newAura = aurEff;
break;
}
}
Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
for (auto itr = tAuras.begin(); itr != tAuras.end();)
{
// Use the new aura to see on what stance the target will be
uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0;