Added sorting to all headers to ascending and descending

This commit is contained in:
Tercio Jose
2023-04-21 21:46:36 -03:00
parent 36e5d2978f
commit c9b801e7f0
6 changed files with 160 additions and 151 deletions
+6 -6
View File
@@ -4551,14 +4551,14 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
bkSpellData.petNames[#bkSpellData.petNames+1] = ""
bkSpellData.bCanExpand = true
else
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
@@ -4596,14 +4596,14 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then --PET
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
bkSpellData.petNames[#bkSpellData.petNames+1] = petName
bkSpellData.bCanExpand = true
else --PET
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
@@ -4624,10 +4624,10 @@ function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of
end
end
--copy the keys from the spelltable and add them to the breakdownspelldata
--copy the keys from the spelltable and add them to the spelltableadv
--repeated spells will be summed
for i = 1, #breakdownSpellDataList do
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[i]
Details.SpellTableMixin.SumSpellTables(bkSpellData.spellTables, bkSpellData)
end
+8 -5
View File
@@ -1902,14 +1902,14 @@ function atributo_heal:MontaInfoHealingDone()
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = actorSpellsSorted[index]
bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
bkSpellData.petNames[#bkSpellData.petNames+1] = ""
bkSpellData.bCanExpand = true
else
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
@@ -1920,6 +1920,7 @@ function atributo_heal:MontaInfoHealingDone()
spellTables = {spellTable}, --sub spell tables to show if the spell is expanded
petNames = {""},
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData
alreadyAdded[spellName] = #actorSpellsSorted
@@ -1946,14 +1947,14 @@ function atributo_heal:MontaInfoHealingDone()
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then --PET
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = actorSpellsSorted[index]
bkSpellData.spellIds[#bkSpellData.spellIds+1] = spellId
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
bkSpellData.petNames[#bkSpellData.petNames+1] = petName
bkSpellData.bCanExpand = true
else --PET
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
@@ -1964,6 +1965,8 @@ function atributo_heal:MontaInfoHealingDone()
spellTables = {spellTable},
petNames = {petName},
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
actorSpellsSorted[#actorSpellsSorted+1] = bkSpellData
alreadyAdded[spellName] = #actorSpellsSorted
end
@@ -1973,7 +1976,7 @@ function atributo_heal:MontaInfoHealingDone()
end
for i = 1, #actorSpellsSorted do
---@type breakdownspelldata
---@type spelltableadv
local bkSpellData = actorSpellsSorted[i]
Details.SpellTableMixin.SumSpellTables(bkSpellData.spellTables, bkSpellData)
end
+14 -2
View File
@@ -33,8 +33,9 @@ local spellTable_FieldsToSum = {
---@class spelltablemixin
---@field GetCritPercent fun(spellTable: spelltable) : number
---@field GetCritAverage fun(spellTable: spelltable) : number
---@field GetCastAmount fun(spellTable: spelltable, actorName: string, combatObject: combat)
---@field GetCastAverage fun(spellTable: spelltable, castAmount: number)
---@field SumSpellTables fun(spellTables: spelltable[], targetTable: table)
---@field GetCastsAmount fun(spellTable: spelltable, actorName: string, combatObject: combat)
Details.SpellTableMixin = {
---return the critical hits percent
@@ -56,10 +57,21 @@ Details.SpellTableMixin = {
---@param actorName string
---@param combatObject combat
---@return number
GetCastsAmount = function(spellTable, actorName, combatObject)
GetCastAmount = function(spellTable, actorName, combatObject)
return combatObject:GetSpellCastAmount(actorName, spellTable.id)
end,
---return the average damage per cast
---@param spellTable spelltable
---@param castAmount number
---@return number
GetCastAverage = function(spellTable, castAmount)
if (castAmount > 0) then
return spellTable.total / castAmount
end
return 0
end,
---get the array of spelltables and sum each spellTable with the first spellTable found or on targetTable
---only sum the keys found in the spellTable_FieldsToSum table
---@param spellTables spelltable[]