From 779ebd4b91b917a1ba4ff184b1bbd027aa0c9277 Mon Sep 17 00:00:00 2001 From: eTzmNcbkrng Date: Fri, 7 May 2021 21:23:58 +1200 Subject: [PATCH 1/4] Don't ClassColor names less than 3 characters --- ElvUI/Modules/Chat/Chat.lua | 8 +++++--- ElvUI/Modules/Misc/ChatBubbles.lua | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ElvUI/Modules/Chat/Chat.lua b/ElvUI/Modules/Chat/Chat.lua index 4496a7d6b..37d86663e 100644 --- a/ElvUI/Modules/Chat/Chat.lua +++ b/ElvUI/Modules/Chat/Chat.lua @@ -1440,9 +1440,11 @@ function CH:CheckKeyword(message, author) local classMatch = CH.ClassNames[lowerCaseWord] local wordMatch = classMatch and lowerCaseWord - if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then - local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] - word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) + if string.len(lowerCaseWord) > 2 then + if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then + local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] + word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) + end end end end diff --git a/ElvUI/Modules/Misc/ChatBubbles.lua b/ElvUI/Modules/Misc/ChatBubbles.lua index f5e1f950d..3465282d1 100644 --- a/ElvUI/Modules/Misc/ChatBubbles.lua +++ b/ElvUI/Modules/Misc/ChatBubbles.lua @@ -50,9 +50,11 @@ function M:UpdateBubbleBorder() classMatch = CH.ClassNames[lowerCaseWord] wordMatch = classMatch and lowerCaseWord - if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then - classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] - word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) + if string.len(lowerCaseWord) > 2 then + if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then + classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] + word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) + end end if not isFirstWord then From fe8d76a4bf6246a019749c28eb9b540f9abd6f24 Mon Sep 17 00:00:00 2001 From: eTzmNcbkrng Date: Fri, 4 Jun 2021 19:36:05 +1200 Subject: [PATCH 2/4] Remove trailing white space --- ElvUI/Modules/Chat/Chat.lua | 2 +- ElvUI/Modules/Misc/ChatBubbles.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ElvUI/Modules/Chat/Chat.lua b/ElvUI/Modules/Chat/Chat.lua index 37d86663e..e3bbc108d 100644 --- a/ElvUI/Modules/Chat/Chat.lua +++ b/ElvUI/Modules/Chat/Chat.lua @@ -1440,7 +1440,7 @@ function CH:CheckKeyword(message, author) local classMatch = CH.ClassNames[lowerCaseWord] local wordMatch = classMatch and lowerCaseWord - if string.len(lowerCaseWord) > 2 then + if string.len(lowerCaseWord) > 2 then if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) diff --git a/ElvUI/Modules/Misc/ChatBubbles.lua b/ElvUI/Modules/Misc/ChatBubbles.lua index 3465282d1..ecc3f46ee 100644 --- a/ElvUI/Modules/Misc/ChatBubbles.lua +++ b/ElvUI/Modules/Misc/ChatBubbles.lua @@ -50,7 +50,7 @@ function M:UpdateBubbleBorder() classMatch = CH.ClassNames[lowerCaseWord] wordMatch = classMatch and lowerCaseWord - if string.len(lowerCaseWord) > 2 then + if string.len(lowerCaseWord) > 2 then if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) From 466c15ff6628b87439cab5241100ab8c478d7fde Mon Sep 17 00:00:00 2001 From: eTzmNcbkrng Date: Fri, 2 Jul 2021 22:59:07 +1200 Subject: [PATCH 3/4] Make ClassColorNames' minimum length configurable --- ElvUI/Modules/Chat/Chat.lua | 8 +++----- ElvUI/Modules/Misc/ChatBubbles.lua | 8 +++----- ElvUI_OptionsUI/Chat.lua | 11 ++++++++++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ElvUI/Modules/Chat/Chat.lua b/ElvUI/Modules/Chat/Chat.lua index e3bbc108d..bd7dc3f75 100644 --- a/ElvUI/Modules/Chat/Chat.lua +++ b/ElvUI/Modules/Chat/Chat.lua @@ -1440,11 +1440,9 @@ function CH:CheckKeyword(message, author) local classMatch = CH.ClassNames[lowerCaseWord] local wordMatch = classMatch and lowerCaseWord - if string.len(lowerCaseWord) > 2 then - if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then - local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] - word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) - end + if wordMatch and (E.db.chat.classColorMentionLetterThreshold == nil or strlen(lowerCaseWord) > E.db.chat.classColorMentionLetterThreshold) and not E.global.chat.classColorMentionExcludedNames[wordMatch] then + local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] + word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) end end end diff --git a/ElvUI/Modules/Misc/ChatBubbles.lua b/ElvUI/Modules/Misc/ChatBubbles.lua index ecc3f46ee..9efeea63e 100644 --- a/ElvUI/Modules/Misc/ChatBubbles.lua +++ b/ElvUI/Modules/Misc/ChatBubbles.lua @@ -50,11 +50,9 @@ function M:UpdateBubbleBorder() classMatch = CH.ClassNames[lowerCaseWord] wordMatch = classMatch and lowerCaseWord - if string.len(lowerCaseWord) > 2 then - if wordMatch and not E.global.chat.classColorMentionExcludedNames[wordMatch] then - classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] - word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) - end + if wordMatch and (E.db.chat.classColorMentionLetterThreshold == nil or strlen(lowerCaseWord) > E.db.chat.classColorMentionLetterThreshold) and not E.global.chat.classColorMentionExcludedNames[wordMatch] then + local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] + word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) end if not isFirstWord then diff --git a/ElvUI_OptionsUI/Chat.lua b/ElvUI_OptionsUI/Chat.lua index 12d99203d..f547a72ca 100644 --- a/ElvUI_OptionsUI/Chat.lua +++ b/ElvUI_OptionsUI/Chat.lua @@ -534,8 +534,17 @@ E.Options.args.chat = { E.global.chat.classColorMentionExcludedNames[strlower(value)] = value end }, - classColorMentionExcludedNames = { + classColorMentionLetterThreshold = { order = 4, + type = "range", + name = L["Minimum name length"], + desc = L["Only class color names longer than this many letters."], + min = 0, max = 12, step = 1, + get = function(info) return E.db.chat.classColorMentionLetterThreshold end, + set = function(info, value) E.db.chat.classColorMentionLetterThreshold = value end, + }, + classColorMentionExcludedNames = { + order = 5, type = "multiselect", name = L["Excluded Names"], values = function() return E.global.chat.classColorMentionExcludedNames end, From 1c2ea5f5ebf3e21888cc702dab63a9617b6a5103 Mon Sep 17 00:00:00 2001 From: eTzmNcbkrng Date: Fri, 2 Jul 2021 23:03:29 +1200 Subject: [PATCH 4/4] Unecessarily localised variable --- ElvUI/Modules/Misc/ChatBubbles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ElvUI/Modules/Misc/ChatBubbles.lua b/ElvUI/Modules/Misc/ChatBubbles.lua index 9efeea63e..e517ce5a4 100644 --- a/ElvUI/Modules/Misc/ChatBubbles.lua +++ b/ElvUI/Modules/Misc/ChatBubbles.lua @@ -51,7 +51,7 @@ function M:UpdateBubbleBorder() wordMatch = classMatch and lowerCaseWord if wordMatch and (E.db.chat.classColorMentionLetterThreshold == nil or strlen(lowerCaseWord) > E.db.chat.classColorMentionLetterThreshold) and not E.global.chat.classColorMentionExcludedNames[wordMatch] then - local classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] + classColorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[classMatch] or RAID_CLASS_COLORS[classMatch] word = gsub(word, gsub(tempWord, "%-", "%%-"), format("\124cff%.2x%.2x%.2x%s\124r", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255, tempWord)) end