nameplates: unify all combat colors in one table

This commit is contained in:
shagu
2025-02-17 20:27:41 +01:00
parent c05e46684c
commit 8a1c2fe8ba
+24 -8
View File
@@ -10,6 +10,14 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
["FRIENDLY_PLAYER"] = { .2, .6, 1, .8 } ["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 = { local elitestrings = {
["elite"] = "+", ["elite"] = "+",
["rareelite"] = "R+", ["rareelite"] = "R+",
@@ -585,18 +593,21 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
if superwow_active and C.nameplates.outcombatstate == "1" then if superwow_active and C.nameplates.outcombatstate == "1" then
local guid = plate.parent:GetName(1) or "" local guid = plate.parent:GetName(1) or ""
local target = guid.."target" 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 UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then
if UnitIsUnit(target, "player") then if UnitIsUnit(target, "player") then
plate.health.backdrop:SetBackdropBorderColor(.7,.2,.2,1) color = combatstate.THREAT
elseif UnitExists(target) or UnitIsPlayer(guid) then elseif UnitExists(target) or UnitIsPlayer(guid) then
plate.health.backdrop:SetBackdropBorderColor(.7,.7,.2,1) color = combatstate.NOTHREAT
else else
plate.health.backdrop:SetBackdropBorderColor(.2,.7,.7,1) color = combatstate.STUN
end end
else
plate.health.backdrop:SetBackdropBorderColor(.2,.2,.2,1)
end end
-- set border color
plate.health.backdrop:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
elseif target and C.nameplates.targethighlight == "1" then elseif target and C.nameplates.targethighlight == "1" then
plate.health.backdrop:SetBackdropBorderColor(plate.health.hlr, plate.health.hlg, plate.health.hlb, plate.health.hla) 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 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 if superwow_active and C.nameplates.barcombatstate == "1" then
local guid = plate.parent:GetName(1) or "" local guid = plate.parent:GetName(1) or ""
local target = guid.."target" 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 UnitAffectingCombat("player") and UnitAffectingCombat(guid) and not UnitCanAssist("player", guid) then
if UnitIsUnit(target, "player") then if UnitIsUnit(target, "player") then
r, g, b, a = .7, .2, .2, 1 color = combatstate.THREAT
elseif UnitExists(target) or UnitIsPlayer(guid) then elseif UnitExists(target) or UnitIsPlayer(guid) then
r, g, b, a = .7, .7, .2, 1 color = combatstate.NOTHREAT
else else
r, g, b, a = .2, .7, .7, 1 color = combatstate.STUN
end end
-- override healthbar color
r, g, b, a = color.r, color.g, color.b, color.a
end end
end end