From c05e46684cae41f4b9fde1c288beb2579f87c422 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 17 Feb 2025 20:01:21 +0100 Subject: [PATCH] nameplates: combat state bar 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 | 5 ++++- modules/nameplates.lua | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/api/config.lua b/api/config.lua index 4bb8d170..3fa6a889 100644 --- a/api/config.lua +++ b/api/config.lua @@ -729,6 +729,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("nameplates", nil, "showguildname", "0") pfUI:UpdateConfig("nameplates", nil, "outcombatstate", "1") + pfUI:UpdateConfig("nameplates", nil, "barcombatstate", "0") 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 9a2e9d9d..54859c53 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2269,7 +2269,6 @@ 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") @@ -2288,6 +2287,10 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(U["nameplates"], T["Always Show On Units With Missing HP"], C.nameplates, "fullhealth", "checkbox") CreateConfig(U["nameplates"], T["Always Show On Target Units"], C.nameplates, "target", "checkbox") CreateConfig(U["nameplates"], T["Vertical Healthbar"], C.nameplates, "verticalhealth", "checkbox") + + 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") end) CreateGUIEntry(T["Thirdparty"], T["Integrations"], function() diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 9b8272c6..54079201 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -586,9 +586,9 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () local guid = plate.parent:GetName(1) or "" local target = guid.."target" - if UnitAffectingCombat(guid) then + if UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then if UnitIsUnit(target, "player") then - plate.health.backdrop:SetBackdropBorderColor(.7,.2,.3,1) + plate.health.backdrop:SetBackdropBorderColor(.7,.2,.2,1) elseif UnitExists(target) or UnitIsPlayer(guid) then plate.health.backdrop:SetBackdropBorderColor(.7,.7,.2,1) else @@ -712,6 +712,21 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () r, g, b, a = .5, .5, .5, .8 end + if superwow_active and C.nameplates.barcombatstate == "1" then + local guid = plate.parent:GetName(1) or "" + local target = guid.."target" + + if UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then + if UnitIsUnit(target, "player") then + r, g, b, a = .7, .2, .2, 1 + elseif UnitExists(target) or UnitIsPlayer(guid) then + r, g, b, a = .7, .7, .2, 1 + else + r, g, b, a = .2, .7, .7, 1 + end + end + end + if r ~= plate.cache.r or g ~= plate.cache.g or b ~= plate.cache.b then plate.health:SetStatusBarColor(r, g, b, a) plate.cache.r, plate.cache.g, plate.cache.b = r, g, b