Harden Chat Tweaks social colors with passive class fallback

This commit is contained in:
2026-08-24 10:58:58 +02:00
parent 11b1d0ea3a
commit 3c174c4c02
+25 -17
View File
@@ -393,8 +393,7 @@ module.enable = function(self)
local socialmod = CreateFrame("Frame", "ShaguTweaksSocialMod", UIParent)
socialmod:RegisterEvent("CHAT_MSG_SYSTEM")
socialmod:SetScript("OnEvent", function()
local name = cmatch(arg1, _G.ERR_FRIEND_ONLINE_SS)
name = cmatch(arg1, _G.ERR_FRIEND_OFFLINE_S)
local name = cmatch(arg1, _G.ERR_FRIEND_ONLINE_SS) or cmatch(arg1, _G.ERR_FRIEND_OFFLINE_S)
if name and playerdb[name] and playerdb[name].cname then
playerdb[name].lastseen = date("%a %d-%b-%Y")
end
@@ -445,13 +444,16 @@ module.enable = function(self)
local friendInfo = _G["FriendsFrameFriendButton"..i.."ButtonTextInfo"]
local caption = friendName or friendLoc
if connected then
if not class or class == _G.UNKNOWN then break end
local ccolor = RAID_CLASS_COLORS[L["class"][class]] or { 1,1,1 }
local classToken = class and class ~= _G.UNKNOWN and L["class"][class] or GetUnitData(name)
local ccolor = classToken and RAID_CLASS_COLORS[classToken]
local lcolor = GetDifficultyColor(tonumber(level)) or { 1,1,1 }
zone = (zone == playerzone and "|cffffffff" or "|cffcccccc") .. zone .. "|r"
local cname = rgbhex(ccolor) .. name .. "|r"
local displayZone = zone or ""
displayZone = (displayZone == playerzone and "|cffffffff" or "|cffcccccc") .. displayZone .. "|r"
local cname = ccolor and (rgbhex(ccolor) .. name .. "|r") or name
local clevel = rgbhex(lcolor) .. level .. "|r"
if playerdb[name] then
local classLabel = class and class ~= _G.UNKNOWN and class or _G.UNKNOWN
if ccolor then
playerdb[name] = playerdb[name] or {}
playerdb[name].lastseen = date("%a %d-%b-%Y")
playerdb[name].cname = cname
playerdb[name].clevel = clevel
@@ -459,11 +461,11 @@ module.enable = function(self)
end
if friendName then
friendName:SetText(cname)
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), zone, status))
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), displayZone, status))
else
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), cname, zone, status))
friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), cname, displayZone, status))
end
friendInfo:SetText(format(TEXT(friendinfo), clevel, class, ""))
friendInfo:SetText(format(TEXT(friendinfo), clevel, classLabel, ""))
caption:SetVertexColor(1,1,1,.9)
friendInfo:SetVertexColor(1,1,1,.9)
else
@@ -496,8 +498,11 @@ module.enable = function(self)
displayedText = format(WHO_FRAME_SHOWN_TEMPLATE, num)
WhoFrameTotals:SetText("|cffffffff"..format(GetText("WHO_FRAME_TOTAL_TEMPLATE",nil,num),num).." |cffaaaaaa"..displayedText)
end
class = L["class"][class]
_G["WhoFrameButton"..i.."Name"]:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
local classToken = class and L["class"][class] or (name and GetUnitData(name))
local nameButton = _G["WhoFrameButton"..i.."Name"]
local classButton = _G["WhoFrameButton"..i.."Class"]
nameButton:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
classButton:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b)
if UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 1 then
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(zone == playerzone and .5 or 1, 1, 1)
elseif UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 2 then
@@ -505,12 +510,15 @@ module.enable = function(self)
elseif UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 3 then
_G["WhoFrameButton"..i.."Variable"]:SetTextColor(race == playerrace and .5 or 1, 1, 1)
end
if class then
local color = RAID_CLASS_COLORS[class]
_G["WhoFrameButton"..i.."Class"]:SetTextColor(color.r, color.g, color.b, 1)
if classToken then
local color = RAID_CLASS_COLORS[classToken]
nameButton:SetTextColor(color.r, color.g, color.b, 1)
classButton:SetTextColor(color.r, color.g, color.b, 1)
end
if level then
local color = GetDifficultyColor(level)
_G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b)
end
local color = GetDifficultyColor(level)
_G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b)
end
end)