Skip to content

Commit

Permalink
Fixed small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed May 12, 2023
1 parent 4769914 commit 21da70e
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 17 deletions.
1 change: 1 addition & 0 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 428
local dversion = 429
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down
21 changes: 16 additions & 5 deletions Libs/DF/header.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
72 changes: 68 additions & 4 deletions classes/class_heal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
24 changes: 19 additions & 5 deletions frames/window_playerbreakdown_spells.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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"},
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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},
}
Expand Down Expand Up @@ -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},
}
Expand Down Expand Up @@ -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},
}
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 21da70e

Please sign in to comment.