Skip to content

Commit

Permalink
Add Shaman class recoloring to Era
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Feb 8, 2024
1 parent 4012bb0 commit 63bb44f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 26 deletions.
9 changes: 8 additions & 1 deletion Config/OptionsTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 19 additions & 18 deletions Config/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)(),

Expand Down
17 changes: 11 additions & 6 deletions Init/InitAddon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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

Expand Down
6 changes: 5 additions & 1 deletion Operations/ModifyRequiredClasses.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 63bb44f

Please sign in to comment.