mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- cooldown bar fixes submitted by JontomXire (thanks!)
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user