Core/Auras: Fix problem with aura charges introduced on 42a20f1 with the reuse of existing aura objects on aura reapply.

Closes #1989
Closes #2039
Closes #2211
This commit is contained in:
Havenard
2011-07-09 14:59:35 +07:00
committed by tobmaps
parent bc1f668471
commit 0c984bfdf5
2 changed files with 7 additions and 0 deletions
@@ -41,6 +41,7 @@ class AuraEffect
Aura * GetBase() const { return m_base; }
void GetTargetList(std::list<Unit*> & targetList) const;
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
SpellModifier* GetSpellModifier() const { return m_spellmod; }
SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const { return m_spellProto->Id; }
@@ -831,6 +831,12 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
// reset charges
SetCharges(CalcMaxCharges());
// FIXME: not a best way to synchronize charges, but works
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (AuraEffect* aurEff = GetEffect(i))
if (aurEff->GetAuraType() == SPELL_AURA_ADD_FLAT_MODIFIER || aurEff->GetAuraType() == SPELL_AURA_ADD_PCT_MODIFIER)
if (SpellModifier* mod = aurEff->GetSpellModifier())
mod->charges = GetCharges();
}
SetNeedClientUpdateForTargets();
return false;