chat: more robust and configurable player colors

This commit is contained in:
shagu
2018-09-02 16:35:51 +02:00
parent 5790f2f7bc
commit db5a021f0e
5 changed files with 24 additions and 14 deletions
-3
View File
@@ -77,9 +77,6 @@ Please make sure to have the latest version installed and check for conflicting
**Can I use Clique with pfUI?**
A pfUI compatible version of Clique can be found [Here](https://gitlab.com/shagu/Clique/releases). If you want to keep your current version of Clique, you'll have to apply this [Patch](https://gitlab.com/shagu/Clique/commit/a5ee56c3f803afbdda07bae9cd330e0d4a75d75a).
**Why do I see player names instead of linked items?**
That's a conflict with prat. You'll have to either disable Prat's class colors by typing `/prat playernames toggle` or disable pfUI's class colors within the settings dialog. The entry can found in the chat section: `Enable Class Colors`.
**How do I show the Damage- and Threatmeter Dock?**
If you enabled the "dock"-feature for your external (third-party) meters such as DPSMate or KTM, then you'll be able to toggle between them and the Right Chat by clicking on the ">" symbol on the bottom-right panel.
+1
View File
@@ -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", "unknowncolor", ".7,.7,.7,1")
pfUI:UpdateConfig("chat", "text", "channelnumonly", "1")
pfUI:UpdateConfig("chat", "text", "detecturl", "1")
pfUI:UpdateConfig("chat", "text", "classcolor", "1")
+21 -10
View File
@@ -814,6 +814,9 @@ pfUI:RegisterModule("chat", function ()
local r,g,b,a = strsplit(",", C.chat.text.timecolor)
local timecolorhex = string.format("%02x%02x%02x%02x", a*255, r*255, g*255, b*255)
local r,g,b,a = strsplit(",", C.chat.text.unknowncolor)
local unknowncolorhex = string.format("%02x%02x%02x%02x", a*255, r*255, g*255, b*255)
for i=1,NUM_CHAT_WINDOWS do
if not _G["ChatFrame"..i].HookAddMessage then
_G["ChatFrame"..i].HookAddMessage = _G["ChatFrame"..i].AddMessage
@@ -839,18 +842,26 @@ pfUI:RegisterModule("chat", function ()
-- display class colors if already indexed
if C.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 Class ~= UNKNOWN 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"
for name in string.gfind(text, "|Hplayer:(.-)|h") do
local cname
-- search player in database
if pfUI_playerDB[name] and pfUI_playerDB[name].class ~= nil then
local class = pfUI_playerDB[name].class
if class ~= UNKNOWN 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)
cname = left .. "|cff" .. color .. name .. "|r" .. right
end
else
cname = left .. "|c" .. unknowncolorhex .. name .. "|r" .. right
end
text = string.gsub(text, "|Hplayer:"..name.."|h%["..name.."%]|h(.-:-)", "|Hplayer:"..name.."|h"..cname.."|h%1")
end
text = string.gsub(text, "|Hplayer:(.-)|h%[.-%]|h(.-:-)", "|r" .. left .. "|Hplayer:%1|h" .. Name .. "|h|r" .. right .. "%2")
end
-- reduce channel name to number
+1
View File
@@ -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["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")
CreateConfig(nil, this, T["Right Chat Width"], C.chat.right, "width")
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: |cff33ffccpf|cffffffffUI
## Author: Shagu
## Notes: A complete user interface replacement.
## Version: 3.14.1
## Version: 3.14.2
## SavedVariables: pfUI_profiles, pfUI_addon_profiles, pfUI_cache
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB