Renamed variables, code cleanup
This commit is contained in:
+303
-396
@@ -1,6 +1,6 @@
|
||||
|
||||
local _detalhes = _G.Details
|
||||
local Details = _detalhes
|
||||
local Details = _G.Details
|
||||
local Details = Details
|
||||
local tocName, Details222 = ...
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -17,25 +17,25 @@
|
||||
|
||||
local _InCombatLockdown = InCombatLockdown --wow api local
|
||||
|
||||
local classDamage = _detalhes.atributo_damage --details local
|
||||
local classHeal = _detalhes.atributo_heal --details local
|
||||
local classEnergy = _detalhes.atributo_energy --details local
|
||||
local classUtility = _detalhes.atributo_misc --details local
|
||||
local alvo_da_habilidade = _detalhes.alvo_da_habilidade --details local
|
||||
local habilidade_dano = _detalhes.habilidade_dano --details local
|
||||
local habilidade_cura = _detalhes.habilidade_cura --details local
|
||||
local container_habilidades = _detalhes.container_habilidades --details local
|
||||
local container_combatentes = _detalhes.container_combatentes --details local
|
||||
local classDamage = Details.atributo_damage --details local
|
||||
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 = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
local container_damage_target = Details.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--constants
|
||||
|
||||
local class_type_dano = _detalhes.atributos.dano
|
||||
local class_type_cura = _detalhes.atributos.cura
|
||||
local class_type_e_energy = _detalhes.atributos.e_energy
|
||||
local class_type_misc = _detalhes.atributos.misc
|
||||
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
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--core
|
||||
@@ -52,54 +52,50 @@
|
||||
end
|
||||
|
||||
--reaplica as tabelas no overall
|
||||
function _detalhes:RestauraOverallMetaTables()
|
||||
|
||||
function Details:RestoreOverallMetatables()
|
||||
local is_in_instance = select(1, IsInInstance())
|
||||
|
||||
local combate = _detalhes.tabela_overall
|
||||
local combate = Details.tabela_overall
|
||||
combate.overall_refreshed = true
|
||||
combate.hasSaved = true
|
||||
|
||||
combate.__call = _detalhes.call_combate
|
||||
combate.__call = Details.call_combate
|
||||
|
||||
_detalhes.refresh:r_combate (combate)
|
||||
Details.refresh:r_combate (combate)
|
||||
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_dano])
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_cura])
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_e_energy])
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_misc])
|
||||
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])
|
||||
|
||||
_detalhes.refresh:r_container_combatentes (combate [5]) --ghost container
|
||||
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}
|
||||
|
||||
for class_type, atributo in ipairs(todos_atributos) do
|
||||
for _, esta_classe in ipairs(atributo) do
|
||||
|
||||
local nome = esta_classe.nome
|
||||
|
||||
if (is_in_instance and _detalhes.remove_realm_from_name) then
|
||||
if (is_in_instance and Details.remove_realm_from_name) then
|
||||
esta_classe.displayName = nome:gsub(("%-.*"), "")
|
||||
elseif (_detalhes.remove_realm_from_name) then
|
||||
elseif (Details.remove_realm_from_name) then
|
||||
esta_classe.displayName = nome:gsub(("%-.*"), "") --"%*"
|
||||
else
|
||||
esta_classe.displayName = nome
|
||||
end
|
||||
|
||||
if (class_type == class_type_dano) then
|
||||
_detalhes.refresh:r_atributo_damage (esta_classe)
|
||||
Details.refresh:r_atributo_damage (esta_classe)
|
||||
|
||||
elseif (class_type == class_type_cura) then
|
||||
_detalhes.refresh:r_atributo_heal (esta_classe)
|
||||
Details.refresh:r_atributo_heal (esta_classe)
|
||||
|
||||
elseif (class_type == class_type_e_energy) then
|
||||
_detalhes.refresh:r_atributo_energy (esta_classe)
|
||||
Details.refresh:r_atributo_energy (esta_classe)
|
||||
|
||||
elseif (class_type == class_type_misc) then
|
||||
_detalhes.refresh:r_atributo_misc (esta_classe)
|
||||
|
||||
Details.refresh:r_atributo_misc (esta_classe)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -110,30 +106,29 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--reaplica indexes e metatables
|
||||
function _detalhes:RestauraMetaTables()
|
||||
function Details:RestoreMetatables()
|
||||
|
||||
_detalhes.refresh:r_atributo_custom()
|
||||
Details.refresh:r_atributo_custom()
|
||||
|
||||
--container de pets e hist�rico
|
||||
_detalhes.refresh:r_container_pets (_detalhes.tabela_pets)
|
||||
_detalhes.refresh:r_historico (_detalhes.tabela_historico)
|
||||
Details.refresh:r_container_pets (Details.tabela_pets)
|
||||
Details.refresh:r_historico (Details.tabela_historico)
|
||||
|
||||
--tabelas dos combates
|
||||
local combate_overall = _detalhes.tabela_overall
|
||||
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 tabelas_do_historico = _detalhes.tabela_historico.tabelas --atalho
|
||||
local tabelas_do_historico = Details.tabela_historico.tabelas --atalho
|
||||
|
||||
--recupera meta function
|
||||
for _, combat_table in ipairs(tabelas_do_historico) do
|
||||
combat_table.__call = _detalhes.call_combate
|
||||
combat_table.__call = Details.call_combate
|
||||
end
|
||||
|
||||
for i = #tabelas_do_historico-1, 1, -1 do
|
||||
@@ -159,7 +154,7 @@
|
||||
combate.hasSaved = true
|
||||
|
||||
--recupera a meta e indexes da tabela do combate
|
||||
_detalhes.refresh:r_combate (combate, combate_overall)
|
||||
Details.refresh:r_combate (combate, combate_overall)
|
||||
|
||||
--aumenta o tempo do combate do overall, seta as datas e os combates armazenados
|
||||
if (not overall_saved and combate.overall_added) then
|
||||
@@ -173,11 +168,11 @@
|
||||
end
|
||||
combate_overall.data_fim = combate.data_fim or combate_overall.data_fim
|
||||
--
|
||||
if (not _detalhes.tabela_overall.overall_enemy_name) then
|
||||
_detalhes.tabela_overall.overall_enemy_name = combate.is_boss and combate.is_boss.name or combate.enemy
|
||||
if (not Details.tabela_overall.overall_enemy_name) then
|
||||
Details.tabela_overall.overall_enemy_name = combate.is_boss and combate.is_boss.name or combate.enemy
|
||||
else
|
||||
if (_detalhes.tabela_overall.overall_enemy_name ~= (combate.is_boss and combate.is_boss.name or combate.enemy)) then
|
||||
_detalhes.tabela_overall.overall_enemy_name = "-- x -- x --"
|
||||
if (Details.tabela_overall.overall_enemy_name ~= (combate.is_boss and combate.is_boss.name or combate.enemy)) then
|
||||
Details.tabela_overall.overall_enemy_name = "-- x -- x --"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -188,14 +183,14 @@
|
||||
end
|
||||
|
||||
--recupera a meta e indexes dos 4 container
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_dano], overall_dano)
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_cura], overall_cura)
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_e_energy], overall_energy)
|
||||
_detalhes.refresh:r_container_combatentes (combate [class_type_misc], overall_misc)
|
||||
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)
|
||||
|
||||
--ghost container
|
||||
if (combate[5]) then
|
||||
_detalhes.refresh:r_container_combatentes (combate [5], combate_overall [5])
|
||||
Details.refresh:r_container_combatentes (combate [5], combate_overall [5])
|
||||
end
|
||||
|
||||
--tabela com os 4 tabelas de jogadores
|
||||
@@ -206,9 +201,9 @@
|
||||
|
||||
local nome = esta_classe.nome
|
||||
|
||||
if (is_in_instance and _detalhes.remove_realm_from_name) then
|
||||
if (is_in_instance and Details.remove_realm_from_name) then
|
||||
esta_classe.displayName = nome:gsub(("%-.*"), "")
|
||||
elseif (_detalhes.remove_realm_from_name) then
|
||||
elseif (Details.remove_realm_from_name) then
|
||||
esta_classe.displayName = nome:gsub(("%-.*"), "") --%*
|
||||
else
|
||||
esta_classe.displayName = nome
|
||||
@@ -276,465 +271,377 @@
|
||||
|
||||
end
|
||||
|
||||
function _detalhes:DoInstanceCleanup()
|
||||
function Details:DoInstanceCleanup()
|
||||
for _, instanceObject in ipairs(Details.tabela_instancias) do
|
||||
---@cast instanceObject instance
|
||||
|
||||
--normal instances
|
||||
for _, esta_instancia in ipairs(_detalhes.tabela_instancias) do
|
||||
|
||||
if (esta_instancia.StatusBar.left) then
|
||||
esta_instancia.StatusBarSaved = {
|
||||
["left"] = esta_instancia.StatusBar.left.real_name or "NONE",
|
||||
["center"] = esta_instancia.StatusBar.center.real_name or "NONE",
|
||||
["right"] = esta_instancia.StatusBar.right.real_name or "NONE",
|
||||
if (instanceObject.StatusBar.left) then
|
||||
instanceObject.StatusBarSaved = {
|
||||
["left"] = instanceObject.StatusBar.left.real_name or "NONE",
|
||||
["center"] = instanceObject.StatusBar.center.real_name or "NONE",
|
||||
["right"] = instanceObject.StatusBar.right.real_name or "NONE",
|
||||
}
|
||||
esta_instancia.StatusBarSaved.options = {
|
||||
[esta_instancia.StatusBarSaved.left] = esta_instancia.StatusBar.left.options,
|
||||
[esta_instancia.StatusBarSaved.center] = esta_instancia.StatusBar.center.options,
|
||||
[esta_instancia.StatusBarSaved.right] = esta_instancia.StatusBar.right.options
|
||||
instanceObject.StatusBarSaved.options = {
|
||||
[instanceObject.StatusBarSaved.left] = instanceObject.StatusBar.left.options,
|
||||
[instanceObject.StatusBarSaved.center] = instanceObject.StatusBar.center.options,
|
||||
[instanceObject.StatusBarSaved.right] = instanceObject.StatusBar.right.options
|
||||
}
|
||||
end
|
||||
|
||||
--erase all widgets frames
|
||||
|
||||
esta_instancia.scroll = nil
|
||||
esta_instancia.baseframe = nil
|
||||
esta_instancia.bgframe = nil
|
||||
esta_instancia.bgdisplay = nil
|
||||
esta_instancia.freeze_icon = nil
|
||||
esta_instancia.freeze_texto = nil
|
||||
esta_instancia.barras = nil
|
||||
esta_instancia.showing = nil
|
||||
esta_instancia.agrupada_a = nil
|
||||
esta_instancia.grupada_pos = nil
|
||||
esta_instancia.agrupado = nil
|
||||
esta_instancia._version = nil
|
||||
|
||||
esta_instancia.h_baixo = nil
|
||||
esta_instancia.h_esquerda = nil
|
||||
esta_instancia.h_direita = nil
|
||||
esta_instancia.h_cima = nil
|
||||
esta_instancia.break_snap_button = nil
|
||||
esta_instancia.alert = nil
|
||||
|
||||
esta_instancia.StatusBar = nil
|
||||
esta_instancia.consolidateFrame = nil
|
||||
esta_instancia.consolidateButtonTexture = nil
|
||||
esta_instancia.consolidateButton = nil
|
||||
esta_instancia.lastIcon = nil
|
||||
esta_instancia.firstIcon = nil
|
||||
|
||||
esta_instancia.menu_attribute_string = nil
|
||||
|
||||
esta_instancia.wait_for_plugin_created = nil
|
||||
esta_instancia.waiting_raid_plugin = nil
|
||||
esta_instancia.waiting_pid = nil
|
||||
|
||||
instanceObject.scroll = nil
|
||||
instanceObject.baseframe = nil
|
||||
instanceObject.bgframe = nil
|
||||
instanceObject.bgdisplay = nil
|
||||
instanceObject.freeze_icon = nil
|
||||
instanceObject.freeze_texto = nil
|
||||
instanceObject.barras = nil
|
||||
instanceObject.showing = nil
|
||||
instanceObject.agrupada_a = nil
|
||||
instanceObject.grupada_pos = nil
|
||||
instanceObject.agrupado = nil
|
||||
instanceObject._version = nil
|
||||
instanceObject.h_baixo = nil
|
||||
instanceObject.h_esquerda = nil
|
||||
instanceObject.h_direita = nil
|
||||
instanceObject.h_cima = nil
|
||||
instanceObject.break_snap_button = nil
|
||||
instanceObject.alert = nil
|
||||
instanceObject.StatusBar = nil
|
||||
instanceObject.consolidateFrame = nil
|
||||
instanceObject.consolidateButtonTexture = nil
|
||||
instanceObject.consolidateButton = nil
|
||||
instanceObject.lastIcon = nil
|
||||
instanceObject.firstIcon = nil
|
||||
instanceObject.menu_attribute_string = nil
|
||||
instanceObject.wait_for_plugin_created = nil
|
||||
instanceObject.waiting_raid_plugin = nil
|
||||
instanceObject.waiting_pid = nil
|
||||
end
|
||||
|
||||
--unused instances
|
||||
for _, esta_instancia in ipairs(_detalhes.unused_instances) do
|
||||
for _, instanceObject in ipairs(Details.unused_instances) do
|
||||
---@cast instanceObject instance
|
||||
|
||||
if (esta_instancia.StatusBar.left) then
|
||||
esta_instancia.StatusBarSaved = {
|
||||
["left"] = esta_instancia.StatusBar.left.real_name or "NONE",
|
||||
["center"] = esta_instancia.StatusBar.center.real_name or "NONE",
|
||||
["right"] = esta_instancia.StatusBar.right.real_name or "NONE",
|
||||
if (instanceObject.StatusBar.left) then
|
||||
instanceObject.StatusBarSaved = {
|
||||
["left"] = instanceObject.StatusBar.left.real_name or "NONE",
|
||||
["center"] = instanceObject.StatusBar.center.real_name or "NONE",
|
||||
["right"] = instanceObject.StatusBar.right.real_name or "NONE",
|
||||
}
|
||||
esta_instancia.StatusBarSaved.options = {
|
||||
[esta_instancia.StatusBarSaved.left] = esta_instancia.StatusBar.left.options,
|
||||
[esta_instancia.StatusBarSaved.center] = esta_instancia.StatusBar.center.options,
|
||||
[esta_instancia.StatusBarSaved.right] = esta_instancia.StatusBar.right.options
|
||||
instanceObject.StatusBarSaved.options = {
|
||||
[instanceObject.StatusBarSaved.left] = instanceObject.StatusBar.left.options,
|
||||
[instanceObject.StatusBarSaved.center] = instanceObject.StatusBar.center.options,
|
||||
[instanceObject.StatusBarSaved.right] = instanceObject.StatusBar.right.options
|
||||
}
|
||||
end
|
||||
|
||||
--erase all widgets frames
|
||||
esta_instancia.scroll = nil
|
||||
esta_instancia.baseframe = nil
|
||||
esta_instancia.bgframe = nil
|
||||
esta_instancia.bgdisplay = nil
|
||||
esta_instancia.freeze_icon = nil
|
||||
esta_instancia.freeze_texto = nil
|
||||
esta_instancia.barras = nil
|
||||
esta_instancia.showing = nil
|
||||
esta_instancia.agrupada_a = nil
|
||||
esta_instancia.grupada_pos = nil
|
||||
esta_instancia.agrupado = nil
|
||||
esta_instancia._version = nil
|
||||
|
||||
esta_instancia.h_baixo = nil
|
||||
esta_instancia.h_esquerda = nil
|
||||
esta_instancia.h_direita = nil
|
||||
esta_instancia.h_cima = nil
|
||||
esta_instancia.break_snap_button = nil
|
||||
esta_instancia.alert = nil
|
||||
|
||||
esta_instancia.StatusBar = nil
|
||||
esta_instancia.consolidateFrame = nil
|
||||
esta_instancia.consolidateButtonTexture = nil
|
||||
esta_instancia.consolidateButton = nil
|
||||
esta_instancia.lastIcon = nil
|
||||
esta_instancia.firstIcon = nil
|
||||
|
||||
esta_instancia.menu_attribute_string = nil
|
||||
|
||||
esta_instancia.wait_for_plugin_created = nil
|
||||
esta_instancia.waiting_raid_plugin = nil
|
||||
esta_instancia.waiting_pid = nil
|
||||
instanceObject.scroll = nil
|
||||
instanceObject.baseframe = nil
|
||||
instanceObject.bgframe = nil
|
||||
instanceObject.bgdisplay = nil
|
||||
instanceObject.freeze_icon = nil
|
||||
instanceObject.freeze_texto = nil
|
||||
instanceObject.barras = nil
|
||||
instanceObject.showing = nil
|
||||
instanceObject.agrupada_a = nil
|
||||
instanceObject.grupada_pos = nil
|
||||
instanceObject.agrupado = nil
|
||||
instanceObject._version = nil
|
||||
instanceObject.h_baixo = nil
|
||||
instanceObject.h_esquerda = nil
|
||||
instanceObject.h_direita = nil
|
||||
instanceObject.h_cima = nil
|
||||
instanceObject.break_snap_button = nil
|
||||
instanceObject.alert = nil
|
||||
instanceObject.StatusBar = nil
|
||||
instanceObject.consolidateFrame = nil
|
||||
instanceObject.consolidateButtonTexture = nil
|
||||
instanceObject.consolidateButton = nil
|
||||
instanceObject.lastIcon = nil
|
||||
instanceObject.firstIcon = nil
|
||||
instanceObject.menu_attribute_string = nil
|
||||
instanceObject.wait_for_plugin_created = nil
|
||||
instanceObject.waiting_raid_plugin = nil
|
||||
instanceObject.waiting_pid = nil
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:DoOwnerCleanup()
|
||||
local combats = _detalhes.tabela_historico.tabelas or {}
|
||||
local overall_added
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
tinsert(combats, _detalhes.tabela_overall)
|
||||
overall_added = true
|
||||
function Details:DoOwnerCleanup()
|
||||
---@type combat[]
|
||||
local combats = Details.tabela_historico.tabelas or {}
|
||||
local bOverallAdded
|
||||
if (not Details.overall_clear_logout) then
|
||||
tinsert(combats, Details.tabela_overall)
|
||||
bOverallAdded = true
|
||||
end
|
||||
|
||||
for index, combat in ipairs(combats) do
|
||||
for index, container in ipairs(combat) do
|
||||
for index, esta_classe in ipairs(container._ActorTable) do
|
||||
esta_classe.owner = nil
|
||||
---@cast combat combat
|
||||
for index, actorContainer in ipairs(combat) do
|
||||
---@cast actorContainer actorcontainer
|
||||
for index, actorObject in ipairs(actorContainer._ActorTable) do
|
||||
---@cast actorObject actor
|
||||
actorObject.owner = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (overall_added) then
|
||||
if (bOverallAdded) then
|
||||
tremove(combats, #combats)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:DoClassesCleanup()
|
||||
local combats = _detalhes.tabela_historico.tabelas or {}
|
||||
local overall_added
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
tinsert(combats, _detalhes.tabela_overall)
|
||||
overall_added = true
|
||||
function Details:DoClassesCleanup()
|
||||
---@type combat[]
|
||||
local combats = Details.tabela_historico.tabelas or {}
|
||||
local bOverallAdded
|
||||
if (not Details.overall_clear_logout) then
|
||||
tinsert(combats, Details.tabela_overall)
|
||||
bOverallAdded = true
|
||||
end
|
||||
|
||||
for index, combat in ipairs(combats) do
|
||||
for class_type, container in ipairs(combat) do
|
||||
for index, esta_classe in ipairs(container._ActorTable) do
|
||||
for index, combatObject in ipairs(combats) do
|
||||
for classType, actorContainer in ipairs(combatObject) do
|
||||
---@cast actorContainer actorcontainer
|
||||
for index, actorObject in ipairs(actorContainer._ActorTable) do
|
||||
---@cast actorObject actor
|
||||
|
||||
esta_classe.displayName = nil
|
||||
esta_classe.minha_barra = nil
|
||||
actorObject.displayName = nil
|
||||
actorObject.minha_barra = nil
|
||||
|
||||
if (class_type == class_type_dano) then
|
||||
_detalhes.clear:c_atributo_damage (esta_classe)
|
||||
elseif (class_type == class_type_cura) then
|
||||
_detalhes.clear:c_atributo_heal (esta_classe)
|
||||
elseif (class_type == class_type_e_energy) then
|
||||
_detalhes.clear:c_atributo_energy (esta_classe)
|
||||
elseif (class_type == class_type_misc) then
|
||||
_detalhes.clear:c_atributo_misc (esta_classe)
|
||||
if (classType == class_type_dano) then
|
||||
Details.clear:c_atributo_damage(actorObject)
|
||||
|
||||
elseif (classType == class_type_cura) then
|
||||
Details.clear:c_atributo_heal(actorObject)
|
||||
|
||||
elseif (classType == class_type_e_energy) then
|
||||
Details.clear:c_atributo_energy(actorObject)
|
||||
|
||||
elseif (classType == class_type_misc) then
|
||||
Details.clear:c_atributo_misc(actorObject)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (overall_added) then
|
||||
if (bOverallAdded) then
|
||||
tremove(combats, #combats)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:DoContainerCleanup()
|
||||
local combats = _detalhes.tabela_historico.tabelas or {}
|
||||
local overall_added
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
tinsert(combats, _detalhes.tabela_overall)
|
||||
overall_added = true
|
||||
function Details:DoContainerCleanup()
|
||||
---@type combat[]
|
||||
local combats = Details.tabela_historico.tabelas or {}
|
||||
local bOverallAdded
|
||||
if (not Details.overall_clear_logout) then
|
||||
tinsert(combats, Details.tabela_overall)
|
||||
bOverallAdded = true
|
||||
end
|
||||
|
||||
for index, combat in ipairs(combats) do
|
||||
_detalhes.clear:c_combate (combat)
|
||||
Details.clear:c_combate(combat)
|
||||
for index, container in ipairs(combat) do
|
||||
_detalhes.clear:c_container_combatentes (container)
|
||||
Details.clear:c_container_combatentes(container)
|
||||
end
|
||||
end
|
||||
|
||||
if (overall_added) then
|
||||
if (bOverallAdded) then
|
||||
tremove(combats, #combats)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:DoContainerIndexCleanup()
|
||||
local combats = _detalhes.tabela_historico.tabelas or {}
|
||||
local overall_added
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
tinsert(combats, _detalhes.tabela_overall)
|
||||
overall_added = true
|
||||
function Details:DoContainerIndexCleanup()
|
||||
---@type combat[]
|
||||
local combats = Details.tabela_historico.tabelas or {}
|
||||
local bOverallAdded
|
||||
if (not Details.overall_clear_logout) then
|
||||
tinsert(combats, Details.tabela_overall)
|
||||
bOverallAdded = true
|
||||
end
|
||||
|
||||
for index, combat in ipairs(combats) do
|
||||
for index, container in ipairs(combat) do
|
||||
_detalhes.clear:c_container_combatentes_index (container)
|
||||
Details.clear:c_container_combatentes_index(container)
|
||||
end
|
||||
end
|
||||
|
||||
if (overall_added) then
|
||||
if (bOverallAdded) then
|
||||
tremove(combats, #combats)
|
||||
end
|
||||
end
|
||||
|
||||
--limpa indexes, metatables e shadows
|
||||
function _detalhes:PrepareTablesForSave()
|
||||
|
||||
_detalhes.clear_ungrouped = true
|
||||
function Details:PrepareTablesForSave()
|
||||
Details.clear_ungrouped = true
|
||||
|
||||
--clear instances
|
||||
_detalhes:DoInstanceCleanup()
|
||||
_detalhes:DoClassesCleanup() --aumentou 1 combat
|
||||
_detalhes:DoContainerCleanup() --aumentou 1 combat
|
||||
Details:DoInstanceCleanup()
|
||||
Details:DoClassesCleanup() --aumentou 1 combat
|
||||
Details:DoContainerCleanup() --aumentou 1 combat
|
||||
|
||||
--clear combats
|
||||
local tabelas_de_combate = {}
|
||||
local historico_tabelas = _detalhes.tabela_historico.tabelas or {}
|
||||
local combatTables = {}
|
||||
---@type combat[]
|
||||
local combatHistoryTable = Details.tabela_historico.tabelas or {}
|
||||
|
||||
--remove os segmentos de trash
|
||||
for i = #historico_tabelas, 1, -1 do
|
||||
local combate = historico_tabelas [i]
|
||||
if (combate:IsTrash()) then
|
||||
table.remove (historico_tabelas, i)
|
||||
for i = #combatHistoryTable, 1, -1 do
|
||||
---@type combat
|
||||
local combateObject = combatHistoryTable[i]
|
||||
if (combateObject:IsTrash()) then
|
||||
table.remove(combatHistoryTable, i)
|
||||
Details:Destroy(combatHistoryTable)
|
||||
end
|
||||
end
|
||||
|
||||
--remove os segmentos > que o limite permitido para salvar
|
||||
if (_detalhes.segments_amount_to_save and _detalhes.segments_amount_to_save < _detalhes.segments_amount) then
|
||||
for i = _detalhes.segments_amount, _detalhes.segments_amount_to_save+1, -1 do
|
||||
if (_detalhes.tabela_historico.tabelas [i]) then
|
||||
table.remove (_detalhes.tabela_historico.tabelas, i)
|
||||
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
|
||||
|
||||
--tabela do combate atual
|
||||
local tabela_atual = _detalhes.tabela_vigente or _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
|
||||
--limpa a tabela overall
|
||||
if (_detalhes.overall_clear_logout) then
|
||||
_detalhes.tabela_overall = nil
|
||||
if (Details.overall_clear_logout) then
|
||||
Details.tabela_overall = nil
|
||||
_detalhes_database.tabela_overall = nil
|
||||
else
|
||||
local _combate = _detalhes.tabela_overall
|
||||
---@type combat
|
||||
local overallCombatObject = Details.tabela_overall
|
||||
|
||||
_combate.previous_combat = nil
|
||||
local todos_atributos = {_combate [class_type_dano] or {}, _combate [class_type_cura] or {}, _combate [class_type_e_energy] or {}, _combate [class_type_misc] or {}}
|
||||
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]
|
||||
}
|
||||
|
||||
for class_type, _tabela in ipairs(todos_atributos) do
|
||||
local conteudo = _tabela._ActorTable
|
||||
|
||||
--Limpa tabelas que n�o estejam em grupo
|
||||
if (conteudo) then
|
||||
if (_detalhes.clear_ungrouped) then
|
||||
--if (not _detalhes.clear_ungrouped) then
|
||||
local _iter = {index = 1, data = conteudo[1], cleaned = 0} --._ActorTable[1] para pegar o primeiro index
|
||||
|
||||
while (_iter.data) do --search key: ~deletar ~apagar
|
||||
local can_erase = true
|
||||
|
||||
if (_iter.data.grupo or _iter.data.boss or _iter.data.boss_fight_component or _iter.data.pvp_component or _iter.data.fight_component) then
|
||||
can_erase = false
|
||||
else
|
||||
|
||||
local owner = _iter.data.owner
|
||||
if (owner) then
|
||||
local owner_actor = _combate [class_type]._NameIndexTable [owner.nome]
|
||||
if (owner_actor) then
|
||||
local owner_actor = _combate [class_type]._ActorTable [owner_actor]
|
||||
if (owner_actor) then
|
||||
if (owner.grupo or owner.boss or owner.boss_fight_component or owner.fight_component) then
|
||||
can_erase = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (can_erase) then
|
||||
_table_remove(conteudo, _iter.index)
|
||||
_iter.cleaned = _iter.cleaned + 1
|
||||
_iter.data = conteudo [_iter.index]
|
||||
else
|
||||
_iter.index = _iter.index + 1
|
||||
_iter.data = conteudo [_iter.index]
|
||||
end
|
||||
--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
|
||||
|
||||
if (_iter.cleaned > 0) then
|
||||
fullRemap(_tabela)
|
||||
--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 _, _tabela in ipairs(historico_tabelas) do
|
||||
tabelas_de_combate [#tabelas_de_combate+1] = _tabela
|
||||
for i, combatObject in ipairs(combatHistoryTable) do
|
||||
---@cast combatObject combat
|
||||
combatTables[#combatTables+1] = combatObject
|
||||
end
|
||||
|
||||
for tabela_index, _combate in ipairs(tabelas_de_combate) do
|
||||
|
||||
--this is a cleanup for combat stored in the segment list
|
||||
for combatIndex, combatObject in ipairs(combatTables) do
|
||||
--limpa a tabela do grafico
|
||||
if (_detalhes.clear_graphic) then
|
||||
_combate.TimeData = {}
|
||||
if (Details.clear_graphic) then
|
||||
combatObject.TimeData = {}
|
||||
end
|
||||
|
||||
--limpa a referencia do ultimo combate
|
||||
_combate.previous_combat = nil
|
||||
combatObject.previous_combat = nil
|
||||
|
||||
local container_dano = _combate [class_type_dano] or {}
|
||||
local container_cura = _combate [class_type_cura] or {}
|
||||
local container_e_energy = _combate [class_type_e_energy] or {}
|
||||
local container_misc = _combate [class_type_misc] or {}
|
||||
|
||||
local todos_atributos = {container_dano, container_cura, container_e_energy, container_misc}
|
||||
|
||||
local IsBossEncounter = _combate.is_boss
|
||||
if (IsBossEncounter) then
|
||||
if (_combate.pvp) then
|
||||
IsBossEncounter = false
|
||||
local bIsBossEncounter = combatObject.is_boss
|
||||
if (bIsBossEncounter) then
|
||||
if (combatObject.pvp) then
|
||||
bIsBossEncounter = false
|
||||
end
|
||||
end
|
||||
|
||||
if (not _combate.is_mythic_dungeon_segment) then
|
||||
for class_type, _tabela in ipairs(todos_atributos) do
|
||||
|
||||
local conteudo = _tabela._ActorTable
|
||||
|
||||
--Limpa tabelas que n�o estejam em grupo
|
||||
if (conteudo) then
|
||||
|
||||
if (_detalhes.clear_ungrouped) then
|
||||
--n�o deleta dummies e actors de fora do grupo
|
||||
--if (not _detalhes.clear_ungrouped) then
|
||||
|
||||
local _iter = {index = 1, data = conteudo[1], cleaned = 0} --._ActorTable[1] para pegar o primeiro index
|
||||
|
||||
while (_iter.data) do --search key: ~deletar ~apagar
|
||||
local can_erase = true
|
||||
|
||||
if (_iter.data.grupo or _iter.data.boss or _iter.data.boss_fight_component or IsBossEncounter or _iter.data.pvp_component or _iter.data.fight_component) then
|
||||
can_erase = false
|
||||
else
|
||||
local owner = _iter.data.owner
|
||||
if (owner) then
|
||||
local owner_actor = _combate [class_type]._NameIndexTable [owner.nome]
|
||||
if (owner_actor) then
|
||||
local owner_actor = _combate [class_type]._ActorTable [owner_actor]
|
||||
if (owner_actor) then
|
||||
if (owner.grupo or owner.boss or owner.boss_fight_component or owner.fight_component) then
|
||||
can_erase = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (can_erase) then
|
||||
|
||||
if (not _iter.data.owner) then --pet
|
||||
local myself = _iter.data
|
||||
|
||||
if (myself.tipo == class_type_dano or myself.tipo == class_type_cura and _combate.totals [myself.tipo] and myself.total) then
|
||||
_combate.totals [myself.tipo] = _combate.totals [myself.tipo] - (myself.total or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] = _combate.totals_grupo [myself.tipo] - (myself.total or 0)
|
||||
end
|
||||
|
||||
elseif (myself.tipo == class_type_e_energy and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] [myself.powertype] and myself.total) then
|
||||
_combate.totals [myself.tipo] [myself.powertype] = _combate.totals [myself.tipo] [myself.powertype] - (myself.total or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] [myself.powertype] = _combate.totals_grupo [myself.tipo] [myself.powertype] - (myself.total or 0)
|
||||
end
|
||||
|
||||
elseif (myself.tipo == class_type_misc) then
|
||||
if (myself.cc_break and _combate.totals[myself.tipo] and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["cc_break"]) then
|
||||
_combate.totals [myself.tipo] ["cc_break"] = _combate.totals [myself.tipo] ["cc_break"] - (myself.cc_break or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["cc_break"] = _combate.totals_grupo [myself.tipo] ["cc_break"] - (myself.cc_break or 0)
|
||||
end
|
||||
end
|
||||
if (myself.ress and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["ress"]) then
|
||||
_combate.totals [myself.tipo] ["ress"] = _combate.totals [myself.tipo] ["ress"] - (myself.ress or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["ress"] = _combate.totals_grupo [myself.tipo] ["ress"] - (myself.ress or 0)
|
||||
end
|
||||
end
|
||||
--n�o precisa diminuir o total dos buffs e debuffs
|
||||
if (myself.cooldowns_defensive and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["cooldowns_defensive"]) then
|
||||
_combate.totals [myself.tipo] ["cooldowns_defensive"] = _combate.totals [myself.tipo] ["cooldowns_defensive"] - (myself.cooldowns_defensive or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["cooldowns_defensive"] = _combate.totals_grupo [myself.tipo] ["cooldowns_defensive"] - (myself.cooldowns_defensive or 0)
|
||||
end
|
||||
end
|
||||
if (myself.interrupt and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["interrupt"]) then
|
||||
_combate.totals [myself.tipo] ["interrupt"] = _combate.totals [myself.tipo] ["interrupt"] - (myself.interrupt or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["interrupt"] = _combate.totals_grupo [myself.tipo] ["interrupt"] - (myself.interrupt or 0)
|
||||
end
|
||||
end
|
||||
if (myself.dispell and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["dispell"]) then
|
||||
_combate.totals [myself.tipo] ["dispell"] = _combate.totals [myself.tipo] ["dispell"] - (myself.dispell or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["dispell"] = _combate.totals_grupo [myself.tipo] ["dispell"] - (myself.dispell or 0)
|
||||
end
|
||||
end
|
||||
if (myself.dead and _combate.totals [myself.tipo] and _combate.totals [myself.tipo] ["dead"]) then
|
||||
_combate.totals [myself.tipo] ["dead"] = _combate.totals [myself.tipo] ["dead"] - (myself.dead or 0)
|
||||
if (myself.grupo) then
|
||||
_combate.totals_grupo [myself.tipo] ["dead"] = _combate.totals_grupo [myself.tipo] ["dead"] - (myself.dead or 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_table_remove(conteudo, _iter.index)
|
||||
_iter.cleaned = _iter.cleaned + 1
|
||||
_iter.data = conteudo [_iter.index]
|
||||
else
|
||||
_iter.index = _iter.index + 1
|
||||
_iter.data = conteudo [_iter.index]
|
||||
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
|
||||
|
||||
if (_iter.cleaned > 0) then
|
||||
fullRemap(_tabela)
|
||||
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 is mythic dungeon segment
|
||||
end
|
||||
end
|
||||
|
||||
--panic mode
|
||||
if (_detalhes.segments_panic_mode and _detalhes.can_panic_mode) then
|
||||
if (_detalhes.tabela_vigente.is_boss) then
|
||||
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
|
||||
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 (_detalhes.data_cleanup_logout) then
|
||||
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
|
||||
_detalhes.tabela_overall = nil
|
||||
_detalhes_database.tabela_overall = nil
|
||||
end
|
||||
if (Details.data_cleanup_logout) then
|
||||
Details.tabela_historico = Details.historico:NovoHistorico()
|
||||
Details.tabela_overall = nil
|
||||
_detalhes_database.tabela_overall = nil
|
||||
end
|
||||
|
||||
--clear customs
|
||||
_detalhes.clear:c_atributo_custom()
|
||||
Details.clear:c_atributo_custom()
|
||||
|
||||
--clear owners
|
||||
_detalhes:DoOwnerCleanup()
|
||||
Details:DoOwnerCleanup()
|
||||
|
||||
--cleaer container indexes
|
||||
_detalhes:DoContainerIndexCleanup()
|
||||
--cleer container indexes
|
||||
Details:DoContainerIndexCleanup()
|
||||
end
|
||||
|
||||
function _detalhes:reset_window(instancia)
|
||||
function Details:reset_window(instancia)
|
||||
if (instancia.segmento == -1) then
|
||||
instancia.showing[instancia.atributo].need_refresh = true
|
||||
instancia.v_barras = true
|
||||
|
||||
Reference in New Issue
Block a user