From 3109d9c0aeeb76d03298ccc77b0c3cfdb9c05a2f Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Sun, 7 Aug 2011 17:41:44 +0200 Subject: [PATCH] Core/Spells: Spells that can be spellstolen that have a permanent duration should respect the 2 minute spellsteal buff duration limit. --- src/server/game/Entities/Unit/Unit.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 95546ea99b..f1f552ef04 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3755,7 +3755,8 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* } bool stealCharge = aura->GetSpellInfo()->AttributesEx7 & SPELL_ATTR7_DISPEL_CHARGES; - int32 dur = std::min(2 * MINUTE * IN_MILLISECONDS, aura->GetDuration()); + // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster + uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration())); if (Aura* newAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID())) { @@ -3763,7 +3764,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* newAura->ModCharges(1); else newAura->ModStackAmount(1); - newAura->SetDuration(dur); + newAura->SetDuration(int32(dur)); } else { @@ -3782,7 +3783,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* caster->GetSingleCastAuras().push_back(aura); } // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate - newAura->SetLoadedState(aura->GetMaxDuration(), dur, stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]); + newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]); newAura->ApplyForTargets(); } }