From b8d23a0e280a904f3ccfba720af42ab7394ede78 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 2 Sep 2024 16:21:45 +0200 Subject: [PATCH] nameplates: combat state border colors * red: attacking player * yellow: attacking other * blue: no target (npc only) * none: out of combat This only works if super-wow is enabled. --- api/config.lua | 1 + modules/gui.lua | 1 + modules/nameplates.lua | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/api/config.lua b/api/config.lua index 3b842206..b12f2d93 100644 --- a/api/config.lua +++ b/api/config.lua @@ -704,6 +704,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("nameplates", nil, "totemicons", "0") pfUI:UpdateConfig("nameplates", nil, "showguildname", "0") + pfUI:UpdateConfig("nameplates", nil, "outcombatstate", "1") pfUI:UpdateConfig("nameplates", nil, "outfriendly", "0") pfUI:UpdateConfig("nameplates", nil, "outfriendlynpc", "1") pfUI:UpdateConfig("nameplates", nil, "outneutral", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 26cdc027..9d734bd9 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2236,6 +2236,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["nameplates"], T["Red Border On Enemy Units"], C.nameplates, "outenemy", "checkbox") CreateConfig(U["nameplates"], T["Border Around Target Unit"], C.nameplates, "targethighlight", "checkbox") CreateConfig(U["nameplates"], T["Border Color Around Target Unit"], C.nameplates, "highlightcolor", "color") + CreateConfig(U["nameplates"], T["Overwrite Border Color With Combat State"], C.nameplates, "outcombatstate", "checkbox") CreateConfig(nil, T["Healthbar"], nil, nil, "header") CreateConfig(U["nameplates"], T["Healthbar Vertical Offset"], C.nameplates.health, "offset") diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 007964ec..ef61ae79 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -545,7 +545,22 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () end -- target indicator - if target and C.nameplates.targethighlight == "1" then + if superwow_active and C.nameplates.outcombatstate == "1" then + local guid = plate.parent:GetName(1) or "" + local target = guid.."target" + + if UnitAffectingCombat(guid) then + if UnitIsUnit(target, "player") then + plate.health.backdrop:SetBackdropBorderColor(.7,.2,.3,1) + elseif UnitExists(target) or UnitIsPlayer(guid) then + plate.health.backdrop:SetBackdropBorderColor(.7,.7,.2,1) + else + plate.health.backdrop:SetBackdropBorderColor(.2,.7,.7,1) + end + else + plate.health.backdrop:SetBackdropBorderColor(.2,.2,.2,1) + end + elseif target and C.nameplates.targethighlight == "1" then plate.health.backdrop:SetBackdropBorderColor(plate.health.hlr, plate.health.hlg, plate.health.hlb, plate.health.hla) elseif C.nameplates.outfriendlynpc == "1" and unittype == "FRIENDLY_NPC" then plate.health.backdrop:SetBackdropBorderColor(.2,.7,.3,1)