From a3cfd711feb6e85e49b8554e9f1537157f52831e Mon Sep 17 00:00:00 2001 From: roby-brok Date: Fri, 21 Aug 2026 10:43:34 +0100 Subject: [PATCH] nameplates: read friendly name colours from the class table The class-colour write sourced r, g, b from the health bar rather than from PFUI_CLASS_COLORS[class], which the condition tested for but never read. So "class colours on friendly names" only produced a class colour when friendclassc - a bar option - happened to be on as well; otherwise the name took the generic friendly colour. In every case it also inherited the tapped-grey and barcombatstate overrides meant for the bar, neither of which belongs on the name. The name now reads the class table directly. The discarded "and PFUI_CLASS_COLORS[class]" term was dead weight: the table carries an __index metamethod returning a grey ColorMixin for any missing key, so it was always truthy and merely allocated a throwaway table per evaluation. "and class" is the real guard. One behaviour change falls out - a friendly player of an unrecognised class now takes that grey fallback rather than the bar colour, which is what the option means. (cherry picked from commit f880dc3528db2ba0d0936b00a4dff8deec48e6d2) (cherry picked from commit 111d70004d4fb172f168aa48a4cb6177a7f0d393) --- modules/nameplates.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 6ebb64ba..8e1d0518 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1267,7 +1267,7 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE") -- either could suppress the other -- and since nameplate.cache survives -- pool reuse, a recycled plate could keep the previous unit's name colour. local ownname = unittype == "FRIENDLY_PLAYER" and C.nameplates["friendclassnamec"] == "1" - and class and PFUI_CLASS_COLORS[class] and true or nil + and class and true or nil if plate.cache.ownname ~= ownname then plate.cache.ownname = ownname @@ -1276,9 +1276,16 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE") plate.cache.ownnamecolor = nil end - if ownname and r + g + b ~= plate.cache.ownnamecolor then - plate.cache.ownnamecolor = r + g + b - plate.name:SetTextColor(r, g, b, a) + -- read the class colour directly rather than reusing the bar's r,g,b: the + -- bar only carries a class colour when friendclassc happens to be on, and + -- it also picks up the tapped-grey and barcombatstate overrides, neither of + -- which belongs on the name. + if ownname then + local cr, cg, cb, ca = PFUI_CLASS_COLORS[class]:GetRGBA() + if cr + cg + cb ~= plate.cache.ownnamecolor then + plate.cache.ownnamecolor = cr + cg + cb + plate.name:SetTextColor(cr, cg, cb, ca) + end end if target and C.nameplates.cpdisplay == "1" then