diff --git a/Details.toc b/Details.toc index 25c36645..8cbb06bd 100644 --- a/Details.toc +++ b/Details.toc @@ -124,6 +124,7 @@ frames\window_bookmark.lua frames\window_classcolor.lua frames\window_statistics.lua frames\window_aura_tracker.lua +frames\window_debug.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/frames/window_debug.lua b/frames/window_debug.lua new file mode 100644 index 00000000..b9466a69 --- /dev/null +++ b/frames/window_debug.lua @@ -0,0 +1,141 @@ + +local Details = Details +local addonName, Details222 = ... +---@type detailsframework +local detailsFramework = DetailsFramework +local _ + +--namespace +Details.AuraTracker = { + buff = {}, + debuff = {}, +} + +--frame options +local windowWidth = 800 +local windowHeight = 670 +local scrollWidth = 790 +local scrollHeightBuff = 400 +local scrollHeightDebuff = 200 +local scrollLineAmountBuff = 20 +local scrollLineAmountDebuff = 10 +local scrollLineHeight = 20 + +local createDebugOptionsFrame = function() + --create a panel + --parent, width, height, title, frameName, panelOptions + local debugOptionsPanel = DetailsFramework:CreateSimplePanel(UIParent, windowWidth, windowHeight, "Details! Debug Options", "DetailsDebugOptionsPanel", {}) + + detailsFramework:ApplyStandardBackdrop(debugOptionsPanel) + + --disable the buil-in mouse integration of the simple panel, doing this to use LibWindow-1.1 as the window management + debugOptionsPanel:SetScript("OnMouseDown", nil) + debugOptionsPanel:SetScript("OnMouseUp", nil) + + --need to create a window frame button that only accepts right clicks and when clicked it'll hide the panel + + --register in the libWindow + local LibWindow = LibStub("LibWindow-1.1") + LibWindow.RegisterConfig(debugOptionsPanel, Details.debug_options_panel.position) + LibWindow.MakeDraggable(debugOptionsPanel) + LibWindow.RestorePosition(debugOptionsPanel) + + --scale bar + local scaleBar = DetailsFramework:CreateScaleBar(debugOptionsPanel, Details.debug_options_panel.scaletable) + debugOptionsPanel:SetScale(Details.debug_options_panel.scaletable.scale) + + --status bar + local statusBar = DetailsFramework:CreateStatusBar(debugOptionsPanel) + statusBar.text = statusBar:CreateFontString(nil, "overlay", "GameFontNormal") + statusBar.text:SetPoint("left", statusBar, "left", 5, 0) + statusBar.text:SetText("By Terciob | Part of Details! Damage Meter") + DetailsFramework:SetFontSize(statusBar.text, 11) + DetailsFramework:SetFontColor(statusBar.text, "gray") + + local options = { + {--general debug + type = "toggle", + get = function() + return Details.debug + end, + set = function(self, fixedparam, value) + Details.debug = value + if (not value) then + Details:Msg("diagnostic mode has been turned off.") + else + Details:Msg("diagnostic mode has been turned on.") + end + end, + name = "General Details! Debug", + desc = "General Details! Debug", + }, + + {type = "blank"}, + + {--debug net + type = "toggle", + get = function() + return Details.debugnet + end, + set = function(self, fixedparam, value) + Details.debugnet = value + if (not value) then + Details:Msg("net diagnostic mode has been turned off.") + else + Details:Msg("net diagnostic mode has been turned on.") + end + end, + name = "Net Diagnostic Debug", + desc = "Net Diagnostic Debug", + }, + + {type = "blank"}, + + {--mythic+ debug + type = "toggle", + get = function() + local debugState = Details222.Debug.GetMythicPlusDebugState() + return debugState + end, + set = function(self, fixedparam, value) + Details222.Debug.SetMythicPlusDebugState() + end, + name = "End of Mythic+ Panel Debug", + desc = "Panel shown at the end of a Mythic+ dungeon", + }, + + {--mythic+ loot debug + type = "toggle", + get = function() + local _, lootDebugState = Details222.Debug.GetMythicPlusDebugState() + return lootDebugState + end, + set = function(self, fixedparam, value) + Details222.Debug.SetMythicPlusLootDebugState() + end, + name = "Loot Shown in the End of Mythic+ Panel Debug", + desc = "Loot shown in the Panel shown at the end of a Mythic+ dungeon", + }, + } + + options.always_boxfirst = true + options.align_as_pairs = true + options.align_as_pairs_string_space = 260 + + --templates + local options_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") + local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") + local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") + + detailsFramework:BuildMenu(debugOptionsPanel, options, 5, -40, 150, false, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template) +end + +function Details.ShowDebugOptionsPanel() + if (DetailsDebugOptionsPanel) then + DetailsDebugOptionsPanel:Show() + else + createDebugOptionsFrame() + end +end \ No newline at end of file diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index 10a6d92f..f5474c55 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -37,6 +37,11 @@ function Details222.Debug.SetMythicPlusDebugState(bState) Details:Msg("mythic+ debug mode:", tostring(CONST_DEBUG_MODE)) end +---@return boolean CONST_DEBUG_MODE, boolean LOOT_DEBUG_MODE +function Details222.Debug.GetMythicPlusDebugState() + return CONST_DEBUG_MODE, LOOT_DEBUG_MODE +end + function Details222.Debug.SetMythicPlusLootDebugState(bState) if (bState == nil) then bState = not LOOT_DEBUG_MODE diff --git a/functions/profiles.lua b/functions/profiles.lua index ba6f4cbf..b656c13d 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1197,6 +1197,11 @@ local default_global_data = { encounter_journal_cache = {}, --store a dump of the encounter journal installed_skins_cache = {}, + debug_options_panel = { + scaletable = {scale = 1}, + position = {}, + }, + user_is_patreon_supporter = false, show_warning_id1 = true, diff --git a/functions/slash.lua b/functions/slash.lua index 7be1f198..a7a1ed5d 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -942,26 +942,7 @@ function SlashCmdList.DETAILS (msg, editbox) Details222.Debug.SetMythicPlusLootDebugState() --passing nothing will toggle the debug state elseif (command == "debug") then - if (Details.debug) then - Details.debug = false - print(Loc ["STRING_DETAILS1"] .. "diagnostic mode has been turned off.") - return - else - Details.debug = true - print(Loc ["STRING_DETAILS1"] .. "diagnostic mode has been turned on.") - - if (rest and rest ~= "") then - if (rest == "-clear") then - _detalhes_global.debug_chr_log = "" - print(Loc ["STRING_DETAILS1"] .. "log for characters has been wiped.") - return - end - Details.debug_chr = rest - _detalhes_global.debug_chr_log = _detalhes_global.debug_chr_log or "" - print(Loc ["STRING_DETAILS1"] .. "diagnostic for character " .. rest .. " turned on.") - return - end - end + Details.ShowDebugOptionsPanel() --debug combat log elseif (msg == "combatlog") then