From 63bb44f81bdbe192cac0039754b5dc66f001238d Mon Sep 17 00:00:00 2001 From: Anonomit Date: Wed, 7 Feb 2024 19:37:05 -0500 Subject: [PATCH] Add Shaman class recoloring to Era --- Config/OptionsTables.lua | 9 ++++++- Config/Settings.lua | 37 ++++++++++++++-------------- Init/InitAddon.lua | 17 ++++++++----- Operations/ModifyRequiredClasses.lua | 6 ++++- 4 files changed, 43 insertions(+), 26 deletions(-) diff --git a/Config/OptionsTables.lua b/Config/OptionsTables.lua index 1d8a518..a59e3e6 100644 --- a/Config/OptionsTables.lua +++ b/Config/OptionsTables.lua @@ -848,8 +848,15 @@ local function MakeExtraOptions(opts, categoryName) local opts = GUI:CreateGroupBox(opts, L["Recolor"]) local disabled = not self:GetOption("allow", "recolor") - GUI:CreateToggle(opts, {"doRecolor", stat}, self.L["Show Class Color"], nil, disabled).width = 1 + local option = GUI:CreateToggle(opts, {"doRecolor", stat}, self.L["Show Class Color"], nil, disabled) + option.width = self.isEra and 1.5 or 1 GUI:CreateReset(opts, {"doRecolor", stat}) + + if self.isEra then + local disabled = not self:GetOption("allow", "recolor") or not self:GetOption("doRecolor", stat) + GUI:CreateToggle(opts, {"doRecolor", "RequiredClasses_shaman"}, self:MakeColorCode("F58CBA", C_CreatureInfo.GetClassInfo(7).className) .. " -> " .. self:MakeColorCode("2459FF", C_CreatureInfo.GetClassInfo(7).className), nil, disabled).width = 1.5 + GUI:CreateReset(opts, {"doRecolor", "RequiredClasses_shaman"}) + end end do diff --git a/Config/Settings.lua b/Config/Settings.lua index 42b129e..775727d 100644 --- a/Config/Settings.lua +++ b/Config/Settings.lua @@ -65,24 +65,25 @@ function Addon:MakeDefaultOptions() Speed = 1, }, doRecolor = { - ["*"] = true, - Title = false, - Armor = false, - BonusArmor = false, - Block = false, - Enchant = false, - EnchantOnUse = false, -- no GUI option, should not be enabled. inherits from Use - Socket_red = false, - Socket_blue = false, - Socket_yellow = false, - Socket_purple = false, - Socket_green = false, - Socket_orange = false, - Socket_prismatic = false, - Socket_meta = false, - Equip = false, -- just to match Use - ChanceOnHit = false, -- just to match Use - Use = false, -- because of EnchantOnUse + ["*"] = true, + Title = false, + Armor = false, + BonusArmor = false, + Block = false, + Enchant = false, + EnchantOnUse = false, -- no GUI option, should not be enabled. inherits from Use + RequiredClasses_shaman = true, + Socket_red = false, + Socket_blue = false, + Socket_yellow = false, + Socket_purple = false, + Socket_green = false, + Socket_orange = false, + Socket_prismatic = false, + Socket_meta = false, + Equip = false, -- just to match Use + ChanceOnHit = false, -- just to match Use + Use = false, -- because of EnchantOnUse }, color = (function() local colors = {["*"] = "00ff00"} for stat, StatInfo in pairs(self.statsInfo) do colors[stat] = StatInfo.color end return colors end)(), diff --git a/Init/InitAddon.lua b/Init/InitAddon.lua index 4ad1691..eb41572 100644 --- a/Init/InitAddon.lua +++ b/Init/InitAddon.lua @@ -413,9 +413,10 @@ do Addon.sampleRequiredClassesString = format("%s" .. ITEM_CLASSES_ALLOWED, "", table.concat({C_CreatureInfo.GetClassInfo(5).className, C_CreatureInfo.GetClassInfo(9).className, C_CreatureInfo.GetClassInfo(2).className}, ", ")) - Addon.classNames = {} - Addon.classNamesColored = {} - Addon.classIconAtlases = {} + Addon.classNames = {} + Addon.classNamesColored = {} + Addon.classNamesColoredEra = {} + Addon.classIconAtlases = {} -- WARRIOR, PALADIN, HUNTER, ROGUE, PRIEST, DEATHKNIGHT, SHAMAN, MAGE, WARLOCK, MONK, DRUID, DEMONHUNTER local ID = {} @@ -424,10 +425,14 @@ do if classInfo then ID[classInfo.classFile] = classInfo.classID + local color = select(4, GetClassColor(classInfo.classFile)) + local colorEra = classInfo.classFile == "SHAMAN" and "2459FF" or color + local matcher = "%f[%w%s] " .. classInfo.className - Addon.classNames[matcher] = classInfo.className - Addon.classNamesColored[matcher] = Addon:MakeColorCode(Addon:TrimAlpha(select(4, GetClassColor(classInfo.classFile))), classInfo.className) - Addon.classIconAtlases[matcher] = "groupfinder-icon-class-" .. classInfo.classFile:lower() + Addon.classNames[matcher] = classInfo.className + Addon.classNamesColored[matcher] = Addon:MakeColorCode(Addon:TrimAlpha(color), classInfo.className) + Addon.classNamesColoredEra[matcher] = Addon:MakeColorCode(Addon:TrimAlpha(colorEra), classInfo.className) + Addon.classIconAtlases[matcher] = "groupfinder-icon-class-" .. classInfo.classFile:lower() end end diff --git a/Operations/ModifyRequiredClasses.lua b/Operations/ModifyRequiredClasses.lua index ac19c80..090494e 100644 --- a/Operations/ModifyRequiredClasses.lua +++ b/Operations/ModifyRequiredClasses.lua @@ -28,7 +28,11 @@ function Addon:ModifyRequiredClasses(text) if names then if recolor then - sub = Addon.classNamesColored[matcher] + if self.isEra and self:GetOption("doRecolor", "RequiredClasses_shaman") then + sub = Addon.classNamesColoredEra[matcher] + else + sub = Addon.classNamesColored[matcher] + end else sub = className end