Renamed variables, code cleanup
This commit is contained in:
@@ -446,6 +446,23 @@
|
||||
---@field damage_taken number amount of damage the actor took durent the segment
|
||||
---@field damage_from table<string, boolean> store the name of the actors which damaged the actor, format: [actorName] = true
|
||||
|
||||
---@class actorheal : actor
|
||||
|
||||
---@class actorenergy : actor
|
||||
|
||||
---@class actorutility : actor
|
||||
---@field cc_break number amount of times the actor broke a cc
|
||||
---@field dispell number amount of times the actor dispelled a buff or debuff
|
||||
---@field interrupt number amount of times the actor interrupted a spell
|
||||
---@field ress number amount of times the actor ressed a player
|
||||
---@field dead number amount of times the actor died
|
||||
---@field cooldowns_defensive number amount of times the actor used a defensive cooldown
|
||||
---@field buff_uptime number amount of time the actor had a buff
|
||||
---@field debuff_uptime number amount of time the actor had a debuff
|
||||
--interrupt_targets interrupt_spells interrompeu_oque
|
||||
--cc_break_targets cc_break_spells cc_break_oque
|
||||
|
||||
|
||||
---@class segmentid : number
|
||||
---@class instanceid : number
|
||||
---@class attributeid : number
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
|
||||
Details.gameVersionPrefix = gameVersionPrefix
|
||||
|
||||
pcall(function() Details.version_alpha_id = tonumber(Details.curseforgeVersion:match("%-(%d+)%-")) end)
|
||||
|
||||
--WD 10288 RELEASE 10.0.2
|
||||
--WD 10288 ALPHA 21 10.0.2
|
||||
function Details.GetVersionString()
|
||||
@@ -90,6 +92,7 @@
|
||||
Details222.GarbageCollector = {}
|
||||
Details222.BreakdownWindow = {}
|
||||
Details222.PlayerStats = {}
|
||||
Details222.LoadSavedVariables = {}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--initialization stuff
|
||||
|
||||
+15
-15
@@ -552,22 +552,22 @@
|
||||
-- update tooltip function --
|
||||
|
||||
if (self.id) then
|
||||
local school = _detalhes.spell_school_cache [self.nome]
|
||||
local school = _detalhes.spell_school_cache[self.nome]
|
||||
if (school) then
|
||||
local school_color = _detalhes.school_colors [school]
|
||||
if (not school_color) then
|
||||
school_color = _detalhes.school_colors ["unknown"]
|
||||
local schoolColor = Details.spells_school[school]
|
||||
if (not schoolColor) then
|
||||
schoolColor = Details.spells_school[1]
|
||||
end
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(school_color)
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(schoolColor.decimals)
|
||||
else
|
||||
local color = _detalhes.school_colors ["unknown"]
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(color)
|
||||
local schoolColor = Details.spells_school[1]
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(schoolColor.decimals)
|
||||
end
|
||||
else
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
|
||||
end
|
||||
|
||||
self:RefreshBarra2 (row, instance, previous_table, is_forced, row_value, index, row_container)
|
||||
self:RefreshBarra2(row, instance, previous_table, is_forced, row_value, index, row_container)
|
||||
|
||||
end
|
||||
|
||||
@@ -644,16 +644,16 @@
|
||||
|
||||
if (from_resize) then
|
||||
if (self.id) then
|
||||
local school = _detalhes.spell_school_cache [self.nome]
|
||||
local school = _detalhes.spell_school_cache[self.nome]
|
||||
if (school) then
|
||||
local school_color = _detalhes.school_colors [school]
|
||||
if (not school_color) then
|
||||
school_color = _detalhes.school_colors ["unknown"]
|
||||
local schoolColor = Details.spells_school[school]
|
||||
if (not schoolColor) then
|
||||
schoolColor = Details.spells_school[1]
|
||||
end
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(school_color)
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(schoolColor.decimals)
|
||||
else
|
||||
local color = _detalhes.school_colors ["unknown"]
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(color)
|
||||
local schoolColor = Details.spells_school[1]
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(schoolColor.decimals)
|
||||
end
|
||||
else
|
||||
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
|
||||
|
||||
@@ -1677,12 +1677,12 @@ end
|
||||
end
|
||||
|
||||
local _, _, icon = GetSpellInfo(self.damage_spellid)
|
||||
local school_color = Details.school_colors [self.spellschool]
|
||||
if (not school_color) then
|
||||
school_color = Details.school_colors ["unknown"]
|
||||
local spellSchoolColor = Details.spells_school[self.spellschool] and Details.spells_school[self.spellschool].decimals
|
||||
if (not spellSchoolColor) then
|
||||
spellSchoolColor = Details.spells_school[1]
|
||||
end
|
||||
|
||||
Details:SetBarColors(thisLine, instancia, unpack(school_color))
|
||||
Details:SetBarColors(thisLine, instancia, unpack(spellSchoolColor))
|
||||
|
||||
thisLine.icone_classe:SetTexture(icon)
|
||||
thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
|
||||
|
||||
+124
-206
@@ -1,209 +1,127 @@
|
||||
-- damage ability file
|
||||
local _detalhes = _G.Details
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--local pointers
|
||||
local ipairs = ipairs
|
||||
local pairs = pairs
|
||||
local _UnitAura = UnitAura
|
||||
local Details = _G.Details
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
local classDamageSpellTable = Details.habilidade_dano
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--constants
|
||||
local habilidade_dano = _detalhes.habilidade_dano
|
||||
local _recording_ability_with_buffs = false
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--internals
|
||||
--_detalhes.habilidade_dano:NovaTabela(spellId)
|
||||
|
||||
function Details222.DamageSpells.CreateSpellTable(spellId, cleuToken)
|
||||
return habilidade_dano:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
|
||||
--cleu token is used to check if the spell is a dot
|
||||
function Details.CreateSpellTable(spellId, cleuToken)
|
||||
return habilidade_dano:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
|
||||
function habilidade_dano:NovaTabela(id, link, token)
|
||||
local _newDamageSpell = {
|
||||
total = 0, --total damage
|
||||
counter = 0, --counter
|
||||
id = id, --spellid
|
||||
successful_casted = 0, --successful casted times (only for enemies)
|
||||
|
||||
--min damage made by normal hits
|
||||
n_min = 0,
|
||||
--max damage made by normal hits
|
||||
n_max = 0,
|
||||
--amount normal hits
|
||||
n_amt = 0,
|
||||
--total damage of normal hits
|
||||
n_total = 0,
|
||||
|
||||
--critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_total = 0,
|
||||
|
||||
--glacing hits
|
||||
g_amt = 0,
|
||||
g_dmg = 0,
|
||||
|
||||
--resisted
|
||||
r_amt = 0,
|
||||
r_dmg = 0,
|
||||
|
||||
--blocked
|
||||
b_amt = 0,
|
||||
b_dmg = 0,
|
||||
|
||||
--obsorved
|
||||
a_amt = 0,
|
||||
a_dmg = 0,
|
||||
|
||||
targets = {},
|
||||
extra = {}
|
||||
}
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
_detalhes:SpellIsDot (id)
|
||||
end
|
||||
|
||||
return _newDamageSpell
|
||||
end
|
||||
|
||||
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
|
||||
self.counter = self.counter + 1
|
||||
self [missType] = (self [missType] or 0) + 1
|
||||
|
||||
self.targets [nome] = self.targets [nome] or 0
|
||||
end
|
||||
|
||||
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected)
|
||||
|
||||
self.total = self.total + amount
|
||||
|
||||
--if is reflected add the spellId into the extra table
|
||||
--this is too show which spells has been reflected
|
||||
if (isreflected) then
|
||||
self.extra [isreflected] = (self.extra [isreflected] or 0) + amount
|
||||
end
|
||||
|
||||
self.targets [nome] = (self.targets [nome] or 0) + amount
|
||||
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (resisted and resisted > 0) then
|
||||
self.r_dmg = self.r_dmg+amount --tabela.total � o total de dano
|
||||
self.r_amt = self.r_amt+1 --tabela.total � o total de dano
|
||||
end
|
||||
|
||||
if (blocked and blocked > 0) then
|
||||
self.b_dmg = self.b_dmg+amount --amount � o total de dano
|
||||
self.b_amt = self.b_amt+1 --amount � o total de dano
|
||||
end
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.a_dmg = self.a_dmg+amount --amount � o total de dano
|
||||
self.a_amt = self.a_amt+1 --amount � o total de dano
|
||||
end
|
||||
|
||||
if (glacing) then
|
||||
self.g_dmg = self.g_dmg+amount --amount � o total de dano
|
||||
self.g_amt = self.g_amt+1 --amount � o total de dano
|
||||
|
||||
elseif (critical) then
|
||||
self.c_total = self.c_total+amount --amount � o total de dano
|
||||
self.c_amt = self.c_amt+1 --amount � o total de dano
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
|
||||
else
|
||||
self.n_total = self.n_total+amount
|
||||
self.n_amt = self.n_amt+1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if (_recording_ability_with_buffs) then
|
||||
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
|
||||
|
||||
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
|
||||
|
||||
local SpellBuffDetails = self.BuffTable
|
||||
if (not SpellBuffDetails) then
|
||||
self.BuffTable = {}
|
||||
SpellBuffDetails = self.BuffTable
|
||||
end
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
--precisa ver se ele tinha na hora que aplicou
|
||||
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
|
||||
if (SoloDebuffPower) then
|
||||
local ThisDebuff = SoloDebuffPower [self.id]
|
||||
if (ThisDebuff) then
|
||||
local ThisDebuffOnTarget = ThisDebuff [serial]
|
||||
if (ThisDebuffOnTarget) then
|
||||
for index, buff_name in ipairs(ThisDebuffOnTarget.buffs) do
|
||||
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [buff_name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
for BuffName, _ in pairs(_detalhes.Buffs.BuffsTable) do
|
||||
local name = _UnitAura ("player", BuffName)
|
||||
if (name ~= nil) then
|
||||
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--core
|
||||
|
||||
function _detalhes:UpdateDamageAbilityGears()
|
||||
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
|
||||
end
|
||||
|
||||
--[[
|
||||
if (isoffhand) then
|
||||
self.off_amt = self.off_amt + 1
|
||||
self.off_dmg = self.off_dmg + amount
|
||||
else
|
||||
self.main_amt = self.main_amt + 1
|
||||
function Details222.DamageSpells.CreateSpellTable(spellId, cleuToken)
|
||||
return classDamageSpellTable:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
--]]
|
||||
|
||||
--cleu token is used to check if the spell is a dot
|
||||
function Details.CreateSpellTable(spellId, cleuToken)
|
||||
return classDamageSpellTable:NovaTabela(spellId, nil, cleuToken)
|
||||
end
|
||||
|
||||
---create a spelltable to store the damage of a spell
|
||||
---@param spellId number
|
||||
---@param link nil
|
||||
---@param token string
|
||||
---@return spelltable
|
||||
function classDamageSpellTable:NovaTabela(spellId, link, token)
|
||||
---@type spelltable
|
||||
local spellTable = {
|
||||
total = 0, --total damage
|
||||
counter = 0, --counter
|
||||
id = spellId, --spellid
|
||||
successful_casted = 0, --successful casted times (only for enemies)
|
||||
|
||||
--min damage made by normal hits
|
||||
n_min = 0,
|
||||
--max damage made by normal hits
|
||||
n_max = 0,
|
||||
--amount normal hits
|
||||
n_amt = 0,
|
||||
--total damage of normal hits
|
||||
n_total = 0,
|
||||
|
||||
--critical hits
|
||||
c_min = 0,
|
||||
c_max = 0,
|
||||
c_amt = 0,
|
||||
c_total = 0,
|
||||
|
||||
--glacing hits
|
||||
g_amt = 0,
|
||||
g_dmg = 0,
|
||||
|
||||
--resisted
|
||||
r_amt = 0,
|
||||
r_dmg = 0,
|
||||
|
||||
--blocked
|
||||
b_amt = 0,
|
||||
b_dmg = 0,
|
||||
|
||||
--obsorved
|
||||
a_amt = 0,
|
||||
a_dmg = 0,
|
||||
|
||||
targets = {},
|
||||
extra = {}
|
||||
}
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
Details:SpellIsDot(spellId)
|
||||
end
|
||||
|
||||
return spellTable
|
||||
end
|
||||
|
||||
function classDamageSpellTable:AddMiss(serial, targetName, targetFlags, sourceName, missType)
|
||||
self.counter = self.counter + 1
|
||||
self[missType] = (self[missType] or 0) + 1
|
||||
self.targets[targetName] = self.targets[targetName] or 0
|
||||
end
|
||||
|
||||
function classDamageSpellTable:Add(targetSerial, targetName, targetFlags, amount, sourceName, resisted, blocked, absorbed, critical, glacing, token, bIsOffhand, bIsReflected)
|
||||
self.total = self.total + amount
|
||||
|
||||
--when reflected add the spellId into the extra table to show which spells has reflected
|
||||
if (bIsReflected) then
|
||||
self.extra[bIsReflected] = (self.extra[bIsReflected] or 0) + amount
|
||||
end
|
||||
|
||||
self.targets[targetName] = (self.targets[targetName] or 0) + amount
|
||||
self.counter = self.counter + 1
|
||||
|
||||
if (resisted and resisted > 0) then
|
||||
self.r_dmg = self.r_dmg + amount
|
||||
self.r_amt = self.r_amt + 1
|
||||
end
|
||||
|
||||
if (blocked and blocked > 0) then
|
||||
self.b_dmg = self.b_dmg + amount
|
||||
self.b_amt = self.b_amt + 1
|
||||
end
|
||||
|
||||
if (absorbed and absorbed > 0) then
|
||||
self.a_dmg = self.a_dmg + amount
|
||||
self.a_amt = self.a_amt + 1
|
||||
end
|
||||
|
||||
if (glacing) then
|
||||
self.g_dmg = self.g_dmg + amount
|
||||
self.g_amt = self.g_amt + 1
|
||||
|
||||
elseif (critical) then
|
||||
self.c_total = self.c_total + amount
|
||||
self.c_amt = self.c_amt + 1
|
||||
if (amount > self.c_max) then
|
||||
self.c_max = amount
|
||||
end
|
||||
if (self.c_min > amount or self.c_min == 0) then
|
||||
self.c_min = amount
|
||||
end
|
||||
|
||||
else
|
||||
self.n_total = self.n_total + amount
|
||||
self.n_amt = self.n_amt + 1
|
||||
if (amount > self.n_max) then
|
||||
self.n_max = amount
|
||||
end
|
||||
if (self.n_min > amount or self.n_min == 0) then
|
||||
self.n_min = amount
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -12,10 +12,10 @@ local addonName, Details222 = ...
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--constants
|
||||
|
||||
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
|
||||
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
|
||||
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
|
||||
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
|
||||
local classDamage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
|
||||
local classHeal = _detalhes.container_type.CONTAINER_HEAL_CLASS
|
||||
local classEnergy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
|
||||
local classUtility = _detalhes.container_type.CONTAINER_MISC_CLASS
|
||||
local habilidade_dano = _detalhes.habilidade_dano
|
||||
local habilidade_cura = _detalhes.habilidade_cura
|
||||
local habilidade_e_energy = _detalhes.habilidade_e_energy
|
||||
@@ -44,7 +44,6 @@ local addonName, Details222 = ...
|
||||
return self._ActorTable[spellId]
|
||||
end
|
||||
|
||||
|
||||
---return a table containing keys as spellid and value as spelltable
|
||||
---@return table<number, table>
|
||||
function container_habilidades:GetRawSpellTable()
|
||||
@@ -113,16 +112,16 @@ local addonName, Details222 = ...
|
||||
end
|
||||
|
||||
function container_habilidades:FuncaoDeCriacao (tipo)
|
||||
if (tipo == container_damage) then
|
||||
if (tipo == classDamage) then
|
||||
return habilidade_dano.NovaTabela
|
||||
|
||||
elseif (tipo == container_heal) then
|
||||
elseif (tipo == classHeal) then
|
||||
return habilidade_cura.NovaTabela
|
||||
|
||||
elseif (tipo == container_energy) then
|
||||
elseif (tipo == classEnergy) then
|
||||
return habilidade_e_energy.NovaTabela
|
||||
|
||||
elseif (tipo == container_misc) then
|
||||
elseif (tipo == classUtility) then
|
||||
return habilidade_misc.NovaTabela
|
||||
|
||||
end
|
||||
|
||||
+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
|
||||
|
||||
+193
-211
@@ -166,6 +166,9 @@
|
||||
|
||||
local buffs_to_other_players = {
|
||||
[10060] = true, --power infusion
|
||||
[413426] = true, --rippling anthem (trinket 10.1)
|
||||
[405734] = true, --spore tender
|
||||
[406785] = true, --invigorating spore cloud
|
||||
}
|
||||
|
||||
local empower_cache = {}
|
||||
@@ -3205,7 +3208,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
[SPELL_POWER_FURY] = true, --warrior demonhunter dps
|
||||
}
|
||||
|
||||
local resource_power_type = {
|
||||
local resourcePowerType = {
|
||||
[SPELL_POWER_COMBO_POINTS2] = SPELL_POWER_ENERGY, --combo points
|
||||
[SPELL_POWER_SOUL_SHARDS] = SPELL_POWER_MANA, --warlock
|
||||
[SPELL_POWER_LUNAR_POWER] = SPELL_POWER_MANA, --druid
|
||||
@@ -3320,121 +3323,105 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
end
|
||||
|
||||
-- ~energy ~resource
|
||||
function parser:energize (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount, overpower, powertype, altpower)
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--early checks and fixes
|
||||
if (not who_name) then
|
||||
who_name = "[*] "..spellname
|
||||
elseif (not alvo_name) then
|
||||
function parser:energize (token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, amount, overpower, powerType, altpower)
|
||||
if (not sourceName) then
|
||||
sourceName = "[*] " .. spellName
|
||||
elseif (not targetName) then
|
||||
return
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--check if is energy or resource
|
||||
|
||||
--Details:Dump({token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount, overpower, powertype, altpower})
|
||||
|
||||
--get resource type
|
||||
local is_resource, resource_amount, resource_id = resource_power_type [powertype], amount, powertype
|
||||
local bIsResource, resourceAmount, resourceId = resourcePowerType[powerType], amount, powerType
|
||||
|
||||
--check if is valid
|
||||
if (not energy_types [powertype] and not is_resource) then
|
||||
if (not energy_types[powerType] and not bIsResource) then
|
||||
return
|
||||
|
||||
elseif (is_resource) then
|
||||
powertype = is_resource
|
||||
elseif (bIsResource) then
|
||||
powerType = bIsResource
|
||||
amount = 0
|
||||
end
|
||||
|
||||
overpower = overpower or 0
|
||||
|
||||
--[[statistics]]-- _detalhes.statistics.energy_calls = _detalhes.statistics.energy_calls + 1
|
||||
|
||||
_current_energy_container.need_refresh = true
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--get actors
|
||||
--get actors
|
||||
---@type actor
|
||||
local sourceActor = energy_cache[sourceName]
|
||||
local ownerActor
|
||||
|
||||
--main actor
|
||||
local este_jogador, meu_dono = energy_cache [who_name] --meu_dono is always nil
|
||||
if (not este_jogador) then --pode ser um desconhecido ou um pet
|
||||
este_jogador, meu_dono, who_name = _current_energy_container:PegarCombatente (who_serial, who_name, who_flags, true)
|
||||
este_jogador.powertype = powertype
|
||||
if (meu_dono) then
|
||||
meu_dono.powertype = powertype
|
||||
if (not sourceActor) then
|
||||
sourceActor, ownerActor, sourceName = _current_energy_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
|
||||
sourceActor.powertype = powerType
|
||||
if (ownerActor) then
|
||||
ownerActor.powertype = powerType
|
||||
end
|
||||
if (not meu_dono) then --se n�o for um pet, adicionar no cache
|
||||
--does pet generates energy to its owner in any circustance?
|
||||
energy_cache [who_name] = este_jogador
|
||||
if (not ownerActor) then
|
||||
energy_cache[sourceName] = sourceActor
|
||||
end
|
||||
end
|
||||
|
||||
if (not este_jogador.powertype) then
|
||||
este_jogador.powertype = powertype
|
||||
if (not sourceActor.powertype) then
|
||||
sourceActor.powertype = powerType
|
||||
end
|
||||
|
||||
--target
|
||||
local jogador_alvo, alvo_dono = energy_cache [alvo_name]
|
||||
if (not jogador_alvo) then
|
||||
jogador_alvo, alvo_dono, alvo_name = _current_energy_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true)
|
||||
jogador_alvo.powertype = powertype
|
||||
if (alvo_dono) then
|
||||
alvo_dono.powertype = powertype
|
||||
---@type actor
|
||||
local targetActor = energy_cache[targetName]
|
||||
local ownerTarget
|
||||
if (not targetActor) then
|
||||
targetActor, ownerTarget, targetName = _current_energy_container:PegarCombatente(targetSerial, targetName, targetFlags, true)
|
||||
targetActor.powertype = powerType
|
||||
if (ownerTarget) then
|
||||
ownerTarget.powertype = powerType
|
||||
end
|
||||
if (not alvo_dono) then
|
||||
energy_cache [alvo_name] = jogador_alvo
|
||||
if (not ownerTarget) then
|
||||
energy_cache[targetName] = targetActor
|
||||
end
|
||||
end
|
||||
|
||||
if (jogador_alvo.powertype ~= este_jogador.powertype) then
|
||||
--print("error: different power types: who -> ", este_jogador.powertype, " target -> ", jogador_alvo.powertype)
|
||||
if (targetActor.powertype ~= sourceActor.powertype) then
|
||||
return
|
||||
end
|
||||
|
||||
este_jogador.last_event = _tempo
|
||||
sourceActor.last_event = _tempo
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--amount add
|
||||
|
||||
if (not is_resource) then
|
||||
|
||||
--amount = amount - overpower
|
||||
--amount add
|
||||
|
||||
if (not bIsResource) then
|
||||
--add to targets
|
||||
este_jogador.targets [alvo_name] = (este_jogador.targets [alvo_name] or 0) + amount
|
||||
sourceActor.targets[targetName] = (sourceActor.targets[targetName] or 0) + amount
|
||||
|
||||
--add to combat total
|
||||
_current_total [3] [powertype] = _current_total [3] [powertype] + amount
|
||||
_current_total[3][powerType] = _current_total[3][powerType] + amount
|
||||
|
||||
if (este_jogador.grupo) then
|
||||
_current_gtotal [3] [powertype] = _current_gtotal [3] [powertype] + amount
|
||||
if (sourceActor.grupo) then
|
||||
_current_gtotal [3] [powerType] = _current_gtotal [3] [powerType] + amount
|
||||
end
|
||||
|
||||
--regen produced amount
|
||||
este_jogador.total = este_jogador.total + amount
|
||||
este_jogador.totalover = este_jogador.totalover + overpower
|
||||
sourceActor.total = sourceActor.total + amount
|
||||
sourceActor.totalover = sourceActor.totalover + overpower
|
||||
|
||||
--target regenerated amount
|
||||
jogador_alvo.received = jogador_alvo.received + amount
|
||||
targetActor.received = targetActor.received + amount
|
||||
|
||||
--owner
|
||||
if (meu_dono) then
|
||||
meu_dono.total = meu_dono.total + amount
|
||||
if (ownerActor) then
|
||||
ownerActor.total = ownerActor.total + amount
|
||||
end
|
||||
|
||||
--actor spells table
|
||||
local spellTable = este_jogador.spells._ActorTable[spellid]
|
||||
local spellTable = sourceActor.spells._ActorTable[spellId]
|
||||
if (not spellTable) then
|
||||
spellTable = este_jogador.spells:PegaHabilidade(spellid, true, token)
|
||||
spellTable = sourceActor.spells:PegaHabilidade(spellId, true, token)
|
||||
end
|
||||
|
||||
--return spell:Add (alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype)
|
||||
return _spell_energy_func (spellTable, alvo_serial, alvo_name, alvo_flags, amount, who_name, powertype, overpower)
|
||||
return _spell_energy_func (spellTable, targetSerial, targetName, targetFlags, amount, sourceName, powerType, overpower)
|
||||
else
|
||||
--is a resource
|
||||
este_jogador.resource = este_jogador.resource + resource_amount
|
||||
este_jogador.resource_type = resource_id
|
||||
sourceActor.resource = sourceActor.resource + resourceAmount
|
||||
sourceActor.resource_type = resourceId
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3583,7 +3570,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--get actors
|
||||
--main actor
|
||||
---@type actorutility, actorutility
|
||||
local sourceActor, ownerActor = misc_cache[sourceName], nil
|
||||
if (not sourceActor) then
|
||||
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
|
||||
@@ -3595,12 +3582,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
------------------------------------------------------------------------------------------------
|
||||
--build containers on the fly
|
||||
if (not sourceActor.interrupt) then
|
||||
sourceActor.interrupt = _detalhes:GetOrderNumber(sourceName)
|
||||
sourceActor.interrupt = Details:GetOrderNumber()
|
||||
sourceActor.interrupt_targets = {}
|
||||
sourceActor.interrupt_spells = container_habilidades:NovoContainer(container_misc)
|
||||
sourceActor.interrompeu_oque = {}
|
||||
end
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--add amount
|
||||
|
||||
@@ -3985,86 +3972,70 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
end
|
||||
|
||||
--serach key: ~cc
|
||||
function parser:break_cc (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool, auraType)
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--early checks and fixes
|
||||
if (not cc_spell_list [spellid]) then
|
||||
return
|
||||
--print("NO CC:", spellid, spellname, extraSpellID, extraSpellName)
|
||||
end
|
||||
|
||||
if (bitBand(who_flags, AFFILIATION_GROUP) == 0) then
|
||||
return
|
||||
end
|
||||
|
||||
if (not spellname) then
|
||||
spellname = "Melee"
|
||||
end
|
||||
|
||||
if (not alvo_name) then
|
||||
--no target name, just quit
|
||||
function parser:break_cc(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellType, extraSpellID, extraSpellName, extraSchool, auraType)
|
||||
if (not cc_spell_list[spellId]) then
|
||||
return
|
||||
|
||||
elseif (not who_name) then
|
||||
--no actor name, use spell name instead
|
||||
who_name = "[*] " .. spellname
|
||||
who_flags = 0xa48
|
||||
who_serial = ""
|
||||
elseif (bitBand(sourceFlags, AFFILIATION_GROUP) == 0) then
|
||||
return
|
||||
|
||||
elseif (not targetName) then
|
||||
return --no target name, just quit
|
||||
end
|
||||
|
||||
if (not spellName) then
|
||||
spellName = "Melee"
|
||||
end
|
||||
|
||||
if (not sourceName) then
|
||||
sourceName = "[*] " .. spellName --if there's no sourceName, use spellName instead
|
||||
sourceFlags = 0xa48
|
||||
sourceSerial = ""
|
||||
end
|
||||
|
||||
_current_misc_container.need_refresh = true
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--get actors
|
||||
|
||||
local este_jogador, meu_dono = misc_cache [who_name]
|
||||
if (not este_jogador) then --pode ser um desconhecido ou um pet
|
||||
este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true)
|
||||
if (not meu_dono) then --se n�o for um pet, adicionar no cache
|
||||
misc_cache [who_name] = este_jogador
|
||||
---@type actorutility, actorutility
|
||||
local sourceActor, ownerActor = misc_cache[sourceName], nil
|
||||
if (not sourceActor) then --unknown if is a pet or player
|
||||
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente(sourceSerial, sourceName, sourceFlags, true)
|
||||
if (not ownerActor) then --not a pet: add to cache
|
||||
misc_cache[sourceName] = sourceActor
|
||||
end
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--build containers on the fly
|
||||
|
||||
if (not este_jogador.cc_break) then
|
||||
--constr�i aqui a tabela dele
|
||||
este_jogador.cc_break = _detalhes:GetOrderNumber(who_name)
|
||||
este_jogador.cc_break_targets = {}
|
||||
este_jogador.cc_break_spells = container_habilidades:NovoContainer (container_misc)
|
||||
este_jogador.cc_break_oque = {}
|
||||
--create the spell container on the fly
|
||||
if (not sourceActor.cc_break) then
|
||||
sourceActor.cc_break = Details:GetOrderNumber()
|
||||
sourceActor.cc_break_targets = {}
|
||||
sourceActor.cc_break_oque = {}
|
||||
---@type spellcontainer
|
||||
sourceActor.cc_break_spells = container_habilidades:NovoContainer(container_misc)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--add amount
|
||||
sourceActor.last_event = _tempo
|
||||
|
||||
--update last event
|
||||
este_jogador.last_event = _tempo
|
||||
|
||||
--combat cc break total
|
||||
_current_total [4].cc_break = _current_total [4].cc_break + 1
|
||||
|
||||
if (este_jogador.grupo) then
|
||||
_current_combat.totals_grupo[4].cc_break = _current_combat.totals_grupo[4].cc_break+1
|
||||
--add amount
|
||||
_current_total[4].cc_break = _current_total[4].cc_break + 1
|
||||
if (sourceActor.grupo) then
|
||||
_current_combat.totals_grupo[4].cc_break = _current_combat.totals_grupo[4].cc_break + 1
|
||||
end
|
||||
|
||||
--add amount
|
||||
este_jogador.cc_break = este_jogador.cc_break + 1
|
||||
sourceActor.cc_break = sourceActor.cc_break + 1
|
||||
|
||||
--broke what
|
||||
este_jogador.cc_break_oque [spellid] = (este_jogador.cc_break_oque [spellid] or 0) + 1
|
||||
sourceActor.cc_break_oque[spellId] = (sourceActor.cc_break_oque[spellId] or 0) + 1
|
||||
|
||||
--actor targets
|
||||
este_jogador.cc_break_targets [alvo_name] = (este_jogador.cc_break_targets [alvo_name] or 0) + 1
|
||||
sourceActor.cc_break_targets[targetName] = (sourceActor.cc_break_targets[targetName] or 0) + 1
|
||||
|
||||
--actor spells table
|
||||
local spell = este_jogador.cc_break_spells._ActorTable [extraSpellID]
|
||||
if (not spell) then
|
||||
spell = este_jogador.cc_break_spells:PegaHabilidade (extraSpellID, true, token)
|
||||
---@type spelltable
|
||||
local spellTable = sourceActor.cc_break_spells._ActorTable[extraSpellID]
|
||||
if (not spellTable) then
|
||||
spellTable = sourceActor.cc_break_spells:PegaHabilidade(extraSpellID, true, token)
|
||||
end
|
||||
return _spell_utility_func (spell, alvo_serial, alvo_name, alvo_flags, who_name, token, spellid, spellname)
|
||||
return _spell_utility_func(spellTable, targetSerial, targetName, targetFlags, sourceName, token, spellId, spellName)
|
||||
end
|
||||
|
||||
--serach key: ~dead ~death ~morte
|
||||
@@ -4087,30 +4058,28 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
---@param targetSerial string
|
||||
---@param targetName string
|
||||
---@param targetFlags number
|
||||
function parser:dead (token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags)
|
||||
--early checks and fixes
|
||||
function parser:dead(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags)
|
||||
--early checks and fixes
|
||||
if (not targetName) then
|
||||
return
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------
|
||||
--build dead
|
||||
|
||||
---@type actordamage
|
||||
local damageActor = _current_damage_container:GetActor(targetName)
|
||||
--check for outsiders
|
||||
--check if the dead actor is an actor outside the player group, for instance a pvp player or a npc
|
||||
if (_in_combat and targetFlags and (not damageActor or (bitBand(targetFlags, 0x00000008) ~= 0 and not damageActor.grupo))) then
|
||||
--frags
|
||||
if (_detalhes.only_pvp_frags and (bitBand(targetFlags, 0x00000400) == 0 or (bitBand(targetFlags, 0x00000040) == 0 and bitBand(targetFlags, 0x00000020) == 0))) then --byte 2 = 4 (HOSTILE) byte 3 = 4 (OBJECT_TYPE_PLAYER)
|
||||
return
|
||||
end
|
||||
if (_detalhes.only_pvp_frags and (bitBand(targetFlags, 0x00000400) == 0 or (bitBand(targetFlags, 0x00000040) == 0 and bitBand(targetFlags, 0x00000020) == 0))) then --byte 2 = 4 (HOSTILE) byte 3 = 4 (OBJECT_TYPE_PLAYER)
|
||||
return
|
||||
end
|
||||
|
||||
if (not _current_combat.frags [targetName]) then
|
||||
_current_combat.frags [targetName] = 1
|
||||
else
|
||||
_current_combat.frags [targetName] = _current_combat.frags [targetName] + 1
|
||||
end
|
||||
if (not _current_combat.frags[targetName]) then
|
||||
_current_combat.frags[targetName] = 1
|
||||
else
|
||||
_current_combat.frags[targetName] = _current_combat.frags[targetName] + 1
|
||||
end
|
||||
|
||||
_current_combat.frags_need_refresh = true
|
||||
_current_combat.frags_need_refresh = true
|
||||
|
||||
--player death
|
||||
elseif (not UnitIsFeignDeath(targetName)) then
|
||||
@@ -4137,8 +4106,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
_current_misc_container.need_refresh = true
|
||||
|
||||
--combat totals
|
||||
_current_total [4].dead = _current_total [4].dead + 1
|
||||
_current_gtotal [4].dead = _current_gtotal [4].dead + 1
|
||||
_current_total[4].dead = _current_total[4].dead + 1
|
||||
_current_gtotal[4].dead = _current_gtotal[4].dead + 1
|
||||
|
||||
--main actor no container de misc que ir� armazenar a morte
|
||||
local thisPlayer, meu_dono = misc_cache [targetName]
|
||||
@@ -4415,7 +4384,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
--core
|
||||
|
||||
function parser:WipeSourceCache()
|
||||
wipe (monk_guard_talent)
|
||||
Details:Destroy(monk_guard_talent)
|
||||
end
|
||||
|
||||
local token_list = {
|
||||
@@ -4430,85 +4399,84 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
|
||||
--serach key: ~capture
|
||||
|
||||
_detalhes.capture_types = {"damage", "heal", "energy", "miscdata", "aura", "spellcast"}
|
||||
_detalhes.capture_schedules = {}
|
||||
Details.capture_types = {"damage", "heal", "energy", "miscdata", "aura", "spellcast"}
|
||||
Details.capture_schedules = {}
|
||||
|
||||
function _detalhes:CaptureIsAllEnabled()
|
||||
for _, _thisType in ipairs(_detalhes.capture_types) do
|
||||
if (not _detalhes.capture_real [_thisType]) then
|
||||
function Details:CaptureIsAllEnabled()
|
||||
for _, thisType in ipairs(Details.capture_types) do
|
||||
if (not Details.capture_real[thisType]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function _detalhes:CaptureIsEnabled (capture)
|
||||
if (_detalhes.capture_real [capture]) then
|
||||
function Details:CaptureIsEnabled(capture)
|
||||
if (Details.capture_real[capture]) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function _detalhes:CaptureRefresh()
|
||||
for _, _thisType in ipairs(_detalhes.capture_types) do
|
||||
if (_detalhes.capture_current [_thisType]) then
|
||||
_detalhes:CaptureEnable (_thisType)
|
||||
function Details:CaptureRefresh()
|
||||
for _, thisType in ipairs(Details.capture_types) do
|
||||
if (Details.capture_current[thisType]) then
|
||||
Details:CaptureEnable(thisType)
|
||||
else
|
||||
_detalhes:CaptureDisable (_thisType)
|
||||
Details:CaptureDisable(thisType)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:CaptureGet(capture_type)
|
||||
return _detalhes.capture_real [capture_type]
|
||||
function Details:CaptureGet(captureType)
|
||||
return Details.capture_real[captureType]
|
||||
end
|
||||
|
||||
function _detalhes:CaptureSet (on_off, capture_type, real, time)
|
||||
|
||||
if (on_off == nil) then
|
||||
on_off = _detalhes.capture_real [capture_type]
|
||||
function Details:CaptureSet(onOff, captureType, real, time)
|
||||
if (onOff == nil) then
|
||||
onOff = Details.capture_real[captureType]
|
||||
end
|
||||
|
||||
if (real) then
|
||||
--hard switch
|
||||
_detalhes.capture_real [capture_type] = on_off
|
||||
_detalhes.capture_current [capture_type] = on_off
|
||||
Details.capture_real[captureType] = onOff
|
||||
Details.capture_current[captureType] = onOff
|
||||
else
|
||||
--soft switch
|
||||
_detalhes.capture_current [capture_type] = on_off
|
||||
Details.capture_current[captureType] = onOff
|
||||
if (time) then
|
||||
local schedule_id = math.random(1, 10000000)
|
||||
local new_schedule = _detalhes:ScheduleTimer("CaptureTimeout", time, {capture_type, schedule_id})
|
||||
tinsert(_detalhes.capture_schedules, {new_schedule, schedule_id})
|
||||
local scheduleId = math.random(1, 10000000)
|
||||
local new_schedule = Details:ScheduleTimer("CaptureTimeout", time, {captureType, scheduleId}) --todo: use Details.Schedule
|
||||
tinsert(Details.capture_schedules, {new_schedule, scheduleId})
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes:CaptureRefresh()
|
||||
Details:CaptureRefresh()
|
||||
end
|
||||
|
||||
function _detalhes:CancelAllCaptureSchedules()
|
||||
for i = 1, #_detalhes.capture_schedules do
|
||||
local schedule_table, schedule_id = unpack(_detalhes.capture_schedules[i])
|
||||
_detalhes:CancelTimer(schedule_table)
|
||||
function Details:CancelAllCaptureSchedules()
|
||||
for i = 1, #Details.capture_schedules do
|
||||
local schedule_table, schedule_id = unpack(Details.capture_schedules[i])
|
||||
Details:CancelTimer(schedule_table)
|
||||
end
|
||||
wipe(_detalhes.capture_schedules)
|
||||
wipe(Details.capture_schedules)
|
||||
end
|
||||
|
||||
function _detalhes:CaptureTimeout (table)
|
||||
function Details:CaptureTimeout (table)
|
||||
local capture_type, schedule_id = unpack(table)
|
||||
_detalhes.capture_current [capture_type] = _detalhes.capture_real [capture_type]
|
||||
_detalhes:CaptureRefresh()
|
||||
Details.capture_current [capture_type] = Details.capture_real [capture_type]
|
||||
Details:CaptureRefresh()
|
||||
|
||||
for index, table in ipairs(_detalhes.capture_schedules) do
|
||||
for index, table in ipairs(Details.capture_schedules) do
|
||||
local id = table [2]
|
||||
if (schedule_id == id) then
|
||||
tremove(_detalhes.capture_schedules, index)
|
||||
tremove(Details.capture_schedules, index)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes:CaptureDisable (capture_type)
|
||||
function Details:CaptureDisable (capture_type)
|
||||
|
||||
capture_type = string.lower(capture_type)
|
||||
|
||||
@@ -5718,50 +5686,64 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
end
|
||||
|
||||
--~load
|
||||
local start_details = function()
|
||||
if (not _detalhes.gump) then
|
||||
local TurnTheSpeakersOn = function()
|
||||
if (not Details.gump) then
|
||||
--failed to load the framework
|
||||
|
||||
if (not _detalhes.instance_load_failed) then
|
||||
_detalhes:CreatePanicWarning()
|
||||
if (not Details.instance_load_failed) then
|
||||
Details:CreatePanicWarning()
|
||||
end
|
||||
_detalhes.instance_load_failed.text:SetText("Framework for Details! isn't loaded.\nIf you just updated the addon, please reboot the game client.\nWe apologize for the inconvenience and thank you for your comprehension.")
|
||||
|
||||
Details.instance_load_failed.text:SetText("Framework for Details! isn't loaded.\nIf you just updated the addon, please reboot the game client.\nWe apologize for the inconvenience and thank you for your comprehension.")
|
||||
return
|
||||
end
|
||||
|
||||
--cooltip
|
||||
if (not _G.GameCooltip) then
|
||||
_detalhes.popup = _G.GameCooltip
|
||||
else
|
||||
_detalhes.popup = _G.GameCooltip
|
||||
Details.popup = _G.GameCooltip
|
||||
Details.in_group = IsInGroup() or IsInRaid()
|
||||
Details.temp_table1 = {}
|
||||
Details.encounter = {}
|
||||
Details.in_combat = false
|
||||
Details.combat_id = 0
|
||||
Details.opened_windows = 0
|
||||
Details.playername = UnitName("player")
|
||||
|
||||
--player faction and enemy faction
|
||||
Details.faction = UnitFactionGroup("player")
|
||||
if (Details.faction == PLAYER_FACTION_GROUP[0]) then --player is horde
|
||||
Details.faction_against = PLAYER_FACTION_GROUP[1] --ally
|
||||
Details.faction_id = 0
|
||||
|
||||
elseif (Details.faction == PLAYER_FACTION_GROUP[1]) then --player is alliance
|
||||
Details.faction_against = PLAYER_FACTION_GROUP[0] --horde
|
||||
Details.faction_id = 1
|
||||
end
|
||||
|
||||
--check group
|
||||
_detalhes.in_group = IsInGroup() or IsInRaid()
|
||||
local startLoadTime = debugprofilestop()
|
||||
|
||||
--write into details object all basic keys and default profile
|
||||
_detalhes:ApplyBasicKeys()
|
||||
--check if is first run, update keys for character and global data
|
||||
_detalhes:LoadGlobalAndCharacterData()
|
||||
--this function applies the Details.default_profile to Details object, this isn't yet the player profile which will load later
|
||||
Details222.LoadSavedVariables.DefaultProfile()
|
||||
|
||||
--details updated and not reopened the game client
|
||||
if (_detalhes.FILEBROKEN) then
|
||||
return
|
||||
end
|
||||
--load up data from savedvariables for the character
|
||||
Details222.LoadSavedVariables.CharacterData()
|
||||
|
||||
--load all the saved combats
|
||||
_detalhes:LoadCombatTables()
|
||||
--load up data from saved variables for the account (shared among all the players' characters; this is not the Blizzard account, lol).
|
||||
Details222.LoadSavedVariables.SharedData()
|
||||
|
||||
--load data of the segments saved from latest game session
|
||||
Details222.LoadSavedVariables.CombatSegments()
|
||||
|
||||
--load the profiles
|
||||
_detalhes:LoadConfig()
|
||||
Details:LoadConfig()
|
||||
|
||||
_detalhes:UpdateParserGears()
|
||||
Details:UpdateParserGears()
|
||||
|
||||
--load auto run code
|
||||
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()
|
||||
@@ -5769,9 +5751,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
||||
end
|
||||
|
||||
function _detalhes.parser_functions:ADDON_LOADED(...)
|
||||
local addon_name = select(1, ...)
|
||||
if (addon_name == "Details") then
|
||||
start_details()
|
||||
local addonName = select(1, ...)
|
||||
if (addonName == "Details") then
|
||||
TurnTheSpeakersOn()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -115,10 +115,6 @@
|
||||
return _detalhes:NewError ("Details version is out of date.")
|
||||
end
|
||||
|
||||
if (_detalhes.FILEBROKEN) then
|
||||
return _detalhes:NewError ("Game client needs to be restarted in order to finish Details! update.")
|
||||
end
|
||||
|
||||
if (PluginType == "TANK") then
|
||||
PluginType = "RAID"
|
||||
end
|
||||
|
||||
+7
-5
@@ -337,11 +337,13 @@
|
||||
return playername, playerclass, deathtime, deathcombattime, deathtimestring, playermaxhealth, deathevents, lastcooldown
|
||||
end
|
||||
|
||||
function Details:GetOrderNumber() --who_name
|
||||
--local name = upper (who_name .. "zz")
|
||||
--local byte1 = abs(_string_byte (name, 2)-91)/1000000
|
||||
--return byte1 + abs(_string_byte (name, 1)-91)/10000
|
||||
return _math_random (1000, 9000) / 1000000
|
||||
---get a random fraction number
|
||||
---@return number
|
||||
function Details:GetOrderNumber() --anyString
|
||||
--local name = upper(anyString .. "zz")
|
||||
--local byte1 = abs(_string_byte(name, 2)-91) / 1000000
|
||||
--return byte1 + abs(_string_byte(name, 1)-91) / 10000
|
||||
return _math_random(1000, 9000) / 1000000
|
||||
end
|
||||
|
||||
--/script print(tonumber(4/1000000)) - 4e-006
|
||||
|
||||
+49
-51
@@ -20,18 +20,18 @@
|
||||
["DETAILS_INSTANCE_CHANGEATTRIBUTE"] = {},
|
||||
["DETAILS_INSTANCE_CHANGEMODE"] = {},
|
||||
["DETAILS_INSTANCE_NEWROW"] = {},
|
||||
|
||||
|
||||
--misc
|
||||
["DETAILS_OPTIONS_MODIFIED"] = {},
|
||||
["UNIT_SPEC"] = {},
|
||||
["UNIT_TALENTS"] = {},
|
||||
["PLAYER_TARGET"] = {},
|
||||
["DETAILS_PROFILE_APPLYED"] = {},
|
||||
|
||||
|
||||
--data
|
||||
["DETAILS_DATA_RESET"] = {},
|
||||
["DETAILS_DATA_SEGMENTREMOVED"] = {},
|
||||
|
||||
|
||||
--combat
|
||||
["COMBAT_ENCOUNTER_START"] = {},
|
||||
["COMBAT_ENCOUNTER_END"] = {},
|
||||
@@ -50,18 +50,18 @@
|
||||
["COMBAT_ARENA_END"] = {},
|
||||
["COMBAT_MYTHICDUNGEON_START"] = {},
|
||||
["COMBAT_MYTHICDUNGEON_END"] = {},
|
||||
|
||||
|
||||
--area
|
||||
["ZONE_TYPE_CHANGED"] = {},
|
||||
|
||||
|
||||
--roster
|
||||
["GROUP_ONENTER"] = {},
|
||||
["GROUP_ONLEAVE"] = {},
|
||||
|
||||
|
||||
--buffs
|
||||
["BUFF_UPDATE"] = {},
|
||||
["BUFF_UPDATE_DEBUFFPOWER"] = {},
|
||||
|
||||
|
||||
--network
|
||||
["REALM_CHANNEL_ENTER"] = {}, --deprecated (realm channels are disabled)
|
||||
["REALM_CHANNEL_LEAVE"] = {}, --deprecated
|
||||
@@ -70,7 +70,7 @@
|
||||
}
|
||||
|
||||
local function AlreadyRegistred (_tables, _object)
|
||||
for index, _this_object in ipairs(_tables) do
|
||||
for index, _this_object in ipairs(_tables) do
|
||||
if (_this_object.__eventtable) then
|
||||
if (_this_object [1] == _object) then
|
||||
return index
|
||||
@@ -141,7 +141,7 @@ local common_events = {
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (common_events [event]) then
|
||||
if (not AlreadyRegistred (_detalhes.RegistredEvents [event], object)) then
|
||||
if (func) then
|
||||
@@ -168,7 +168,7 @@ local common_events = {
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
|
||||
if (not AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)) then
|
||||
if (func) then
|
||||
@@ -177,7 +177,6 @@ local common_events = {
|
||||
tinsert(_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
|
||||
end
|
||||
_detalhes.RecordPlayerAbilityWithBuffs = true
|
||||
_detalhes:UpdateDamageAbilityGears()
|
||||
_detalhes:UpdateParserGears()
|
||||
return true
|
||||
else
|
||||
@@ -191,7 +190,7 @@ local common_events = {
|
||||
--Unregister a Event
|
||||
|
||||
function _detalhes:UnregisterEvent (object, event)
|
||||
|
||||
|
||||
if (not _detalhes.RegistredEvents [event]) then
|
||||
if (object.Msg) then
|
||||
object:Msg("(debug) unknown event", event)
|
||||
@@ -200,7 +199,7 @@ local common_events = {
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if (common_events [event]) then
|
||||
local index = AlreadyRegistred (_detalhes.RegistredEvents [event], object)
|
||||
if (index) then
|
||||
@@ -222,14 +221,13 @@ local common_events = {
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
elseif (event == "BUFF_UPDATE_DEBUFFPOWER") then
|
||||
local index = AlreadyRegistred (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], object)
|
||||
if (index) then
|
||||
table.remove (_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"], index)
|
||||
if (#_detalhes.RegistredEvents ["BUFF_UPDATE_DEBUFFPOWER"] < 1) then
|
||||
_detalhes.RecordPlayerAbilityWithBuffs = false
|
||||
_detalhes:UpdateDamageAbilityGears()
|
||||
_detalhes:UpdateParserGears()
|
||||
end
|
||||
return true
|
||||
@@ -242,11 +240,11 @@ local common_events = {
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--internal functions
|
||||
|
||||
|
||||
local dispatch_error = function(name, errortext)
|
||||
_detalhes:Msg((name or "<no context>"), " |cFFFF9900error|r: ", errortext)
|
||||
end
|
||||
|
||||
|
||||
--safe call an external func with payload and without telling who is calling
|
||||
function _detalhes:QuickDispatchEvent (func, event, ...)
|
||||
if (type(func) ~= "function") then
|
||||
@@ -254,19 +252,19 @@ local common_events = {
|
||||
elseif (type(event) ~= "string") then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local okay, errortext = pcall(func, event, ...)
|
||||
|
||||
|
||||
if (not okay) then
|
||||
--trigger an error msg
|
||||
dispatch_error (_, errortext)
|
||||
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
--quick dispatch with context, send the caller object within the payload
|
||||
function _detalhes:QuickDispatchEventWithContext (context, func, event, ...)
|
||||
if (type(context) ~= "table") then
|
||||
@@ -276,85 +274,85 @@ local common_events = {
|
||||
elseif (type(event) ~= "string") then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local okay, errortext = pcall(func, context, event, ...)
|
||||
|
||||
|
||||
if (not okay) then
|
||||
--attempt to get the context name
|
||||
local objectName = context.__name or context._name or context.name or context.Name
|
||||
--trigger an error msg
|
||||
dispatch_error (objectName, errortext)
|
||||
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--Send Event
|
||||
function _detalhes:SendEvent(event, object, ...)
|
||||
|
||||
|
||||
--send event to all registred plugins
|
||||
|
||||
|
||||
if (event == "PLUGIN_DISABLED" or event == "PLUGIN_ENABLED") then
|
||||
return object:OnDetailsEvent (event, ...)
|
||||
|
||||
|
||||
elseif (not object) then
|
||||
--iterate among all plugins which registered a function for this event
|
||||
for _, PluginObject in ipairs(_detalhes.RegistredEvents[event]) do
|
||||
|
||||
|
||||
--when __eventtable is true, the plugin registered a function or method name to callback
|
||||
--if is false, we call OnDetailsEvent method on the plugin
|
||||
if (PluginObject.__eventtable) then
|
||||
|
||||
--if is false, we call OnDetailsEvent method on the plugin
|
||||
if (PluginObject.__eventtable) then
|
||||
|
||||
local pluginTable = PluginObject [1]
|
||||
|
||||
|
||||
--check if the plugin is enabled
|
||||
if (pluginTable.Enabled and pluginTable.__enabled) then
|
||||
|
||||
|
||||
--check if fegistered a function
|
||||
if (type(PluginObject [2]) == "function") then
|
||||
local func = PluginObject [2]
|
||||
_detalhes:QuickDispatchEvent (func, event, ...)
|
||||
--PluginObject [2] (event, ...)
|
||||
|
||||
|
||||
--if not it must be a method name
|
||||
else
|
||||
local methodName = PluginObject [2]
|
||||
local func = pluginTable [methodName]
|
||||
|
||||
|
||||
_detalhes:QuickDispatchEventWithContext (pluginTable, func, event, ...)
|
||||
--PluginObject [1] [PluginObject [2]] (PluginObject, event, ...)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--if no function(only registred the event) sent the event to OnDetailsEvent
|
||||
else
|
||||
else
|
||||
if (PluginObject.Enabled and PluginObject.__enabled) then
|
||||
_detalhes:QuickDispatchEventWithContext (PluginObject, PluginObject.OnDetailsEvent, event, ...)
|
||||
--PluginObject:OnDetailsEvent (event, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--plugin notifications (does not send to listeners)
|
||||
elseif (type(object) == "string" and object == "SEND_TO_ALL") then
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.RaidTables.Plugins) do
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.RaidTables.Plugins) do
|
||||
if (PluginObject.__enabled) then
|
||||
_detalhes:QuickDispatchEventWithContext (PluginObject, PluginObject.OnDetailsEvent, event)
|
||||
--PluginObject:OnDetailsEvent (event)
|
||||
end
|
||||
end
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.SoloTables.Plugins) do
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.SoloTables.Plugins) do
|
||||
if (PluginObject.__enabled) then
|
||||
_detalhes:QuickDispatchEventWithContext (PluginObject, PluginObject.OnDetailsEvent, event)
|
||||
--PluginObject:OnDetailsEvent (event)
|
||||
end
|
||||
end
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.ToolBar.Plugins) do
|
||||
|
||||
for _, PluginObject in ipairs(_detalhes.ToolBar.Plugins) do
|
||||
if (PluginObject.__enabled) then
|
||||
_detalhes:QuickDispatchEventWithContext (PluginObject, PluginObject.OnDetailsEvent, event)
|
||||
--PluginObject:OnDetailsEvent (event)
|
||||
@@ -372,9 +370,9 @@ local common_events = {
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--special cases
|
||||
function _detalhes:SendOptionsModifiedEvent (instance)
|
||||
|
||||
|
||||
_detalhes.last_options_modified = _detalhes.last_options_modified or (GetTime() - 5)
|
||||
|
||||
|
||||
if (_detalhes.last_options_modified + 0.3 < GetTime()) then
|
||||
_detalhes:SendEvent("DETAILS_OPTIONS_MODIFIED", nil, instance)
|
||||
_detalhes.last_options_modified = GetTime()
|
||||
@@ -389,20 +387,20 @@ local common_events = {
|
||||
_detalhes.last_options_modified_schedule = _detalhes:ScheduleTimer("SendOptionsModifiedEvent", 0.31, instance)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--listeners
|
||||
|
||||
local listener_meta = setmetatable({}, _detalhes)
|
||||
listener_meta.__index = listener_meta
|
||||
|
||||
|
||||
function listener_meta:RegisterEvent(event, func)
|
||||
return _detalhes:RegisterEvent(self, event, func)
|
||||
end
|
||||
function listener_meta:UnregisterEvent (event)
|
||||
return _detalhes:UnregisterEvent (self, event)
|
||||
end
|
||||
|
||||
|
||||
function _detalhes:CreateEventListener()
|
||||
local new = {Enabled = true, __enabled = true}
|
||||
setmetatable(new, listener_meta)
|
||||
|
||||
+252
-336
@@ -1,340 +1,261 @@
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
local Details = _G.Details
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
local C_Timer
|
||||
local UnitName = UnitName
|
||||
|
||||
local _detalhes = _G.Details
|
||||
local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
local _
|
||||
local addonName, Details222 = ...
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--On Details! Load:
|
||||
--load default keys into the main object
|
||||
|
||||
function _detalhes:ApplyBasicKeys()
|
||||
|
||||
--we are not in debug mode
|
||||
self.debug = false
|
||||
|
||||
--connected to realm channel
|
||||
self.is_connected = false
|
||||
|
||||
--who is
|
||||
self.playername = UnitName ("player")
|
||||
self.playerserial = UnitGUID("player")
|
||||
|
||||
--player faction and enemy faction
|
||||
self.faction = UnitFactionGroup ("player")
|
||||
if (self.faction == PLAYER_FACTION_GROUP[0]) then --player is horde
|
||||
self.faction_against = PLAYER_FACTION_GROUP[1] --ally
|
||||
self.faction_id = 0
|
||||
elseif (self.faction == PLAYER_FACTION_GROUP[1]) then --player is alliance
|
||||
self.faction_against = PLAYER_FACTION_GROUP[0] --horde
|
||||
self.faction_id = 1
|
||||
end
|
||||
|
||||
self.zone_type = nil
|
||||
_detalhes.temp_table1 = {}
|
||||
|
||||
--combat
|
||||
self.encounter = {}
|
||||
self.in_combat = false
|
||||
self.combat_id = 0
|
||||
|
||||
--instances (windows)
|
||||
self.solo = self.solo or nil
|
||||
self.raid = self.raid or nil
|
||||
self.opened_windows = 0
|
||||
|
||||
self.default_texture = [[Interface\AddOns\Details\images\bar4]]
|
||||
self.default_texture_name = "Details D'ictum"
|
||||
|
||||
self.class_coords_version = 1
|
||||
self.class_colors_version = 1
|
||||
|
||||
self.school_colors = {
|
||||
[1] = {1.00, 1.00, 0.00},
|
||||
[2] = {1.00, 0.90, 0.50},
|
||||
[4] = {1.00, 0.50, 0.00},
|
||||
[8] = {0.30, 1.00, 0.30},
|
||||
[16] = {0.50, 1.00, 1.00},
|
||||
[32] = {0.50, 0.50, 1.00},
|
||||
[64] = {1.00, 0.50, 1.00},
|
||||
["unknown"] = {0.5, 0.75, 0.75, 1}
|
||||
}
|
||||
|
||||
--load default profile keys
|
||||
for key, value in pairs(_detalhes.default_profile) do
|
||||
if (type(value) == "table") then
|
||||
local ctable = Details.CopyTable(value)
|
||||
self [key] = ctable
|
||||
else
|
||||
self [key] = value
|
||||
end
|
||||
end
|
||||
|
||||
--end
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--On Details! Load:
|
||||
--check if this is a first run, reset, or just load the saved data.
|
||||
|
||||
function _detalhes:LoadGlobalAndCharacterData()
|
||||
|
||||
--check and build the default container for character database
|
||||
|
||||
--it exists?
|
||||
if (not _detalhes_database) then
|
||||
_detalhes_database = Details.CopyTable(_detalhes.default_player_data)
|
||||
end
|
||||
|
||||
--load saved values
|
||||
for key, value in pairs(_detalhes.default_player_data) do
|
||||
|
||||
--check if key exists, e.g. a new key was added
|
||||
if (_detalhes_database [key] == nil) then
|
||||
if (type(value) == "table") then
|
||||
_detalhes_database [key] = Details.CopyTable(_detalhes.default_player_data [key])
|
||||
else
|
||||
_detalhes_database [key] = value
|
||||
end
|
||||
|
||||
elseif (type(_detalhes_database [key]) == "table") then
|
||||
if (type(_detalhes.default_player_data [key]) == "string") then
|
||||
print("|cFFFFAA00Details!|r error 0x8538, report on discord", key, _detalhes_database [key], _detalhes.default_player_data [key])
|
||||
end
|
||||
for key2, value2 in pairs(_detalhes.default_player_data [key]) do
|
||||
if (_detalhes_database [key] [key2] == nil) then
|
||||
if (type(value2) == "table") then
|
||||
_detalhes_database [key] [key2] = Details.CopyTable(_detalhes.default_player_data [key] [key2])
|
||||
else
|
||||
_detalhes_database [key] [key2] = value2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--copy the key from saved table to details object
|
||||
if (type(value) == "table") then
|
||||
_detalhes [key] = Details.CopyTable(_detalhes_database [key])
|
||||
else
|
||||
_detalhes [key] = _detalhes_database [key]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--check and build the default container for account database
|
||||
if (not _detalhes_global) then
|
||||
_detalhes_global = Details.CopyTable(_detalhes.default_global_data)
|
||||
end
|
||||
|
||||
for key, value in pairs(_detalhes.default_global_data) do
|
||||
|
||||
--check if key exists
|
||||
if (_detalhes_global [key] == nil) then
|
||||
if (type(value) == "table") then
|
||||
_detalhes_global [key] = Details.CopyTable(_detalhes.default_global_data [key])
|
||||
else
|
||||
_detalhes_global [key] = value
|
||||
end
|
||||
|
||||
elseif (type(_detalhes_global [key]) == "table") then
|
||||
|
||||
if (type(_detalhes.default_global_data [key]) == "string") then
|
||||
C_Timer.After(5, function()
|
||||
print("|cFFFFAA00Details!|r error 0x8547, report on discord", key, _detalhes_global [key], _detalhes.default_global_data [key])
|
||||
end)
|
||||
end
|
||||
|
||||
if (key == "always_use_profile_name") then
|
||||
_detalhes_global ["always_use_profile_name"] = ""
|
||||
end
|
||||
|
||||
if (type(_detalhes_global [key]) == "table") then
|
||||
for key2, value2 in pairs(_detalhes.default_global_data [key]) do
|
||||
if (_detalhes_global [key] [key2] == nil) then
|
||||
if (type(value2) == "table") then
|
||||
_detalhes_global [key] [key2] = Details.CopyTable(_detalhes.default_global_data [key] [key2])
|
||||
else
|
||||
_detalhes_global [key] [key2] = value2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--copy the key from saved table to details object
|
||||
if (type(value) == "table") then
|
||||
_detalhes [key] = Details.CopyTable(_detalhes_global [key])
|
||||
else
|
||||
_detalhes [key] = _detalhes_global [key]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--end
|
||||
return true
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--On Details! Load:
|
||||
--load previous saved combat data
|
||||
|
||||
function _detalhes:LoadCombatTables()
|
||||
|
||||
--if isn't nothing saved, build a new one
|
||||
if (not _detalhes_database.tabela_historico) then
|
||||
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
|
||||
_detalhes.tabela_overall = _detalhes.combate:NovaTabela()
|
||||
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
--On Details! Load load default keys into the main object
|
||||
function Details222.LoadSavedVariables.DefaultProfile()
|
||||
for key, value in pairs(Details.default_profile) do
|
||||
if (type(value) == "table") then
|
||||
Details[key] = Details.CopyTable(value)
|
||||
else
|
||||
Details[key] = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--build basic containers
|
||||
-- segments
|
||||
_detalhes.tabela_historico = _detalhes_database.tabela_historico or _detalhes.historico:NovoHistorico()
|
||||
-- overall
|
||||
_detalhes.tabela_overall = _detalhes.combate:NovaTabela()
|
||||
function Details222.LoadSavedVariables.CharacterData()
|
||||
local defaultCharacterData = Details.default_player_data
|
||||
local currentCharacterData = _detalhes_database
|
||||
|
||||
-- pets
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
if (_detalhes_database.tabela_pets) then
|
||||
_detalhes.tabela_pets.pets = Details.CopyTable(_detalhes_database.tabela_pets)
|
||||
--check if the player data exists, if not, load from default
|
||||
if (not currentCharacterData) then
|
||||
currentCharacterData = Details.CopyTable(defaultCharacterData)
|
||||
--[[GLOBAL]] _detalhes_database = currentCharacterData
|
||||
end
|
||||
|
||||
--verify if there's new data added to 'default_player_data' and copy it to the savedvariable table
|
||||
--do this up to a deepness level of 2, example: currentCharacterData[key][subKey] = any
|
||||
for key, value in pairs(defaultCharacterData) do
|
||||
if (currentCharacterData[key] == nil) then --the key doesn't exists, add it
|
||||
if (type(value) == "table") then
|
||||
currentCharacterData[key] = Details.CopyTable(defaultCharacterData[key])
|
||||
else
|
||||
currentCharacterData[key] = value
|
||||
end
|
||||
|
||||
elseif (type(currentCharacterData[key]) == "table") then
|
||||
for subKey, subValue in pairs(defaultCharacterData[key]) do
|
||||
if (currentCharacterData[key][subKey] == nil) then
|
||||
if (type(subValue) == "table") then
|
||||
currentCharacterData[key][subKey] = Details.CopyTable(defaultCharacterData[key][subKey])
|
||||
else
|
||||
currentCharacterData[key][subKey] = subValue
|
||||
end
|
||||
end
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
end
|
||||
end
|
||||
|
||||
--if the core revision was incremented, reset all combat data
|
||||
if (_detalhes_database.last_realversion and _detalhes_database.last_realversion < _detalhes.realversion) then
|
||||
--details was been hard upgraded
|
||||
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
|
||||
_detalhes.tabela_overall = _detalhes.combate:NovaTabela()
|
||||
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
--copy the key from saved table to Details object
|
||||
if (type(value) == "table") then
|
||||
Details[key] = Details.CopyTable(currentCharacterData[key])
|
||||
else
|
||||
Details[key] = currentCharacterData[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes_database.tabela_historico = nil
|
||||
_detalhes_database.tabela_overall = nil
|
||||
else
|
||||
--check integrity
|
||||
local combat = _detalhes.tabela_historico.tabelas [1]
|
||||
if (combat) then
|
||||
if (not combat[1] or not combat[2] or not combat[3] or not combat[4]) then
|
||||
--something went wrong in last logon, let's just reset and we are good to go
|
||||
_detalhes.tabela_historico = _detalhes.historico:NovoHistorico()
|
||||
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
--check if this is a first run, reset, or just load the saved data.
|
||||
function Details222.LoadSavedVariables.SharedData()
|
||||
local defaultAccountData = Details.default_global_data
|
||||
local currentAccountData = _detalhes_global
|
||||
|
||||
if (not currentAccountData) then
|
||||
currentAccountData = Details.CopyTable(defaultAccountData)
|
||||
--[[GLOBAL]] _detalhes_global = currentAccountData
|
||||
end
|
||||
|
||||
for key, value in pairs(defaultAccountData) do
|
||||
if (currentAccountData[key] == nil) then
|
||||
if (type(value) == "table") then
|
||||
currentAccountData[key] = Details.CopyTable(defaultAccountData[key])
|
||||
else
|
||||
currentAccountData[key] = value
|
||||
end
|
||||
|
||||
elseif (type(currentAccountData[key]) == "table") then
|
||||
if (key == "always_use_profile_name") then
|
||||
currentAccountData["always_use_profile_name"] = ""
|
||||
end
|
||||
|
||||
if (type(currentAccountData[key]) == "table") then
|
||||
for subKey, subValue in pairs(defaultAccountData[key]) do
|
||||
if (currentAccountData[key][subKey] == nil) then
|
||||
if (type(subValue) == "table") then
|
||||
currentAccountData[key][subKey] = Details.CopyTable(defaultAccountData[key][subKey])
|
||||
else
|
||||
currentAccountData[key][subKey] = subValue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (not _detalhes.overall_clear_logout) then
|
||||
if (_detalhes_database.tabela_overall) then
|
||||
_detalhes.tabela_overall = _detalhes_database.tabela_overall
|
||||
_detalhes:RestauraOverallMetaTables()
|
||||
end
|
||||
else
|
||||
_detalhes.tabela_overall = _detalhes.combate:NovaTabela()
|
||||
end
|
||||
|
||||
--re-build all indexes and metatables
|
||||
_detalhes:RestauraMetaTables()
|
||||
|
||||
--get last combat table
|
||||
local historico_UM = _detalhes.tabela_historico.tabelas[1]
|
||||
|
||||
if (historico_UM) then
|
||||
_detalhes.tabela_vigente = historico_UM --significa que elas eram a mesma tabela, ent�o aqui elas se tornam a mesma tabela
|
||||
else
|
||||
_detalhes.tabela_vigente = _detalhes.combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
end
|
||||
|
||||
--need refresh for all containers
|
||||
for _, container in ipairs(_detalhes.tabela_overall) do
|
||||
container.need_refresh = true
|
||||
end
|
||||
for _, container in ipairs(_detalhes.tabela_vigente) do
|
||||
container.need_refresh = true
|
||||
end
|
||||
|
||||
--erase combat data from the database
|
||||
_detalhes_database.tabela_vigente = nil
|
||||
_detalhes_database.tabela_historico = nil
|
||||
_detalhes_database.tabela_pets = nil
|
||||
|
||||
-- double check for pet container
|
||||
if (not _detalhes.tabela_pets or not _detalhes.tabela_pets.pets) then
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
end
|
||||
_detalhes:UpdateContainerCombatentes()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--copy the key from savedvariables to Details object
|
||||
if (type(value) == "table") then
|
||||
Details[key] = Details.CopyTable(currentAccountData[key])
|
||||
else
|
||||
Details[key] = currentAccountData[key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--load previous saved combat data
|
||||
function Details222.LoadSavedVariables.CombatSegments()
|
||||
local currentCharacterData = _G["_detalhes_database"] --no need to check if it exists, it's already checked
|
||||
|
||||
--if isn't nothing saved, build a new one and quit
|
||||
if (not currentCharacterData.tabela_historico) then
|
||||
Details.tabela_historico = Details.historico:NovoHistorico()
|
||||
Details.tabela_overall = Details.combate:NovaTabela()
|
||||
Details.tabela_vigente = Details.combate:NovaTabela(_, Details.tabela_overall)
|
||||
Details.tabela_pets = Details.container_pets:NovoContainer()
|
||||
Details:UpdateContainerCombatentes()
|
||||
return
|
||||
else
|
||||
Details.tabela_historico = Details.CopyTable(currentCharacterData.tabela_historico)
|
||||
Details.tabela_overall = Details.combate:NovaTabela()
|
||||
Details.tabela_pets = Details.container_pets:NovoContainer()
|
||||
if (currentCharacterData.tabela_pets) then
|
||||
Details.tabela_pets.pets = Details.CopyTable(currentCharacterData.tabela_pets)
|
||||
end
|
||||
Details:UpdateContainerCombatentes()
|
||||
|
||||
--if the core revision was incremented, reset all combat data to avoid incompatible data
|
||||
if (currentCharacterData.last_realversion and currentCharacterData.last_realversion < Details.realversion) then
|
||||
--details was been hard upgraded
|
||||
Details.tabela_historico = Details.historico:NovoHistorico()
|
||||
Details.tabela_overall = Details.combate:NovaTabela()
|
||||
Details.tabela_vigente = Details.combate:NovaTabela(_, Details.tabela_overall)
|
||||
Details.tabela_pets = Details.container_pets:NovoContainer()
|
||||
Details:UpdateContainerCombatentes()
|
||||
|
||||
currentCharacterData.tabela_historico = nil
|
||||
currentCharacterData.tabela_overall = nil
|
||||
else
|
||||
--check integrity
|
||||
local combat = Details.tabela_historico.tabelas[1]
|
||||
if (combat) then
|
||||
if (not combat[1] or not combat[2] or not combat[3] or not combat[4]) then
|
||||
--something went wrong in last logon, let's just reset and we are good to go
|
||||
Details.tabela_historico = Details.historico:NovoHistorico()
|
||||
Details.tabela_vigente = Details.combate:NovaTabela(_, Details.tabela_overall)
|
||||
Details.tabela_pets = Details.container_pets:NovoContainer()
|
||||
Details:UpdateContainerCombatentes()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (not Details.overall_clear_logout) then
|
||||
if (currentCharacterData.tabela_overall) then
|
||||
Details.tabela_overall = currentCharacterData.tabela_overall
|
||||
Details:RestoreOverallMetatables()
|
||||
end
|
||||
else
|
||||
Details.tabela_overall = Details.combate:NovaTabela()
|
||||
end
|
||||
|
||||
--re-build all indexes and metatables
|
||||
Details:RestoreMetatables()
|
||||
|
||||
--get lastest combat the player participated
|
||||
---@type combat
|
||||
local firstSegment = Details.tabela_historico.tabelas[1]
|
||||
|
||||
if (firstSegment) then
|
||||
Details.tabela_vigente = firstSegment
|
||||
else
|
||||
Details.tabela_vigente = Details.combate:NovaTabela(_, Details.tabela_overall)
|
||||
end
|
||||
|
||||
--need refresh for all containers
|
||||
for _, actorContainer in ipairs(Details.tabela_overall) do
|
||||
actorContainer.need_refresh = true
|
||||
end
|
||||
for _, actorContainer in ipairs(Details.tabela_vigente) do
|
||||
actorContainer.need_refresh = true
|
||||
end
|
||||
|
||||
--erase combat data from the database
|
||||
if (currentCharacterData.tabela_historico) then
|
||||
Details:Destroy(currentCharacterData.tabela_historico)
|
||||
end
|
||||
if (currentCharacterData.tabela_pets) then
|
||||
Details:Destroy(currentCharacterData.tabela_pets)
|
||||
end
|
||||
|
||||
--double check for pet container
|
||||
if (not Details.tabela_pets or not Details.tabela_pets.pets) then
|
||||
Details.tabela_pets = Details.container_pets:NovoContainer()
|
||||
end
|
||||
Details:UpdateContainerCombatentes()
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--On Details! Load:
|
||||
--load the saved config on the addon
|
||||
|
||||
function _detalhes:LoadConfig()
|
||||
function Details:LoadConfig()
|
||||
|
||||
--plugins data
|
||||
_detalhes.plugin_database = _detalhes_database.plugin_database or {}
|
||||
Details.plugin_database = _detalhes_database.plugin_database or {}
|
||||
|
||||
--startup
|
||||
|
||||
--set the nicktag cache host
|
||||
_detalhes:NickTagSetCache (_detalhes_database.nick_tag_cache)
|
||||
Details:NickTagSetCache (_detalhes_database.nick_tag_cache)
|
||||
|
||||
--count data
|
||||
_detalhes:CountDataOnLoad()
|
||||
Details:CountDataOnLoad()
|
||||
|
||||
--solo e raid plugin
|
||||
if (_detalhes_database.SoloTablesSaved) then
|
||||
if (_detalhes_database.SoloTablesSaved.Mode) then
|
||||
_detalhes.SoloTables.Mode = _detalhes_database.SoloTablesSaved.Mode
|
||||
_detalhes.SoloTables.LastSelected = _detalhes_database.SoloTablesSaved.LastSelected
|
||||
Details.SoloTables.Mode = _detalhes_database.SoloTablesSaved.Mode
|
||||
Details.SoloTables.LastSelected = _detalhes_database.SoloTablesSaved.LastSelected
|
||||
else
|
||||
_detalhes.SoloTables.Mode = 1
|
||||
Details.SoloTables.Mode = 1
|
||||
end
|
||||
end
|
||||
|
||||
--switch tables
|
||||
_detalhes.switch.slots = _detalhes_global.switchSaved.slots
|
||||
_detalhes.switch.table = _detalhes_global.switchSaved.table
|
||||
Details.switch.slots = _detalhes_global.switchSaved.slots
|
||||
Details.switch.table = _detalhes_global.switchSaved.table
|
||||
|
||||
if (_detalhes.switch.table) then
|
||||
for i = 1, #_detalhes.switch.table do
|
||||
if (not _detalhes.switch.table [i]) then
|
||||
_detalhes.switch.table [i] = {}
|
||||
if (Details.switch.table) then
|
||||
for i = 1, #Details.switch.table do
|
||||
if (not Details.switch.table [i]) then
|
||||
Details.switch.table [i] = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--last boss
|
||||
_detalhes.last_encounter = _detalhes_database.last_encounter
|
||||
Details.last_encounter = _detalhes_database.last_encounter
|
||||
|
||||
--buffs
|
||||
_detalhes.savedbuffs = _detalhes_database.savedbuffs
|
||||
_detalhes.Buffs:BuildTables()
|
||||
Details.savedbuffs = _detalhes_database.savedbuffs
|
||||
Details.Buffs:BuildTables()
|
||||
|
||||
--initialize parser
|
||||
_detalhes.capture_current = {}
|
||||
for captureType, captureValue in pairs(_detalhes.capture_real) do
|
||||
_detalhes.capture_current [captureType] = captureValue
|
||||
Details.capture_current = {}
|
||||
for captureType, captureValue in pairs(Details.capture_real) do
|
||||
Details.capture_current [captureType] = captureValue
|
||||
end
|
||||
|
||||
--row animations
|
||||
_detalhes:SetUseAnimations()
|
||||
Details:SetUseAnimations()
|
||||
|
||||
--initialize spell cache
|
||||
_detalhes:ClearSpellCache()
|
||||
Details:ClearSpellCache()
|
||||
|
||||
--version first run
|
||||
if (not _detalhes_database.last_version or _detalhes_database.last_version ~= _detalhes.userversion) then
|
||||
_detalhes.is_version_first_run = true
|
||||
if (not _detalhes_database.last_version or _detalhes_database.last_version ~= Details.userversion) then
|
||||
Details.is_version_first_run = true
|
||||
end
|
||||
|
||||
--profile
|
||||
@@ -342,45 +263,45 @@ function _detalhes:LoadConfig()
|
||||
local unitname = UnitName ("player")
|
||||
|
||||
--fix for old versions
|
||||
if (type(_detalhes.always_use_profile) == "string") then
|
||||
_detalhes.always_use_profile = false
|
||||
_detalhes.always_use_profile_name = ""
|
||||
if (type(Details.always_use_profile) == "string") then
|
||||
Details.always_use_profile = false
|
||||
Details.always_use_profile_name = ""
|
||||
end
|
||||
|
||||
if (type(_detalhes.always_use_profile_name) ~= "string") then
|
||||
_detalhes.always_use_profile = false
|
||||
_detalhes.always_use_profile_name = ""
|
||||
if (type(Details.always_use_profile_name) ~= "string") then
|
||||
Details.always_use_profile = false
|
||||
Details.always_use_profile_name = ""
|
||||
end
|
||||
|
||||
--check for "always use this profile"
|
||||
if (_detalhes.always_use_profile and not _detalhes.always_use_profile_exception [unitname]) then
|
||||
local profile_name = _detalhes.always_use_profile_name
|
||||
if (profile_name and profile_name ~= "" and _detalhes:GetProfile (profile_name)) then
|
||||
if (Details.always_use_profile and not Details.always_use_profile_exception [unitname]) then
|
||||
local profile_name = Details.always_use_profile_name
|
||||
if (profile_name and profile_name ~= "" and Details:GetProfile (profile_name)) then
|
||||
_detalhes_database.active_profile = profile_name
|
||||
end
|
||||
end
|
||||
|
||||
--character first run
|
||||
if (_detalhes_database.active_profile == "") then
|
||||
_detalhes.character_first_run = true
|
||||
Details.character_first_run = true
|
||||
--� a primeira vez que este character usa profiles, precisa copiar as keys existentes
|
||||
local current_profile_name = _detalhes:GetCurrentProfileName()
|
||||
_detalhes:GetProfile (current_profile_name, true)
|
||||
_detalhes:SaveProfileSpecial()
|
||||
local current_profile_name = Details:GetCurrentProfileName()
|
||||
Details:GetProfile (current_profile_name, true)
|
||||
Details:SaveProfileSpecial()
|
||||
end
|
||||
|
||||
--load profile and active instances
|
||||
local current_profile_name = _detalhes:GetCurrentProfileName()
|
||||
local current_profile_name = Details:GetCurrentProfileName()
|
||||
--check if exists, if not, create one
|
||||
local profile = _detalhes:GetProfile (current_profile_name, true)
|
||||
local profile = Details:GetProfile (current_profile_name, true)
|
||||
|
||||
--instances
|
||||
_detalhes.tabela_instancias = _detalhes_database.tabela_instancias or {}
|
||||
Details.tabela_instancias = _detalhes_database.tabela_instancias or {}
|
||||
|
||||
--fix for version 1.21.0
|
||||
if (#_detalhes.tabela_instancias > 0) then --only happens once after the character logon
|
||||
if (#Details.tabela_instancias > 0) then --only happens once after the character logon
|
||||
for index, saved_skin in ipairs(profile.instances) do
|
||||
local instance = _detalhes.tabela_instancias [index]
|
||||
local instance = Details.tabela_instancias [index]
|
||||
if (instance) then
|
||||
saved_skin.__was_opened = instance.ativa
|
||||
saved_skin.__pos = Details.CopyTable(instance.posicao)
|
||||
@@ -390,7 +311,7 @@ function _detalhes:LoadConfig()
|
||||
saved_skin.__snapV = instance.verticalSnap
|
||||
|
||||
for key, value in pairs(instance) do
|
||||
if (_detalhes.instance_defaults [key] ~= nil) then
|
||||
if (Details.instance_defaults [key] ~= nil) then
|
||||
if (type(value) == "table") then
|
||||
saved_skin [key] = Details.CopyTable(value)
|
||||
else
|
||||
@@ -401,8 +322,8 @@ function _detalhes:LoadConfig()
|
||||
end
|
||||
end
|
||||
|
||||
for index, instance in _detalhes:ListInstances() do
|
||||
_detalhes.local_instances_config [index] = {
|
||||
for index, instance in Details:ListInstances() do
|
||||
Details.local_instances_config [index] = {
|
||||
pos = Details.CopyTable(instance.posicao),
|
||||
is_open = instance.ativa,
|
||||
attribute = instance.atributo,
|
||||
@@ -417,51 +338,46 @@ function _detalhes:LoadConfig()
|
||||
isLocked = instance.isLocked
|
||||
}
|
||||
|
||||
if (_detalhes.local_instances_config [index].isLocked == nil) then
|
||||
_detalhes.local_instances_config [index].isLocked = false
|
||||
if (Details.local_instances_config [index].isLocked == nil) then
|
||||
Details.local_instances_config [index].isLocked = false
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes.tabela_instancias = {}
|
||||
Details.tabela_instancias = {}
|
||||
end
|
||||
|
||||
--apply the profile
|
||||
_detalhes:ApplyProfile (current_profile_name, true)
|
||||
Details:ApplyProfile(current_profile_name, true)
|
||||
|
||||
--custom
|
||||
_detalhes.custom = _detalhes_global.custom
|
||||
if (_detalhes_global.custom and _detalhes_global.custom[1] and _detalhes_global.custom[1].__index and _detalhes_global.custom[1].__index._InstanceLastCombatShown) then
|
||||
C_Timer.After(5, function() print("|cFFFFAA00Details!|r error 0x8487, report on discord") end)
|
||||
end
|
||||
_detalhes.refresh:r_atributo_custom()
|
||||
|
||||
Details.custom = _detalhes_global.custom
|
||||
if (_detalhes_global.custom and _detalhes_global.custom[1] and _detalhes_global.custom[1].__index and _detalhes_global.custom[1].__index._InstanceLastCombatShown) then
|
||||
C_Timer.After(5, function() print("|cFFFFAA00Details!|r error 0x8487, report on discord") end)
|
||||
end
|
||||
Details.refresh:r_atributo_custom()
|
||||
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--On Details! Load:
|
||||
--count logons, tutorials, etc
|
||||
|
||||
function _detalhes:CountDataOnLoad()
|
||||
|
||||
--On Details! Load count logons, tutorials, etc
|
||||
function Details:CountDataOnLoad()
|
||||
--basic
|
||||
if (not _detalhes_global.got_first_run) then
|
||||
_detalhes.is_first_run = true
|
||||
end
|
||||
if (not _detalhes_global.got_first_run) then
|
||||
Details.is_first_run = true
|
||||
end
|
||||
|
||||
--tutorial
|
||||
self.tutorial = self.tutorial or {}
|
||||
self.tutorial = self.tutorial or {}
|
||||
|
||||
self.tutorial.logons = self.tutorial.logons or 0
|
||||
self.tutorial.logons = self.tutorial.logons + 1
|
||||
self.tutorial.logons = self.tutorial.logons or 0
|
||||
self.tutorial.logons = self.tutorial.logons + 1
|
||||
|
||||
self.tutorial.unlock_button = self.tutorial.unlock_button or 0
|
||||
self.tutorial.version_announce = self.tutorial.version_announce or 0
|
||||
self.tutorial.main_help_button = self.tutorial.main_help_button or 0
|
||||
self.tutorial.alert_frames = self.tutorial.alert_frames or {false, false, false, false, false, false}
|
||||
self.tutorial.unlock_button = self.tutorial.unlock_button or 0
|
||||
self.tutorial.version_announce = self.tutorial.version_announce or 0
|
||||
self.tutorial.main_help_button = self.tutorial.main_help_button or 0
|
||||
self.tutorial.alert_frames = self.tutorial.alert_frames or {false, false, false, false, false, false}
|
||||
|
||||
self.tutorial.main_help_button = self.tutorial.main_help_button + 1
|
||||
|
||||
self.character_data = self.character_data or {logons = 0}
|
||||
self.character_data.logons = self.character_data.logons + 1
|
||||
self.tutorial.main_help_button = self.tutorial.main_help_button + 1
|
||||
|
||||
self.character_data = self.character_data or {logons = 0}
|
||||
self.character_data.logons = self.character_data.logons + 1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user