From ca02c51b9200c25eb6c9590d7ebe894ba0a88d4b Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 7 Sep 2018 23:03:27 +0200 Subject: [PATCH] chat: option to disable color of unknown classes --- api/config.lua | 1 + modules/chat.lua | 9 ++++++--- modules/gui.lua | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/config.lua b/api/config.lua index 1bdecf32..3496f033 100644 --- a/api/config.lua +++ b/api/config.lua @@ -657,6 +657,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", "tintunknown", "1") pfUI:UpdateConfig("chat", "text", "unknowncolor", ".7,.7,.7,1") pfUI:UpdateConfig("chat", "text", "channelnumonly", "1") pfUI:UpdateConfig("chat", "text", "detecturl", "1") diff --git a/modules/chat.lua b/modules/chat.lua index cf7ba187..fa660073 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -845,7 +845,7 @@ pfUI:RegisterModule("chat", function () for name in string.gfind(text, "|Hplayer:(.-)|h") do local color = unknowncolorhex - + local match = false -- search player in database if pfUI_playerDB[name] and pfUI_playerDB[name].class ~= nil then local class = pfUI_playerDB[name].class @@ -854,11 +854,14 @@ pfUI:RegisterModule("chat", function () RAID_CLASS_COLORS[class].r * 255, RAID_CLASS_COLORS[class].g * 255, RAID_CLASS_COLORS[class].b * 255) + match = true end end - text = string.gsub(text, "|Hplayer:"..name.."|h%["..name.."%]|h(.-:-)", - left.."|cff"..color.."|Hplayer:"..name.."|h" .. name .. "|h|r"..right.."%1") + if C.chat.text.tintunknown == "1" or match then + text = string.gsub(text, "|Hplayer:"..name.."|h%["..name.."%]|h(.-:-)", + left.."|cff"..color.."|Hplayer:"..name.."|h" .. name .. "|h|r"..right.."%1") + end end end diff --git a/modules/gui.lua b/modules/gui.lua index 515410d4..9229c4d6 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -1159,6 +1159,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, this, T["Hide Channel Names"], C.chat.text, "channelnumonly", "checkbox") CreateConfig(nil, this, T["Enable URL Detection"], C.chat.text, "detecturl", "checkbox") CreateConfig(nil, this, T["Enable Class Colors"], C.chat.text, "classcolor", "checkbox") + CreateConfig(nil, this, T["Colorize Unknown Classes"], C.chat.text, "tintunknown", "checkbox") CreateConfig(nil, this, T["Unknown Class Color"], C.chat.text, "unknowncolor", "color") CreateConfig(nil, this, T["Left Chat Width"], C.chat.left, "width") CreateConfig(nil, this, T["Left Chat Height"], C.chat.left, "height")