- fixed a bug where cooldown timers wouldn't always reset when an ability was brought off cooldown early

This commit is contained in:
Parnic
2010-09-28 04:06:28 +00:00
parent cd0f08837a
commit 51ee5972d4

View File

@ -25,7 +25,7 @@ function IceCustomCDBar.prototype:Enable(core)
IceCustomCDBar.super.prototype.Enable(self, core) IceCustomCDBar.super.prototype.Enable(self, core)
self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "UpdateCustomBarEvent") self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "UpdateCustomBarEvent")
self:RegisterEvent("SPELL_UPDATE_USEABLE", "UpdateCustomBarEvent") self:RegisterEvent("SPELL_UPDATE_USABLE", "UpdateCustomBarEvent")
self:Show(true) self:Show(true)
@ -372,11 +372,13 @@ end
function IceCustomCDBar.prototype:GetCooldownDuration(buffName) function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
local now = GetTime() local now = GetTime()
local localDuration = nil local localDuration = nil
local localStart, localRemaining, hasCooldown = GetSpellCooldown(self.moduleSettings.cooldownToTrack) local localStart, localRemaining, hasCooldown = GetSpellCooldown(buffName)
if (hasCooldown == 1) then if (hasCooldown == 1) then
-- the item has a potential cooldown -- 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) localRemaining = localRemaining + (localStart - now)
localDuration = localRemaining localDuration = localRemaining
else else
@ -391,7 +393,7 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
if localDuration > 1.5 then if localDuration > 1.5 then
return localDuration, localRemaining return localDuration, localRemaining
else else
localRemaining = self.cooldownEndTime - now localRemaining = (self.cooldownEndTime or now) - now
if localRemaining > 0 then if localRemaining > 0 then
return self.cooldownDuration, localRemaining return self.cooldownDuration, localRemaining
else else
@ -462,7 +464,7 @@ function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate)
self:GetCooldownDuration(self.moduleSettings.cooldownToTrack) self:GetCooldownDuration(self.moduleSettings.cooldownToTrack)
if not remaining then if not remaining then
self.cooldownEndTime = 0 self.cooldownEndTime = nil
else else
self.cooldownEndTime = remaining + now self.cooldownEndTime = remaining + now
end end