From 0c984bfdf5aa6ad52b8d74518df61af1a6c9c188 Mon Sep 17 00:00:00 2001 From: Havenard Date: Sat, 9 Jul 2011 14:59:35 +0700 Subject: [PATCH] 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 --- src/server/game/Spells/Auras/SpellAuraEffects.h | 1 + src/server/game/Spells/Auras/SpellAuras.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 6a06d4d3a4..8aaef85c39 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -41,6 +41,7 @@ class AuraEffect Aura * GetBase() const { return m_base; } void GetTargetList(std::list & targetList) const; void GetApplicationList(std::list & applicationList) const; + SpellModifier* GetSpellModifier() const { return m_spellmod; } SpellEntry const* GetSpellProto() const { return m_spellProto; } uint32 GetId() const { return m_spellProto->Id; } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 3f49fc2cf1..0f21cee986 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -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;