diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 19 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.h | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 2e09b28aa6f..f90a5431856 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -191,7 +191,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo // send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges // stack amount has priority over charges (checked on retail with spell 50262) - auraData.Applications = aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges(); + auraData.Applications = aura->IsUsingStacks() ? aura->GetStackAmount() : aura->GetCharges(); if (!(auraData.Flags & AFLAG_NOCASTER)) auraData.CastUnit = aura->GetCasterGUID(); @@ -924,12 +924,27 @@ void Aura::SetStackAmount(uint8 stackAmount) SetNeedClientUpdateForTargets(); } +bool Aura::IsUsingStacks() const +{ + return m_spellInfo->StackAmount > 0; +} + +uint32 Aura::CalcMaxStackAmount() const +{ + int32 maxStackAmount = m_spellInfo->StackAmount; + if (Unit* caster = GetCaster()) + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_STACK_AMOUNT2, maxStackAmount); + return maxStackAmount; +} + bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode /*= AURA_REMOVE_BY_DEFAULT*/, bool resetPeriodicTimer /*= true*/) { int32 stackAmount = m_stackAmount + num; + int32 maxStackAmount = int32(CalcMaxStackAmount()); // limit the stack amount (only on stack increase, stack amount may be changed manually) - if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount))) + if ((num > 0) && (stackAmount > maxStackAmount)) { // not stackable aura - set stack amount to 1 if (!m_spellInfo->StackAmount) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 9292db994d6..410d825000d 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -183,6 +183,9 @@ class TC_GAME_API Aura void SetStackAmount(uint8 num); bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer = true); + uint32 CalcMaxStackAmount() const; + bool IsUsingStacks() const; + uint8 GetCasterLevel() const { return m_casterLevel; } bool HasMoreThanOneEffectForType(AuraType auraType) const; |