From cd72ecce78b3152b8db62c96e90cb9d14ea5e565 Mon Sep 17 00:00:00 2001 From: Alan Deutscher Date: Tue, 14 Jan 2020 10:49:32 -0800 Subject: Scripts/Spells: fix Turkey Timer duration (#24048) * spell_gen_turkey_marker::OnPeriodic: Pop expired stack timestamps from tracking list. * Be a bit more explicit about the data type of removedCount. * Formatting nudge. * Remove brackets. (cherry picked from commit a0c07655eb6b42a2e1fd9319d53c7ed7f2c585d8) --- src/server/scripts/Spells/spell_generic.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 81bab4a1772..09f08d50b28 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3399,12 +3399,17 @@ class spell_gen_turkey_marker : public AuraScript void OnPeriodic(AuraEffect const* /*aurEff*/) { - if (_applyTimes.empty()) - return; + int32 removeCount = 0; + + // pop expired times off of the stack + while (!_applyTimes.empty() && _applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS()) + { + _applyTimes.pop_front(); + removeCount++; + } - // pop stack if it expired for us - if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS()) - ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE); + if (removeCount) + ModStackAmount(-removeCount, AURA_REMOVE_BY_EXPIRE); } void Register() override -- cgit v1.2.3