Skip to content

Commit

Permalink
Add gem color customization
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Mar 31, 2023
1 parent 39f2c16 commit 7c1e92d
Show file tree
Hide file tree
Showing 10 changed files with 845 additions and 35 deletions.
43 changes: 41 additions & 2 deletions Config/OptionsTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,45 @@ function Addon:MakeExtraOptions(categoryName, chatCmd, arg1, ...)
end
GUI:CreateGroup(opts, GUI:Order(), " ", nil, nil, true)

-- Socket
do
local stat = "Socket"

local sockets = {
{"Socket_red", GEM_TEXT_RED},
{"Socket_blue", GEM_TEXT_BLUE},
{"Socket_yellow", GEM_TEXT_YELLOW},
{"Socket_purple", GEM_TEXT_PURPLE},
{"Socket_green", GEM_TEXT_GREEN},
{"Socket_orange", GEM_TEXT_ORANGE},
{"Socket_prismatic", GEM_TEXT_PRISMATIC},
{"Socket_meta", GEM_TEXT_META},
}

local samples = {}
for _, socket in ipairs(sockets) do
local socketType, defaultText = unpack(socket, 1, 2)
local defaultText, formattedText = GetFormattedText(socketType, self.COLORS.WHITE, defaultText, defaultText)
tinsert(samples, {defaultText, formattedText})
end


local opts = GUI:CreateGroup(opts, stat, samples[1][2])

-- CreateTitle(opts, defaultText, formattedText, changed)
CreateSamples(opts, samples)

for _, socket in ipairs(sockets) do
local stat = socket[1]
local opts = GUI:CreateGroupBox(opts, socket[2])

local disabled = disabled or not Addon:GetOption("allow", "recolor")
GUI:CreateToggle(opts, {"doRecolor", stat}, L["Recolor"], nil, disabled).width = 0.5
GUI:CreateColor(opts, {"color", stat}, self.L["Color"], nil, disabled or not Addon:GetOption("doRecolor", stat)).width = 0.5
CreateReset(opts, {"color", stat})
end
end

-- Socket Hint
local function MakeSocketHintOptions()
do
Expand All @@ -1400,9 +1439,9 @@ function Addon:MakeExtraOptions(categoryName, chatCmd, arg1, ...)

CreateHide(opts, stat)
end
GUI:CreateGroup(opts, GUI:Order(), " ", nil, nil, true)
end
if self:GetOption("doReorder", "SocketHint") then MakeSocketHintOptions() end
GUI:CreateGroup(opts, GUI:Order(), " ", nil, nil, true)

-- Durability
do
Expand Down Expand Up @@ -1609,7 +1648,7 @@ function Addon:MakeExtraOptions(categoryName, chatCmd, arg1, ...)
end
GUI:CreateGroup(opts, GUI:Order(), " ", nil, nil, true)

if not self:GetOption("doReorder", "SocketHint") then MakeSocketHintOptions() end
if not self:GetOption("doReorder", "SocketHint") then MakeSocketHintOptions() GUI:CreateGroup(opts, GUI:Order(), " ", nil, nil, true) end

if not self:GetOption("doReorder", "Refundable") then MakeRefundableOption() end
if not self:GetOption("doReorder", "SoulboundTradeable") then MakeTradeableOption() end
Expand Down
28 changes: 18 additions & 10 deletions Config/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,24 @@ 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
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
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
Loading

0 comments on commit 7c1e92d

Please sign in to comment.