From 7e3a7aa975338b6f7368aa4fd1000679a280dbfb Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Tue, 25 Aug 2026 19:46:37 +0200 Subject: [PATCH] Remove duplicate social colors and native ignore override --- mods/chat-tweaks.lua | 182 +------------------------------------------ 1 file changed, 2 insertions(+), 180 deletions(-) diff --git a/mods/chat-tweaks.lua b/mods/chat-tweaks.lua index 921de94..e02ac88 100644 --- a/mods/chat-tweaks.lua +++ b/mods/chat-tweaks.lua @@ -1,21 +1,14 @@ local _G = ShaguTweaks.GetGlobalEnv() local T = ShaguTweaks.T -local L = ShaguTweaks.L local API = ShaguTweaks.API or {} -local gfind = string.gmatch or string.gfind -local GetUnitData = ShaguTweaks.GetUnitData -local GetExpansion = ShaguTweaks.GetExpansion -local hooksecurefunc = ShaguTweaks.hooksecurefunc -local cmatch = ShaguTweaks.cmatch local rgbhex = ShaguTweaks.rgbhex local strsplit = ShaguTweaks.strsplit local scrollspeed = 1 -local friendinfo = gsub(gsub(FRIENDS_LEVEL_TEMPLATE,"%%s","%%s %%s"),"%%d","%%s") local module = ShaguTweaks:register({ title = T["Chat Tweaks"], - description = T["Improves chat with mouse wheel scrolling, sticky channels, arrow-up repeat, shortened names, item link preview, Alt/Ctrl-click to invite/target, right-click ignore, chat history, and class colors."], + description = T["Improves chat with mouse wheel scrolling, sticky channels, arrow-up repeat, shortened names, item link preview, Alt/Ctrl-click to invite/target, chat history, and clickable URLs."], expansions = { ["vanilla"] = true }, category = T["Social & Chat"], enabled = true, @@ -128,10 +121,6 @@ end -- ============================================================ module.enable = function(self) - -- Turtle/Octo/Raven already provide the intended class-color table, - -- including blue shamans. Do not replace RAID_CLASS_COLORS here: keeping - -- the server UI table intact also preserves references held by other addons. - -- -------------------------------------------------------- -- Sticky channels & arrow-up repeat -- -------------------------------------------------------- @@ -199,7 +188,7 @@ module.enable = function(self) end -- -------------------------------------------------------- - -- Per-frame hooks: history + CLINK cleanup + URLs + class colors + -- Per-frame hooks: history + CLINK cleanup + URLs -- -------------------------------------------------------- for i=1, NUM_CHAT_WINDOWS do local isCombat = 0 @@ -242,18 +231,6 @@ module.enable = function(self) -- URL detection text = HandleLink(text) - -- Class colors on player links - for name in gfind(text, "|Hplayer:(.-)|h") do - local real, _ = strsplit(":", name) - local color = "|cffaaaaaa" - local class = GetUnitData(real) - if class and class ~= UNKNOWN then - color = rgbhex(RAID_CLASS_COLORS[class]) - end - text = string.gsub(text, "|Hplayer:"..name.."|h%["..real.."%]|h(.-:-)", - "|r["..color.."|Hplayer:"..name.."|h"..color..real.."|h|r".."]|r".."%1") - end - SaveChatHistory(frame:GetID(), text, a1, a2, a3) frame:ShaguTweaksBaseAddMessage(text, a1, a2, a3, a4, a5) end @@ -349,159 +326,4 @@ module.enable = function(self) _G.CHAT_YELL_GET = left.."Y"..right .. default _G.CHAT_WHISPER_GET = "[From]" .. default _G.CHAT_WHISPER_INFORM_GET = "[To]" .. default - - -- -------------------------------------------------------- - -- Right-click ignore - -- -------------------------------------------------------- - UnitPopupButtons["IGNORE_PLAYER"] = { text = "Ignore", dist = 0 } - for index, value in ipairs(UnitPopupMenus["FRIEND"]) do - if value == "GUILD_LEAVE" then - table.insert(UnitPopupMenus["FRIEND"], index+1, "IGNORE_PLAYER") - end - end - hooksecurefunc("UnitPopup_OnClick", function(self) - if this.value == "IGNORE_PLAYER" then - AddIgnore(_G[UIDROPDOWNMENU_INIT_MENU].name) - end - end) - - -- -------------------------------------------------------- - -- Social colors: guild, friends, who lists - -- -------------------------------------------------------- - ShaguTweaks_cache = ShaguTweaks_cache or {} - ShaguTweaks_cache["players"] = ShaguTweaks_cache["players"] or {} - local playerdb = ShaguTweaks_cache["players"] - - local socialmod = CreateFrame("Frame", "ShaguTweaksSocialMod", UIParent) - socialmod:RegisterEvent("CHAT_MSG_SYSTEM") - socialmod:SetScript("OnEvent", function() - 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 - end) - - hooksecurefunc("GuildStatus_Update", function() - local playerzone = GetRealZoneText() - local off = FauxScrollFrame_GetOffset(GuildListScrollFrame) - local _, _, playerrankindex = GetGuildInfo("player") - for i=1, GUILDMEMBERS_TO_DISPLAY do - local name, _, rankindex, level, class, zone, _, _, online = GetGuildRosterInfo(off + i) - class = L["class"][class] - if name then - if class then - local color = RAID_CLASS_COLORS[class] - local alpha = online and 1 or .5 - _G["GuildFrameButton"..i.."Name"]:SetTextColor(color.r, color.g, color.b, alpha) - _G["GuildFrameButton"..i.."Class"]:SetTextColor(color.r, color.g, color.b, alpha) - _G["GuildFrameGuildStatusButton"..i.."Name"]:SetTextColor(color.r, color.g, color.b, alpha) - end - if level then - local color = GetDifficultyColor(level) - local alpha = online and 1 or .5 - _G["GuildFrameButton"..i.."Level"]:SetTextColor(color.r+.2, color.g+.2, color.b+.2, alpha) - end - if zone and zone == playerzone then - local alpha = online and 1 or .5 - _G["GuildFrameButton"..i.."Zone"]:SetTextColor(.5, 1, 1, alpha) - end - if rankindex and rankindex == playerrankindex then - local alpha = online and 1 or .5 - _G["GuildFrameGuildStatusButton"..i.."Rank"]:SetTextColor(.5, 1, 1, alpha) - end - end - end - end) - - local FRIENDS_NAME_LOCATION = GetExpansion() == "vanilla" and "ButtonTextNameLocation" or "ButtonTextLocation" - hooksecurefunc("FriendsList_Update", function() - if GetNumFriends() == 0 then return end - local playerzone = GetRealZoneText() - local off = FauxScrollFrame_GetOffset(FriendsFrameFriendsScrollFrame) - for i=1, FRIENDS_TO_DISPLAY do - local name, level, class, zone, connected, status = GetFriendInfo(off + i) - if not name or name == _G.UNKNOWN then break end - local friendName = _G["FriendsFrameFriendButton"..i.."ButtonTextName"] - local friendLoc = _G["FriendsFrameFriendButton"..i..FRIENDS_NAME_LOCATION] - local friendInfo = _G["FriendsFrameFriendButton"..i.."ButtonTextInfo"] - local caption = friendName or friendLoc - if connected then - 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 } - 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" - 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 - playerdb[name].cclass = ccolor - end - if friendName then - friendName:SetText(cname) - friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), displayZone, status)) - else - friendLoc:SetText(format(TEXT(FRIENDS_LIST_TEMPLATE), cname, displayZone, status)) - end - friendInfo:SetText(format(TEXT(friendinfo), clevel, classLabel, "")) - caption:SetVertexColor(1,1,1,.9) - friendInfo:SetVertexColor(1,1,1,.9) - else - if playerdb[name] and playerdb[name].cname and playerdb[name].clevel and playerdb[name].lastseen then - caption:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), playerdb[name].cname)) - friendInfo:SetText(format(TEXT(friendinfo), playerdb[name].clevel, playerdb[name].lastseen, "")) - else - caption:SetText(format(TEXT(FRIENDS_LIST_OFFLINE_TEMPLATE), name.."|r")) - friendInfo:SetText(TEXT(UNKNOWN)) - end - caption:SetVertexColor(1,1,1,.4) - friendInfo:SetVertexColor(1,1,1,.4) - end - end - end) - - hooksecurefunc("WhoList_Update", function() - local num, max = GetNumWhoResults() - local off = FauxScrollFrame_GetOffset(WhoListScrollFrame) - local playerzone = GetRealZoneText() - local playerrace = UnitRace("player") - local playerguild = GetGuildInfo("player") - for i=1, WHOS_TO_DISPLAY do - local name, guild, level, race, class, zone = GetWhoInfo(off + i) - local displayedText = "" - if num + 1 >= MAX_WHOS_FROM_SERVER then - displayedText = format(WHO_FRAME_SHOWN_TEMPLATE, MAX_WHOS_FROM_SERVER) - WhoFrameTotals:SetText("|cffffffff"..format(GetText("WHO_FRAME_TOTAL_TEMPLATE",nil,num),max).." |cffaaaaaa"..displayedText) - else - displayedText = format(WHO_FRAME_SHOWN_TEMPLATE, num) - WhoFrameTotals:SetText("|cffffffff"..format(GetText("WHO_FRAME_TOTAL_TEMPLATE",nil,num),num).." |cffaaaaaa"..displayedText) - end - 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 - _G["WhoFrameButton"..i.."Variable"]:SetTextColor(guild == playerguild and .5 or 1, 1, 1) - elseif UIDropDownMenu_GetSelectedID(WhoFrameDropDown) == 3 then - _G["WhoFrameButton"..i.."Variable"]:SetTextColor(race == playerrace and .5 or 1, 1, 1) - end - 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 - end - end) - end