Skip to content

Commit

Permalink
Added a panel for '/details debug' command
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jun 26, 2024
1 parent 591da92 commit ae2d6b8
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 20 deletions.
1 change: 1 addition & 0 deletions Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,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
Expand Down
1 change: 1 addition & 0 deletions Details_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,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
Expand Down
1 change: 1 addition & 0 deletions Details_Classic.toc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ frames\window_brokertexteditor.lua
frames\window_bookmark.lua
frames\window_classcolor.lua
frames\window_statistics.lua
frames\window_debug.lua

classes\class_error.lua
classes\class_spelltable.lua
Expand Down
1 change: 1 addition & 0 deletions Details_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ frames\window_brokertexteditor.lua
frames\window_bookmark.lua
frames\window_classcolor.lua
frames\window_statistics.lua
frames\window_debug.lua

classes\class_error.lua
classes\class_spelltable.lua
Expand Down
141 changes: 141 additions & 0 deletions frames/window_debug.lua
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions frames/window_mythicplus/window_end_of_run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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
Expand Down
5 changes: 5 additions & 0 deletions functions/profiles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,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_aug_predicted_spell_damage = false,
Expand Down
21 changes: 1 addition & 20 deletions functions/slash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -939,26 +939,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
Expand Down

0 comments on commit ae2d6b8

Please sign in to comment.