From 51ee5972d40eb96182f06ac2e27394fa73b9cebe Mon Sep 17 00:00:00 2001 From: Parnic Date: Tue, 28 Sep 2010 04:06:28 +0000 Subject: [PATCH] - fixed a bug where cooldown timers wouldn't always reset when an ability was brought off cooldown early --- modules/CustomCDBar.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 387d407..5adedbc 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -25,7 +25,7 @@ function IceCustomCDBar.prototype:Enable(core) IceCustomCDBar.super.prototype.Enable(self, core) self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "UpdateCustomBarEvent") - self:RegisterEvent("SPELL_UPDATE_USEABLE", "UpdateCustomBarEvent") + self:RegisterEvent("SPELL_UPDATE_USABLE", "UpdateCustomBarEvent") self:Show(true) @@ -372,11 +372,13 @@ end function IceCustomCDBar.prototype:GetCooldownDuration(buffName) local now = GetTime() local localDuration = nil - local localStart, localRemaining, hasCooldown = GetSpellCooldown(self.moduleSettings.cooldownToTrack) + local localStart, localRemaining, hasCooldown = GetSpellCooldown(buffName) if (hasCooldown == 1) then -- the item has a potential cooldown - if (localStart > now) then + if localStart == 0 and localRemaining == 0 then + return nil, nil + elseif (localStart > now) then localRemaining = localRemaining + (localStart - now) localDuration = localRemaining else @@ -391,7 +393,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName) if localDuration > 1.5 then return localDuration, localRemaining else - localRemaining = self.cooldownEndTime - now + localRemaining = (self.cooldownEndTime or now) - now if localRemaining > 0 then return self.cooldownDuration, localRemaining else @@ -462,7 +464,7 @@ function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate) self:GetCooldownDuration(self.moduleSettings.cooldownToTrack) if not remaining then - self.cooldownEndTime = 0 + self.cooldownEndTime = nil else self.cooldownEndTime = remaining + now end