diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c5a6e8440be..3b292e4f7d5 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3496,7 +3496,19 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura)) { if (aura->GetSpellProto()->StackAmount) + { aura->ModStackAmount(foundAura->GetStackAmount()); + + // Update periodic timers from the previous aura + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + AuraEffect *existingEff = foundAura->GetEffect(i); + AuraEffect *newEff = aura->GetEffect(i); + if (!existingEff || !newEff) + continue; + newEff->SetPeriodicTimer(existingEff->GetPeriodicTimer()); + } + } // Use the new one to replace the old one // This is the only place where AURA_REMOVE_BY_STACK should be used diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index c2c99b167e0..d44e73f360f 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -45,6 +45,9 @@ class AuraEffect int32 GetAmount() const { return m_amount; } void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;} + int32 GetPeriodicTimer() const { return m_periodicTimer; } + void SetPeriodicTimer(int32 periodicTimer) { m_periodicTimer = periodicTimer; } + int32 CalculateAmount(Unit * caster); void CalculatePeriodic(Unit * caster, bool create = false); void CalculateSpellMod(); |