Skip to content

Commit

Permalink
Cutting off events that are beyond 10 seconds from the character death
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jul 29, 2024
1 parent 5d9d8e2 commit dea44cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions classes/class_combat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions core/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dea44cc

Please sign in to comment.