Added an option to only display a buff/debuff watcher when the tracked aura has more than X stacks (default 0) (ticket #185)

This commit is contained in:
Parnic
2015-03-03 22:39:28 -06:00
parent e5eb235aef
commit 6daa9ea927

View File

@ -157,6 +157,7 @@ function IceCustomBar.prototype:GetDefaultSettings()
settings["lowerTextColor"] = {r=1, g=1, b=1} settings["lowerTextColor"] = {r=1, g=1, b=1}
settings["upperTextColor"] = {r=1, g=1, b=1} settings["upperTextColor"] = {r=1, g=1, b=1}
settings["customUnit"] = "player" settings["customUnit"] = "player"
settings["minCount"] = 0
return settings return settings
end end
@ -386,6 +387,24 @@ function IceCustomBar.prototype:GetOptions()
order = 30.7, order = 30.7,
} }
opts["minCount"] = {
type = 'input',
name = L["Minimum stacks to show"],
desc = L["Only show the bar when the number of applications of this buff or debuff exceeds this number"],
get = function()
return self.moduleSettings.minCount and tostring(self.moduleSettings.minCount) or "0"
end,
set = function(info, v)
self.moduleSettings.minCount = tonumber(v)
self:Redraw()
self:UpdateCustomBar(self.unit)
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 30.71,
}
opts["barColor"] = { opts["barColor"] = {
type = 'color', type = 'color',
name = L["Bar color"], name = L["Bar color"],
@ -716,16 +735,15 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
local now = GetTime() local now = GetTime()
local remaining = nil local remaining = nil
local count = 0
local auraIcon = nil local auraIcon = nil
local endTime = 0 local endTime = 0
if not fromUpdate then if not fromUpdate then
if tonumber(self.moduleSettings.buffToTrack) == nil then if tonumber(self.moduleSettings.buffToTrack) == nil then
self.auraDuration, remaining, count, auraIcon, endTime = self.auraDuration, remaining, self.auraBuffCount, auraIcon, endTime =
self:GetAuraDuration(self.unit, self.moduleSettings.buffToTrack) self:GetAuraDuration(self.unit, self.moduleSettings.buffToTrack)
else else
self.auraDuration, remaining, count, auraIcon, endTime = self.auraDuration, remaining, self.auraBuffCount, auraIcon, endTime =
self:GetAuraDuration(self.unit, GetSpellInfo(self.moduleSettings.buffToTrack)) self:GetAuraDuration(self.unit, GetSpellInfo(self.moduleSettings.buffToTrack))
end end
@ -753,7 +771,9 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
end end
end end
if self.auraEndTime ~= nil and (self.auraEndTime == 0 or self.auraEndTime >= now) then self.auraBuffCount = self.auraBuffCount or 0
if self.auraEndTime ~= nil and (self.auraEndTime == 0 or self.auraEndTime >= now) and (not self.moduleSettings.minCount or self.auraBuffCount > self.moduleSettings.minCount) then
if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self) then if not self:ShouldAlwaysSubscribe() and not fromUpdate and not IceHUD.IceCore:IsUpdateSubscribed(self) then
if not self.UpdateCustomBarFunc then if not self.UpdateCustomBarFunc then
self.UpdateCustomBarFunc = function() self:UpdateCustomBar(self.unit, true) end self.UpdateCustomBarFunc = function() self:UpdateCustomBar(self.unit, true) end
@ -803,8 +823,6 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
end end
end end
fullString = self.moduleSettings.upperText .. (not self.bIsAura and (" " .. buffString) or "") fullString = self.moduleSettings.upperText .. (not self.bIsAura and (" " .. buffString) or "")
else
self.auraBuffCount = 0
end end
if DogTag ~= nil then if DogTag ~= nil then