- Added the ability to track custom units on buff/debuff watchers. (ticket #115)

This commit is contained in:
Parnic
2014-10-12 14:42:29 -05:00
parent 06f8375dcf
commit dedee2a799

View File

@ -5,7 +5,7 @@ local DogTag = nil
local IceHUD = _G.IceHUD local IceHUD = _G.IceHUD
local validUnits = {"player", "target", "focus", "focustarget", "pet", "pettarget", "vehicle", "targettarget", "main hand weapon", "off hand weapon"} local validUnits = {"player", "target", "focus", "focustarget", "pet", "pettarget", "vehicle", "targettarget", "main hand weapon", "off hand weapon", "other"}
local buffOrDebuff = {"buff", "debuff"} local buffOrDebuff = {"buff", "debuff"}
local validBuffTimers = {"none", "seconds", "minutes:seconds", "minutes"} local validBuffTimers = {"none", "seconds", "minutes:seconds", "minutes"}
local AuraIconWidth = 20 local AuraIconWidth = 20
@ -48,7 +48,7 @@ function IceCustomBar.prototype:Enable(core)
self:Show(true) self:Show(true)
self.unit = self.moduleSettings.myUnit self.unit = self:GetUnitToTrack()
self:ConditionalSubscribe() self:ConditionalSubscribe()
if not self.moduleSettings.usesDogTagStrings then if not self.moduleSettings.usesDogTagStrings then
@ -76,6 +76,18 @@ function IceCustomBar.prototype:Disable(core)
IceCustomBar.super.prototype.Disable(self, core) IceCustomBar.super.prototype.Disable(self, core)
end end
function IceCustomBar.prototype:GetUnitToTrack()
if self.moduleSettings.myUnit == "other" then
if self.moduleSettings.customUnit ~= nil and self.moduleSettings.customUnit ~= "" then
return self.moduleSettings.customUnit
else
return validUnits[1]
end
else
return self.moduleSettings.myUnit
end
end
function IceCustomBar.prototype:FixupTextColors() function IceCustomBar.prototype:FixupTextColors()
if not self.moduleSettings.upperTextColor then if not self.moduleSettings.upperTextColor then
self.moduleSettings.upperTextColor = {r=1, g=1, b=1} self.moduleSettings.upperTextColor = {r=1, g=1, b=1}
@ -144,6 +156,7 @@ function IceCustomBar.prototype:GetDefaultSettings()
settings["exactMatch"] = false settings["exactMatch"] = false
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"
return settings return settings
end end
@ -252,7 +265,7 @@ function IceCustomBar.prototype:GetOptions()
end, end,
set = function(info, v) set = function(info, v)
self.moduleSettings.myUnit = info.option.values[v] self.moduleSettings.myUnit = info.option.values[v]
self.unit = info.option.values[v] self.unit = self:GetUnitToTrack()
self:RegisterFontStrings() self:RegisterFontStrings()
self:ConditionalSubscribe() self:ConditionalSubscribe()
self:Redraw() self:Redraw()
@ -265,6 +278,29 @@ function IceCustomBar.prototype:GetOptions()
order = 30.4, order = 30.4,
} }
opts["customUnitToTrack"] = {
type = 'input',
name = L["Custom unit"],
desc = L["Any valid unit id such as: party1, raid14, targettarget, etc. Not guaranteed to work with all unit ids.\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.customUnit
end,
set = function(info, v)
self.moduleSettings.customUnit = v
self.unit = self:GetUnitToTrack()
self:RegisterFontStrings()
self:ConditionalSubscribe()
self:Redraw()
self:UpdateCustomBar(self.unit)
IceHUD:NotifyOptionsChange()
end,
hidden = function()
return self.moduleSettings.myUnit ~= "other"
end,
usage = "<what custom unit to track when unitToTrack is set to 'other'>",
order = 30.45,
}
opts["buffOrDebuff"] = { opts["buffOrDebuff"] = {
type = 'select', type = 'select',
values = buffOrDebuff, values = buffOrDebuff,