- cooldown bar fixes submitted by JontomXire (thanks!)

This commit is contained in:
Parnic
2011-12-01 23:00:56 +00:00
parent f7a82b695d
commit b46ea82511

View File

@ -478,35 +478,26 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
buffName = self:GetSpellNameOrId(buffName) buffName = self:GetSpellNameOrId(buffName)
local now = GetTime() local now = GetTime()
local localDuration = nil local localRemaining = nil
local localStart, localRemaining, hasCooldown = GetSpellCooldown(buffName) local localStart, localDuration, hasCooldown = GetSpellCooldown(buffName)
if (hasCooldown == 1 and localRemaining > 1.5) then if (hasCooldown == 1 and localRemaining > 1.5) then
-- the item has a potential cooldown -- the item has a potential cooldown
if localStart == 0 and localRemaining == 0 then if (localDuration <= 1.5) then
return nil, nil if (self.cooldownEndTime > now) then
elseif (localStart > now) then return self.cooldownDuration, (self.cooldownEndTime - now)
localRemaining = localRemaining + (localStart - now)
localDuration = localRemaining
else
localRemaining = localRemaining + (localStart - now)
localDuration = (now - localStart) + localRemaining
end
if self.moduleSettings.maxDuration and tonumber(self.moduleSettings.maxDuration) ~= 0 and localDuration > 1.5 then
localDuration = tonumber(self.moduleSettings.maxDuration)
end
if localDuration > 1.5 then
return localDuration, localRemaining
else
localRemaining = (self.cooldownEndTime or now) - now
if localRemaining > 0 then
return self.cooldownDuration, localRemaining
else else
return nil, nil return nil, nil
end end
end end
localRemaining = localDuration + (localStart - now)
if self.moduleSettings.maxDuration and tonumber(self.moduleSettings.maxDuration) ~= 0 then
localDuration = tonumber(self.moduleSettings.maxDuration)
end
return localDuration, localRemaining
else else
return nil, nil return nil, nil
end end