Cutting off events that are beyond 10 seconds from the character death

This commit is contained in:
Tercio Jose
2024-07-29 20:52:42 -03:00
committed by andrew6180
parent cdff54b2f6
commit 5659b7d9f0
3 changed files with 9 additions and 4 deletions
+2
View File
@@ -282,6 +282,8 @@
---@field PhaseData table
---@field player_last_events table<string, table[]> record the latest events of each player, latter used to build the death log
---@field
---@field LockActivityTime fun(self: combat)
---@field CutDeathEventsByTime fun(self: combat, time: number?) remove death events by time, default 10 seconds
---@field GetTotal fun(self: combat, attribute: number, subAttribute: number?, onlyGroup: boolean?) : number return the total amount of the requested attribute
---@field GetCurrentPhase fun(self: combat) : number return the current phase of the combat or the phase where the combat ended
---@field StoreTalents fun(self:combat)
+4 -4
View File
@@ -940,19 +940,19 @@ local segmentTypeToString = {
end
end
function classCombat:CutDeathByTime(time)
function classCombat:CutDeathEventsByTime(time)
time = time or 10
local deathsTable = self:GetDeaths()
for i = #deathsTable, 1, -1 do
local deathTable = deathsTable[i]
local playerName, playerClass, deathTime, deathCombatTime, deathTimeString, playerMaxHealth, deathEvents, lastCooldown, spec = Details:UnpackDeathTable(deathTable)
for evIndex = 1, #deathEvents do
for evIndex = #deathEvents, 1, -1 do
local event = deathEvents[evIndex]
local evType = event[1]
if (type(evType) == "boolean") then
local eventTime = event[4]
print(eventTime, deathTime)
if (eventTime+10 < deathTime) then
print("this event is ignored, and should be removed", event[1])
table.remove(deathEvents, evIndex)
end
end
end
+3
View File
@@ -511,6 +511,9 @@
--lock timers
currentCombat:LockActivityTime()
--remove death events that are irrelevant for the death log
currentCombat:CutDeathEventsByTime()
--get waste shields
if (Details.close_shields) then
Details:CloseShields(currentCombat)