mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- WIP version of optionally hiding TargetOfTarget modules if the player is the active target. everything seems to work except for TargetOfTargetHealth and I'm not quite sure why yet...need to check it out further
This commit is contained in:
@ -2,6 +2,8 @@ local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TargetTargetCast = AceOO.Class(IceCastBar)
|
||||
|
||||
local SelfDisplayModeOptions = {"Hide", "Normal"}
|
||||
|
||||
-- Constructor --
|
||||
function TargetTargetCast.prototype:init()
|
||||
TargetTargetCast.super.prototype.init(self, "TargetTargetCast")
|
||||
@ -25,6 +27,7 @@ function TargetTargetCast.prototype:GetDefaultSettings()
|
||||
settings["enabled"] = false
|
||||
settings["barVerticalOffset"] = 35
|
||||
settings["scale"] = 0.7
|
||||
settings["selfDisplayMode"] = "Normal"
|
||||
|
||||
return settings
|
||||
end
|
||||
@ -44,6 +47,11 @@ function TargetTargetCast.prototype:UpdateTargetTarget()
|
||||
return
|
||||
end
|
||||
|
||||
if self.moduleSettings.selfDisplayMode == "Hide" and UnitIsUnit("player", self.unit) then
|
||||
self:StopBar()
|
||||
return
|
||||
end
|
||||
|
||||
local spell = UnitCastingInfo(self.unit)
|
||||
if (spell) then
|
||||
self:StartBar(IceCastBar.Actions.Cast)
|
||||
@ -130,6 +138,24 @@ function TargetTargetCast.prototype:GetOptions()
|
||||
order = 29
|
||||
}
|
||||
|
||||
opts["selfDisplayMode"] = {
|
||||
type = "text",
|
||||
name = "Self Display Mode",
|
||||
desc = "What this bar should do whenever the player is the TargetOfTarget",
|
||||
get = function()
|
||||
return self.moduleSettings.selfDisplayMode
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.selfDisplayMode = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
validate = SelfDisplayModeOptions,
|
||||
order = 44,
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
|
@ -2,6 +2,8 @@ local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TargetTargetHealth = AceOO.Class(IceTargetHealth)
|
||||
|
||||
local SelfDisplayModeOptions = {"Color as SelfColor", "Hide", "Normal"}
|
||||
|
||||
|
||||
-- Constructor --
|
||||
function TargetTargetHealth.prototype:init()
|
||||
@ -20,7 +22,7 @@ function TargetTargetHealth.prototype:GetDefaultSettings()
|
||||
settings["offset"] = 12
|
||||
settings["classColor"] = false
|
||||
settings["selfColor"] = { r = 0, g = 0, b = 1 }
|
||||
settings["useSelfColor"] = true
|
||||
settings["selfDisplayMode"] = "Color as SelfColor"
|
||||
settings["upperText"] = "[PercentHP:Round]"
|
||||
settings["lowerText"] = "[(HP:Round \"/\" MaxHP:Round):HPColor:Bracket]"
|
||||
settings["barVerticalOffset"] = 35
|
||||
@ -38,19 +40,21 @@ function TargetTargetHealth.prototype:GetOptions()
|
||||
|
||||
opts["hideBlizz"] = nil
|
||||
|
||||
opts["useSelfColor"] = {
|
||||
type = "toggle",
|
||||
name = "Use Self Color",
|
||||
desc = "Whether or not to use the self color.",
|
||||
opts["selfDisplayMode"] = {
|
||||
type = "text",
|
||||
name = "Self Display Mode",
|
||||
desc = "What this bar should do whenever the player is the TargetOfTarget",
|
||||
get = function()
|
||||
return self.moduleSettings.useSelfColor
|
||||
return self.moduleSettings.selfDisplayMode
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.useSelfColor = value
|
||||
self.moduleSettings.selfDisplayMode = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
validate = SelfDisplayModeOptions,
|
||||
order = 44,
|
||||
}
|
||||
|
||||
@ -66,7 +70,7 @@ function TargetTargetHealth.prototype:GetOptions()
|
||||
IceHUD.IceCore:SetColor("SelfColor", r, g, b)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.useSelfColor
|
||||
return not self.moduleSettings.enabled or self.moduleSettings.selfDisplayMode ~= "Color as SelfColor"
|
||||
end,
|
||||
hasAlpha = false,
|
||||
order = 45,
|
||||
@ -80,6 +84,16 @@ function TargetTargetHealth.prototype:Enable(core)
|
||||
self.registerEvents = false
|
||||
TargetTargetHealth.super.prototype.Enable(self, core)
|
||||
|
||||
if self.moduleSettings.useSelfColor ~= nil then
|
||||
if self.moduleSettings.useSelfColor == true then
|
||||
self.moduleSettings.selfDisplayMode = "Color as SelfColor"
|
||||
else
|
||||
self.moduleSettings.selfDisplayMode = "Normal"
|
||||
end
|
||||
|
||||
self.moduleSettings.useSelfColor = nil
|
||||
end
|
||||
|
||||
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.1, self, "targettarget")
|
||||
end
|
||||
|
||||
@ -92,7 +106,7 @@ end
|
||||
function TargetTargetHealth.prototype:Update(unit)
|
||||
self.color = "TargetTargetHealthFriendly" -- friendly > 4
|
||||
|
||||
local reaction = UnitReaction("targettarget", "player")
|
||||
local reaction = UnitReaction(self.unit, "player")
|
||||
|
||||
if (reaction and (reaction == 4)) then
|
||||
self.color = "TargetTargetHealthNeutral"
|
||||
@ -112,10 +126,17 @@ function TargetTargetHealth.prototype:Update(unit)
|
||||
self.color = "Tapped"
|
||||
end
|
||||
|
||||
if UnitIsUnit("player", "targettarget") and self.moduleSettings.useSelfColor then
|
||||
self.color = "SelfColor"
|
||||
if UnitIsUnit("player", self.unit) then
|
||||
if self.moduleSettings.selfDisplayMode == "Color as SelfColor" then
|
||||
self.color = "SelfColor"
|
||||
elseif self.moduleSettings.selfDisplayMode == "Hide" then
|
||||
self:Show(false)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
self:Show(true)
|
||||
|
||||
self.determineColor = false
|
||||
TargetTargetHealth.super.prototype.Update(self, unit)
|
||||
end
|
||||
|
@ -2,6 +2,8 @@ local AceOO = AceLibrary("AceOO-2.0")
|
||||
|
||||
local TargetTargetMana = AceOO.Class(IceTargetMana)
|
||||
|
||||
local SelfDisplayModeOptions = {"Hide", "Normal"}
|
||||
|
||||
-- Constructor --
|
||||
function TargetTargetMana.prototype:init()
|
||||
TargetTargetMana.super.prototype.init(self, "TargetTargetMana", "targettarget")
|
||||
@ -23,10 +25,35 @@ function TargetTargetMana.prototype:GetDefaultSettings()
|
||||
settings["barVerticalOffset"] = 35
|
||||
settings["scale"] = 0.7
|
||||
settings["enabled"] = false
|
||||
settings["selfDisplayMode"] = "Normal"
|
||||
|
||||
return settings
|
||||
end
|
||||
|
||||
function TargetTargetMana.prototype:GetOptions()
|
||||
local opts = TargetTargetMana.super.prototype.GetOptions(self)
|
||||
|
||||
opts["selfDisplayMode"] = {
|
||||
type = "text",
|
||||
name = "Self Display Mode",
|
||||
desc = "What this bar should do whenever the player is the TargetOfTarget",
|
||||
get = function()
|
||||
return self.moduleSettings.selfDisplayMode
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.selfDisplayMode = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
validate = SelfDisplayModeOptions,
|
||||
order = 44,
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
function TargetTargetMana.prototype:Enable(core)
|
||||
self.registerEvents = false
|
||||
-- make sure the super class doesn't override our color selection
|
||||
@ -45,6 +72,13 @@ end
|
||||
function TargetTargetMana.prototype:Update(unit)
|
||||
self.color = "TargetTargetMana"
|
||||
|
||||
if self.moduleSettings.selfDisplayMode == "Hide" and UnitIsUnit("player", self.unit) then
|
||||
self:Show(false)
|
||||
return
|
||||
end
|
||||
|
||||
self:Show(true)
|
||||
|
||||
local manaType = UnitPowerType(self.unit)
|
||||
|
||||
if (self.moduleSettings.scaleManaColor) then
|
||||
|
Reference in New Issue
Block a user