diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index 802b64b2..e640fb42 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -471,6 +471,7 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) end ---@param self df_button + ---@param filterMode texturefilter function ButtonMetaFunctions:SetIconFilterMode(filterMode) if (self.icon) then self.icon:SetTexture(self.icon:GetTexture(), nil, nil, filterMode) diff --git a/Libs/DF/editor.lua b/Libs/DF/editor.lua index 0f253d27..731c3d09 100644 --- a/Libs/DF/editor.lua +++ b/Libs/DF/editor.lua @@ -21,6 +21,9 @@ local _ --the editor doesn't know which key in the profileTable holds the current value for an attribute, so it uses a map table to find it. --the mapTable is a table with the attribute name as a key, and the value is the profile key. For example, {["size"] = "text_size"} means profileTable["text_size"] = 10. + + + ---@class df_editor : frame, df_optionsmixin, df_editormixin ---@field options table ---@field registeredObjects df_editor_objectinfo[] @@ -39,6 +42,7 @@ local _ ---@field objectSelector df_scrollbox ---@field moverFrames df_editor_mover[] ---@field canvasScrollBox df_canvasscrollbox +---@field AnchorFrames df_editor_anchorframes ---@class df_editor_attribute ---@field key string? @@ -62,7 +66,7 @@ local _ ---@field callback function? ---@field options df_editobjectoptions ---@field selectButton button ----@field refFrame frame +---@field refFrame frame usually the parent of the object registered ---@class df_editor_mover_movinginfo : table ---@field startX number @@ -415,6 +419,17 @@ detailsFramework.EditorMixin = { end end, +---@class df_editor_anchorframes : table +---@field anchorFrames table +---@field DisableAllAnchors fun(self:df_editor_anchorframes) +---@field SetupAnchorsForObject fun(self:df_editor_anchorframes, anchorTable:table) +---@field SelectAnchorPoint fun(self:df_editor_anchorframes) +---@field GetAnchorFrame fun(self:df_editor_anchorframes, index:number):frame +---@field SetNotInUseForAllAnchors fun(self:df_editor_anchorframes) +---@field SetNotInUse fun(self:df_editor_anchorframes, anchorFrame:frame) +---@field SetInUse fun(self:df_editor_anchorframes, anchorFrame:frame) +---@field CreateNineAnchors fun(self:df_editor_anchorframes) + --screen position offset is the XY screen position offset from the bottom left of the screen, they are always positive, they go from 0 to screen width or height CreateAnchorFrames = function(editorFrame) --table containing 9 buttons, each one in a different position of the object, indexes one to nine in this order: topleft, left, bottomleft, bottom, bottomright, right, topright, top, center @@ -429,7 +444,7 @@ detailsFramework.EditorMixin = { end end, - SetupAnchorsForObject = function(self, object, anchorTable) + SetupAnchorsForObject = function(self, anchorTable) editorFrame.AnchorFrames:DisableAllAnchors() local registeredObject = editorFrame:GetEditingRegisteredObject() @@ -892,7 +907,7 @@ detailsFramework.EditorMixin = { end if (anchorSettings) then - self.AnchorFrames:SetupAnchorsForObject(object, anchorSettings) + self.AnchorFrames:SetupAnchorsForObject(anchorSettings) end --at this point, the optionsTable is ready to be used on DF:BuildMenuVolatile() @@ -1246,6 +1261,7 @@ detailsFramework.EditorMixin = { self:StopObjectMovement() local moverFrames = self:GetMoverFrames() moverFrames:Hide() + self.AnchorFrames:DisableAllAnchors() end, ---@param self df_editor diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 134f186e..19fd337a 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 542 +local dversion = 544 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/boot.lua b/boot.lua index 20d7e345..01c465fd 100644 --- a/boot.lua +++ b/boot.lua @@ -103,6 +103,8 @@ --namespace for texture Details222.Textures = {} + Details222.Debug = {} + --namespace for pet Details222.Pets = {} Details222.PetContainer = { diff --git a/frames/window_mythicplus/window_chart.lua b/frames/window_mythicplus/window_chart.lua index 89240037..4178e939 100644 --- a/frames/window_mythicplus/window_chart.lua +++ b/frames/window_mythicplus/window_chart.lua @@ -1,6 +1,5 @@ local Details = _G.Details -local DF = _G.DetailsFramework local addonName, Details222 = ... local _ @@ -10,8 +9,13 @@ local verbosemode = false local CreateFrame = CreateFrame local UIParent = UIParent +---@type detailsframework +local detailsFramework = DetailsFramework + local mythicDungeonCharts = Details222.MythicPlus.Charts.Listener +local UISpecialFrames = UISpecialFrames + -- /run _G.DetailsMythicDungeonChartHandler.ShowEndOfMythicPlusPanel() -- /run _G.DetailsMythicDungeonChartHandler.ShowChart() @@ -25,7 +29,7 @@ function mythicDungeonCharts.ShowChart() dungeonChartFrame:SetFrameStrata("DIALOG") dungeonChartFrame:EnableMouse(true) dungeonChartFrame:SetMovable(true) - DetailsFramework:ApplyStandardBackdrop(dungeonChartFrame) + detailsFramework:ApplyStandardBackdrop(dungeonChartFrame) --minimized frame mythicDungeonCharts.FrameMinimized = CreateFrame("frame", "DetailsMythicDungeonChartFrameminimized", UIParent, "BackdropTemplate") @@ -37,7 +41,7 @@ function mythicDungeonCharts.ShowChart() fMinimized:EnableMouse(true) fMinimized:SetMovable(true) fMinimized:Hide() - DetailsFramework:ApplyStandardBackdrop(fMinimized) + detailsFramework:ApplyStandardBackdrop(fMinimized) dungeonChartFrame.IsMinimized = false @@ -51,7 +55,7 @@ function mythicDungeonCharts.ShowChart() titlebar:SetBackdropBorderColor(0, 0, 0, 1) --title - local titleLabel = Details.gump:NewLabel(titlebar, titlebar, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) + local titleLabel = detailsFramework:NewLabel(titlebar, titlebar, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) titleLabel:SetPoint("center", titlebar , "center") titleLabel:SetPoint("top", titlebar , "top", 0, -5) dungeonChartFrame.TitleText = titleLabel @@ -66,7 +70,7 @@ function mythicDungeonCharts.ShowChart() titlebarMinimized:SetBackdropBorderColor(0, 0, 0, 1) --title - local titleLabelMinimized = Details.gump:NewLabel(titlebarMinimized, titlebarMinimized, nil, "titulo", "Dungeon Run Chart", "GameFontHighlightLeft", 10, {227/255, 186/255, 4/255}) + local titleLabelMinimized = detailsFramework:NewLabel(titlebarMinimized, titlebarMinimized, nil, "titulo", "Dungeon Run Chart", "GameFontHighlightLeft", 10, {227/255, 186/255, 4/255}) titleLabelMinimized:SetPoint("left", titlebarMinimized , "left", 4, 0) --titleLabelMinimized:SetPoint("top", titlebarMinimized , "top", 0, -5) dungeonChartFrame.TitleTextMinimized = titleLabelMinimized @@ -85,7 +89,7 @@ function mythicDungeonCharts.ShowChart() LibWindow.MakeDraggable(fMinimized) LibWindow.SavePosition(fMinimized) - dungeonChartFrame.ChartFrame = Details:GetFramework():CreateChartPanel(dungeonChartFrame, 1200, 600, "DetailsMythicDungeonChartGraphicFrame") + dungeonChartFrame.ChartFrame = detailsFramework:CreateChartPanel(dungeonChartFrame, 1200, 600, "DetailsMythicDungeonChartGraphicFrame") dungeonChartFrame.ChartFrame:SetPoint("topleft", dungeonChartFrame, "topleft", 5, -20) dungeonChartFrame.ChartFrame.FrameInUse = {} @@ -200,12 +204,16 @@ function mythicDungeonCharts.ShowChart() local on_switch_enable = function(_, _, state) Details.mythic_plus.show_damage_graphic = state end - local enabledSwitch, enabledLabel = Details.gump:CreateSwitch(dungeonChartFrame, on_switch_enable, Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, "Enabled", Details.gump:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft") + local enabledSwitch, enabledLabel = detailsFramework:CreateSwitch(dungeonChartFrame, on_switch_enable, Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, "Enabled", detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft") enabledSwitch:SetAsCheckBox() enabledSwitch.tooltip = "Show this chart at the end of a mythic dungeon run.\n\nIf disabled, you can reactivate it again at the options panel > streamer settings." - enabledLabel:SetPoint("right", minimizeButton, "left", -22, 0) - enabledSwitch:SetSize(16, 16) - Details.gump:SetFontColor(enabledLabel, "gray") + + if (enabledLabel) then + enabledLabel:SetPoint("right", minimizeButton, "left", -22, 0) + enabledSwitch:SetSize(16, 16) + detailsFramework:SetFontColor(enabledLabel, "gray") + end + enabledSwitch.checked_texture:SetVertexColor(.75, .75, .75) local leftDivisorLine = dungeonChartFrame.BossWidgetsFrame:CreateTexture(nil, "overlay") @@ -233,7 +241,7 @@ function mythicDungeonCharts.ShowChart() newBossWidget:SetBackdropColor(0, 0, 0, 0.1) newBossWidget:SetBackdropBorderColor(0, 0, 0, 0) - local bossAvatar = Details:GetFramework():CreateImage(newBossWidget, "", 64, 32, "border") + local bossAvatar = detailsFramework:CreateImage(newBossWidget, "", 64, 32, "border") bossAvatar:SetPoint("bottomleft", newBossWidget, "bottomleft", 0, 0) newBossWidget.AvatarTexture = bossAvatar @@ -241,7 +249,7 @@ function mythicDungeonCharts.ShowChart() verticalLine:SetTexture(1, 1, 1, 0.3) verticalLine:SetPoint("bottomleft", newBossWidget, "bottomright", 0, 0) - local timeText = Details:GetFramework():CreateLabel(newBossWidget) + local timeText = detailsFramework:CreateLabel(newBossWidget) timeText:SetPoint("bottomright", newBossWidget, "bottomright", 0, 0) newBossWidget.TimeText = timeText @@ -260,7 +268,7 @@ function mythicDungeonCharts.ShowChart() bossWidget:SetPoint("bottomright", dungeonChartFrame.ChartFrame.Graphic, "bottomleft", xPosition, 0) - bossWidget.TimeText:SetText(Details:GetFramework():IntegerToTimer(bossTable[1])) + bossWidget.TimeText:SetText(detailsFramework:IntegerToTimer(bossTable[1])) if (bossTable[2].bossimage) then bossWidget.AvatarTexture:SetTexture(bossTable[2].bossimage) @@ -280,7 +288,7 @@ function mythicDungeonCharts.ShowChart() if (Details.mythic_plus.last_mythicrun_chart) then --load the last mythic dungeon run chart local t = {} - Details:GetFramework().table.copy(t, Details.mythic_plus.last_mythicrun_chart) + detailsFramework.table.copy(t, Details.mythic_plus.last_mythicrun_chart) mythicDungeonCharts.ChartTable = t mythicDungeonCharts:Debug("no valid data, saved data loaded") @@ -360,7 +368,7 @@ function mythicDungeonCharts.ShowChart() local phrase = "Details!: Average Dps for " mythicDungeonCharts.Frame.ChartFrame:SetTitle("") - Details:GetFramework():SetFontSize(mythicDungeonCharts.Frame.ChartFrame.chart_title, 14) + detailsFramework:SetFontSize(mythicDungeonCharts.Frame.ChartFrame.chart_title, 14) mythicDungeonCharts.Frame.TitleText:SetText(mythicDungeonCharts.ChartTable.DungeonName and phrase .. mythicDungeonCharts.ChartTable.DungeonName or phrase) diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index b81b09db..10a6d92f 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -27,7 +27,23 @@ local mythicDungeonCharts = Details222.MythicPlus.Charts.Listener local mythicDungeonFrames = Details222.MythicPlus.Frames local CONST_DEBUG_MODE = false -local SOFT_DEBUG_MODE = true +local LOOT_DEBUG_MODE = false + +function Details222.Debug.SetMythicPlusDebugState(bState) + if (bState == nil) then + bState = not CONST_DEBUG_MODE + end + CONST_DEBUG_MODE = bState + Details:Msg("mythic+ debug mode:", tostring(CONST_DEBUG_MODE)) +end + +function Details222.Debug.SetMythicPlusLootDebugState(bState) + if (bState == nil) then + bState = not LOOT_DEBUG_MODE + end + LOOT_DEBUG_MODE = bState + Details:Msg("mythic+ loot debug mode:", tostring(LOOT_DEBUG_MODE)) +end --debug _G.MythicDungeonFrames = mythicDungeonFrames @@ -104,7 +120,7 @@ function lootFrame.UpdateUnitLoot(unitBanner) ---@type details_loot_cache[] local lootCandidates = {} - if (SOFT_DEBUG_MODE) then + if (LOOT_DEBUG_MODE) then if (UnitIsUnit("player", unitId)) then Details:Msg("Loot UpdateUnitLoot:", unitName, GetTime()) end @@ -121,6 +137,7 @@ function lootFrame.UpdateUnitLoot(unitBanner) lootCandidates[lootIndex] = lootInfo lootIndex = lootIndex + 1 end + table.remove(lootCache, i) end end end @@ -145,7 +162,7 @@ function lootFrame.UpdateUnitLoot(unitBanner) lootSquare:Show() - if (SOFT_DEBUG_MODE) then + if (LOOT_DEBUG_MODE) then if (UnitIsUnit("player", unitId)) then Details:Msg("Loot DISPLAYED:", unitName, GetTime()) end @@ -190,7 +207,7 @@ lootFrame:SetScript("OnEvent", function(self, event, ...) } table.insert(lootFrame.LootCache[unitName], lootCacheTable) - if (SOFT_DEBUG_MODE) then + if (LOOT_DEBUG_MODE) then Details:Msg("Loot ADDED:", unitName, itemLink, effectiveILvl, itemQuality, baseItemLevel) end @@ -204,7 +221,7 @@ lootFrame:SetScript("OnEvent", function(self, event, ...) end) end else - if (SOFT_DEBUG_MODE) then + if (LOOT_DEBUG_MODE) then Details:Msg("Loot SKIPPED:", unitName, itemLink, effectiveILvl, itemQuality, baseItemLevel) end end diff --git a/functions/mythicdungeon/data_capture.lua b/functions/mythicdungeon/data_capture.lua index e63395dd..46f26f2a 100644 --- a/functions/mythicdungeon/data_capture.lua +++ b/functions/mythicdungeon/data_capture.lua @@ -32,7 +32,6 @@ local mythicDungeonCharts = Details222.MythicPlus.Charts.Listener --debug _G.DetailsMythicDungeonChartHandler = mythicDungeonCharts ---DetailsMythicDungeonChartHandler.ChartTable.Players["playername"].ChartData = {max_value = 0} function mythicDungeonCharts:Debug(...) if (debugmode or verbosemode) then diff --git a/functions/slash.lua b/functions/slash.lua index 61d9b7c5..7be1f198 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -935,6 +935,12 @@ function SlashCmdList.DETAILS (msg, editbox) print(Loc["STRING_DETAILS1"] .. "net diagnostic mode has been turned on.") end + elseif (command == "m+debug") then + Details222.Debug.SetMythicPlusDebugState() --passing nothing will toggle the debug state + + elseif (command == "m+debugloot") then + Details222.Debug.SetMythicPlusLootDebugState() --passing nothing will toggle the debug state + elseif (command == "debug") then if (Details.debug) then Details.debug = false