From fbdfbcd77f45c3bc876a320a906bf31ea4dcdbbe Mon Sep 17 00:00:00 2001 From: Parnic Date: Thu, 25 Mar 2010 18:10:16 +0000 Subject: [PATCH] - added user-submitted "max duration" functionality to custom bars such that they can always be a fixed time period --- modules/CustomBar.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 040ae26..8969236 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -66,6 +66,7 @@ function IceCustomBar.prototype:GetDefaultSettings() settings["displayWhenEmpty"] = false settings["hideAnimationSettings"] = true settings["buffTimerDisplay"] = "minutes" + settings["maxDuration"] = 0 return settings end @@ -247,6 +248,27 @@ function IceCustomBar.prototype:GetOptions() 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 = "", + order = 21.1, + } + return opts end @@ -277,6 +299,10 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName) local buff, rank, texture, count, type, duration, endTime, unitCaster = UnitAura(unitName, i, buffFilter) local isMine = unitCaster == "player" + if self.moduleSettings.maxDuration and self.moduleSettings.maxDuration ~= 0 then + duration = self.moduleSettings.maxDuration + end + while buff do if (string.match(buff:upper(), buffName:upper()) and (not self.moduleSettings.trackOnlyMine or isMine)) then if endTime and not remaining then