From 548701cba6b68670bbebd57d3eb555375d935970 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 4 Sep 2015 14:07:01 -0400 Subject: [PATCH] Fix int underflow error in disc reuse timers focus --- zone/effects.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 85a858c94..a18e80428 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -623,11 +623,17 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { if(spell.recast_time > 0) { uint32 reduced_recast = spell.recast_time / 1000; - reduced_recast -= GetFocusEffect(focusReduceRecastTime, spell_id); - if(reduced_recast <= 0){ + auto focus = GetFocusEffect(focusReduceRecastTime, spell_id); + // do stupid stuff because custom servers. + // we really should be able to just do the -= focus but since custom servers could have shorter reuse timers + // we have to make sure we don't underflow the uint32 ... + // and yes, the focus effect can be used to increase the durations (spell 38944) + if (focus > reduced_recast) { reduced_recast = 0; if (GetPTimers().Enabled((uint32)DiscTimer)) GetPTimers().Clear(&database, (uint32)DiscTimer); + } else { + reduced_recast -= focus; } if (reduced_recast > 0)