Code changes, see commit description

Combat Objects which has been discarded due to any reason will have the boolean member:  __destroyed set to true. With this change, 3rd party code can see if the data cached is up to date or obsolete.

- Removed several deprecated code from March 2023 and earlier.
- Large amount of code cleanup and refactoring, some functions got renamed, they are listed below:
* TravarTempos renamed to LockActivityTime.
* ClearTempTables renamed to ClearCacheTables.
* SpellIsDot renamed to SetAsDotSpell.
* FlagCurrentCombat remamed to FlagNewCombat_PVPState.
* UpdateContainerCombatentes renamed to UpdatePetCache.
* segmentClass:AddCombat(combatObject) renamed to Details222.Combat.AddCombat(combatToBeAdded)

- CurrentCombat.verifica_combate timer is now obsolete.
- Details.last_closed_combat is now obsolete.
- Details.EstaEmCombate is now obsolete.
- Details.options is now obsolete.

- Added: Details:RemoveSegmentByCombatObject(combatObject)

- Spec Guess Timers are now stored within Details222.GuessSpecSchedules.Schedules, all timers are killed at the end of the combat or at a data reset.

- Initial time to send startup signal reduced from 5 to 4 seconds.

- Fixed some division by zero on ptr 10.1.5.
- Fixed DETAILS_STARTED event not triggering in some cases due to 'event not registered'.
This commit is contained in:
Tercio Jose
2023-06-27 19:01:44 -03:00
parent d3d5154c67
commit 6ccb64863e
23 changed files with 971 additions and 808 deletions
+37 -28
View File
@@ -408,7 +408,7 @@
---copy deaths from combat2 into combat1
---if bMythicPlus is true it'll check if the death has mythic plus death time and use it instead of the normal death time
---@param combat1 combat
---@param combat1 combat
---@param combat2 combat
---@param bMythicPlus boolean
function classCombat.CopyDeathsFrom(combat1, combat2, bMythicPlus)
@@ -720,43 +720,52 @@ end
---@return table
function classCombat:CreateLastEventsTable(playerName)
local lastEventsTable = {}
for i = 1, Details.deadlog_events do
lastEventsTable [i] = {}
lastEventsTable[i] = {}
end
lastEventsTable.n = 1
self.player_last_events[playerName] = lastEventsTable
return lastEventsTable
end
--trava o tempo dos jogadores aps o trmino do combate.
function classCombat:TravarTempos()
if (self [1]) then
for _, jogador in ipairs(self [1]._ActorTable) do --damage
if (jogador:GetOrChangeActivityStatus()) then -- retorna se ele esta com o dps ativo
Details222.TimeMachine.StopTime(jogador)
jogador:GetOrChangeActivityStatus(false) --lock the actor timer
else
if (jogador.start_time == 0) then
jogador.start_time = _tempo
end
if (not jogador.end_time) then
jogador.end_time = _tempo
end
---pass through all actors and check if the activity time is unlocked, if it is, lock it
---@param self combat
function classCombat:LockActivityTime()
---@cast self combat
---@type actorcontainer
local containerDamage = self:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
---@type actorcontainer
local containerHeal = self:GetContainer(DETAILS_ATTRIBUTE_HEAL)
for _, actorObject in containerDamage:ListActors() do
if (actorObject:GetOrChangeActivityStatus()) then --check if the timer is unlocked
Details222.TimeMachine.StopTime(actorObject)
actorObject:GetOrChangeActivityStatus(false) --lock the actor timer
else
if (actorObject.start_time == 0) then
actorObject.start_time = _tempo
end
if (not actorObject.end_time) then
actorObject.end_time = _tempo
end
end
end
if (self [2]) then
for _, jogador in ipairs(self [2]._ActorTable) do --healing
if (jogador:GetOrChangeActivityStatus()) then -- retorna se ele esta com o dps ativo
Details222.TimeMachine.StopTime(jogador)
jogador:GetOrChangeActivityStatus(false) --lock the actor timer
else
if (jogador.start_time == 0) then
jogador.start_time = _tempo
end
if (not jogador.end_time) then
jogador.end_time = _tempo
end
for _, actorObject in containerHeal:ListActors() do
--check if the timer is unlocked
if (actorObject:GetOrChangeActivityStatus()) then
--lock the actor timer
Details222.TimeMachine.StopTime(actorObject)
--remove the actor from the time machine
actorObject:GetOrChangeActivityStatus(false)
else
if (actorObject.start_time == 0) then
actorObject.start_time = _tempo
end
if (not actorObject.end_time) then
actorObject.end_time = _tempo
end
end
end