Sort by critpercent and casts are now working; new class 'SpellTable'
This commit is contained in:
+1
-57
@@ -121,60 +121,4 @@ Details222.Mixins.ActorMixin = {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
--need to transfer the function bellow to another file
|
||||
|
||||
--this are the fields from spellTable that can be summed
|
||||
local spellTable_FieldsToSum = {
|
||||
["counter"] = true,
|
||||
["total"] = true,
|
||||
["c_amt"] = true,
|
||||
["c_min"] = true,
|
||||
["c_max"] = true,
|
||||
["c_total"] = true,
|
||||
["n_amt"] = true,
|
||||
["n_total"] = true,
|
||||
["n_min"] = true,
|
||||
["n_max"] = true,
|
||||
["successful_casted"] = true,
|
||||
["g_amt"] = true,
|
||||
["g_dmg"] = true,
|
||||
["r_amt"] = true,
|
||||
["r_dmg"] = true,
|
||||
["b_amt"] = true,
|
||||
["b_dmg"] = true,
|
||||
["a_amt"] = true,
|
||||
["a_dmg"] = true,
|
||||
["totalabsorb"] = true,
|
||||
["absorbed"] = true,
|
||||
["overheal"] = true,
|
||||
["totaldenied"] = true,
|
||||
}
|
||||
|
||||
---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[]
|
||||
---@param targetTable table
|
||||
function Details:SumSpellTables(spellTables, targetTable)
|
||||
local amtSpellTables = #spellTables
|
||||
|
||||
if (amtSpellTables == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
targetTable = targetTable or spellTables[1]
|
||||
|
||||
for i = 1, amtSpellTables do
|
||||
local spellTable = spellTables[i]
|
||||
if (spellTable) then
|
||||
for key, value in pairs(spellTable) do
|
||||
---@cast key string
|
||||
---@cast value number
|
||||
if (spellTable_FieldsToSum[key]) then
|
||||
targetTable[key] = (targetTable[key] or 0) + value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user