Harden Chat Tweaks social colors with passive class fallback

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