mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
- added pvp indicator to TargetHealth/TargetTargetHealth bars
- moved some icons into their own Icon Settings group for the TargetHealth/TargetTargetHealth bars configuration
This commit is contained in:
@ -15,6 +15,8 @@ IceTargetHealth.prototype.EliteTexture = IceElement.TexturePath .. "Elite"
|
||||
IceTargetHealth.prototype.RareEliteTexture = IceElement.TexturePath .. "RareElite"
|
||||
IceTargetHealth.prototype.RareTexture = IceElement.TexturePath .. "Rare"
|
||||
|
||||
local configMode = false
|
||||
|
||||
-- Constructor --
|
||||
function IceTargetHealth.prototype:init(moduleName, unit)
|
||||
if not moduleName or not unit then
|
||||
@ -46,6 +48,9 @@ function IceTargetHealth.prototype:GetDefaultSettings()
|
||||
settings["abbreviateHealth"] = true
|
||||
settings["classIconOffset"] = {x=0, y=0}
|
||||
settings["showClassificationIcon"] = false
|
||||
settings["showPvPIcon"] = true
|
||||
settings["PvPIconOffset"] = {x=23, y=11}
|
||||
settings["PvPIconScale"] = 1.0
|
||||
|
||||
return settings
|
||||
end
|
||||
@ -110,98 +115,6 @@ function IceTargetHealth.prototype:GetOptions()
|
||||
order = 43
|
||||
}
|
||||
|
||||
opts["showRaidIcon"] = {
|
||||
type = "toggle",
|
||||
name = "Show Raid Icon",
|
||||
desc = "Whether or not to show the raid icon above this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.showRaidIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showRaidIcon = value
|
||||
self:UpdateRaidTargetIcon()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 50
|
||||
}
|
||||
|
||||
opts["lockIconAlpha"] = {
|
||||
type = "toggle",
|
||||
name = "Lock raid icon to 100% alpha",
|
||||
desc = "With this enabled, the raid icon is always 100% alpha, regardless of the bar's alpha. Otherwise, it assumes the bar's alpha level.",
|
||||
get = function()
|
||||
return self.moduleSettings.lockIconAlpha
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.lockIconAlpha = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 51
|
||||
}
|
||||
|
||||
opts["raidIconOnTop"] = {
|
||||
type = "toggle",
|
||||
name = "Draw Raid Icon On Top",
|
||||
desc = "Whether to draw the raid icon in front of or behind this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconOnTop
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconOnTop = value
|
||||
self:UpdateRaidTargetIcon()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.showRaidIcon
|
||||
end,
|
||||
order = 52
|
||||
}
|
||||
|
||||
opts["raidIconXOffset"] = {
|
||||
type = "range",
|
||||
name = "Raid Icon X Offset",
|
||||
desc = "How far to push the raid icon right or left",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconXOffset
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconXOffset = value
|
||||
self:SetRaidIconPlacement()
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 53
|
||||
}
|
||||
|
||||
opts["raidIconYOffset"] = {
|
||||
type = "range",
|
||||
name = "Raid Icon Y Offset",
|
||||
desc = "How far to push the raid icon up or down",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconYOffset
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconYOffset = value
|
||||
self:SetRaidIconPlacement()
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 54
|
||||
}
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
opts["shortenHealth"] = {
|
||||
type = 'toggle',
|
||||
@ -220,61 +133,252 @@ if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
}
|
||||
end
|
||||
|
||||
opts["showClassificationIcon"] = {
|
||||
type = "toggle",
|
||||
name = "Show Elite Icon",
|
||||
desc = "Whether or not to show the rare/elite icon above this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.showClassificationIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showClassificationIcon = value
|
||||
self:Redraw()
|
||||
end,
|
||||
opts["iconSettings"] =
|
||||
{
|
||||
type = 'group',
|
||||
name = '|c' .. self.configColor .. 'Icon Settings|r',
|
||||
desc = 'Settings related to icons',
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 60
|
||||
}
|
||||
args = {
|
||||
iconConfigMode = {
|
||||
type = "toggle",
|
||||
name = "Icon config mode",
|
||||
desc = "With this enabled, all icons draw so you can configure their placement\n\nNote: the combat and status icons are actually the same texture so you'll only see combat in config mode (unless you're already resting)",
|
||||
get = function()
|
||||
return configMode
|
||||
end,
|
||||
set = function(v)
|
||||
configMode = v
|
||||
self:CheckPvP()
|
||||
self:UpdateRaidTargetIcon()
|
||||
self:Redraw()
|
||||
end,
|
||||
order = 5
|
||||
},
|
||||
|
||||
opts["classIconXOffset"] = {
|
||||
type = "range",
|
||||
name = "Elite Icon X Offset",
|
||||
desc = "How far to push the elite icon right or left",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['x']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['x'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 61
|
||||
}
|
||||
lockIconAlpha = {
|
||||
type = "toggle",
|
||||
name = "Lock all icons to 100% alpha",
|
||||
desc = "With this enabled, all icons will be 100% visible regardless of the alpha settings for this bar.",
|
||||
get = function()
|
||||
return self.moduleSettings.lockIconAlpha
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.lockIconAlpha = v
|
||||
self:Redraw()
|
||||
end,
|
||||
order = 6
|
||||
},
|
||||
|
||||
opts["classIconYOffset"] = {
|
||||
type = "range",
|
||||
name = "Elite Icon Y Offset",
|
||||
desc = "How far to push the elite icon up or down",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['y']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['y'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 62
|
||||
PvPIcon = {
|
||||
type = "toggle",
|
||||
name = "Show PvP icon",
|
||||
desc = "Whether or not to show the PvP icon",
|
||||
get = function()
|
||||
return self.moduleSettings.showPvPIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showPvPIcon = value
|
||||
self:CheckPvP()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 40
|
||||
},
|
||||
PvPIconOffsetX = {
|
||||
type = "range",
|
||||
name = "PvP Icon Horizontal Offset",
|
||||
desc = "How much to offset the PvP icon from the bar horizontally",
|
||||
min = 0,
|
||||
max = 250,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.PvPIconOffset['x']
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.PvPIconOffset['x'] = v
|
||||
self:SetTexLoc(self.frame.PvPIcon, self.moduleSettings.PvPIconOffset['x'], self.moduleSettings.PvPIconOffset['y'])
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.showPvPIcon
|
||||
end,
|
||||
order = 41
|
||||
},
|
||||
PvPIconOffsetY = {
|
||||
type = "range",
|
||||
name = "PvP Icon Vertical Offset",
|
||||
desc = "How much to offset the PvP icon from the bar vertically",
|
||||
min = -300,
|
||||
max = 50,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.PvPIconOffset['y']
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.PvPIconOffset['y'] = v
|
||||
self:SetTexLoc(self.frame.PvPIcon, self.moduleSettings.PvPIconOffset['x'], self.moduleSettings.PvPIconOffset['y'])
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.showPvPIcon
|
||||
end,
|
||||
order = 42
|
||||
},
|
||||
PvPIconScale = {
|
||||
type = "range",
|
||||
name = "PvP Icon Scale",
|
||||
desc = "How much to scale the PvP icon",
|
||||
min = 0.05,
|
||||
max = 2,
|
||||
step = 0.05,
|
||||
get = function()
|
||||
return self.moduleSettings.PvPIconScale
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.PvPIconScale = v
|
||||
self:SetTexScale(self.frame.PvPIcon, 20, 20, v)
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.showPvPIcon
|
||||
end,
|
||||
order = 43
|
||||
},
|
||||
|
||||
showRaidIcon = {
|
||||
type = "toggle",
|
||||
name = "Show Raid Icon",
|
||||
desc = "Whether or not to show the raid icon above this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.showRaidIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showRaidIcon = value
|
||||
self:UpdateRaidTargetIcon()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 50
|
||||
},
|
||||
|
||||
raidIconOnTop = {
|
||||
type = "toggle",
|
||||
name = "Draw Raid Icon On Top",
|
||||
desc = "Whether to draw the raid icon in front of or behind this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconOnTop
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconOnTop = value
|
||||
self:UpdateRaidTargetIcon()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled or not self.moduleSettings.showRaidIcon
|
||||
end,
|
||||
order = 52
|
||||
},
|
||||
|
||||
raidIconXOffset = {
|
||||
type = "range",
|
||||
name = "Raid Icon X Offset",
|
||||
desc = "How far to push the raid icon right or left",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconXOffset
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconXOffset = value
|
||||
self:SetRaidIconPlacement()
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 53
|
||||
},
|
||||
|
||||
raidIconYOffset = {
|
||||
type = "range",
|
||||
name = "Raid Icon Y Offset",
|
||||
desc = "How far to push the raid icon up or down",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.raidIconYOffset
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.raidIconYOffset = value
|
||||
self:SetRaidIconPlacement()
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 54
|
||||
},
|
||||
|
||||
showClassificationIcon = {
|
||||
type = "toggle",
|
||||
name = "Show Elite Icon",
|
||||
desc = "Whether or not to show the rare/elite icon above this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.showClassificationIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showClassificationIcon = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 60
|
||||
},
|
||||
|
||||
classIconXOffset = {
|
||||
type = "range",
|
||||
name = "Elite Icon X Offset",
|
||||
desc = "How far to push the elite icon right or left",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['x']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['x'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 61
|
||||
},
|
||||
|
||||
classIconYOffset = {
|
||||
type = "range",
|
||||
name = "Elite Icon Y Offset",
|
||||
desc = "How far to push the elite icon up or down",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['y']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['y'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 62
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return opts
|
||||
@ -290,6 +394,9 @@ function IceTargetHealth.prototype:Enable(core)
|
||||
self:RegisterEvent("UNIT_FLAGS", "Update")
|
||||
self:RegisterEvent("UNIT_FACTION", "Update")
|
||||
self:RegisterEvent("RAID_TARGET_UPDATE", "UpdateRaidTargetIcon")
|
||||
self:RegisterEvent("UPDATE_FACTION", "CheckPvP")
|
||||
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP")
|
||||
self:RegisterEvent("UNIT_FACTION", "CheckPvP")
|
||||
end
|
||||
|
||||
if (self.moduleSettings.hideBlizz) then
|
||||
@ -337,7 +444,7 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
self.frame.classIcon:Show()
|
||||
self.frame.classIcon:SetAlpha(self.alpha == 0 and 0 or math.min(1, self.alpha + 0.2))
|
||||
|
||||
if IceHUD.IceCore:IsInConfigMode() or classification == "worldboss" or classification == "elite" then
|
||||
if configMode or IceHUD.IceCore:IsInConfigMode() or classification == "worldboss" or classification == "elite" then
|
||||
self.frame.classIcon:SetTexture(self.EliteTexture)
|
||||
elseif classification == "rareelite" then
|
||||
self.frame.classIcon:SetTexture(self.RareEliteTexture)
|
||||
@ -388,6 +495,9 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
self:SetBottomText2()
|
||||
end
|
||||
end
|
||||
|
||||
self:CheckPvP()
|
||||
self:SetIconAlpha()
|
||||
end
|
||||
|
||||
|
||||
@ -407,6 +517,7 @@ end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:SetTexLoc(texframe, xpos, ypos, anchorFrom, anchorTo)
|
||||
texframe:Show()
|
||||
texframe:ClearAllPoints()
|
||||
texframe:SetPoint(anchorFrom or "TOPLEFT", self.frame, anchorTo or "TOPLEFT", xpos or 0, ypos or 0)
|
||||
end
|
||||
@ -464,12 +575,12 @@ function IceTargetHealth.prototype:UpdateRaidTargetIcon()
|
||||
self.frame.raidIcon:SetFrameStrata("LOW")
|
||||
end
|
||||
|
||||
if not self.moduleSettings.showRaidIcon or (not UnitExists(self.unit) and not IceHUD.IceCore:IsInConfigMode()) then
|
||||
if not self.moduleSettings.showRaidIcon or (not UnitExists(self.unit) and (not configMode and not IceHUD.IceCore:IsInConfigMode())) then
|
||||
self.frame.raidIcon:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local index = IceHUD.IceCore:IsInConfigMode() and 1 or GetRaidTargetIndex(self.unit);
|
||||
local index = (IceHUD.IceCore:IsInConfigMode() or configMode) and 1 or GetRaidTargetIndex(self.unit);
|
||||
|
||||
if (index and (index > 0)) then
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon.icon, index)
|
||||
@ -495,6 +606,46 @@ function IceTargetHealth.prototype:Round(health)
|
||||
end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:CheckPvP()
|
||||
local pvpMode = nil
|
||||
local minx, maxx, miny, maxy
|
||||
|
||||
if configMode or UnitIsPVPFreeForAll(self.unit) then
|
||||
pvpMode = "FFA"
|
||||
|
||||
minx, maxx, miny, maxy = 0.05, 0.605, 0.015, 0.57
|
||||
elseif UnitIsPVP(self.unit) then
|
||||
pvpMode = UnitFactionGroup(self.unit)
|
||||
|
||||
if pvpMode == "Alliance" then
|
||||
minx, maxx, miny, maxy = 0.07, 0.58, 0.06, 0.57
|
||||
else
|
||||
minx, maxx, miny, maxy = 0.08, 0.58, 0.045, 0.545
|
||||
end
|
||||
end
|
||||
|
||||
if pvpMode then
|
||||
if configMode or self.moduleSettings.showPvPIcon then
|
||||
self.frame.PvPIcon = self:CreateTexCoord(self.frame.PvPIcon, "Interface\\TargetingFrame\\UI-PVP-"..pvpMode, 20, 20,
|
||||
self.moduleSettings.PvPIconScale, minx, maxx, miny, maxy)
|
||||
self:SetTexLoc(self.frame.PvPIcon, self.moduleSettings.PvPIconOffset['x'], self.moduleSettings.PvPIconOffset['y'])
|
||||
elseif self.frame.PvPIcon and self.frame.PvPIcon:IsVisible() then
|
||||
self.frame.PvPIcon = self:DestroyTexFrame(self.frame.PvPIcon)
|
||||
end
|
||||
else
|
||||
if self.frame.PvPIcon and self.frame.PvPIcon:IsVisible() then
|
||||
self.frame.PvPIcon = self:DestroyTexFrame(self.frame.PvPIcon)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function IceTargetHealth.prototype:SetIconAlpha()
|
||||
if self.frame.PvPIcon then
|
||||
self.frame.PvPIcon:SetAlpha(self.moduleSettings.lockIconAlpha and 1 or self.alpha)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:ShowBlizz()
|
||||
TargetFrame:Show()
|
||||
|
Reference in New Issue
Block a user