From bbdeeb5217a0b39593dddaa9d94d9ce7f6cdfe00 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 2 Feb 2017 19:42:12 +0100 Subject: [PATCH] chat: add option to disable player class color --- modules/chat.lua | 23 +++++++++++++---------- modules/config.lua | 1 + modules/gui.lua | 1 + 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/chat.lua b/modules/chat.lua index b5f08ce5..24e0a909 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -594,18 +594,21 @@ pfUI:RegisterModule("chat", function () end getglobal("ChatFrame"..i).AddMessage = function (frame, text, ...) if text then - local Name = string.gsub(text, ".*|Hplayer:(.-)|h.*", "%1") - if pfUI_playerDB[Name] and pfUI_playerDB[Name].class ~= nil then - local Class = pfUI_playerDB[Name].class - if RAID_CLASS_COLORS[Class] ~= nil then - local Color = string.format("%02x%02x%02x", - RAID_CLASS_COLORS[Class].r * 255, - RAID_CLASS_COLORS[Class].g * 255, - RAID_CLASS_COLORS[Class].b * 255) - Name = "|cff" .. Color .. Name .. "|r" + + if pfUI_config.chat.text.classcolor == "1" then + local Name = string.gsub(text, ".*|Hplayer:(.-)|h.*", "%1") + if pfUI_playerDB[Name] and pfUI_playerDB[Name].class ~= nil then + local Class = pfUI_playerDB[Name].class + if RAID_CLASS_COLORS[Class] ~= nil then + local Color = string.format("%02x%02x%02x", + RAID_CLASS_COLORS[Class].r * 255, + RAID_CLASS_COLORS[Class].g * 255, + RAID_CLASS_COLORS[Class].b * 255) + Name = "|cff" .. Color .. Name .. "|r" + end end + text = string.gsub(text, "|Hplayer:(.-)|h%[.-%]|h(.-:-)", "[|Hplayer:%1|h" .. Name .. "|h]" .. "%2") end - text = string.gsub(text, "|Hplayer:(.-)|h%[.-%]|h(.-:-)", "[|Hplayer:%1|h" .. Name .. "|h]" .. "%2") if pfUI_config.chat.global.whispermod == "1" then -- patch incoming whisper string to match the colors diff --git a/modules/config.lua b/modules/config.lua index c00b4ed0..68259e3c 100644 --- a/modules/config.lua +++ b/modules/config.lua @@ -143,6 +143,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("chat", "text", "timeformat", "%H:%M:%S") pfUI:UpdateConfig("chat", "text", "timebracket", "[]") pfUI:UpdateConfig("chat", "text", "timecolor", ".8,.8,.8,1") + pfUI:UpdateConfig("chat", "text", "classcolor", "1") pfUI:UpdateConfig("chat", "left", "width", "380") pfUI:UpdateConfig("chat", "left", "height", "180") pfUI:UpdateConfig("chat", "right", "enable", "0") diff --git a/modules/gui.lua b/modules/gui.lua index e071a845..a86c7b52 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -987,6 +987,7 @@ pfUI:RegisterModule("gui", function () pfUI.gui:CreateConfig(pfUI.gui.chat, "Timestamp format:", pfUI_config.chat.text, "timeformat") pfUI.gui:CreateConfig(pfUI.gui.chat, "Timestamp brackets:", pfUI_config.chat.text, "timebracket") pfUI.gui:CreateConfig(pfUI.gui.chat, "Timestamp color:", pfUI_config.chat.text, "timecolor", "color") + pfUI.gui:CreateConfig(pfUI.gui.chat, "Use class colors for known players:", pfUI_config.chat.text, "classcolor", "checkbox") pfUI.gui:CreateConfig(pfUI.gui.chat, "Left chat width:", pfUI_config.chat.left, "width") pfUI.gui:CreateConfig(pfUI.gui.chat, "Left chat height:", pfUI_config.chat.left, "height") pfUI.gui:CreateConfig(pfUI.gui.chat, "Right chat width:", pfUI_config.chat.right, "width")