Skip to content

Commit

Permalink
Refactor debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Sep 30, 2024
1 parent ab5538a commit 4cf2cc7
Show file tree
Hide file tree
Showing 5 changed files with 284 additions and 132 deletions.
124 changes: 67 additions & 57 deletions Config/OptionsTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ end)
local function GetFormattedStatText(number, stat)
local StatInfo = Addon.statsInfo[stat]
local hidden = Addon:GetOption("hide", stat)
local text = StatInfo:GetDefaultForm(number)
local defaultForm = StatInfo:GetDefaultForm(number)
Addon:Assertf(defaultForm, "Failed GetDefaultForm with stat %s. number: %s", stat, tostring(number))
local text
if Addon:GetOption("allow", "reword") and Addon:GetOption("doReword", stat) then
text = StatInfo:ConvertToNormalForm(text)
text = strGsub(StatInfo:Reword(text, text), "%+(%-)", "%1")
local normalForm = StatInfo:ConvertToNormalForm(defaultForm)
Addon:Assertf(normalForm, "Failed ConvertToNormalForm with stat %s. defaultForm: %s", stat, defaultForm)
text = strGsub(StatInfo:Reword(normalForm, normalForm), "%+(%-)", "%1")
Addon:Assertf(text, "Failed Reword with stat %s. normalForm: %s", stat, normalForm)
else
text = defaultForm
end
local color = StatInfo.tooltipColor
if hidden then
Expand Down Expand Up @@ -2125,6 +2131,29 @@ end




-- ██████╗ ██████╗ ██████╗ ███████╗██╗██╗ ███████╗ ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
-- ██╔══██╗██╔══██╗██╔═══██╗██╔════╝██║██║ ██╔════╝ ██╔═══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝
-- ██████╔╝██████╔╝██║ ██║█████╗ ██║██║ █████╗ ██║ ██║██████╔╝ ██║ ██║██║ ██║██╔██╗ ██║███████╗
-- ██╔═══╝ ██╔══██╗██║ ██║██╔══╝ ██║██║ ██╔══╝ ██║ ██║██╔═══╝ ██║ ██║██║ ██║██║╚██╗██║╚════██║
-- ██║ ██║ ██║╚██████╔╝██║ ██║███████╗███████╗ ╚██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║███████║
-- ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝

local function MakeProfileOptions(opts, categoryName)
local self = Addon
local GUI = self.GUI

local profileOptions = self.AceDBOptions:GetOptionsTable(self:GetDB())
profileOptions.order = GUI:Order()
opts.args[categoryName] = profileOptions

return opts
end





-- ██████╗ ███████╗██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
-- ██╔══██╗██╔════╝██╔══██╗██║ ██║██╔════╝ ██╔═══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝
-- ██║ ██║█████╗ ██████╔╝██║ ██║██║ ███╗ ██║ ██║██████╔╝ ██║ ██║██║ ██║██╔██╗ ██║███████╗
Expand Down Expand Up @@ -2160,38 +2189,53 @@ local function MakeDebugOptions(opts, categoryName)
end
end

-- Debug View
-- Debug Output
do
local opts = GUI:CreateGroup(opts, GUI:Order(), "View")
local opts = GUI:CreateGroup(opts, GUI:Order(), "Output")

local disabled = not self:GetGlobalOption"debug"

do
local opts = GUI:CreateGroupBox(opts, "Suppress All")

GUI:CreateToggle(opts, {"debugView", "suppressAll"}, self.L["Hide"], nil, disabled).width = 2
GUI:CreateToggle(opts, {"debugOutput", "suppressAll"}, self.debugPrefix .. " " .. self.L["Hide messages like this one."], nil, disabled).width = 2
end

do
local opts = GUI:CreateGroupBox(opts, "Tooltips")
local opts = GUI:CreateGroupBox(opts, "Message Types")

local disabled = disabled or self:GetGlobalOption("debugView", "suppressAll")
local disabled = disabled or self:GetGlobalOption("debugOutput", "suppressAll")

for i, data in ipairs{
{"tooltipLineNumbers", "Tooltip Line Numbers"},
{"paddingConversionSuccesses", "Padding Conversion Successes"},
{"paddingConversionFailures", "Padding Conversion Failures"},
{"tooltipMethodHook", "Tooltip Method Hook"},
{"tooltipOnSetItemHook", "Tooltip tooltipOnSetItem Hook"},
{"tooltipHookFail", "Tooltip Hook Failure"},
{"tooltipHookMarked", "Tooltip Hook Marked"},
{"initialTooltipData", "Initial Tooltip Data"},
{"finalTooltipData", "Final Tooltip Data"},
{"constructorCreated", "Constructor Created"},
{"constructorCached", "Constructor Cached"},
{"constructorWiped", "Constructor Wiped"},
{"constructorValidationFail", "Constructor Validation Failure"},
{"constructorLineMove", "Constructor Moving Line"},
{"paddingDecisions", "Padding Decisions"},
{"optionSet", "Option Set"},
{"cvarSet", "CVar Set"},
{"InterfaceOptionsFrameFix", "Interface Options Patch"},
{"throttlingStarted", "Throttling Started"},
} do
if i ~= 1 then
GUI:CreateNewline(opts)
end
GUI:CreateToggle(opts, {"debugView", data[1]}, data[2], nil, disabled).width = 2
GUI:CreateToggle(opts, {"debugOutput", data[1]}, format("%d: %s", i, data[2]), nil, disabled).width = 2
end
end

do
local opts = GUI:CreateGroupBox(opts, "Scanner Tooltips")

local disabled = disabled or self:GetGlobalOption("debugOutput", "suppressAll")

for i, data in ipairs{
{"tooltip_GameTooltip", "GameTooltip"},
{"tooltip_ItemRefTooltip", "ItemRefTooltip"},
Expand All @@ -2201,58 +2245,43 @@ local function MakeDebugOptions(opts, categoryName)
if i ~= 1 then
GUI:CreateNewline(opts)
end
GUI:CreateToggle(opts, {"debugView", data[1]}, data[2]).width = 2
GUI:CreateToggle(opts, {"debugOutput", data[1]}, data[2], nil, disabled).width = 2
end
end
end

-- Debug Output
-- Debug View
do
local opts = GUI:CreateGroup(opts, GUI:Order(), "Output")
local opts = GUI:CreateGroup(opts, GUI:Order(), "View")

local disabled = not self:GetGlobalOption"debug"

do
local opts = GUI:CreateGroupBox(opts, "Suppress All")

GUI:CreateToggle(opts, {"debugOutput", "suppressAll"}, self.debugPrefix .. " " .. self.L["Hide messages like this one."], nil, disabled).width = 2
GUI:CreateToggle(opts, {"debugView", "suppressAll"}, self.L["Hide"], nil, disabled).width = 2
end

do
local opts = GUI:CreateGroupBox(opts, "Message Types")
local opts = GUI:CreateGroupBox(opts, "Tooltips")

local disabled = disabled or self:GetGlobalOption("debugOutput", "suppressAll")
local disabled = disabled or self:GetGlobalOption("debugView", "suppressAll")

for i, data in ipairs{
{"tooltipMethodHook", "Tooltip Method Hook"},
{"tooltipOnSetItemHook", "Tooltip tooltipOnSetItem Hook"},
{"tooltipHookFail", "Tooltip Hook Failure"},
{"tooltipHookMarked", "Tooltip Hook Marked"},
{"initialTooltipData", "Initial Tooltip Data"},
{"finalTooltipData", "Final Tooltip Data"},
{"constructorCreated", "Constructor Created"},
{"constructorCached", "Constructor Cached"},
{"constructorWiped", "Constructor Wiped"},
{"constructorValidationFail", "Constructor Validation Failure"},
{"constructorLineMove", "Constructor Moving Line"},
{"paddingDecisions", "Padding Decisions"},
{"optionSet", "Option Set"},
{"cvarSet", "CVar Set"},
{"InterfaceOptionsFrameFix", "Interface Options Patch"},
{"throttlingStarted", "Throttling Started"},
{"tooltipLineNumbers", "Tooltip Line Numbers"},
{"paddingConversionSuccesses", "Padding Conversion Successes"},
{"paddingConversionFailures", "Padding Conversion Failures"},
} do
if i ~= 1 then
GUI:CreateNewline(opts)
end
GUI:CreateToggle(opts, {"debugOutput", data[1]}, data[2], nil, disabled).width = 2
GUI:CreateToggle(opts, {"debugView", data[1]}, data[2], nil, disabled).width = 2
end
end

do
local opts = GUI:CreateGroupBox(opts, "Scanner Tooltips")

local disabled = disabled or self:GetGlobalOption("debugOutput", "suppressAll")

for i, data in ipairs{
{"tooltip_GameTooltip", "GameTooltip"},
{"tooltip_ItemRefTooltip", "ItemRefTooltip"},
Expand All @@ -2262,7 +2291,7 @@ local function MakeDebugOptions(opts, categoryName)
if i ~= 1 then
GUI:CreateNewline(opts)
end
GUI:CreateToggle(opts, {"debugOutput", data[1]}, data[2], nil, disabled).width = 2
GUI:CreateToggle(opts, {"debugView", data[1]}, data[2]).width = 2
end
end
end
Expand Down Expand Up @@ -2363,25 +2392,6 @@ local function MakeDebugOptions(opts, categoryName)
end


-- ██████╗ ██████╗ ██████╗ ███████╗██╗██╗ ███████╗ ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
-- ██╔══██╗██╔══██╗██╔═══██╗██╔════╝██║██║ ██╔════╝ ██╔═══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝
-- ██████╔╝██████╔╝██║ ██║█████╗ ██║██║ █████╗ ██║ ██║██████╔╝ ██║ ██║██║ ██║██╔██╗ ██║███████╗
-- ██╔═══╝ ██╔══██╗██║ ██║██╔══╝ ██║██║ ██╔══╝ ██║ ██║██╔═══╝ ██║ ██║██║ ██║██║╚██╗██║╚════██║
-- ██║ ██║ ██║╚██████╔╝██║ ██║███████╗███████╗ ╚██████╔╝██║ ██║ ██║╚██████╔╝██║ ╚████║███████║
-- ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝

local function MakeProfileOptions(opts, categoryName)
local self = Addon
local GUI = self.GUI

local profileOptions = self.AceDBOptions:GetOptionsTable(self:GetDB())
profileOptions.order = GUI:Order()
opts.args[categoryName] = profileOptions

return opts
end




-- █████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗ ██████╗ ██████╗ ████████╗██╗ ██████╗ ███╗ ██╗███████╗
Expand Down
Loading

0 comments on commit 4cf2cc7

Please sign in to comment.