- added "maximum duration" feature to cooldown bars by request

This commit is contained in:
Parnic
2010-03-28 13:47:40 +00:00
parent 5268134748
commit 792de0eeab

View File

@ -57,6 +57,7 @@ function IceCustomCDBar.prototype:GetDefaultSettings()
settings["hideAnimationSettings"] = true settings["hideAnimationSettings"] = true
settings["cooldownTimerDisplay"] = "minutes" settings["cooldownTimerDisplay"] = "minutes"
settings["customBarType"] = "CD" settings["customBarType"] = "CD"
settings["maxDuration"] = 0
return settings return settings
end end
@ -180,6 +181,27 @@ function IceCustomCDBar.prototype:GetOptions()
order = 21 order = 21
} }
opts["maxDuration"] = {
type = 'text',
name = "Maximum duration",
desc = "Maximum Duration for the bar (the bar will remained full if it has longer than maximum remaining). Leave 0 for spell duration.\n\nRemember to press ENTER after filling out this box with the name you want or it will not save.",
get = function()
return self.moduleSettings.maxDuration
end,
set = function(v)
if not v or not tonumber(v) then
v = 0
end
self.moduleSettings.maxDuration = v
self:Redraw()
end,
disabled = function()
return not self.moduleSettings.enabled
end,
usage = "<the maximum duration for a bar>",
order = 21.1,
}
return opts return opts
end end
@ -204,6 +226,10 @@ function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
localDuration = (now - localStart) + localRemaining localDuration = (now - localStart) + localRemaining
end end
if self.moduleSettings.maxDuration and self.moduleSettings.maxDuration ~= 0 then
localDuration = tonumber(self.moduleSettings.maxDuration)
end
if localDuration > 1.5 then if localDuration > 1.5 then
return localDuration, localRemaining return localDuration, localRemaining
else else