From 8a1c2fe8ba456f9a3fbbe5b9d3bb9aa74cdc8fb5 Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 17 Feb 2025 20:27:41 +0100 Subject: [PATCH] nameplates: unify all combat colors in one table --- modules/nameplates.lua | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 54079201..a77ad585 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -10,6 +10,14 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () ["FRIENDLY_PLAYER"] = { .2, .6, 1, .8 } } + local combatstate = { + ["NOTHREAT"] = { r = .7, g = .7, b = .2, a = 1 }, + ["THREAT"] = { r = .7, g = .2, b = .2, a = 1 }, + ["CASTING"] = { r = .7, g = .2, b = .7, a = 1 }, + ["STUN"] = { r = .2, g = .7, b = .7, a = 1 }, + ["NONE"] = { r = .2, g = .2, b = .2, a = 1 }, + } + local elitestrings = { ["elite"] = "+", ["rareelite"] = "R+", @@ -585,18 +593,21 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () 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 - plate.health.backdrop:SetBackdropBorderColor(.7,.2,.2,1) + color = combatstate.THREAT elseif UnitExists(target) or UnitIsPlayer(guid) then - plate.health.backdrop:SetBackdropBorderColor(.7,.7,.2,1) + color = combatstate.NOTHREAT else - plate.health.backdrop:SetBackdropBorderColor(.2,.7,.7,1) + color = combatstate.STUN end - else - plate.health.backdrop:SetBackdropBorderColor(.2,.2,.2,1) end + + -- set border color + plate.health.backdrop:SetBackdropBorderColor(color.r, color.g, color.b, color.a) 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 @@ -715,15 +726,20 @@ 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 + -- determine color based on combat state 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 + color = combatstate.THREAT elseif UnitExists(target) or UnitIsPlayer(guid) then - r, g, b, a = .7, .7, .2, 1 + color = combatstate.NOTHREAT else - r, g, b, a = .2, .7, .7, 1 + color = combatstate.STUN end + + -- override healthbar color + r, g, b, a = color.r, color.g, color.b, color.a end end