- 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)
local now = GetTime()
local localDuration = nil
local localStart, localRemaining, hasCooldown = GetSpellCooldown(buffName)
local localRemaining = nil
local localStart, localDuration, hasCooldown = GetSpellCooldown(buffName)
if (hasCooldown == 1 and localRemaining > 1.5) then
-- the item has a potential cooldown
if localStart == 0 and localRemaining == 0 then
return nil, nil
elseif (localStart > now) then
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
if (localDuration <= 1.5) then
if (self.cooldownEndTime > now) then
return self.cooldownDuration, (self.cooldownEndTime - now)
else
return nil, nil
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
return nil, nil
end