From 21da70e1587fc9b5f7a8c50ecea1a4675f63279e Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Fri, 12 May 2023 17:52:17 -0300 Subject: [PATCH] Fixed small bugs --- Definitions.lua | 1 + Libs/DF/fw.lua | 2 +- Libs/DF/header.lua | 21 +++++-- boot.lua | 4 +- classes/class_heal.lua | 72 ++++++++++++++++++++++-- frames/window_playerbreakdown_spells.lua | 24 ++++++-- startup.lua | 19 +++++++ 7 files changed, 126 insertions(+), 17 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 9eb638fde..103a52eb5 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -160,6 +160,7 @@ ---@field SetResizeBounds fun(self: frame, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number) ---@class button : frame +---@field Click fun(self: button) ---@field SetNormalTexture fun(self: button, texture: texture) ---@field SetPushedTexture fun(self: button, texture: texture) ---@field SetHighlightTexture fun(self: button, texture: texture) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index a4f01bec1..a99bd7e2a 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 428 +local dversion = 429 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/header.lua b/Libs/DF/header.lua index 5ccf1cb89..65c6061b0 100644 --- a/Libs/DF/header.lua +++ b/Libs/DF/header.lua @@ -27,7 +27,7 @@ local wipe = wipe ---@field OnColumnSettingChangeCallback function ---@field GetColumnWidth fun(self: df_headerframe, columnId: number) ---@field SetHeaderTable fun(self: df_headerframe, newTable) ----@field GetSelectedColumn fun(self: df_headerframe) : number, string, string +---@field GetSelectedColumn fun(self: df_headerframe) : number, string, string, string ---@field Refresh fun(self: df_headerframe) ---@field UpdateSortArrow fun(self: df_headerframe, columnHeader: df_headercolumnframe, defaultShown: boolean|nil, defaultOrder: string|nil) ---@field UpdateColumnHeader fun(self: df_headerframe, columnHeader: df_headercolumnframe, headerIndex) @@ -37,7 +37,7 @@ local wipe = wipe ---@field GetNextHeader fun(self: df_headerframe) : df_headercolumnframe ---@field SetColumnSettingChangedCallback fun(self: df_headerframe, func: function) : boolean ----@class df_headercolumnframe : frame +---@class df_headercolumnframe : button ---@field Icon texture ---@field Text fontstring ---@field Arrow texture @@ -219,14 +219,13 @@ detailsFramework.HeaderMixin = { --return which header is current selected and the the order ASC DESC ---@param self df_headerframe - ---@return number, string + ---@return number, string, string, string GetSelectedColumn = function(self) ---@type number local columnSelected = self.columnSelected ---@type df_headercolumnframe local columnHeader = self.columnHeadersCreated[columnSelected or 1] - - return columnSelected, columnHeader.order, columnHeader.key + return columnSelected, columnHeader.order, columnHeader.key, columnHeader.columnData.name end, --clean up and rebuild the header following the header options @@ -573,6 +572,18 @@ detailsFramework.HeaderMixin = { return columnHeader end, + ---return a header button by passing its name (.name on the column table) + ---@param self df_headerframe + ---@param columnName string + ---@return df_headercolumnframe|nil + GetHeaderColumnByName = function(self, columnName) + for _, headerColumnFrame in ipairs(self.columnHeadersCreated) do + if (headerColumnFrame.columnData.name == columnName) then + return headerColumnFrame + end + end + end, + NextHeader = 1, HeaderWidth = 0, HeaderHeight = 0, diff --git a/boot.lua b/boot.lua index a8932a25a..2cc95412b 100644 --- a/boot.lua +++ b/boot.lua @@ -15,8 +15,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 11004 - Details.alpha_build_counter = 11004 --if this is higher than the regular counter, use it instead + Details.build_counter = 11010 + Details.alpha_build_counter = 11010 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter diff --git a/classes/class_heal.lua b/classes/class_heal.lua index b3e8a12fc..5bb64496a 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -1658,11 +1658,75 @@ end ---------- bifurca��o function atributo_heal:MontaInfo() if (info.sub_atributo == 1 or info.sub_atributo == 2) then - return self:MontaInfoHealingDone() + self:MontaInfoHealingDone() + + --[=[ + local bNeedUpdateAgain = false + + --sort by healing done + ---@type df_headerframe + local spellsHeader = DetailsSpellBreakdownTab.GetSpellScrollFrame().Header + local totalHeader = spellsHeader:GetHeaderColumnByName("amount") + if (totalHeader and totalHeader:IsShown()) then + local columnSelected, order, key, name = spellsHeader:GetSelectedColumn() + if (name == "overheal") then + totalHeader:Click() + bNeedUpdateAgain = true + end + end + + ---@type df_headerframe + local targetsHeader = DetailsSpellBreakdownTab.GetTargetScrollFrame().Header + local totalHeader = targetsHeader:GetHeaderColumnByName("amount") + if (totalHeader and totalHeader:IsShown()) then + local columnSelected, order, key, name = targetsHeader:GetSelectedColumn() + if (name == "overheal") then + totalHeader:Click() + bNeedUpdateAgain = true + end + end + + if (bNeedUpdateAgain) then + self:MontaInfoHealingDone() + end + --]=] + elseif (info.sub_atributo == 3) then - return self:MontaInfoOverHealing() + self:MontaInfoHealingDone() + + --[=[ + local bNeedUpdateAgain = false + + --sort by overhealing + ---@type df_headerframe + local spellsHeader = DetailsSpellBreakdownTab.GetSpellScrollFrame().Header + local overhealHeader = spellsHeader:GetHeaderColumnByName("overheal") + if (overhealHeader and overhealHeader:IsShown()) then + local columnSelected, order, key, name = spellsHeader:GetSelectedColumn() + if (name ~= "overheal") then + overhealHeader:Click() + bNeedUpdateAgain = true + end + end + + ---@type df_headerframe + local targetsHeader = DetailsSpellBreakdownTab.GetTargetScrollFrame().Header + local overhealHeader = targetsHeader:GetHeaderColumnByName("overheal") + if (overhealHeader and overhealHeader:IsShown()) then + local columnSelected, order, key, name = targetsHeader:GetSelectedColumn() + if (name ~= "overheal") then + overhealHeader:Click() + bNeedUpdateAgain = true + end + end + + if (bNeedUpdateAgain) then + self:MontaInfoHealingDone() + end + --]=] + elseif (info.sub_atributo == 4) then - return self:MontaInfoHealTaken() + self:MontaInfoHealTaken() end end @@ -1768,7 +1832,7 @@ function atributo_heal:MontaInfoHealTaken() end -function atributo_heal:MontaInfoOverHealing() +function atributo_heal:MontaInfoOverHealing() --this should be deprecated now --pegar as habilidade de dar sort no heal local instancia = info.instancia diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index 267d1a884..6bc930bad 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -190,7 +190,7 @@ local spellContainerColumnData = { {name = "target", width = 22, label = "", align = "left", enabled = true, offset = columnOffset}, {name = "rank", label = "#", width = 16, align = "center", enabled = true, offset = 6, dataType = "number"}, {name = "expand", label = "^", width = 16, align = "left", enabled = true, offset = -4}, --maybe -3 - {name = "name", label = "spell name", width = 246, align = "left", enabled = true, offset = columnOffset}, + {name = "name", label = "spell name", width = 231, align = "left", enabled = true, offset = columnOffset}, {name = "amount", label = "total", key = "total", selected = true, width = 50, align = "left", enabled = true, canSort = true, sortKey = "total", dataType = "number", order = "DESC", offset = columnOffset}, {name = "persecond", label = "ps", key = "total", width = 50, align = "left", enabled = false, canSort = true, sortKey = "ps", offset = columnOffset, order = "DESC", dataType = "number"}, {name = "percent", label = "%", key = "total", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, @@ -199,16 +199,16 @@ local spellContainerColumnData = { {name = "hits", label = "hits", key = "counter", width = 40, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, {name = "castavg", label = "cast avg", key = "castavg", width = 50, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, {name = "uptime", label = "uptime", key = "uptime", width = 45, align = "left", enabled = false, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, - {name = "overheal", label = "overheal", key = "overheal", width = 65, align = "left", enabled = true, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, + {name = "overheal", label = "overheal", key = "overheal", width = 70, align = "left", enabled = true, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, {name = "absorbed", label = "absorbed", key = "healabsorbed", width = 55, align = "left", enabled = false, canSort = true, order = "DESC", dataType = "number", attribute = DETAILS_ATTRIBUTE_HEAL, offset = columnOffset}, } local targetContainerColumnData = { {name = "icon", width = 22, label = "", align = "left", enabled = true, offset = columnOffset}, {name = "rank", label = "#", width = 20, align = "left", enabled = true, offset = columnOffset}, - {name = "name", label = "name", width = 200, align = "left", enabled = true, offset = columnOffset}, + {name = "name", label = "name", width = 185, align = "left", enabled = true, offset = columnOffset}, {name = "amount", label = "total", key = "total", selected = true, width = 50, align = "left", enabled = true, canSort = true, sortKey = "total", dataType = "number", order = "DESC", offset = columnOffset}, - {name = "overheal", label = "overheal", key = "overheal", width = 50, align = "left", enabled = true, canSort = true, sortKey = "total", dataType = "number", order = "DESC", offset = columnOffset, attribute = DETAILS_ATTRIBUTE_HEAL}, + {name = "overheal", label = "overheal", key = "overheal", width = 70, align = "left", enabled = true, canSort = true, sortKey = "total", dataType = "number", order = "DESC", offset = columnOffset, attribute = DETAILS_ATTRIBUTE_HEAL}, {name = "percent", label = "%", key = "total", width = 50, align = "left", enabled = true, canSort = true, offset = columnOffset, order = "DESC", dataType = "number"}, } @@ -297,6 +297,14 @@ local onColumnHeaderClickCallback = function(headerFrame, columnHeader) local scrollFrame = spellsTab.GetScrollFrameByContainerType(containerType) scrollFrame:Refresh() + + local instance = spellsTab.GetInstance() + instance:RefreshWindow(true) +end + +local onAnyColumnHeaderClickCallback = function() + local instance = spellsTab.GetInstance() + instance:RefreshWindow(true) end ---copy settings from the ColumnInfo table which doesn't exists in the details profile @@ -1825,6 +1833,8 @@ function spellsTab.CreatePhasesContainer(tabFrame) --~phase ~createphasecontaine reziser_color = {.5, .5, .5, 0.7}, reziser_max_width = 246, + header_click_callback = onAnyColumnHeaderClickCallback, + header_backdrop_color = {0.1, 0.1, 0.1, 0.4}, text_color = {1, 1, 1, 0.823}, } @@ -2034,6 +2044,8 @@ function spellsTab.CreateGenericContainer(tabFrame) --~create ~generic ~createge reziser_color = {.5, .5, .5, 0.7}, reziser_max_width = 246, + header_click_callback = onAnyColumnHeaderClickCallback, + header_backdrop_color = {0.1, 0.1, 0.1, 0.4}, text_color = {1, 1, 1, 0.823}, } @@ -2165,6 +2177,8 @@ function spellsTab.CreateTargetContainer(tabFrame) --~create ~target ~createtarg reziser_color = {.5, .5, .5, 0.7}, reziser_max_width = 246, + header_click_callback = onAnyColumnHeaderClickCallback, + header_backdrop_color = {0.1, 0.1, 0.1, 0.4}, text_color = {1, 1, 1, 0.823}, } @@ -2458,7 +2472,7 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll elseif (header.name == "overheal" and spellTable.overheal) then if (spellTable.overheal > 0) then local totalHeal = spellTable.overheal + value - text:SetText(string.format("%.1f", spellTable.overheal / totalHeal * 100) .. "%") + text:SetText(Details:ToK2(spellTable.overheal) .. " (" .. math.floor(spellTable.overheal / totalHeal * 100) .. "%)") else text:SetText("0%") end diff --git a/startup.lua b/startup.lua index 29df6bc3b..613339a87 100644 --- a/startup.lua +++ b/startup.lua @@ -343,6 +343,25 @@ function Details:StartMeUp() --check is this is the first run of this version if (Details.is_version_first_run) then + local breakdownData = Details.breakdown_spell_tab + if (breakdownData) then + local spellContainerHeaders = breakdownData.spellcontainer_headers + if (spellContainerHeaders) then + if (spellContainerHeaders.overheal) then + spellContainerHeaders.overheal.enabled = true + spellContainerHeaders.overheal.width = 70 + end + end + + local targetContainerHeaders = breakdownData.targetcontainer_headers + if (targetContainerHeaders) then + if (targetContainerHeaders.overheal) then + targetContainerHeaders.overheal.enabled = true + targetContainerHeaders.overheal.width = 70 + end + end + end + local lowerInstanceId = Details:GetLowerInstanceNumber() if (lowerInstanceId) then lowerInstanceId = Details:GetInstance(lowerInstanceId)