Replacing table.wipe with Details:Destroy()

This commit is contained in:
Tercio Jose
2023-05-22 15:31:29 -03:00
parent fa0d1e1d08
commit 0cdfa2b900
40 changed files with 1205 additions and 1322 deletions
+12 -13
View File
@@ -12,7 +12,6 @@
local _math_max = math.max --lua local
local ipairs = ipairs --lua local
local pairs = pairs --lua local
local wipe = table.wipe --lua local
local bitBand = bit.band --lua local
local GetInstanceInfo = GetInstanceInfo --wow api local
@@ -358,14 +357,14 @@
Details:ClearCCPetsBlackList()
wipe(Details.encounter_end_table)
Details:Destroy(Details.encounter_end_table)
wipe(Details.pets_ignored)
wipe(Details.pets_no_owner)
Details:Destroy(Details.pets_ignored)
Details:Destroy(Details.pets_no_owner)
Details.container_pets:BuscarPets()
wipe(Details.cache_damage_group)
wipe(Details.cache_healing_group)
Details:Destroy(Details.cache_damage_group)
Details:Destroy(Details.cache_healing_group)
Details:UpdateParserGears()
--get all buff already applied before the combat start
@@ -878,11 +877,11 @@
Details.leaving_combat = false
Details:OnCombatPhaseChanged()
wipe(Details.tabela_vigente.PhaseData.damage_section)
wipe(Details.tabela_vigente.PhaseData.heal_section)
Details:Destroy(Details.tabela_vigente.PhaseData.damage_section)
Details:Destroy(Details.tabela_vigente.PhaseData.heal_section)
wipe(Details.cache_damage_group)
wipe(Details.cache_healing_group)
Details:Destroy(Details.cache_damage_group)
Details:Destroy(Details.cache_healing_group)
Details:UpdateParserGears()
@@ -899,7 +898,7 @@
--do not wipe the encounter table if is in the argus encounter ~REMOVE on 8.0
if (Details.encounter_table and Details.encounter_table.id ~= 2092) then
wipe(Details.encounter_table)
Details:Destroy(Details.encounter_table)
else
if (Details.debug) then
Details:Msg("(debug) in argus encounter, cannot wipe the encounter table.")
@@ -938,7 +937,7 @@
--enemies
local enemiesAmount = GetNumArenaOpponentSpecs and GetNumArenaOpponentSpecs() or 5
table.wipe(_detalhes.arena_enemies)
Details:Destroy(_detalhes.arena_enemies)
for i = 1, enemiesAmount do
local enemyName = _G.GetUnitName("arena" .. i, true)
@@ -1330,7 +1329,7 @@
--store pets sent through 'needpetowner'
Details.sent_pets = Details.sent_pets or {n = time()}
if (Details.sent_pets.n+20 < time()) then
wipe(Details.sent_pets)
Details:Destroy(Details.sent_pets)
Details.sent_pets.n = time()
end
+17 -18
View File
@@ -232,7 +232,8 @@ end
local statusbar_enabled1 = window1.show_statusbar
local statusbar_enabled2 = window2.show_statusbar
table.wipe(window1.snap); table.wipe(window2.snap)
Details:Destroy(window1.snap)
Details:Destroy(window2.snap)
window1.snap [3] = 2; window2.snap [1] = 1;
window1.horizontalSnap = true; window2.horizontalSnap = true
@@ -345,15 +346,13 @@ end
------------------------------------------------------------------------------------------------------------
function _detalhes:SetDeathLogLimit (limit)
function _detalhes:SetDeathLogLimit(limit)
if (limit and type(limit) == "number" and limit >= 8) then
_detalhes.deadlog_events = limit
local combat = _detalhes.tabela_vigente
local combatObject = Details:GetCurrentCombat()
local wipe = table.wipe
for player_name, event_table in pairs(combat.player_last_events) do
for player_name, event_table in pairs(combatObject.player_last_events) do
if (limit > #event_table) then
for i = #event_table + 1, limit do
event_table [i] = {}
@@ -361,7 +360,7 @@ function _detalhes:SetDeathLogLimit (limit)
else
event_table.n = 1
for _, t in ipairs(event_table) do
wipe (t)
Details:Destroy(t)
end
end
end
@@ -442,7 +441,7 @@ function _detalhes:ResetSpecCache (forced)
local isininstance = IsInInstance()
if (forced or (not isininstance and not _detalhes.in_group)) then
table.wipe(_detalhes.cached_specs)
Details:Destroy(_detalhes.cached_specs)
if (_detalhes.track_specs) then
local my_spec = DetailsFramework.GetSpecialization()
@@ -458,7 +457,7 @@ function _detalhes:ResetSpecCache (forced)
end
elseif (_detalhes.in_group and not isininstance) then
table.wipe(_detalhes.cached_specs)
Details:Destroy(_detalhes.cached_specs)
if (_detalhes.track_specs) then
if (IsInRaid()) then
@@ -1913,7 +1912,7 @@ end
--test
--/run _detalhes.ilevel:CalcItemLevel ("player", UnitGUID("player"), true)
--/run wipe (_detalhes.item_level_pool)
--/run wipe(_detalhes.item_level_pool)
function ilvl_core:CalcItemLevel (unitid, guid, shout)
@@ -2176,7 +2175,7 @@ function ilvl_core:QueryInspect (unitName, callback, param1)
end
function ilvl_core:ClearQueryInspectQueue()
wipe (ilvl_core.forced_inspects)
Details:Destroy (ilvl_core.forced_inspects)
ilvl_core.clear_queued_list = nil
end
@@ -3288,7 +3287,7 @@ function Details222.Cache.DoMaintenance()
if (currentTime > Details.latest_spell_pool_access + delay) then
local spellIdPoolBackup = DetailsFramework.table.copy({}, Details.spell_pool)
wipe(Details.spell_pool)
Details:Destroy(Details.spell_pool)
--preserve ignored spells spellId
for spellId in pairs(Details.spellid_ignored) do
@@ -3296,31 +3295,31 @@ function Details222.Cache.DoMaintenance()
end
Details.latest_spell_pool_access = currentTime
wipe(spellIdPoolBackup)
Details:Destroy(spellIdPoolBackup)
end
if (currentTime > Details.latest_npcid_pool_access + delay) then
local npcIdPoolBackup = DetailsFramework.table.copy({}, Details.npcid_pool)
wipe(Details.npcid_pool)
Details:Destroy(Details.npcid_pool)
--preserve ignored npcs npcId
for npcId in pairs (Details.npcid_ignored) do
Details.npcid_pool[npcId] = npcIdPoolBackup[npcId]
end
Details.latest_npcid_pool_access = currentTime
wipe(npcIdPoolBackup)
Details:Destroy(npcIdPoolBackup)
end
if (currentTime > Details.latest_encounter_spell_pool_access + delay) then
wipe(Details.encounter_spell_pool)
Details:Destroy(Details.encounter_spell_pool)
Details.latest_encounter_spell_pool_access = currentTime
end
if (Details.boss_mods_timers and Details.boss_mods_timers.latest_boss_mods_access) then
if (currentTime > Details.boss_mods_timers.latest_boss_mods_access + delay) then
wipe(Details.boss_mods_timers.encounter_timers_bw)
wipe(Details.boss_mods_timers.encounter_timers_dbm)
Details:Destroy(Details.boss_mods_timers.encounter_timers_bw)
Details:Destroy(Details.boss_mods_timers.encounter_timers_dbm)
Details.boss_mods_timers.latest_boss_mods_access = currentTime
end
end
+215 -228
View File
@@ -12,7 +12,6 @@
local setmetatable = setmetatable --lua local
local _table_remove = table.remove --lua local
local _bit_band = bit.band --lua local
local wipe = table.wipe --lua local
local _time = time --lua local
local _InCombatLockdown = InCombatLockdown --wow api local
@@ -21,21 +20,14 @@
local classHeal = Details.atributo_heal --details local
local classEnergy = Details.atributo_energy --details local
local classUtility = Details.atributo_misc --details local
local alvo_da_habilidade = Details.alvo_da_habilidade --details local
local habilidade_dano = Details.habilidade_dano --details local
local habilidade_cura = Details.habilidade_cura --details local
local container_habilidades = Details.container_habilidades --details local
local container_combatentes = Details.container_combatentes --details local
local container_damage_target = Details.container_type.CONTAINER_DAMAGETARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--constants
local class_type_dano = Details.atributos.dano
local class_type_cura = Details.atributos.cura
local class_type_e_energy = Details.atributos.e_energy
local class_type_misc = Details.atributos.misc
local classTypeDamage = Details.atributos.dano
local classTypeHeal = Details.atributos.cura
local classTypeEnergy = Details.atributos.e_energy
local classTypeUtility = Details.atributos.misc
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--core
@@ -44,9 +36,9 @@
---@param actorContainer actorcontainer
local fullRemap = function(actorContainer)
local namingMap = actorContainer._NameIndexTable
wipe(namingMap)
Details:Destroy(namingMap)
for i = 1, #actorContainer._ActorTable do
local actorName = actorContainer._ActorTable[i].nome
local actorName = actorContainer._ActorTable[i].nome --so the actor got wiped, but the actor table is still there but without any members
namingMap[actorName] = i
end
end
@@ -63,14 +55,14 @@
Details.refresh:r_combate (combate)
Details.refresh:r_container_combatentes (combate [class_type_dano])
Details.refresh:r_container_combatentes (combate [class_type_cura])
Details.refresh:r_container_combatentes (combate [class_type_e_energy])
Details.refresh:r_container_combatentes (combate [class_type_misc])
Details.refresh:r_container_combatentes (combate [classTypeDamage])
Details.refresh:r_container_combatentes (combate [classTypeHeal])
Details.refresh:r_container_combatentes (combate [classTypeEnergy])
Details.refresh:r_container_combatentes (combate [classTypeUtility])
Details.refresh:r_container_combatentes (combate [5]) --ghost container
local todos_atributos = {combate [class_type_dano]._ActorTable, combate [class_type_cura]._ActorTable, combate [class_type_e_energy]._ActorTable, combate [class_type_misc]._ActorTable}
local todos_atributos = {combate [classTypeDamage]._ActorTable, combate [classTypeHeal]._ActorTable, combate [classTypeEnergy]._ActorTable, combate [classTypeUtility]._ActorTable}
for class_type, atributo in ipairs(todos_atributos) do
for _, esta_classe in ipairs(atributo) do
@@ -84,16 +76,16 @@
esta_classe.displayName = nome
end
if (class_type == class_type_dano) then
if (class_type == classTypeDamage) then
Details.refresh:r_atributo_damage (esta_classe)
elseif (class_type == class_type_cura) then
elseif (class_type == classTypeHeal) then
Details.refresh:r_atributo_heal (esta_classe)
elseif (class_type == class_type_e_energy) then
elseif (class_type == classTypeEnergy) then
Details.refresh:r_atributo_energy (esta_classe)
elseif (class_type == class_type_misc) then
elseif (class_type == classTypeUtility) then
Details.refresh:r_atributo_misc (esta_classe)
end
end
@@ -110,19 +102,16 @@
--reaplica indexes e metatables
function Details:RestoreMetatables()
Details.refresh:r_atributo_custom()
--container de pets e histrico
Details.refresh:r_container_pets (Details.tabela_pets)
Details.refresh:r_historico (Details.tabela_historico)
--tabelas dos combates
local combate_overall = Details.tabela_overall
local overall_dano = combate_overall [class_type_dano] --damage atalho
local overall_cura = combate_overall [class_type_cura] --heal atalho
local overall_energy = combate_overall [class_type_e_energy] --energy atalho
local overall_misc = combate_overall [class_type_misc] --misc atalho
local overall_dano = combate_overall [classTypeDamage] --damage atalho
local overall_cura = combate_overall [classTypeHeal] --heal atalho
local overall_energy = combate_overall [classTypeEnergy] --energy atalho
local overall_misc = combate_overall [classTypeUtility] --misc atalho
local tabelas_do_historico = Details.tabela_historico.tabelas --atalho
@@ -183,10 +172,10 @@
end
--recupera a meta e indexes dos 4 container
Details.refresh:r_container_combatentes (combate [class_type_dano], overall_dano)
Details.refresh:r_container_combatentes (combate [class_type_cura], overall_cura)
Details.refresh:r_container_combatentes (combate [class_type_e_energy], overall_energy)
Details.refresh:r_container_combatentes (combate [class_type_misc], overall_misc)
Details.refresh:r_container_combatentes (combate [classTypeDamage], overall_dano)
Details.refresh:r_container_combatentes (combate [classTypeHeal], overall_cura)
Details.refresh:r_container_combatentes (combate [classTypeEnergy], overall_energy)
Details.refresh:r_container_combatentes (combate [classTypeUtility], overall_misc)
--ghost container
if (combate[5]) then
@@ -194,7 +183,7 @@
end
--tabela com os 4 tabelas de jogadores
local todos_atributos = {combate [class_type_dano]._ActorTable, combate [class_type_cura]._ActorTable, combate [class_type_e_energy]._ActorTable, combate [class_type_misc]._ActorTable}
local todos_atributos = {combate [classTypeDamage]._ActorTable, combate [classTypeHeal]._ActorTable, combate [classTypeEnergy]._ActorTable, combate [classTypeUtility]._ActorTable}
for class_type, atributo in ipairs(todos_atributos) do
for _, esta_classe in ipairs(atributo) do
@@ -211,28 +200,28 @@
local shadow
if (class_type == class_type_dano) then
if (class_type == classTypeDamage) then
if (combate.overall_added and not overall_saved) then
shadow = classDamage:r_connect_shadow (esta_classe)
else
shadow = classDamage:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_cura) then
elseif (class_type == classTypeHeal) then
if (combate.overall_added and not overall_saved) then
shadow = classHeal:r_connect_shadow (esta_classe)
else
shadow = classHeal:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_e_energy) then
elseif (class_type == classTypeEnergy) then
if (combate.overall_added and not overall_saved) then
shadow = classEnergy:r_connect_shadow (esta_classe)
else
shadow = classEnergy:r_onlyrefresh_shadow (esta_classe)
end
elseif (class_type == class_type_misc) then
elseif (class_type == classTypeUtility) then
if (combate.overall_added and not overall_saved) then
shadow = classUtility:r_connect_shadow (esta_classe)
else
@@ -370,18 +359,18 @@
function Details:DoOwnerCleanup()
---@type combat[]
local combats = Details.tabela_historico.tabelas or {}
local combatTables = Details.tabela_historico.tabelas or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
tinsert(combats, Details.tabela_overall)
tinsert(combatTables, Details.tabela_overall)
bOverallAdded = true
end
for index, combat in ipairs(combats) do
for _, combat in ipairs(combatTables) do
---@cast combat combat
for index, actorContainer in ipairs(combat) do
for _, actorContainer in ipairs(combat) do
---@cast actorContainer actorcontainer
for index, actorObject in ipairs(actorContainer._ActorTable) do
for _, actorObject in ipairs(actorContainer._ActorTable) do
---@cast actorObject actor
actorObject.owner = nil
end
@@ -389,38 +378,41 @@
end
if (bOverallAdded) then
tremove(combats, #combats)
tremove(combatTables, #combatTables)
end
end
function Details:DoClassesCleanup()
---@type combat[]
local combats = Details.tabela_historico.tabelas or {}
local bOverallAdded
local combatTables = Details.tabela_historico.tabelas or {}
local bOverallAdded = false
if (not Details.overall_clear_logout) then
tinsert(combats, Details.tabela_overall)
--add the overall segment to the cleanup within the other segments
--it is removed after the cleanup
tinsert(combatTables, Details.tabela_overall)
bOverallAdded = true
end
for index, combatObject in ipairs(combats) do
for index, combatObject in ipairs(combatTables) do
---@cast combatObject combat
for classType, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
for index, actorObject in ipairs(actorContainer._ActorTable) do
for _, actorObject in ipairs(actorContainer._ActorTable) do --low level loop for performance
---@cast actorObject actor
actorObject.displayName = nil
actorObject.minha_barra = nil
if (classType == class_type_dano) then
if (classType == classTypeDamage) then
Details.clear:c_atributo_damage(actorObject)
elseif (classType == class_type_cura) then
elseif (classType == classTypeHeal) then
Details.clear:c_atributo_heal(actorObject)
elseif (classType == class_type_e_energy) then
elseif (classType == classTypeEnergy) then
Details.clear:c_atributo_energy(actorObject)
elseif (classType == class_type_misc) then
elseif (classType == classTypeUtility) then
Details.clear:c_atributo_misc(actorObject)
end
end
@@ -428,219 +420,214 @@
end
if (bOverallAdded) then
tremove(combats, #combats)
--remove the overall segment from the regular segments
tremove(combatTables, #combatTables)
end
end
function Details:DoContainerCleanup()
---@type combat[]
local combats = Details.tabela_historico.tabelas or {}
local combatTables = Details.tabela_historico.tabelas or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
tinsert(combats, Details.tabela_overall)
tinsert(combatTables, Details.tabela_overall)
bOverallAdded = true
end
for index, combat in ipairs(combats) do
Details.clear:c_combate(combat)
for index, container in ipairs(combat) do
Details.clear:c_container_combatentes(container)
for _, combatObject in ipairs(combatTables) do
---@cast combatObject combat
Details.clear:c_combate(combatObject)
for _, actorContainer in ipairs(combatObject) do
---@cast actorContainer actorcontainer
Details.clear:c_container_combatentes(actorContainer)
end
end
if (bOverallAdded) then
tremove(combats, #combats)
tremove(combatTables, #combatTables)
end
end
function Details:DoContainerIndexCleanup()
---@type combat[]
local combats = Details.tabela_historico.tabelas or {}
local allSegments = Details.tabela_historico.tabelas or {}
local bOverallAdded
if (not Details.overall_clear_logout) then
tinsert(combats, Details.tabela_overall)
tinsert(allSegments, Details.tabela_overall)
bOverallAdded = true
end
for index, combat in ipairs(combats) do
for index, container in ipairs(combat) do
Details.clear:c_container_combatentes_index(container)
for _, combatObject in ipairs(allSegments) do
for _, actorContainer in ipairs(combatObject) do
Details.clear:c_container_combatentes_index(actorContainer)
end
end
if (bOverallAdded) then
tremove(combats, #combats)
tremove(allSegments, #allSegments)
end
end
--limpa indexes, metatables e shadows
function Details:PrepareTablesForSave()
Details.clear_ungrouped = true
function Details:PrepareTablesForSave()
Details.clear_ungrouped = true
--clear instances
Details:DoInstanceCleanup()
Details:DoClassesCleanup() --aumentou 1 combat
Details:DoContainerCleanup() --aumentou 1 combat
Details:DoInstanceCleanup() --checked
Details:DoClassesCleanup() --checked
Details:DoContainerCleanup() --checked
--clear combats
local combatTables = {}
---@type combat[]
local combatHistoryTable = Details.tabela_historico.tabelas or {}
---@type combat[]
local combatTables = {}
---@type combat[]
local allSegments = Details.tabela_historico.tabelas or {}
--remove os segmentos de trash
for i = #combatHistoryTable, 1, -1 do
---@type combat
local combateObject = combatHistoryTable[i]
if (combateObject:IsTrash()) then
table.remove(combatHistoryTable, i)
Details:Destroy(combatHistoryTable)
end
--remove segments marked as 'trash'
for i = #allSegments, 1, -1 do
---@type combat
local combatObject = allSegments[i]
if (combatObject:IsTrash()) then
table.remove(allSegments, i)
Details:Destroy(combatObject)
end
--remove os segmentos > que o limite permitido para salvar
if (Details.segments_amount_to_save and Details.segments_amount_to_save < Details.segments_amount) then
for i = Details.segments_amount, Details.segments_amount_to_save+1, -1 do
if (Details.tabela_historico.tabelas[i]) then
---@type combat
local combatObject = Details.tabela_historico.tabelas[i]
table.remove(Details.tabela_historico.tabelas, i)
Details:Destroy(combatObject)
end
end
end
--limpa a tabela overall
if (Details.overall_clear_logout) then
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
else
---@type combat
local overallCombatObject = Details.tabela_overall
overallCombatObject.previous_combat = nil
---@type actorcontainer[]
local allAttributes = {
overallCombatObject[class_type_dano],
overallCombatObject[class_type_cura],
overallCombatObject[class_type_e_energy],
overallCombatObject[class_type_misc]
}
--this is a cleanup for overall data
if (Details.clear_ungrouped) then
--deal with actor which could potentially be removed from the database
for classType, actorContainer in ipairs(allAttributes) do
--get the actor table from the container, this table can be used
local actorTable = actorContainer:GetActorTable()
for i = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[i]
if (actorObject.grupo and not actorObject.boss and not actorObject.boss_fight_component and not actorObject.fight_component and not actorObject.pvp_component and not actorObject.arena_enemy and not actorObject.enemy) then
--remove the actor from the container
table.remove(actorTable, i)
Details:DestroyActor(actorTable, overallCombatObject)
end
end
fullRemap(actorContainer)
end
end
--now deal with pets without owners
for classType, actorContainer in ipairs(allAttributes) do
--get the actor table from the container, this table can be used
local actorTable = actorContainer:GetActorTable()
for i = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[i]
if (actorObject.owner) then
if (not actorObject.owner.serial) then
Details:DestroyActor(actorObject, overallCombatObject)
table.remove(actorTable, i)
end
end
end
fullRemap(actorContainer)
end
end
for i, combatObject in ipairs(combatHistoryTable) do
---@cast combatObject combat
combatTables[#combatTables+1] = combatObject
end
--this is a cleanup for combat stored in the segment list
for combatIndex, combatObject in ipairs(combatTables) do
--limpa a tabela do grafico
if (Details.clear_graphic) then
combatObject.TimeData = {}
end
--limpa a referencia do ultimo combate
combatObject.previous_combat = nil
local bIsBossEncounter = combatObject.is_boss
if (bIsBossEncounter) then
if (combatObject.pvp) then
bIsBossEncounter = false
end
end
if (not combatObject.is_mythic_dungeon_segment and Details.clear_ungrouped) then
for i = 1, DETAILS_COMBAT_AMOUNT_CONTAINERS do
---@type actorcontainer
local actorContainer = combatObject:GetContainer(i)
if (actorContainer) then
local actorTable = actorContainer:GetActorTable()
for o = #actorTable, 1, -1 do
local actorObject = actorTable[o]
if (not actorObject.grupo and not actorObject.boss and not actorObject.boss_fight_component and not bIsBossEncounter and not actorObject.pvp_component and not actorObject.fight_component) then
Details:DestroyActor(actorObject, combatObject)
table.remove(actorTable, o)
end
end
fullRemap(actorContainer)
for o = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[o]
if (actorObject.owner) then
if (not actorObject.owner.serial) then
Details:DestroyActor(actorObject, combatObject)
table.remove(actorTable, i)
end
end
end
fullRemap(actorContainer)
end
end
end
end
--panic mode (in case the play disconnets during a boss encounter, drop all tables to speedup the login and login back process)
if (Details.segments_panic_mode and Details.can_panic_mode) then
if (Details.tabela_vigente.is_boss) then
Details.tabela_historico = Details.historico:NovoHistorico()
end
end
--clear all segments on logoff
if (Details.data_cleanup_logout) then
Details.tabela_historico = Details.historico:NovoHistorico()
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
end
--clear customs
Details.clear:c_atributo_custom()
--clear owners
Details:DoOwnerCleanup()
--cleer container indexes
Details:DoContainerIndexCleanup()
end
--remove segments > of the segment limit to save
if (Details.segments_amount_to_save and Details.segments_amount_to_save < Details.segments_amount) then
for i = Details.segments_amount, Details.segments_amount_to_save + 1, -1 do
if (Details.tabela_historico.tabelas[i]) then
---@type combat
local combatObject = Details.tabela_historico.tabelas[i]
table.remove(Details.tabela_historico.tabelas, i)
Details:Destroy(combatObject)
end
end
end
--clear overall segment
if (Details.overall_clear_logout) then
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
Details:Destroy(Details.tabela_overall)
else
---@type combat
local overallCombatObject = Details.tabela_overall
overallCombatObject.previous_combat = nil
--this is a cleanup for overall data (overall)
if (Details.clear_ungrouped) then
--deal with actor which could potentially be removed from the database
for containerId = 1, DETAILS_COMBAT_AMOUNT_CONTAINERS do
local actorContainer = overallCombatObject:GetContainer(containerId)
local actorTable = actorContainer:GetActorTable()
for actorIndex = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[actorIndex]
if (not actorObject.grupo and not actorObject.boss and not actorObject.boss_fight_component and not actorObject.fight_component and not actorObject.pvp_component and not actorObject.arena_enemy and not actorObject.enemy) then
Details:DestroyActor(actorObject, actorContainer, overallCombatObject)
end
end
end
end
--find orphans, finding orphans should be done when deleting an actor, it should iterate among the actor pets and delete them as well
--now deal with pets without owners (overall)
for containerId = 1, DETAILS_COMBAT_AMOUNT_CONTAINERS do
local actorContainer = overallCombatObject:GetContainer(containerId)
local actorTable = actorContainer:GetActorTable()
for actorIndex = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[actorIndex]
if (actorObject.owner) then
if (not actorObject.owner.serial) then
Details:DestroyActor(actorObject, actorContainer, overallCombatObject)
end
end
end
end
end
for i, combatObject in ipairs(allSegments) do
---@cast combatObject combat
combatTables[#combatTables+1] = combatObject
end
--this is a cleanup for combat stored in the segment list
for combatIndex, combatObject in ipairs(combatTables) do
---@cast combatObject combat
--clear the time data (chart data) - if the option to cleanup on logout is enabled
if (Details.clear_graphic) then
Details:Destroy(combatObject.TimeData)
combatObject.TimeData = {}
end
--clear the reference of the previous combat
combatObject.previous_combat = nil
local bIsBossEncounter = combatObject.is_boss
if (bIsBossEncounter) then
if (combatObject.pvp) then
bIsBossEncounter = false
end
end
if (not combatObject.is_mythic_dungeon_segment and Details.clear_ungrouped) then
for i = 1, DETAILS_COMBAT_AMOUNT_CONTAINERS do
---@type actorcontainer
local actorContainer = combatObject:GetContainer(i)
if (actorContainer) then
local actorTable = actorContainer:GetActorTable()
for o = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[o]
if (not actorObject.grupo and not actorObject.boss and not actorObject.boss_fight_component and not bIsBossEncounter and not actorObject.pvp_component and not actorObject.fight_component) then
Details:DestroyActor(actorObject, actorContainer, combatObject)
end
end
--find orphans
for o = #actorTable, 1, -1 do
---@type actor
local actorObject = actorTable[o]
if (actorObject.owner) then
if (not actorObject.owner.serial) then
Details:DestroyActor(actorObject, actorContainer, combatObject)
end
end
end
end
end
end
end
--panic mode (in case the player disconnets during a boss encounter, drop all tables to speedup the login and login back process)
if (Details.segments_panic_mode and Details.can_panic_mode) then
if (Details.tabela_vigente.is_boss) then
Details.tabela_historico = Details.historico:NovoHistorico()
end
end
--clear all segments on logoff
if (Details.data_cleanup_logout) then
Details.tabela_historico = Details.historico:NovoHistorico()
Details.tabela_overall = nil
_detalhes_database.tabela_overall = nil
end
--clear customs
Details.clear:c_atributo_custom()
--clear owners
Details:DoOwnerCleanup()
--clear container indexes
Details:DoContainerIndexCleanup()
end
function Details:reset_window(instancia)
if (instancia.segmento == -1) then
instancia.showing[instancia.atributo].need_refresh = true
@@ -720,7 +707,7 @@
Details:ResetSpecCache()
--cleanup the shield cache
wipe(Details.ShieldCache)
Details:Destroy(Details.ShieldCache)
--set the time of the last run
Details222.GarbageCollector.lastCollectTime = Details._tempo
+72 -72
View File
@@ -4459,7 +4459,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
local schedule_table, schedule_id = unpack(Details.capture_schedules[i])
Details:CancelTimer(schedule_table)
end
wipe(Details.capture_schedules)
Details:Destroy(Details.capture_schedules)
end
function Details:CaptureTimeout (table)
@@ -4870,7 +4870,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
--reset spec cache if broadcaster requested
if (_detalhes.streamer_config.reset_spec_cache) then
wipe (_detalhes.cached_specs)
Details:Destroy (_detalhes.cached_specs)
end
end
@@ -4972,7 +4972,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.boss1_health_percent = 1
local dbm_mod, dbm_time = _detalhes.encounter_table.DBM_Mod, _detalhes.encounter_table.DBM_ModTime
wipe(_detalhes.encounter_table)
Details:Destroy(_detalhes.encounter_table)
_detalhes.encounter_table.phase = 1
@@ -5100,10 +5100,10 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:SendEvent("COMBAT_ENCOUNTER_END", nil, ...)
wipe(_detalhes.encounter_table)
wipe(dk_pets_cache.army)
wipe(dk_pets_cache.apoc)
wipe(empower_cache)
Details:Destroy(_detalhes.encounter_table)
Details:Destroy(dk_pets_cache.army)
Details:Destroy(dk_pets_cache.apoc)
Details:Destroy(empower_cache)
return true
end
@@ -5285,8 +5285,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
if (not OnRegenEnabled) then
wipe(bitfield_swap_cache)
wipe(empower_cache)
Details:Destroy(bitfield_swap_cache)
Details:Destroy(empower_cache)
_detalhes:DispatchAutoRunCode("on_leavecombat")
end
@@ -5601,7 +5601,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:DispatchAutoRunCode("on_groupchange")
wipe (Details.trusted_characters)
Details:Destroy (Details.trusted_characters)
C_Timer.After(5, Details.ScheduleSyncPlayerActorData)
end
@@ -5613,12 +5613,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details222.GarbageCollector.RestartInternalGarbageCollector(true)
Details:WipePets()
Details:SchedulePetUpdate(1)
wipe(Details.details_users)
Details:Destroy(Details.details_users)
Details:InstanceCall(Details.AdjustAlphaByContext)
Details:CheckSwitchOnLogon()
Details:SendEvent("GROUP_ONLEAVE")
Details:DispatchAutoRunCode("on_groupchange")
wipe(Details.trusted_characters)
Details:Destroy(Details.trusted_characters)
else
--player is still in a group
_detalhes:SchedulePetUpdate(2)
@@ -5716,8 +5716,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details.faction_id = 1
end
local startLoadTime = debugprofilestop()
--this function applies the Details.default_profile to Details object, this isn't yet the player profile which will load later
Details222.LoadSavedVariables.DefaultProfile()
@@ -5739,11 +5737,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
Details:StartAutoRun()
Details.isLoaded = true
local endLoadTime = debugprofilestop() - startLoadTime
if (Details.version_alpha_id and Details.version_alpha_id > 0 or true) then
Details:Msg("load time: " .. math.floor(endLoadTime) .. "ms", "alpha:", Details.version_alpha_id)
end
end
function Details.IsLoaded()
@@ -5807,33 +5800,39 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.listener:SetScript("OnEvent", _detalhes.OnEvent)
--logout function ~save ~logout
local saver = CreateFrame("frame", nil, UIParent)
saver:RegisterEvent("PLAYER_LOGOUT")
saver:SetScript("OnEvent", function(...)
---@type frame
local databaseSaver = CreateFrame("frame")
databaseSaver:RegisterEvent("PLAYER_LOGOUT")
databaseSaver:SetScript("OnEvent", function(...)
--safe guard logs and user settings
__details_backup = __details_backup or {
_exit_error = {},
_instance_backup = {},
}
---@type table
local exitErrors = __details_backup._exit_error
---@param text string the error to be logged
local addToExitErrors = function(text)
table.insert(exitErrors, 1, date() .. "|" .. text)
table.remove(exitErrors, 10)
end
---@type string current step of the logout process, used to log which is the current step when an error happens
local currentStep = ""
--save the time played on this class, run protected
local savePlayTimeClass, savePlayTimeError = pcall(function()
Details.SavePlayTimeOnClass()
end)
local savePlayTimeClass, savePlayTimeErrorText = pcall(function() Details.SavePlayTimeOnClass() end)
if (not savePlayTimeClass) then
addToExitErrors("Saving Play Time: " .. savePlayTimeError)
addToExitErrors("Saving Play Time: " .. savePlayTimeErrorText)
end
--SAVINGDATA = true
---@type table record a log of events that happened during the logout process
_detalhes_global.exit_log = {}
---@type table record errors that happened during the logout process
_detalhes_global.exit_errors = _detalhes_global.exit_errors or {}
currentStep = "Checking the framework integrity"
@@ -5845,8 +5844,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return
end
local saver_error = function(errortext)
--if the error log cause an error?
local logSaverError = function(errortext)
local writeLog = function()
_detalhes_global = _detalhes_global or {}
tinsert(_detalhes_global.exit_errors, 1, currentStep .. "|" .. date() .. "|" .. _detalhes.userversion .. "|" .. errortext .. "|" .. debugstack())
@@ -5856,52 +5854,54 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
xpcall(writeLog, addToExitErrors)
end
_detalhes.saver_error_func = saver_error
_detalhes.saver_error_func = logSaverError
_detalhes.logoff_saving_data = true
--close info window
--close breakdown window
if (_detalhes.CloseBreakdownWindow) then
tinsert(_detalhes_global.exit_log, "1 - Closing Janela Info.")
currentStep = "Fecha Janela Info"
xpcall(_detalhes.CloseBreakdownWindow, saver_error)
tinsert(_detalhes_global.exit_log, "1 - Closing Breakdown Window.")
currentStep = "Closing Breakdown Window"
xpcall(_detalhes.CloseBreakdownWindow, logSaverError)
end
--do not save window pos
if (_detalhes.tabela_instancias) then
local clearInstances = function()
currentStep = "Dealing With Instances"
tinsert(_detalhes_global.exit_log, "2 - Clearing user place from instances.")
tinsert(_detalhes_global.exit_log, "2 - Clearing user placed position from instance windows.")
for id, instance in _detalhes:ListInstances() do
if (id) then
tinsert(_detalhes_global.exit_log, " - " .. id .. " has baseFrame: " .. (instance.baseframe and "yes" or "no") .. ".")
if (instance.baseframe) then
instance.baseframe:SetUserPlaced (false)
instance.baseframe:SetDontSavePosition (true)
instance.baseframe:SetUserPlaced(false)
instance.baseframe:SetDontSavePosition(true)
end
end
end
end
xpcall(clearInstances, saver_error)
xpcall(clearInstances, logSaverError)
else
tinsert(_detalhes_global.exit_errors, 1, "not _detalhes.tabela_instancias")
tremove(_detalhes_global.exit_errors, 6)
addToExitErrors("not _detalhes.tabela_instancias")
end
--leave combat start save tables
--if is in combat during the logout, stop the combat
if (_detalhes.in_combat and _detalhes.tabela_vigente) then
tinsert(_detalhes_global.exit_log, "3 - Leaving current combat.")
currentStep = "Leaving Current Combat"
xpcall(_detalhes.SairDoCombate, saver_error)
xpcall(_detalhes.SairDoCombate, logSaverError)
_detalhes.can_panic_mode = true
end
--switch back to default, settings changed by automation
if (_detalhes.CheckSwitchOnLogon and _detalhes.tabela_instancias and _detalhes.tabela_instancias[1] and getmetatable(_detalhes.tabela_instancias[1])) then
tinsert(_detalhes_global.exit_log, "4 - Reversing switches.")
currentStep = "Check Switch on Logon"
xpcall(_detalhes.CheckSwitchOnLogon, saver_error)
xpcall(_detalhes.CheckSwitchOnLogon, logSaverError)
end
--user requested a wipe of the full configuration
if (_detalhes.wipe_full_config) then
tinsert(_detalhes_global.exit_log, "5 - Is a full config wipe.")
addToExitErrors("true: _detalhes.wipe_full_config")
@@ -5910,22 +5910,22 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
return
end
--save the config
--save the config
tinsert(_detalhes_global.exit_log, "6 - Saving Config.")
currentStep = "Saving Config"
xpcall(_detalhes.SaveConfig, saver_error)
xpcall(_detalhes.SaveConfig, logSaverError)
tinsert(_detalhes_global.exit_log, "7 - Saving Profiles.")
currentStep = "Saving Profile"
xpcall(_detalhes.SaveProfile, saver_error)
xpcall(_detalhes.SaveProfile, logSaverError)
--save the nicktag cache
--save the nicktag cache
tinsert(_detalhes_global.exit_log, "8 - Saving nicktag cache.")
local saveNicktabCache = function()
_detalhes_database.nick_tag_cache = Details.CopyTable(_detalhes_database.nick_tag_cache)
end
xpcall(saveNicktabCache, saver_error)
xpcall(saveNicktabCache, logSaverError)
end)
local eraNamedSpellsToID = {}
@@ -6052,30 +6052,30 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
function _detalhes:ClearParserCache() --~wipe
wipe(damage_cache)
wipe(damage_cache_pets)
wipe(damage_cache_petsOwners)
wipe(healing_cache)
wipe(energy_cache)
wipe(misc_cache)
wipe(misc_cache_pets)
wipe(misc_cache_petsOwners)
wipe(npcid_cache)
wipe(enemy_cast_cache)
wipe(empower_cache)
Details:Destroy(damage_cache)
Details:Destroy(damage_cache_pets)
Details:Destroy(damage_cache_petsOwners)
Details:Destroy(healing_cache)
Details:Destroy(energy_cache)
Details:Destroy(misc_cache)
Details:Destroy(misc_cache_pets)
Details:Destroy(misc_cache_petsOwners)
Details:Destroy(npcid_cache)
Details:Destroy(enemy_cast_cache)
Details:Destroy(empower_cache)
wipe(ignore_death_cache)
Details:Destroy(ignore_death_cache)
wipe(reflection_damage)
wipe(reflection_debuffs)
wipe(reflection_events)
wipe(reflection_auras)
wipe(reflection_dispels)
Details:Destroy(reflection_damage)
Details:Destroy(reflection_debuffs)
Details:Destroy(reflection_events)
Details:Destroy(reflection_auras)
Details:Destroy(reflection_dispels)
wipe(dk_pets_cache.army)
wipe(dk_pets_cache.apoc)
Details:Destroy(dk_pets_cache.army)
Details:Destroy(dk_pets_cache.apoc)
wipe(cacheAnything.paladin_vivaldi_blessings)
Details:Destroy(cacheAnything.paladin_vivaldi_blessings)
cacheAnything.track_hunter_frenzy = Details.combat_log.track_hunter_frenzy
@@ -6175,11 +6175,11 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
function _detalhes:UptadeRaidMembersCache()
wipe(raid_members_cache)
wipe(tanks_members_cache)
wipe(auto_regen_cache)
wipe(bitfield_swap_cache)
wipe(empower_cache)
Details:Destroy(raid_members_cache)
Details:Destroy(tanks_members_cache)
Details:Destroy(auto_regen_cache)
Details:Destroy(bitfield_swap_cache)
Details:Destroy(empower_cache)
local groupRoster = _detalhes.tabela_vigente.raid_roster
@@ -6332,7 +6332,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs --can be deprecated
_in_combat = _detalhes.in_combat
wipe(ignored_npcids)
Details:Destroy(ignored_npcids)
--fill it with the default npcs ignored
for npcId in pairs(_detalhes.default_ignored_npcs) do
+2 -2
View File
@@ -107,8 +107,8 @@
end
function timeMachine:Reiniciar()
table.wipe(self.tabelas[1])
table.wipe(self.tabelas[2])
Details:Destroy(self.tabelas[1])
Details:Destroy(self.tabelas[2])
self.tabelas = {{}, {}} --1 dano 2 cura
end
+3 -3
View File
@@ -354,7 +354,7 @@
for key, value in pairs(_table) do
temptable [string.lower(key)] = value
end
temptable, _table = table.wipe(_table), temptable
temptable, _table = Details:Destroy(_table), temptable
return _table
end
@@ -526,7 +526,7 @@
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
wipe (_detalhes.ToKFunctions)
Details:Destroy (_detalhes.ToKFunctions)
tinsert(_detalhes.ToKFunctions, _detalhes.NoToK)
tinsert(_detalhes.ToKFunctions, _detalhes.ToK)
@@ -659,7 +659,7 @@
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
wipe (_detalhes.ToKFunctions)
Details:Destroy (_detalhes.ToKFunctions)
tinsert(_detalhes.ToKFunctions, _detalhes.NoToK)
tinsert(_detalhes.ToKFunctions, _detalhes.ToK)