nameplates: make each combatstate option individual

This commit is contained in:
shagu
2025-02-22 09:13:59 +01:00
parent f5836f4cbd
commit 83aeb1a236
3 changed files with 38 additions and 27 deletions
+6
View File
@@ -730,9 +730,15 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("nameplates", nil, "outcombatstate", "1")
pfUI:UpdateConfig("nameplates", nil, "barcombatstate", "0")
pfUI:UpdateConfig("nameplates", nil, "ccombatthreat", "1")
pfUI:UpdateConfig("nameplates", nil, "ccombatnothreat", "1")
pfUI:UpdateConfig("nameplates", nil, "ccombatstun", "1")
pfUI:UpdateConfig("nameplates", nil, "ccombatcasting", "0")
pfUI:UpdateConfig("nameplates", nil, "combatthreat", ".7,.2,.2,1")
pfUI:UpdateConfig("nameplates", nil, "combatnothreat", ".7,.7,.2,1")
pfUI:UpdateConfig("nameplates", nil, "combatstun", ".2,.7,.7,1")
pfUI:UpdateConfig("nameplates", nil, "combatcasting", ".7,.2,.7,1")
pfUI:UpdateConfig("nameplates", nil, "outfriendly", "0")
pfUI:UpdateConfig("nameplates", nil, "outfriendlynpc", "1")
+8 -3
View File
@@ -2291,9 +2291,14 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(nil, T["SuperWoW Settings"], nil, nil, "header")
CreateConfig(U["nameplates"], T["Overwrite Border Color With Combat State"], C.nameplates, "outcombatstate", "checkbox")
CreateConfig(U["nameplates"], T["Overwrite Health Color With Combat State"], C.nameplates, "barcombatstate", "checkbox")
CreateConfig(U["nameplates"], T["Unit Is Attacking You"], C.nameplates, "combatthreat", "color")
CreateConfig(U["nameplates"], T["Unit Is Attacking Others"], C.nameplates, "combatnothreat", "color")
CreateConfig(U["nameplates"], T["Unit Is Attacking No One"], C.nameplates, "combatstun", "color")
CreateConfig(U["nameplates"], T["Overwrite If Unit Is Attacking You"], C.nameplates, "ccombatthreat", "checkbox")
CreateConfig(U["nameplates"], T["Overwrite If Unit Is Attacking Others"], C.nameplates, "ccombatnothreat", "checkbox")
CreateConfig(U["nameplates"], T["Overwrite If Unit Is Attacking No One"], C.nameplates, "ccombatstun", "checkbox")
CreateConfig(U["nameplates"], T["Overwrite If Unit Is Casting"], C.nameplates, "ccombatcasting", "checkbox")
CreateConfig(U["nameplates"], T["Unit Is Attacking You Color"], C.nameplates, "combatthreat", "color")
CreateConfig(U["nameplates"], T["Unit Is Attacking Others Color"], C.nameplates, "combatnothreat", "color")
CreateConfig(U["nameplates"], T["Unit Is Attacking No One Color"], C.nameplates, "combatstun", "color")
CreateConfig(U["nameplates"], T["Unit Is Casting Color"], C.nameplates, "combatcasting", "color")
end)
CreateGUIEntry(T["Thirdparty"], T["Integrations"], function()
+24 -24
View File
@@ -37,6 +37,25 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
-- cache default border color
local er, eg, eb, ea = GetStringColor(pfUI_config.appearance.border.color)
local function GetCombatStateColor(guid)
local target = guid.."target"
local color = false
if UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then
if C.nameplates.ccombatcasting == "1" and (UnitCastingInfo(guid) or UnitChannelInfo(guid)) then
color = combatstate.CASTING
elseif C.nameplates.ccombatthreat == "1" and UnitIsUnit(target, "player") then
color = combatstate.THREAT
elseif C.nameplates.ccombatnothreat == "1" and UnitExists(target) then
color = combatstate.NOTHREAT
elseif C.nameplates.ccombatstun == "1" and not UnitIsPlayer(guid) then
color = combatstate.STUN
end
end
return color
end
local function IsNamePlate(frame)
if frame:GetObjectType() ~= NAMEPLATE_FRAMETYPE then return nil end
regions = plate:GetRegions()
@@ -465,6 +484,7 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
local orientation = C.nameplates.verticalhealth == "1" and "VERTICAL" or "HORIZONTAL"
local c = combatstate -- load combat state colors
c.CASTING.r, c.CASTING.g, c.CASTING.b, c.CASTING.a = GetStringColor(C.nameplates.combatcasting)
c.THREAT.r, c.THREAT.g, c.THREAT.b, c.THREAT.a = GetStringColor(C.nameplates.combatthreat)
c.NOTHREAT.r, c.NOTHREAT.g, c.NOTHREAT.b, c.NOTHREAT.a = GetStringColor(C.nameplates.combatnothreat)
c.STUN.r, c.STUN.g, c.STUN.b, c.STUN.a = GetStringColor(C.nameplates.combatstun)
@@ -598,19 +618,10 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
-- target indicator
if superwow_active and C.nameplates.outcombatstate == "1" then
local guid = plate.parent:GetName(1) or ""
local target = guid.."target"
local color = combatstate.NONE
-- determine color based on combat state
if UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then
if UnitIsUnit(target, "player") then
color = combatstate.THREAT
elseif UnitExists(target) or UnitIsPlayer(guid) then
color = combatstate.NOTHREAT
else
color = combatstate.STUN
end
end
local color = GetCombatStateColor(guid)
if not color then color = combatstate.NONE end
-- set border color
plate.health.backdrop:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
@@ -731,20 +742,9 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
if superwow_active and C.nameplates.barcombatstate == "1" then
local guid = plate.parent:GetName(1) or ""
local target = guid.."target"
local color = combatstate.NONE
local color = GetCombatStateColor(guid)
-- determine color based on combat state
if UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then
if UnitIsUnit(target, "player") then
color = combatstate.THREAT
elseif UnitExists(target) or UnitIsPlayer(guid) then
color = combatstate.NOTHREAT
else
color = combatstate.STUN
end
-- override healthbar color
if color then
r, g, b, a = color.r, color.g, color.b, color.a
end
end