Added report to breakdown window

This commit is contained in:
Tercio Jose
2024-02-26 13:53:27 -03:00
parent 937e167327
commit c4040ac4de
4 changed files with 205 additions and 53 deletions
@@ -11,9 +11,13 @@ local GetSpellInfo = GetSpellInfo
local _GetSpellInfo = Details.GetSpellInfo
local GameTooltip = GameTooltip
local IsShiftKeyDown = IsShiftKeyDown
local DF = DetailsFramework
local tinsert = table.insert
---@type detailsframework
local DF = DetailsFramework
---@type detailsframework
local detailsFramework = DetailsFramework
local spellsTab = DetailsSpellBreakdownTab
local headerContainerType = spellsTab.headerContainerType
@@ -280,6 +284,38 @@ function spellsTab.CreateTargetContainer(tabFrame) --~create ~target ~createtarg
targetScrollFrame:SetBackdrop({})
targetScrollFrame:SetAllPoints()
---@param self breakdownphasescrollframe
---@return breakdownreporttable
function targetScrollFrame:GetReportData()
local instance = spellsTab.GetInstance()
local data = targetScrollFrame:GetData()
local formatFunc = Details:GetCurrentToKFunction()
local actorObject = spellsTab.GetActor()
local displayId, subDisplayId = instance:GetDisplay()
local subDisplayName = Details:GetSubAttributeName(displayId, subDisplayId)
local combatName = instance:GetCombat():GetCombatName()
---@type breakdownreporttable
local reportData = {
title = "Target of " .. detailsFramework:RemoveRealmName(actorObject:Name()) .. " | " .. subDisplayName .. " | " .. combatName
}
local topValue = data[1] and data[1].total or 0
for i = 1, #data do
---@type breakdowntargettable
local dataTable = data[i]
reportData[#reportData+1] = {
name = dataTable.name,
amount = formatFunc(nil, dataTable.total),
percent = string.format("%.1f", dataTable.total / topValue * 100) .. "%",
}
end
return reportData
end
container:RegisterChildForDrag(targetScrollFrame)
targetScrollFrame.DontHideChildrenOnPreRefresh = false