- Emergencial fix for death logs which sometimes was breaking the addon data capture.

- Fixed window alerts which was showing behind the bars.
- Fixed a issue where Details! windows wasn't hidden when a pet battle starts.
- Fixed a issue with segments menu when a window is placed on the right side of the screen.
- Fixed death log issue with friendly fire hits.
This commit is contained in:
tercio
2014-06-03 16:42:40 -03:00
parent 079b784c72
commit 710a1e6031
27 changed files with 2889 additions and 2332 deletions
+363 -398
View File
@@ -1,415 +1,380 @@
--[[
-------Details! Addon
-------Class Combat
-------This file control combat class. A combat is a object wich hold combat attributes.
-------The numeric part of table is compost by 4 indexes: [1] damage, [2] heal, [3] energies and [4] misc
]]
-- combat class object
local _detalhes = _G._detalhes
--shortcuts
local combate = _detalhes.combate
local container_combatentes = _detalhes.container_combatentes
--flags
local REACTION_HOSTILE = 0x00000040
local CONTROL_PLAYER = 0x00000100
--locals
local _setmetatable = setmetatable --> lua api
local _ipairs = ipairs --> lua api
local _pairs = pairs --> lua api
local _bit_band = bit.band --> lua api
local _date = date --> lua api
local _table_remove = table.remove
--time hold
local _tempo = time()
local _
--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
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[ __call function, get an actor from current combat.
combatTable ( index, actorName )
index: container number [1] damage, [2] heal, [3] energies and [4] misc
actorName: name of an actor (player, npc, pet, etc) --]]
_detalhes.call_combate = function (self, class_type, name)
local container = self[class_type]
local index_mapa = container._NameIndexTable [name]
local actor = container._ActorTable [index_mapa]
return actor
end
combate.__call = _detalhes.call_combate
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[ Class Constructor ]]
function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
local esta_tabela = {true, true, true, true, true}
esta_tabela [1] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> Damage
esta_tabela [2] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_HEAL_CLASS, esta_tabela, combatId) --> Healing
esta_tabela [3] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENERGY_CLASS, esta_tabela, combatId) --> Energies
esta_tabela [4] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS, esta_tabela, combatId) --> Misc
esta_tabela [5] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> place holder for customs
_setmetatable (esta_tabela, combate)
--> try discover if is a pvp combat
local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ...
if (who_serial) then --> aqui irá identificar o boss ou o oponente
if (alvo_name and _bit_band (alvo_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo alvo
esta_tabela.contra = alvo_name
if (_bit_band (alvo_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o alvo é da facção oposta ou foi dado mind control
end
elseif (who_name and _bit_band (who_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo who caso o mob é quem deu o primeiro hit
esta_tabela.contra = who_name
if (_bit_band (who_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o who é da facção oposta ou foi dado mind control
end
else
esta_tabela.pvp = true --> se ambos são friendly, seria isso um PVP entre jogadores da mesma facções?
end
end
--> start/end time (duration)
esta_tabela.data_fim = 0
esta_tabela.data_inicio = 0
--> record last event before dead
esta_tabela.last_events_tables = {}
--> frags
esta_tabela.frags = {}
esta_tabela.frags_need_refresh = false
--> time data container
esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
--> Skill cache (not used)
esta_tabela.CombatSkillCache = {}
-- a tabela sem o tempo de inicio é a tabela descartavel do inicio do addon
if (iniciada) then
esta_tabela.start_time = _tempo
esta_tabela.end_time = nil
else
esta_tabela.start_time = 0
esta_tabela.end_time = nil
end
-- o container irá armazenar as classes de dano -- cria um novo container de indexes de seriais de jogadores --parâmetro 1 classe armazenada no container, parâmetro 2 = flag da classe
esta_tabela[1].need_refresh = true
esta_tabela[2].need_refresh = true
esta_tabela[3].need_refresh = true
esta_tabela[4].need_refresh = true
esta_tabela[5].need_refresh = true
if (_tabela_overall) then --> link é a tabela de combate do overall
esta_tabela[1].shadow = _tabela_overall[1] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[2].shadow = _tabela_overall[2] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[3].shadow = _tabela_overall[3] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[4].shadow = _tabela_overall[4] --> diz ao objeto qual a shadow dele na tabela overall
end
-- abriga a tabela contendo o total de cada atributo
-- esta_tabela.barra_total = barra_total:NovaBarra()
--> barra total movido para um simples membro do combate:
esta_tabela.totals = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa pessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0, --> armazena quantos cooldowns a raid usou
debuff_uptime = 0 --> armazena quantos cooldowns a raid usou
}
}
esta_tabela.totals_grupo = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa oessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0,
debuff_uptime = 0
}
}
return esta_tabela
end
function combate:GetTimeData (name)
return self.TimeData [name]
end
function combate:TravarTempos()
--é necessário travar o tempo em todos os atributos do combate.
if (self [1]) then
for _, jogador in _ipairs (self [1]._ActorTable) do --> damage
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
--jogador.last_events_table = _detalhes:CreateActorLastEventTable()
end
end
else
--print ("combat [1] doesn't exist.")
end
if (self [2]) then
for _, jogador in _ipairs (self [2]._ActorTable) do --> healing
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
--print ("travando o tempo de",jogador.nome, jogador.end_time)
--jogador.last_events_table = _detalhes:CreateActorLastEventTable()
end
end
else
--print ("combat [2] doesn't exist.")
end
end
function combate:UltimaAcao (tempo)
if (tempo) then
self.last_event = tempo
else
return self.last_event
end
end
function combate:GetDate()
return self.data_inicio, self.data_fim
end
function combate:seta_data (tipo)
if (tipo == _detalhes._detalhes_props.DATA_TYPE_START) then
self.data_inicio = _date ("%H:%M:%S")
elseif (tipo == _detalhes._detalhes_props.DATA_TYPE_END) then
self.data_fim = _date ("%H:%M:%S")
end
end
function combate:GetCombatName (try_find)
if (self.is_pvp) then
return self.is_pvp.name
elseif (self.is_boss) then
return self.is_boss.encounter
elseif (self.is_tras) then
return Loc ["STRING_SEGMENT_TRASH"]
else
if (self.enemy) then
return self.enemy
end
if (try_find) then
return _detalhes:FindEnemy()
end
end
return Loc ["STRING_UNKNOW"]
end
function combate:GetActorList (container)
return self [container]._ActorTable
end
function combate:GetCombatTime()
if (self.end_time) then
--print ("tem end time")
return self.end_time - self.start_time
elseif (self.start_time and _detalhes.in_combat) then
--print ("tem start time e esta em combate")
return _tempo - self.start_time
else
--print ("retornando zero")
return 0
end
end
local _detalhes = _G._detalhes
local _
--[[global]] DETAILS_TOTALS_ONLYGROUP = true
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
if (onlyGroup) then
return self.totals_grupo [attribute]
else
return self.totals [attribute]
end
elseif (attribute == 3 or attribute == 4) then
local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute)
if (onlyGroup) then
return self.totals_grupo [attribute] [subName]
else
return self.totals [attribute] [subName]
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable -- lua local
local _ipairs = ipairs -- lua local
local _pairs = pairs -- lua local
local _bit_band = bit.band -- lua local
local _date = date -- lua local
local _table_remove = table.remove -- lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local combate = _detalhes.combate
local container_combatentes = _detalhes.container_combatentes
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 REACTION_HOSTILE = 0x00000040
local CONTROL_PLAYER = 0x00000100
local _tempo = time()
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> api functions
--combat (container type, actor name)
_detalhes.call_combate = function (self, class_type, name)
local container = self[class_type]
local index_mapa = container._NameIndexTable [name]
local actor = container._ActorTable [index_mapa]
return actor
end
return 0
end
combate.__call = _detalhes.call_combate
function combate:seta_tempo_decorrido()
self.end_time = _tempo
end
function _detalhes.refresh:r_combate (tabela_combate, shadow)
_setmetatable (tabela_combate, _detalhes.combate)
tabela_combate.__index = _detalhes.combate
tabela_combate.shadow = shadow
end
function _detalhes.clear:c_combate (tabela_combate)
--tabela_combate.__index = {}
tabela_combate.__index = nil
tabela_combate.__call = {}
tabela_combate._combat_table = nil
tabela_combate.shadow = nil
end
combate.__sub = function (combate1, combate2)
if (combate1 ~= _detalhes.tabela_overall) then
return
--get the start date and end date
function combate:GetDate()
return self.data_inicio, self.data_fim
end
--> sub dano
for index, actor_T2 in _ipairs (combate2[1]._ActorTable) do
local actor_T1 = combate1[1]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [1].need_refresh = true
--> sub heal
for index, actor_T2 in _ipairs (combate2[2]._ActorTable) do
local actor_T1 = combate1[2]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [2].need_refresh = true
--> sub energy
for index, actor_T2 in _ipairs (combate2[3]._ActorTable) do
local actor_T1 = combate1[3]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [3].need_refresh = true
--> sub misc
for index, actor_T2 in _ipairs (combate2[4]._ActorTable) do
local actor_T1 = combate1[4]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [4].need_refresh = true
--> reduz o tempo
combate1.start_time = combate1.start_time + (combate2.end_time - combate2.start_time)
--> apaga as mortes da luta diminuida
local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
if (amt_mortes > 0) then
for i = #combate1.last_events_tables, #combate1.last_events_tables-amt_mortes, -1 do
_table_remove (combate1.last_events_tables, #combate1.last_events_tables)
--return data for charts
function combate:GetTimeData (name)
return self.TimeData [name]
end
--return the name of the encounter or enemy
function combate:GetCombatName (try_find)
if (self.is_pvp) then
return self.is_pvp.name
elseif (self.is_boss) then
return self.is_boss.encounter
elseif (self.is_tras) then
return Loc ["STRING_SEGMENT_TRASH"]
else
if (self.enemy) then
return self.enemy
end
if (try_find) then
return _detalhes:FindEnemy()
end
end
return Loc ["STRING_UNKNOW"]
end
--return a numeric table with all actors on the specific containter
function combate:GetActorList (container)
return self [container]._ActorTable
end
--return the combat time in seconds
function combate:GetCombatTime()
if (self.end_time) then
return self.end_time - self.start_time
elseif (self.start_time and _detalhes.in_combat) then
return _tempo - self.start_time
else
return 0
end
end
--return the total of a specific attribute
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
if (onlyGroup) then
return self.totals_grupo [attribute]
else
return self.totals [attribute]
end
elseif (attribute == 3 or attribute == 4) then
local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute)
if (onlyGroup) then
return self.totals_grupo [attribute] [subName]
else
return self.totals [attribute] [subName]
end
end
return 0
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
--class constructor
function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
local esta_tabela = {true, true, true, true, true}
--> frags
for fragName, fragAmount in pairs (combate2.frags) do
if (fragAmount) then
if (combate1.frags [fragName]) then
combate1.frags [fragName] = combate1.frags [fragName] - fragAmount
else
combate1.frags [fragName] = fragAmount
esta_tabela [1] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> Damage
esta_tabela [2] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_HEAL_CLASS, esta_tabela, combatId) --> Healing
esta_tabela [3] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENERGY_CLASS, esta_tabela, combatId) --> Energies
esta_tabela [4] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS, esta_tabela, combatId) --> Misc
esta_tabela [5] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> place holder for customs
_setmetatable (esta_tabela, combate)
--> try discover if is a pvp combat
local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ...
if (who_serial) then --> aqui irá identificar o boss ou o oponente
if (alvo_name and _bit_band (alvo_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo alvo
esta_tabela.contra = alvo_name
if (_bit_band (alvo_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o alvo é da facção oposta ou foi dado mind control
end
elseif (who_name and _bit_band (who_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo who caso o mob é quem deu o primeiro hit
esta_tabela.contra = who_name
if (_bit_band (who_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o who é da facção oposta ou foi dado mind control
end
else
esta_tabela.pvp = true --> se ambos são friendly, seria isso um PVP entre jogadores da mesma facções?
end
end
--> start/end time (duration)
esta_tabela.data_fim = 0
esta_tabela.data_inicio = 0
--> record last event before dead
esta_tabela.last_events_tables = {}
--> frags
esta_tabela.frags = {}
esta_tabela.frags_need_refresh = false
--> time data container
esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
--> Skill cache (not used)
esta_tabela.CombatSkillCache = {}
-- a tabela sem o tempo de inicio é a tabela descartavel do inicio do addon
if (iniciada) then
esta_tabela.start_time = _tempo
esta_tabela.end_time = nil
else
esta_tabela.start_time = 0
esta_tabela.end_time = nil
end
-- o container irá armazenar as classes de dano -- cria um novo container de indexes de seriais de jogadores --parâmetro 1 classe armazenada no container, parâmetro 2 = flag da classe
esta_tabela[1].need_refresh = true
esta_tabela[2].need_refresh = true
esta_tabela[3].need_refresh = true
esta_tabela[4].need_refresh = true
esta_tabela[5].need_refresh = true
if (_tabela_overall) then --> link é a tabela de combate do overall
esta_tabela[1].shadow = _tabela_overall[1] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[2].shadow = _tabela_overall[2] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[3].shadow = _tabela_overall[3] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[4].shadow = _tabela_overall[4] --> diz ao objeto qual a shadow dele na tabela overall
end
esta_tabela.totals = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa pessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0, --> armazena quantos cooldowns a raid usou
debuff_uptime = 0 --> armazena quantos cooldowns a raid usou
}
}
esta_tabela.totals_grupo = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa oessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0,
debuff_uptime = 0
}
}
return esta_tabela
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--trava o tempo dos jogadores após o término do combate.
function combate:TravarTempos()
if (self [1]) then
for _, jogador in _ipairs (self [1]._ActorTable) do --> damage
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
end
end
end
combate1.frags_need_refresh = true
return combate1
end
combate.__add = function (combate1, combate2)
local all_containers = {combate2 [class_type_dano]._ActorTable, combate2 [class_type_cura]._ActorTable, combate2 [class_type_e_energy]._ActorTable, combate2 [class_type_misc]._ActorTable}
--actor.boss_fight_component
--actor.fight_component
--combat.is_boss
--combat.instance_type -- party raid
for class_type, actor_container in ipairs (all_containers) do
for _, actor in ipairs (actor_container) do
local shadow
if (class_type == class_type_dano) then
shadow = _detalhes.atributo_damage:r_connect_shadow (actor, true)
elseif (class_type == class_type_cura) then
shadow = _detalhes.atributo_heal:r_connect_shadow (actor, true)
elseif (class_type == class_type_e_energy) then
shadow = _detalhes.atributo_energy:r_connect_shadow (actor, true)
elseif (class_type == class_type_misc) then
shadow = _detalhes.atributo_misc:r_connect_shadow (actor, true)
if (self [2]) then
for _, jogador in _ipairs (self [2]._ActorTable) do --> healing
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
end
end
shadow.boss_fight_component = actor.boss_fight_component
shadow.fight_component = actor.fight_component
shadow.grupo = actor.grupo
--if (shadow:EstaoLinkados (actor)) then
-- shadow:FazLinkagem (actor)
--end
end
end
--if (combate2.end_time and combate2.start_time) then
-- combate1.start_time = combate1.start_time - (combate1.end_time - combate1.start_time)
--end
return combate1
end
function _detalhes:UpdateCombat()
_tempo = _detalhes._tempo
end
function combate:UltimaAcao (tempo)
if (tempo) then
self.last_event = tempo
else
return self.last_event
end
end
function combate:seta_data (tipo)
if (tipo == _detalhes._detalhes_props.DATA_TYPE_START) then
self.data_inicio = _date ("%H:%M:%S")
elseif (tipo == _detalhes._detalhes_props.DATA_TYPE_END) then
self.data_fim = _date ("%H:%M:%S")
end
end
function combate:seta_tempo_decorrido()
self.end_time = _tempo
end
function _detalhes.refresh:r_combate (tabela_combate, shadow)
_setmetatable (tabela_combate, _detalhes.combate)
tabela_combate.__index = _detalhes.combate
tabela_combate.shadow = shadow
end
function _detalhes.clear:c_combate (tabela_combate)
--tabela_combate.__index = {}
tabela_combate.__index = nil
tabela_combate.__call = {}
tabela_combate._combat_table = nil
tabela_combate.shadow = nil
end
combate.__sub = function (combate1, combate2)
if (combate1 ~= _detalhes.tabela_overall) then
return
end
--> sub dano
for index, actor_T2 in _ipairs (combate2[1]._ActorTable) do
local actor_T1 = combate1[1]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [1].need_refresh = true
--> sub heal
for index, actor_T2 in _ipairs (combate2[2]._ActorTable) do
local actor_T1 = combate1[2]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [2].need_refresh = true
--> sub energy
for index, actor_T2 in _ipairs (combate2[3]._ActorTable) do
local actor_T1 = combate1[3]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [3].need_refresh = true
--> sub misc
for index, actor_T2 in _ipairs (combate2[4]._ActorTable) do
local actor_T1 = combate1[4]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [4].need_refresh = true
--> reduz o tempo
combate1.start_time = combate1.start_time + (combate2.end_time - combate2.start_time)
--> apaga as mortes da luta diminuida
local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
if (amt_mortes > 0) then
for i = #combate1.last_events_tables, #combate1.last_events_tables-amt_mortes, -1 do
_table_remove (combate1.last_events_tables, #combate1.last_events_tables)
end
end
--> frags
for fragName, fragAmount in pairs (combate2.frags) do
if (fragAmount) then
if (combate1.frags [fragName]) then
combate1.frags [fragName] = combate1.frags [fragName] - fragAmount
else
combate1.frags [fragName] = fragAmount
end
end
end
combate1.frags_need_refresh = true
return combate1
end
combate.__add = function (combate1, combate2)
local all_containers = {combate2 [class_type_dano]._ActorTable, combate2 [class_type_cura]._ActorTable, combate2 [class_type_e_energy]._ActorTable, combate2 [class_type_misc]._ActorTable}
for class_type, actor_container in ipairs (all_containers) do
for _, actor in ipairs (actor_container) do
local shadow
if (class_type == class_type_dano) then
shadow = _detalhes.atributo_damage:r_connect_shadow (actor, true)
elseif (class_type == class_type_cura) then
shadow = _detalhes.atributo_heal:r_connect_shadow (actor, true)
elseif (class_type == class_type_e_energy) then
shadow = _detalhes.atributo_energy:r_connect_shadow (actor, true)
elseif (class_type == class_type_misc) then
shadow = _detalhes.atributo_misc:r_connect_shadow (actor, true)
end
shadow.boss_fight_component = actor.boss_fight_component
shadow.fight_component = actor.fight_component
shadow.grupo = actor.grupo
end
end
return combate1
end
function _detalhes:UpdateCombat()
_tempo = _detalhes._tempo
end
+429 -429
View File
@@ -1,132 +1,73 @@
--why do a cleanup on classes today if i can do tomorrow?
-- damage object
--lua locals
local _cstr = string.format
local _math_floor = math.floor
local _table_sort = table.sort
local _table_insert = table.insert
local _table_size = table.getn
local _setmetatable = setmetatable
local _getmetatable = getmetatable
local _ipairs = ipairs
local _pairs = pairs
local _rawget= rawget
local _math_min = math.min
local _math_max = math.max
local _bit_band = bit.band
local _unpack = unpack
local _type = type
--api locals
local _GetSpellInfo = _detalhes.getspellinfo
local GameTooltip = GameTooltip
local _IsInRaid = IsInRaid
local _IsInGroup = IsInGroup
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local gump = _detalhes.gump
local _
local _detalhes = _G._detalhes
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ( "Details" )
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--constants
local gump = _detalhes.gump
local _
local _cstr = string.format --lua local
local _math_floor = math.floor --lua local
local _table_sort = table.sort --lua local
local _table_insert = table.insert --lua local
local _table_size = table.getn --lua local
local _setmetatable = setmetatable --lua local
local _getmetatable = getmetatable --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _rawget= rawget --lua local
local _math_min = math.min --lua local
local _math_max = math.max --lua local
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local GameTooltip = GameTooltip --api local
local _IsInRaid = IsInRaid --api local
local _IsInGroup = IsInGroup --api local
local _GetSpellInfo = _detalhes.getspellinfo --details api
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local container_habilidades = _detalhes.container_habilidades
local container_combatentes = _detalhes.container_combatentes
local container_pets = _detalhes.container_pets
local atributo_damage = _detalhes.atributo_damage
local atributo_misc = _detalhes.atributo_misc
local habilidade_dano = _detalhes.habilidade_dano
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local container_habilidades = _detalhes.container_habilidades
local container_combatentes = _detalhes.container_combatentes
local atributo_damage = _detalhes.atributo_damage
local atributo_misc = _detalhes.atributo_misc
local habilidade_dano = _detalhes.habilidade_dano
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local modo_ALONE = _detalhes.modos.alone
local modo_GROUP = _detalhes.modos.group
local modo_ALL = _detalhes.modos.all
local modo_GROUP = _detalhes.modos.group
local modo_ALL = _detalhes.modos.all
local class_type = _detalhes.atributos.dano
local class_type = _detalhes.atributos.dano
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local UsingCustomRightText = false
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
local key_overlay = {1, 1, 1, .1}
local key_overlay_press = {1, 1, 1, .2}
local headerColor = "yellow"
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local UsingCustomRightText = false
local info = _detalhes.janela_info
local keyName
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS
local key_overlay = {1, 1, 1, .1}
local key_overlay_press = {1, 1, 1, .2}
local headerColor = "yellow"
local info = _detalhes.janela_info
local keyName
function atributo_damage:NovaTabela (serial, nome, link)
--> constructor
local _new_damageActor = {
--> dps do objeto inicia sempre desligado
tipo = class_type, --> atributo 1 = dano
total = 0,
total_without_pet = 0,
custom = 0,
damage_taken = 0, --> total de dano que este jogador levou
damage_from = {}, --> armazena os nomes que deram dano neste jogador
dps_started = false,
last_event = 0,
on_hold = false,
delay = 0,
last_value = nil, --> ultimo valor que este jogador teve, salvo quando a barra dele é atualizada
last_dps = 0,
end_time = nil,
start_time = 0,
pets = {}, --> armazena os nomes dos pets já com a tag do dono: pet name <owner nome>
friendlyfire_total = 0,
friendlyfire = container_combatentes:NovoContainer (container_friendlyfire),
--container armazenará os seriais dos alvos que o player aplicou dano
targets = container_combatentes:NovoContainer (container_damage_target),
--container armazenará os IDs das habilidades usadas por este jogador
spell_tables = container_habilidades:NovoContainer (container_damage)
}
local OBJECT_TYPE_PLAYER = 0x00000400
_setmetatable (_new_damageActor, atributo_damage)
if (link) then --> se não for a shadow
_new_damageActor.last_events_table = _detalhes:CreateActorLastEventTable()
_new_damageActor.last_events_table.original = true
_new_damageActor.targets.shadow = link.targets
_new_damageActor.spell_tables.shadow = link.spell_tables
_new_damageActor.friendlyfire.shadow = link.friendlyfire
end
return _new_damageActor
end
local ntable = {} --temp
local vtable = {} --temp
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> exported functions
--[[exported]] function _detalhes:CreateActorLastEventTable()
local t = { {}, {}, {}, {}, {}, {}, {}, {} }
@@ -187,29 +128,14 @@ end
end
--[[ exported]] function _detalhes:IsPlayer()
if (self.flags) then
if (_bit_band (self.flag, 0x00000001) ~= 0) then
if (self.flag_original) then
if (_bit_band (self.flag_original, OBJECT_TYPE_PLAYER) ~= 0) then
return true
end
end
return false
end
local sortEnemies = function (t1, t2)
local a = _bit_band (t1.flag_original, 0x00000060)
local b = _bit_band (t2.flag_original, 0x00000060)
if (a ~= 0 and b ~= 0) then
return t1.total > t2.total
elseif (a ~= 0 and b == 0) then
return true
elseif (a == 0 and b ~= 0) then
return false
end
return false
end
--[[exported]] function _detalhes:ContainerSortEnemies (container, amount, keyName2)
keyName = keyName2
@@ -230,338 +156,428 @@ end
return amount, total
end
function atributo_damage:ContainerRefreshDps (container, combat_time)
--[[Exported]] function _detalhes:TooltipForCustom (barra)
GameCooltip:AddLine (Loc ["STRING_LEFT_CLICK_SHARE"])
return true
end
if (_detalhes.time_type == 2 or not _detalhes:CaptureGet ("damage")) then
for _, actor in _ipairs (container) do
if (actor.grupo) then
actor.last_dps = actor.total / combat_time
else
--[[exported]] function _detalhes.Sort1 (table1, table2)
return table1 [1] > table2 [1]
end
--[[exported]] function _detalhes.Sort2 (table1, table2)
return table1 [2] > table2 [2]
end
--[[exported]] function _detalhes.Sort3 (table1, table2)
return table1 [3] > table2 [3]
end
--[[exported]] function _detalhes.Sort4 (table1, table2)
return table1 [4] > table2 [4]
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function atributo_damage:NovaTabela (serial, nome, link)
--> constructor
local _new_damageActor = {
tipo = class_type,
total = 0,
total_without_pet = 0,
custom = 0,
damage_taken = 0,
damage_from = {},
dps_started = false,
last_event = 0,
on_hold = false,
delay = 0,
last_value = nil,
last_dps = 0,
end_time = nil,
start_time = 0,
pets = {},
friendlyfire_total = 0,
friendlyfire = container_combatentes:NovoContainer (container_friendlyfire),
targets = container_combatentes:NovoContainer (container_damage_target),
spell_tables = container_habilidades:NovoContainer (container_damage)
}
_setmetatable (_new_damageActor, atributo_damage)
if (link) then
_new_damageActor.last_events_table = _detalhes:CreateActorLastEventTable()
_new_damageActor.last_events_table.original = true
_new_damageActor.targets.shadow = link.targets
_new_damageActor.spell_tables.shadow = link.spell_tables
_new_damageActor.friendlyfire.shadow = link.friendlyfire
end
return _new_damageActor
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> special cases
-- enemies (sort function)
local sortEnemies = function (t1, t2)
local a = _bit_band (t1.flag_original, 0x00000060)
local b = _bit_band (t2.flag_original, 0x00000060)
if (a ~= 0 and b ~= 0) then
return t1.total > t2.total
elseif (a ~= 0 and b == 0) then
return true
elseif (a == 0 and b ~= 0) then
return false
end
return false
end
-- dps (calculate dps for actors)
function atributo_damage:ContainerRefreshDps (container, combat_time)
if (_detalhes.time_type == 2 or not _detalhes:CaptureGet ("damage")) then
for _, actor in _ipairs (container) do
if (actor.grupo) then
actor.last_dps = actor.total / combat_time
else
actor.last_dps = actor.total / actor:Tempo()
end
end
else
for _, actor in _ipairs (container) do
actor.last_dps = actor.total / actor:Tempo()
end
end
else
for _, actor in _ipairs (container) do
actor.last_dps = actor.total / actor:Tempo()
end
end
end
function _detalhes:ToolTipFrags (instancia, frag, esta_barra, keydown)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> frags
--vardump (frag)
local name = frag [1]
local GameCooltip = GameCooltip
--> mantendo a função o mais low level possível
local damage_container = instancia.showing [1]
local frag_actor = damage_container._ActorTable [damage_container._NameIndexTable [ name ]]
function _detalhes:ToolTipFrags (instancia, frag, esta_barra, keydown)
if (frag_actor) then
local name = frag [1]
local GameCooltip = GameCooltip
local damage_taken_table = {}
local took_damage_from = frag_actor.damage_from
local total_damage_taken = frag_actor.damage_taken
for aggressor, _ in _pairs (took_damage_from) do
--> mantendo a função o mais low level possível
local damage_container = instancia.showing [1]
local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]]
local frag_actor = damage_container._ActorTable [damage_container._NameIndexTable [ name ]]
if (frag_actor) then
if (damager_actor and not damager_actor.owner) then --> checagem por causa do total e do garbage collector que não limpa os names que deram dano
local damage_taken_table = {}
local took_damage_from = frag_actor.damage_from
local total_damage_taken = frag_actor.damage_taken
for aggressor, _ in _pairs (took_damage_from) do
local targets = damager_actor.targets
local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]]
local specific_target = targets._ActorTable [targets._NameIndexTable [ name ]] --> é ele mesmo
if (specific_target) then
damage_taken_table [#damage_taken_table+1] = {aggressor, specific_target.total, damager_actor.classe}
if (damager_actor and not damager_actor.owner) then --> checagem por causa do total e do garbage collector que não limpa os names que deram dano
local targets = damager_actor.targets
local specific_target = targets._ActorTable [targets._NameIndexTable [ name ]] --> é ele mesmo
if (specific_target) then
damage_taken_table [#damage_taken_table+1] = {aggressor, specific_target.total, damager_actor.classe}
end
end
end
end
if (#damage_taken_table > 0) then
if (#damage_taken_table > 0) then
_table_sort (damage_taken_table, _detalhes.Sort2)
GameCooltip:AddLine (Loc ["STRING_DAMAGE_FROM"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
_table_sort (damage_taken_table, _detalhes.Sort2)
GameCooltip:AddLine (Loc ["STRING_DAMAGE_FROM"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
local min = 6
local ismaximized = false
if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then
min = 99
ismaximized = true
end
if (ismaximized) then
--highlight shift key
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay_press)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, 1)
else
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3)
end
for i = 1, math.min (min, #damage_taken_table) do
local t = damage_taken_table [i]
GameCooltip:AddLine (t [1], FormatTooltipNumber (_, t [2]))
local classe = t [3]
if (not classe) then
classe = "UNKNOW"
local min = 6
local ismaximized = false
if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then
min = 99
ismaximized = true
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
if (ismaximized) then
--highlight shift key
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay_press)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, 1)
else
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe]))
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3)
end
_detalhes:AddTooltipBackgroundStatusbar()
for i = 1, math.min (min, #damage_taken_table) do
local t = damage_taken_table [i]
GameCooltip:AddLine (t [1], FormatTooltipNumber (_, t [2]))
local classe = t [3]
if (not classe) then
classe = "UNKNOW"
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
else
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe]))
end
_detalhes:AddTooltipBackgroundStatusbar()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
end
local function RefreshBarraFrags (tabela, barra, instancia)
atributo_damage:AtualizarFrags (tabela, tabela.minha_barra, barra.colocacao, instancia)
end
local function RefreshBarraFrags (tabela, barra, instancia)
atributo_damage:AtualizarFrags (tabela, tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_damage:ReportSingleFragsLine (frag, instancia)
local barra = instancia.barras [frag.minha_barra]
function atributo_damage:ReportSingleFragsLine (frag, instancia)
local barra = instancia.barras [frag.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"].. ": " .. frag [1]} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"].. ": " .. frag [1]} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
end
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instancia)
function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instancia)
tabela ["frags"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = tabela
tabela.nome = tabela [1] --> evita dar erro ao redimencionar a janela
tabela.minha_barra = qual_barra
esta_barra.colocacao = colocacao
if (not _getmetatable (tabela)) then
_setmetatable (tabela, {__call = RefreshBarraFrags})
tabela._custom = true
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. tabela [1])
esta_barra.texto_direita:SetText (tabela [2])
if (colocacao == 1) then
esta_barra.statusbar:SetValue (100)
else
esta_barra.statusbar:SetValue (tabela [2] / instancia.top * 100)
end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
--> ele nao come o texto quando a instância esta muito pequena
esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [tabela [3]]))
if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then
esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\LFGROLE_BW")
esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (_detalhes.class_coords [tabela [3]]))
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
function atributo_damage:ReportSingleVoidZoneLine (actor, instancia)
local barra = instancia.barras [actor.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. ": " .. actor.nome} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
tabela ["frags"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = tabela
tabela.nome = tabela [1] --> evita dar erro ao redimencionar a janela
tabela.minha_barra = qual_barra
esta_barra.colocacao = colocacao
if (not _getmetatable (tabela)) then
_setmetatable (tabela, {__call = RefreshBarraFrags})
tabela._custom = true
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. tabela [1])
esta_barra.texto_direita:SetText (tabela [2])
if (colocacao == 1) then
esta_barra.statusbar:SetValue (100)
else
esta_barra.statusbar:SetValue (tabela [2] / instancia.top * 100)
end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
--> ele nao come o texto quando a instância esta muito pequena
esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [tabela [3]]))
if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then
esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\LFGROLE_BW")
esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (_detalhes.class_coords [tabela [3]]))
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> void zones
function atributo_damage:ReportSingleVoidZoneLine (actor, instancia)
local barra = instancia.barras [actor.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. ": " .. actor.nome} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
end
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
function _detalhes:ToolTipVoidZones (instancia, actor, barra, keydown)
local damage_actor = instancia.showing[1]:PegarCombatente (_, actor.damage_twin)
local habilidade
local alvos
if (damage_actor) then
habilidade = damage_actor.spell_tables._ActorTable [actor.damage_spellid]
end
if (habilidade) then
alvos = habilidade.targets
end
local container = actor.debuff_uptime_targets._ActorTable
for _, alvo in _ipairs (container) do
if (alvos) then
local damage_alvo = alvos._NameIndexTable [alvo.nome]
if (damage_alvo) then
damage_alvo = alvos._ActorTable [damage_alvo]
alvo.damage = damage_alvo.total
function _detalhes:ToolTipVoidZones (instancia, actor, barra, keydown)
local damage_actor = instancia.showing[1]:PegarCombatente (_, actor.damage_twin)
local habilidade
local alvos
if (damage_actor) then
habilidade = damage_actor.spell_tables._ActorTable [actor.damage_spellid]
end
if (habilidade) then
alvos = habilidade.targets
end
local container = actor.debuff_uptime_targets._ActorTable
for _, alvo in _ipairs (container) do
if (alvos) then
local damage_alvo = alvos._NameIndexTable [alvo.nome]
if (damage_alvo) then
damage_alvo = alvos._ActorTable [damage_alvo]
alvo.damage = damage_alvo.total
else
alvo.damage = 0
end
else
alvo.damage = 0
end
else
alvo.damage = 0
end
end
--> sort no container:
_table_sort (container, function (tabela1, tabela2)
if (tabela1.damage > tabela2.damage) then
return true;
elseif (tabela1.damage == tabela2.damage) then
return tabela1.uptime > tabela2.uptime;
end
return false;
end)
actor.debuff_uptime_targets:remapear()
--> monta o cooltip
local GameCooltip = GameCooltip
GameCooltip:AddLine (Loc ["STRING_VOIDZONE_TOOLTIP"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
for _, alvo in _ipairs (container) do
--> sort no container:
_table_sort (container, function (tabela1, tabela2)
if (tabela1.damage > tabela2.damage) then
return true;
elseif (tabela1.damage == tabela2.damage) then
return tabela1.uptime > tabela2.uptime;
end
return false;
end)
actor.debuff_uptime_targets:remapear()
--> monta o cooltip
local GameCooltip = GameCooltip
GameCooltip:AddLine (Loc ["STRING_VOIDZONE_TOOLTIP"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
for _, alvo in _ipairs (container) do
local minutos, segundos = _math_floor (alvo.uptime / 60), _math_floor (alvo.uptime % 60)
if (minutos > 0) then
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. minutos .. "m " .. segundos .. "s" .. ")")
else
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. segundos .. "s" .. ")")
local minutos, segundos = _math_floor (alvo.uptime / 60), _math_floor (alvo.uptime % 60)
if (minutos > 0) then
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. minutos .. "m " .. segundos .. "s" .. ")")
else
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. segundos .. "s" .. ")")
end
local classe = _detalhes:GetClass (alvo.nome)
if (classe) then
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe]))
else
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
end
_detalhes:AddTooltipBackgroundStatusbar()
end
local classe = _detalhes:GetClass (alvo.nome)
if (classe) then
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe]))
else
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
end
local function RefreshBarraVoidZone (tabela, barra, instancia)
tabela:AtualizarVoidZone (tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_misc:AtualizarVoidZone (qual_barra, colocacao, instancia)
--> pega a referência da barra na janela
local esta_barra = instancia.barras [qual_barra]
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
_detalhes:AddTooltipBackgroundStatusbar()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
end
local function RefreshBarraVoidZone (tabela, barra, instancia)
tabela:AtualizarVoidZone (tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_misc:AtualizarVoidZone (qual_barra, colocacao, instancia)
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
self._refresh_window = RefreshBarraVoidZone
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = self
self.minha_barra = qual_barra
esta_barra.colocacao = colocacao
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome)
esta_barra.texto_direita:SetText (self.debuff_uptime)
--if (colocacao == 1) then
self._refresh_window = RefreshBarraVoidZone
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = self
self.minha_barra = qual_barra
esta_barra.colocacao = colocacao
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome)
esta_barra.texto_direita:SetText (self.debuff_uptime)
esta_barra.statusbar:SetValue (100)
--else
-- esta_barra.statusbar:SetValue (self.debuff_uptime / instancia.top * 100)
--end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
local _, _, icon = GetSpellInfo (self.damage_spellid)
local school_color = _detalhes.school_colors [self.spellschool]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
esta_barra.textura:SetVertexColor (_unpack (school_color))
esta_barra.icone_classe:SetTexture (icon)
esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
local _, _, icon = GetSpellInfo (self.damage_spellid)
local school_color = _detalhes.school_colors [self.spellschool]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
esta_barra.textura:SetVertexColor (_unpack (school_color))
esta_barra.icone_classe:SetTexture (icon)
esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then
--need call a refresh function
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
local ntable = {}
local vtable = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> main refresh function
function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, exportar, refresh_needed)
@@ -849,7 +865,6 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (not using_cache) then
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
@@ -1401,11 +1416,7 @@ end
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
--[[Exported]] function _detalhes:TooltipForCustom (barra)
--GameCooltip:AddLine (barra.colocacao..". "..self.nome)
GameCooltip:AddLine (Loc ["STRING_LEFT_CLICK_SHARE"])
return true
end
---------> TOOLTIPS BIFURCAÇÃO
@@ -1428,18 +1439,7 @@ end
local r, g, b
local barAlha = .6
--[[exported]] function _detalhes.Sort1 (table1, table2)
return table1 [1] > table2 [1]
end
--[[exported]] function _detalhes.Sort2 (table1, table2)
return table1 [2] > table2 [2]
end
--[[exported]] function _detalhes.Sort3 (table1, table2)
return table1 [3] > table2 [3]
end
--[[exported]] function _detalhes.Sort4 (table1, table2)
return table1 [4] > table2 [4]
end
---------> DAMAGE DONE & DPS
+217 -243
View File
@@ -1,131 +1,123 @@
--[[ classe do dano aplicado, usado nos eventos:
- SPELL_PERIODIC_DAMAGE
- SPELL_DAMAGE
- SWING_DAMAGE
- RANGE_DAMAGE
-- damage ability file
Parents:
addon -> combate atual -> Npc/Player Swicth -> Container de Habilidades -> esta tabela
]]
local _detalhes = _G._detalhes
local _
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable--lua local
local _ipairs = ipairs--lua local
local _pairs = pairs--lua local
local _UnitAura = UnitAura--api local
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_dano = _detalhes.habilidade_dano
local container_combatentes = _detalhes.container_combatentes
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
--lua locals
local _setmetatable = setmetatable
local _ipairs = ipairs
local _pairs = pairs
local _
--api locals
local _UnitAura = UnitAura
--local _GetSpellInfo = _detalhes.getspellinfo
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_dano = _detalhes.habilidade_dano
local container_combatentes = _detalhes.container_combatentes
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _recording_ability_with_buffs = false
local _recording_ability_with_buffs = false
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
--id, nome, type, miss, dano, cura, overkill, school, resisted, blocked, absorbed, critico, glacing, crushing
function habilidade_dano:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
function habilidade_dano:NovaTabela (id, link, token)
local _newDamageSpell = {
total = 0, --total de dano aplicado por esta habilidade
counter = 0, --conta quantas vezes a habilidade foi chamada
id = id,
successful_casted = 0,
local _newDamageSpell = {
--> normal
n_min = 0,
n_max = 0,
n_amt = 0,
n_dmg = 0,
total = 0, --total damage
counter = 0, --counter
id = id, --spellid
successful_casted = 0, --successful casted times (only for enemies)
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_dmg = 0,
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_dmg = 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 = container_combatentes:NovoContainer (container_damage_target)
}
--> criticos
c_min = 0,
c_max = 0,
c_amt = 0,
c_dmg = 0,
--> glacing
g_amt = 0,
g_dmg = 0,
_setmetatable (_newDamageSpell, habilidade_dano)
--> resisted
r_amt = 0,
r_dmg = 0,
if (link) then
_newDamageSpell.targets.shadow = link.targets
end
--> blocked
b_amt = 0,
b_dmg = 0,
--> obsorved
a_amt = 0,
a_dmg = 0,
if (token == "SPELL_PERIODIC_DAMAGE") then
_detalhes:SpellIsDot (id)
end
targets = container_combatentes:NovoContainer (container_damage_target)
}
_setmetatable (_newDamageSpell, habilidade_dano)
if (link) then
_newDamageSpell.targets.shadow = link.targets
end
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
local miss = self [missType] or 0
miss = miss + 1
self [missType] = miss
local alvo = self.targets:PegarCombatente (serial, nome, flags, true)
return alvo:AddQuantidade (0)
end
function habilidade_dano:AddFF (amount)
self.counter = self.counter + 1
self.total = self.total + amount
end
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
return _newDamageSpell
end
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
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
self.counter = self.counter + 1
local miss = self [missType] or 0
miss = miss + 1
self [missType] = miss
self.targets:PegarCombatente (serial, nome, flags, true) --apenas criar o alvo para a abilidade
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
function habilidade_dano:AddFF (amount)
self.counter = self.counter + 1
self.total = self.total + amount
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
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
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
self.total = self.total + amount
alvo.total = alvo.total + amount
@@ -152,157 +144,139 @@ function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, bl
self.n_min = amount
end
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
if (_recording_ability_with_buffs) then
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
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
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
SpellBuffDetails [buff_name] = buff_info
end
end
end
end
else
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
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
SpellBuffDetails [name] = buff_info
end
end
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_dano)
habilidade.__index = habilidade_dano
habilidade.shadow = shadow._ActorTable [habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
end
function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_dano)
habilidade.__index = habilidade_dano
habilidade.shadow = shadow._ActorTable [habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
end
function _detalhes.clear:c_habilidade_dano (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_dano (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_dano.__add = function (tabela1, tabela2)
tabela1.total = tabela1.total + tabela2.total
tabela1.counter = tabela1.counter + tabela2.counter
tabela1.successful_casted = tabela1.successful_casted + tabela2.successful_casted
tabela1.n_min = tabela1.n_min + tabela2.n_min
tabela1.n_max = tabela1.n_max + tabela2.n_max
tabela1.n_amt = tabela1.n_amt + tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg + tabela2.n_dmg
habilidade_dano.__add = function (tabela1, tabela2)
tabela1.total = tabela1.total + tabela2.total
tabela1.counter = tabela1.counter + tabela2.counter
tabela1.successful_casted = tabela1.successful_casted + tabela2.successful_casted
tabela1.n_min = tabela1.n_min + tabela2.n_min
tabela1.n_max = tabela1.n_max + tabela2.n_max
tabela1.n_amt = tabela1.n_amt + tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg + tabela2.n_dmg
tabela1.c_min = tabela1.c_min + tabela2.c_min
tabela1.c_max = tabela1.c_max + tabela2.c_max
tabela1.c_amt = tabela1.c_amt + tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg + tabela2.c_dmg
--tabela1.g_min = tabela1.g_min + tabela2.g_min
--tabela1.g_max = tabela1.g_max + tabela2.g_max
tabela1.g_amt = tabela1.g_amt + tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg + tabela2.g_dmg
--tabela1.r_min = tabela1.r_min + tabela2.r_min
--tabela1.r_max = tabela1.r_max + tabela2.r_max
tabela1.r_amt = tabela1.r_amt + tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg + tabela2.r_dmg
--tabela1.b_min = tabela1.b_min + tabela2.b_min
--tabela1.b_max = tabela1.b_max + tabela2.b_max
tabela1.b_amt = tabela1.b_amt + tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg + tabela2.b_dmg
--tabela1.a_min = tabela1.a_min + tabela2.a_min
--tabela1.a_max = tabela1.a_max + tabela2.a_max
tabela1.a_amt = tabela1.a_amt + tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg + tabela2.a_dmg
--tabela1.crushing = tabela1.crushing + tabela2.crushing
return tabela1
end
tabela1.c_min = tabela1.c_min + tabela2.c_min
tabela1.c_max = tabela1.c_max + tabela2.c_max
tabela1.c_amt = tabela1.c_amt + tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg + tabela2.c_dmg
tabela1.g_amt = tabela1.g_amt + tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg + tabela2.g_dmg
tabela1.r_amt = tabela1.r_amt + tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg + tabela2.r_dmg
tabela1.b_amt = tabela1.b_amt + tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg + tabela2.b_dmg
tabela1.a_amt = tabela1.a_amt + tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg + tabela2.a_dmg
return tabela1
end
habilidade_dano.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.successful_casted = tabela1.successful_casted - tabela2.successful_casted
habilidade_dano.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.successful_casted = tabela1.successful_casted - tabela2.successful_casted
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg - tabela2.n_dmg
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg - tabela2.n_dmg
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg - tabela2.c_dmg
--tabela1.g_min = tabela1.g_min - tabela2.g_min
--tabela1.g_max = tabela1.g_max - tabela2.g_max
tabela1.g_amt = tabela1.g_amt - tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg - tabela2.g_dmg
--tabela1.r_min = tabela1.r_min - tabela2.r_min
--tabela1.r_max = tabela1.r_max - tabela2.r_max
tabela1.r_amt = tabela1.r_amt - tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg - tabela2.r_dmg
--tabela1.b_min = tabela1.b_min - tabela2.b_min
--tabela1.b_max = tabela1.b_max - tabela2.b_max
tabela1.b_amt = tabela1.b_amt - tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg - tabela2.b_dmg
--tabela1.a_min = tabela1.a_min - tabela2.a_min
--tabela1.a_max = tabela1.a_max - tabela2.a_max
tabela1.a_amt = tabela1.a_amt - tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg - tabela2.a_dmg
--tabela1.crushing = tabela1.crushing - tabela2.crushing
return tabela1
end
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg - tabela2.c_dmg
tabela1.g_amt = tabela1.g_amt - tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg - tabela2.g_dmg
tabela1.r_amt = tabela1.r_amt - tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg - tabela2.r_dmg
tabela1.b_amt = tabela1.b_amt - tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg - tabela2.b_dmg
tabela1.a_amt = tabela1.a_amt - tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg - tabela2.a_dmg
return tabela1
end
function _detalhes:UpdateDamageAbilityGears()
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
end
function _detalhes:UpdateDamageAbilityGears()
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
end
-5
View File
@@ -53,10 +53,6 @@ local class_type = _detalhes.atributos.e_energy
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -253,7 +249,6 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
end)
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+94 -84
View File
@@ -1,102 +1,112 @@
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-- energy ability file
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_energy = _detalhes.habilidade_e_energy
local container_combatentes = _detalhes.container_combatentes
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local _detalhes = _G._detalhes
local _
--lua locals
local _setmetatable = setmetatable
local _ipairs = ipairs
--api locals
local _UnitAura = UnitAura
local _
--local _GetSpellInfo = _detalhes.getspellinfo
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _UnitAura = UnitAura --api local
function habilidade_energy:NovaTabela (id, link, token)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local _newEnergySpell = {
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_energy = _detalhes.habilidade_e_energy
local container_combatentes = _detalhes.container_combatentes
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
id = id,
counter = 0,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function habilidade_energy:NovaTabela (id, link, token)
local _newEnergySpell = {
id = id,
counter = 0,
mana = 0,
e_rage = 0,
e_energy = 0,
runepower = 0,
targets = container_combatentes:NovoContainer (container_energy_target)
}
mana = 0,
e_rage = 0,
e_energy = 0,
runepower = 0,
_setmetatable (_newEnergySpell, habilidade_energy)
targets = container_combatentes:NovoContainer (container_energy_target)
}
_setmetatable (_newEnergySpell, habilidade_energy)
if (link) then
_newEnergySpell.targets.shadow = link.targets
end
return _newEnergySpell
end
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype)
self.counter = self.counter + 1
--local alvo = self.targets:PegarCombatente (serial, nome, flag, true)
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
if (link) then
_newEnergySpell.targets.shadow = link.targets
end
return _newEnergySpell
end
if (powertype == 0) then --> MANA
self.mana = self.mana + amount
alvo.mana = alvo.mana + amount
elseif (powertype == 1) then --> e_rage
self.e_rage = self.e_rage + amount
alvo.e_rage = alvo.e_rage + amount
elseif (powertype == 3) then --> ENERGIA
self.e_energy = self.e_energy + amount
alvo.e_energy = alvo.e_energy + amount
elseif (powertype == 6) then --> RUNEPOWER
self.runepower = self.runepower + amount
alvo.runepower = alvo.runepower + amount
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
if (powertype == 0) then --> MANA
self.mana = self.mana + amount
alvo.mana = alvo.mana + amount
elseif (powertype == 1) then --> e_rage
self.e_rage = self.e_rage + amount
alvo.e_rage = alvo.e_rage + amount
elseif (powertype == 3) then --> ENERGIA
self.e_energy = self.e_energy + amount
alvo.e_energy = alvo.e_energy + amount
elseif (powertype == 6) then --> RUNEPOWER
self.runepower = self.runepower + amount
alvo.runepower = alvo.runepower + amount
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_energy)
habilidade.__index = habilidade_energy
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
function _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_energy)
habilidade.__index = habilidade_energy
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
end
function _detalhes.clear:c_habilidade_e_energy (habilidade)
--habilidade.__index = {}
habilidade.__index = {}
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_e_energy (habilidade)
--habilidade.__index = {}
habilidade.__index = {}
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_energy.__sub = function (tabela1, tabela2)
habilidade_energy.__sub = function (tabela1, tabela2)
tabela1.mana = tabela1.mana - tabela2.mana
tabela1.e_rage = tabela1.e_rage - tabela2.e_rage
tabela1.e_energy = tabela1.e_energy - tabela2.e_energy
tabela1.runepower = tabela1.runepower - tabela2.runepower
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.mana = tabela1.mana - tabela2.mana
tabela1.e_rage = tabela1.e_rage - tabela2.e_rage
tabela1.e_energy = tabela1.e_energy - tabela2.e_energy
tabela1.runepower = tabela1.runepower - tabela2.runepower
tabela1.counter = tabela1.counter - tabela2.counter
return tabela1
end
return tabela1
end
-5
View File
@@ -52,10 +52,6 @@ local class_type = _detalhes.atributos.cura
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -331,7 +327,6 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end)--]]
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+130 -130
View File
@@ -1,154 +1,154 @@
--[[ classe do dano aplicado, usado nos eventos:
- SPELL_HEAL
- SPELL_PERIODIC_HEAL
Parents:
addon -> combate atual -> Npc/Player Swicth -> Container de Habilidades -> esta tabela
]]
-- heal ability file
local _detalhes = _G._detalhes
local gump = _detalhes.gump
local _detalhes = _G._detalhes
local _
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_cura = _detalhes.habilidade_cura
local container_combatentes = _detalhes.container_combatentes
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
--lua locals
local _setmetatable = setmetatable
--api locals
function habilidade_cura:NovaTabela (id, link) --aqui eu não sei que parâmetros passar
local _newHealSpell = {
local _setmetatable = setmetatable --lua local
total = 0,
totalabsorb = 0,
counter = 0,
id = id,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_curado = 0,
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_cura = _detalhes.habilidade_cura
local container_combatentes = _detalhes.container_combatentes
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function habilidade_cura:NovaTabela (id, link)
local _newHealSpell = {
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_curado = 0,
total = 0,
totalabsorb = 0,
counter = 0,
id = id,
absorbed = 0,
overheal = 0,
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_curado = 0,
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_curado = 0,
absorbed = 0,
overheal = 0,
targets = container_combatentes:NovoContainer (container_heal_target)
}
targets = container_combatentes:NovoContainer (container_heal_target)
}
_setmetatable (_newHealSpell, habilidade_cura)
if (link) then
_newHealSpell.targets.shadow = link.targets
end
return _newHealSpell
end
--> o primeiro parametro "spell" vira self a atrasa 1 parâmetro em todos os argumentos.
function habilidade_cura:Add (serial, nome, flag, amount, who_nome, absorbed, critical, overhealing, is_shield)
self.counter = self.counter + 1
--local alvo = self.targets:PegarCombatente (serial, nome, flag, true)
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
if (absorbed and absorbed > 0) then
self.absorbed = self.absorbed + absorbed
alvo.absorbed = alvo.absorbed + absorbed
end
if (overhealing and overhealing > 0) then
self.overheal = self.overheal + overhealing
alvo.overheal = alvo.overheal + overhealing
end
if (amount and amount > 0) then
self.total = self.total + amount
if (is_shield) then
self.totalabsorb = self.totalabsorb + amount
_setmetatable (_newHealSpell, habilidade_cura)
if (link) then
_newHealSpell.targets.shadow = link.targets
end
return _newHealSpell
end
alvo:AddQuantidade (amount)
function habilidade_cura:Add (serial, nome, flag, amount, who_nome, absorbed, critical, overhealing, is_shield)
if (critical) then
self.c_curado = self.c_curado+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
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
self.n_curado = self.n_curado+amount
self.n_amt = self.n_amt+1
if (amount > self.n_max) then
self.n_max = amount
alvo = self.targets._ActorTable [alvo]
end
if (absorbed and absorbed > 0) then
self.absorbed = self.absorbed + absorbed
alvo.absorbed = alvo.absorbed + absorbed
end
if (overhealing and overhealing > 0) then
self.overheal = self.overheal + overhealing
alvo.overheal = alvo.overheal + overhealing
end
if (amount and amount > 0) then
self.total = self.total + amount
alvo.total = alvo.total + amount
if (is_shield) then
self.totalabsorb = self.totalabsorb + amount
end
if (self.n_min > amount or self.n_min == 0) then
self.n_min = amount
if (critical) then
self.c_curado = self.c_curado+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_curado = self.n_curado+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
else
alvo:AddQuantidade (0)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_cura (habilidade, shadow)
_setmetatable (habilidade, habilidade_cura)
habilidade.__index = habilidade_cura
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
function _detalhes.refresh:r_habilidade_cura (habilidade, shadow)
_setmetatable (habilidade, habilidade_cura)
habilidade.__index = habilidade_cura
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
end
function _detalhes.clear:c_habilidade_cura (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_cura (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_cura.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorb = tabela1.totalabsorb - tabela2.totalabsorb
tabela1.counter = tabela1.counter - tabela2.counter
habilidade_cura.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorb = tabela1.totalabsorb - tabela2.totalabsorb
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_curado = tabela1.n_curado - tabela2.n_curado
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_curado = tabela1.n_curado - tabela2.n_curado
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_curado = tabela1.c_curado - tabela2.c_curado
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_curado = tabela1.c_curado - tabela2.c_curado
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
tabela1.overheal = tabela1.overheal - tabela2.overheal
return tabela1
end
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
tabela1.overheal = tabela1.overheal - tabela2.overheal
return tabela1
end
-5
View File
@@ -53,10 +53,6 @@ local class_type = _detalhes.atributos.misc
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -547,7 +543,6 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
--end
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (not player[keyName] or player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+233 -226
View File
@@ -1,58 +1,198 @@
local _detalhes = _G._detalhes
--local gump = _detalhes.gump
-- misc ability file
local _detalhes = _G._detalhes
local _
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_misc = _detalhes.habilidade_misc
local container_combatentes = _detalhes.container_combatentes
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--lua locals
local _
local _setmetatable = setmetatable
local _ipairs = ipairs
--api locals
local _UnitAura = UnitAura
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _UnitAura = UnitAura --api local
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
function habilidade_misc:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_misc = _detalhes.habilidade_misc
local container_combatentes = _detalhes.container_combatentes
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _newMiscSpell = {
id = id,
counter = 0,
targets = container_combatentes:NovoContainer (container_misc_target)
}
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
_newMiscSpell.uptime = 0
_newMiscSpell.actived = false
_newMiscSpell.activedamt = 0
elseif (token == "SPELL_INTERRUPT") then
_newMiscSpell.interrompeu_oque = {}
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
_newMiscSpell.dispell_oque = {}
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
_newMiscSpell.cc_break_oque = {}
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
_setmetatable (_newMiscSpell, habilidade_misc)
if (link) then
_newMiscSpell.targets.shadow = link.targets
end
return _newMiscSpell
end
function habilidade_misc:NovaTabela (id, link, token)
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
--alvo:AddQuantidade (1)
if (spellID == "BUFF_OR_DEBUFF") then
local _newMiscSpell = {
id = id,
counter = 0,
targets = container_combatentes:NovoContainer (container_misc_target)
}
if (spellName == "COOLDOWN") then
self.counter = self.counter + 1
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
_newMiscSpell.uptime = 0
_newMiscSpell.actived = false
_newMiscSpell.activedamt = 0
elseif (token == "SPELL_INTERRUPT") then
_newMiscSpell.interrompeu_oque = {}
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
_newMiscSpell.dispell_oque = {}
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
_newMiscSpell.cc_break_oque = {}
end
_setmetatable (_newMiscSpell, habilidade_misc)
if (link) then
_newMiscSpell.targets.shadow = link.targets
end
return _newMiscSpell
end
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
if (spellID == "BUFF_OR_DEBUFF") then
--> alvo
if (spellName == "COOLDOWN") then
self.counter = self.counter + 1
--> alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (spellName == "BUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "BUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived = false
self.actived_at = nil
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
self.actived = true
self.activedamt = self.activedamt + 1
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
--> ja esta ativo em outro mob e jogou num novo
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "DEBUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.activedamt = self.activedamt - 1
if (self.activedamt == 0) then
self.actived = false
self.actived_at = nil
else
self.actived_at = _detalhes._tempo
end
end
elseif (token == "SPELL_INTERRUPT") then
self.counter = self.counter + 1
if (not self.interrompeu_oque [spellID]) then --> interrompeu_oque a NIL value
self.interrompeu_oque [spellID] = 1
else
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_RESURRECT") then
if (not self.ress) then
self.ress = 1
else
self.ress = self.ress + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
if (not self.dispell) then
self.dispell = 1
else
self.dispell = self.dispell + 1
end
if (not self.dispell_oque [spellID]) then
self.dispell_oque [spellID] = 1
else
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
if (not self.cc_break) then
self.cc_break = 1
else
self.cc_break = self.cc_break + 1
end
if (not self.cc_break_oque [spellID]) then
self.cc_break_oque [spellID] = 1
else
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
@@ -60,190 +200,57 @@ function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spel
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (spellName == "BUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "BUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived = false
self.actived_at = nil
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
self.actived = true
self.activedamt = self.activedamt + 1
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
--> ja esta ativo em outro mob e jogou num novo
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "DEBUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.activedamt = self.activedamt - 1
if (self.activedamt == 0) then
self.actived = false
self.actived_at = nil
else
self.actived_at = _detalhes._tempo
end
end
elseif (token == "SPELL_INTERRUPT") then
self.counter = self.counter + 1
if (not self.interrompeu_oque [spellID]) then --> interrompeu_oque a NIL value
self.interrompeu_oque [spellID] = 1
else
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_RESURRECT") then
if (not self.ress) then
self.ress = 1
else
self.ress = self.ress + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
if (not self.dispell) then
self.dispell = 1
else
self.dispell = self.dispell + 1
end
if (not self.dispell_oque [spellID]) then
self.dispell_oque [spellID] = 1
else
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
if (not self.cc_break) then
self.cc_break = 1
else
self.cc_break = self.cc_break + 1
end
if (not self.cc_break_oque [spellID]) then
self.cc_break_oque [spellID] = 1
else
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
end
end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--> habilidade atual e o container de habilidades da shadow
function _detalhes.refresh:r_habilidade_misc (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_misc)
habilidade.__index = habilidade_misc
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
function _detalhes.clear:c_habilidade_misc (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_misc.__sub = function (tabela1, tabela2)
--interrupts & cooldowns
tabela1.counter = tabela1.counter - tabela2.counter
--buff uptime ou debuff uptime
if (tabela1.uptime and tabela2.uptime) then
tabela1.uptime = tabela1.uptime - tabela2.uptime
end
--ressesrs
if (tabela1.ress and tabela2.ress) then
tabela1.ress = tabela1.ress - tabela2.ress
end
--dispells
if (tabela1.dispell and tabela2.dispell) then
tabela1.dispell = tabela1.dispell - tabela2.dispell
end
--cc_breaks
if (tabela1.cc_break and tabela2.cc_break) then
tabela1.cc_break = tabela1.cc_break - tabela2.cc_break
function _detalhes.refresh:r_habilidade_misc (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_misc)
habilidade.__index = habilidade_misc
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
return tabela1
end
function _detalhes.clear:c_habilidade_misc (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_misc.__sub = function (tabela1, tabela2)
--interrupts & cooldowns
tabela1.counter = tabela1.counter - tabela2.counter
--buff uptime ou debuff uptime
if (tabela1.uptime and tabela2.uptime) then
tabela1.uptime = tabela1.uptime - tabela2.uptime
end
--ressesrs
if (tabela1.ress and tabela2.ress) then
tabela1.ress = tabela1.ress - tabela2.ress
end
--dispells
if (tabela1.dispell and tabela2.dispell) then
tabela1.dispell = tabela1.dispell - tabela2.dispell
end
--cc_breaks
if (tabela1.cc_break and tabela2.cc_break) then
tabela1.cc_break = tabela1.cc_break - tabela2.cc_break
end
return tabela1
end
+45 -43
View File
@@ -1,49 +1,51 @@
-- class target file
local _detalhes = _G._detalhes
--local AceLocale = LibStub ("AceLocale-3.0")
--local Loc = AceLocale:GetLocale ( "Details" )
local gump = _detalhes.gump
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
--lua locals
local _setmetatable = setmetatable
--api locals
--esta tabela irá ser usada por todas os tipos? tipo dano, cura, interrupts?
function alvo_da_habilidade:NovaTabela (link)
local esta_tabela = {total = 0}
_setmetatable (esta_tabela, alvo_da_habilidade)
local _detalhes = _G._detalhes
return esta_tabela
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
function alvo_da_habilidade:AddQuantidade (amt)
self.total = self.total + amt
if (self.shadow) then
return self.shadow:AddQuantidade (amt)
local _setmetatable = setmetatable --lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function alvo_da_habilidade:NovaTabela (link)
local esta_tabela = {total = 0}
_setmetatable (esta_tabela, alvo_da_habilidade)
return esta_tabela
end
end
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
_setmetatable (este_alvo, alvo_da_habilidade)
este_alvo.__index = alvo_da_habilidade
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
end
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
este_alvo.shadow = nil
--este_alvo.__index = {}
este_alvo.__index = nil
end
alvo_da_habilidade.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
if (tabela1.overheal) then
tabela1.overheal = tabela1.overheal - tabela2.overheal
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
function alvo_da_habilidade:AddQuantidade (amt)
self.total = self.total + amt
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
_setmetatable (este_alvo, alvo_da_habilidade)
este_alvo.__index = alvo_da_habilidade
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
end
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
este_alvo.shadow = nil
--este_alvo.__index = {}
este_alvo.__index = nil
end
alvo_da_habilidade.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
if (tabela1.overheal) then
tabela1.overheal = tabela1.overheal - tabela2.overheal
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
end
end
end
+421 -468
View File
@@ -1,511 +1,464 @@
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-- actor container file
local combatente = _detalhes.combatente
local container_combatentes = _detalhes.container_combatentes
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local atributo_damage = _detalhes.atributo_damage
local atributo_heal = _detalhes.atributo_heal
local atributo_energy = _detalhes.atributo_energy
local atributo_misc = _detalhes.atributo_misc
local _detalhes = _G._detalhes
local _
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_enemydebufftarget_target = _detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--api locals
local _UnitClass = UnitClass
local _IsInInstance = IsInInstance
--lua locals
local _setmetatable = setmetatable
local _getmetatable = getmetatable
local _bit_band = bit.band
local _ipairs = ipairs
local _pairs = pairs
local _
--local table_insert = table.insert
--> FLAGS <== qual o tipo do objeto
local OBJECT_TYPE_MASK = 0x0000FC00
local OBJECT_TYPE_OBJECT = 0x00004000
local OBJECT_TYPE_PETGUARDIAN = 0x00003000
local OBJECT_TYPE_GUARDIAN = 0x00002000
local OBJECT_TYPE_PET = 0x00001000
local OBJECT_TYPE_NPC = 0x00000800
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_PETS = OBJECT_TYPE_PET + OBJECT_TYPE_GUARDIAN
local EM_GRUPO = 0x00000007
local REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE or 0x00000040
function container_combatentes:NovoContainer (tipo_do_container, combatTable, combatId)
local _newContainer = {
local _UnitClass = UnitClass --api local
local _IsInInstance = IsInInstance --api local
funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
combatId = combatId,
_ActorTable = {},
_NameIndexTable = {}
}
local _setmetatable = setmetatable --lua local
local _getmetatable = getmetatable --lua local
local _bit_band = bit.band --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
_setmetatable (_newContainer, container_combatentes)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
return _newContainer
end
local combatente = _detalhes.combatente
local container_combatentes = _detalhes.container_combatentes
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local atributo_damage = _detalhes.atributo_damage
local atributo_heal = _detalhes.atributo_heal
local atributo_energy = _detalhes.atributo_energy
local atributo_misc = _detalhes.atributo_misc
local function get_actor_class (novo_objeto, nome, flag)
local _, engClass = _UnitClass (nome)
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_enemydebufftarget_target = _detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS
if (engClass) then
novo_objeto.classe = engClass
return
else
if (flag) then
--> conferir se o jogador é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.classe = "UNGROUPPLAYER"
return
elseif (_bit_band (flag, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
novo_objeto.classe = "PET"
return
end
--> flags
local REACTION_HOSTILE = 0x00000040
local IS_GROUP_OBJECT = 0x00000007
local OBJECT_TYPE_MASK = 0x0000FC00
local OBJECT_TYPE_OBJECT = 0x00004000
local OBJECT_TYPE_PETGUARDIAN = 0x00003000
local OBJECT_TYPE_GUARDIAN = 0x00002000
local OBJECT_TYPE_PET = 0x00001000
local OBJECT_TYPE_NPC = 0x00000800
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_PETS = OBJECT_TYPE_PET + OBJECT_TYPE_GUARDIAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> api functions
function container_combatentes:GetAmount (actorName, key)
key = key or "total"
local index = self._NameIndexTable [actorName]
if (index) then
return self._ActorTable [index] [key] or 0
else
return 0
end
novo_objeto.classe = "UNKNOW"
return
end
end
function container_combatentes:GetAmount (actorName, key)
key = key or "total"
local index = self._NameIndexTable [actorName]
if (index) then
return self._ActorTable [index] [key] or 0
else
return 0
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
local read_actor_flag = function (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
-- converte a flag do wow em flag do details
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> pega afiliação
local details_flag = 0x00000000
if (flag) then
--print ("tem flag")
if (_bit_band (flag, 0x00000400) ~= 0) then --> é um player
details_flag = details_flag+0x00000001
--> build a new actor container
function container_combatentes:NovoContainer (tipo_do_container, combat_table, combat_id)
local _newContainer = {
funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container),
novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent
if (not novo_objeto.displayName) then
tipo = tipo_do_container,
combatId = combat_id,
_ActorTable = {},
_NameIndexTable = {}
}
_setmetatable (_newContainer, container_combatentes)
return _newContainer
end
--> try to get the actor class from name
local function get_actor_class (novo_objeto, nome, flag)
local _, engClass = _UnitClass (nome)
if (engClass) then
novo_objeto.classe = engClass
return
else
if (flag) then
--> conferir se o jogador é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.classe = "UNGROUPPLAYER"
return
elseif (_bit_band (flag, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
novo_objeto.classe = "PET"
return
end
end
novo_objeto.classe = "UNKNOW"
return
end
end
--> read the actor flag
local read_actor_flag = function (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (flag) then
--> é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent
if (not novo_objeto.displayName) then
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), "")
else
novo_objeto.displayName = nome
end
end
if (_bit_band (flag, IS_GROUP_OBJECT) ~= 0 and novo_objeto.classe ~= "UNGROUPPLAYER") then --> faz parte do grupo
novo_objeto.grupo = true
if (shadow_objeto) then
shadow_objeto.grupo = true
end
if (_detalhes:IsATank (serial)) then
novo_objeto.isTank = true
if (shadow_objeto) then
shadow_objeto.isTank = true
end
end
end
--> é um pet
elseif (dono_do_pet) then
novo_objeto.owner = dono_do_pet
novo_objeto.ownerName = dono_do_pet.nome
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), "")
--print (novo_objeto.displayName)
novo_objeto.displayName = nome:gsub (("%-.*"), ">")
else
novo_objeto.displayName = nome
end
end
if (_bit_band (flag, EM_GRUPO) ~= 0 and novo_objeto.classe ~= "UNGROUPPLAYER") then --> faz parte do grupo
details_flag = details_flag+0x00000100
novo_objeto.grupo = true
if (shadow_objeto) then
shadow_objeto.grupo = true
end
if (_detalhes:IsATank (serial)) then
novo_objeto.isTank = true
if (shadow_objeto) then
shadow_objeto.isTank = true
end
end
end
elseif (dono_do_pet) then --> é um pet
details_flag = details_flag+0x00000002
novo_objeto.owner = dono_do_pet
novo_objeto.ownerName = dono_do_pet.nome
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), ">")
else
novo_objeto.displayName = nome
end
--if (not novo_objeto.displayName:find (">")) then
-- novo_objeto.displayName = novo_objeto.displayName .. ">"
--end
--print ("pet -> " .. nome)
else
novo_objeto.displayName = nome
end
-- 0x00000060 --> inimigo neutro
if (_bit_band (flag, 0x00000010) ~= 0) then --> é amigo
details_flag = details_flag+0x00000010
elseif (_bit_band (flag, 0x00000020) ~= 0) then --> é neutro
details_flag = details_flag+0x00000020
--print ("neutro -> " .. nome)
elseif (_bit_band (flag, 0x00000040) ~= 0) then --> é inimigo
details_flag = details_flag+0x00000040
if (_bit_band (flag, 0x00000400) == 0 and _bit_band (flag, OBJECT_TYPE_PETGUARDIAN) == 0) then
novo_objeto.monster = true
end
--print ("inimigos -> " .. nome)
end
else
--print (flag)
end
novo_objeto.flag = details_flag
novo_objeto.flag_original = flag
novo_objeto.serial = serial
end
function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwner)
--> antes de mais nada, vamos verificar se é um pet
local dono_do_pet
if (flag and _bit_band (flag, OBJECT_TYPE_PETS) ~= 0) then --> é um pet
--> aqui ele precisaria achar as tag < > pra saber se o nome passado já não veio com o dono imbutido
--> se não tiver as tags, terá que ser posto aqui
if (not nome:find ("<") or not nome:find (">")) then --> find é lento, não teria outra forma de fazer isso?
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
if (nome_dele) then
nome = nome_dele
--if (_detalhes.debug) then
-- print ("creating actor for pet:", nome, "owner:", dono_nome)
--end
--> e se olharmos no cache do parser antes de tentar cria-lo?
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
--> é inimigo
if (_bit_band (flag, 0x00000040) ~= 0) then
if (_bit_band (flag, OBJECT_TYPE_PLAYER) == 0 and _bit_band (flag, OBJECT_TYPE_PETGUARDIAN) == 0) then
novo_objeto.monster = true
end
end
end
novo_objeto.flag_original = flag
novo_objeto.serial = serial
end
local index = self._NameIndexTable [nome] --> pega o index no mapa
if (index) then
return self._ActorTable [index], dono_do_pet, nome
elseif (criar) then
function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwner)
-- rotinas de criação do objeto shadow
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local shadow = self.shadow --> espelho do container no overall
local shadow_objeto
if (shadow) then --> se tiver o espelho (não for a tabela overall já)
shadow_objeto = shadow:PegarCombatente (_, nome) --> apenas verifica se ele existe ou não
if (not shadow_objeto) then --> se não existir, cria-lo
local novo_nome = nome:gsub ((" <.*"), "") --> tira o nome do pet
shadow_objeto = shadow:PegarCombatente (serial, novo_nome, flag, true)
--> verifica se é um pet, se for confere se tem o nome do dono, se não tiver, precisa por
local dono_do_pet
if (flag and _bit_band (flag, OBJECT_TYPE_PETS) ~= 0) then --> é um pet
--> aqui ele precisaria achar as tag < > pra saber se o nome passado já não veio com o dono imbutido, se não tiver as tags, terá que ser posto aqui
if (not nome:find ("<") or not nome:find (">")) then --> find é lento, não teria outra forma de fazer isso?
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
if (nome_dele) then
nome = nome_dele
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
end
end
end
local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spell_tables, mas não grava nele mesmo
--> pega o index no mapa
local index = self._NameIndexTable [nome]
--> retorna o actor
if (index) then
return self._ActorTable [index], dono_do_pet, nome
novo_objeto.nome = nome
--print (nome)
-- tipo do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> não achou, criar
elseif (criar) then
--if (self.tipo == container_playernpc) then --> CONTAINER COMUM
if (self.tipo == container_damage) then --> CONTAINER DAMAGE
--> espelho do container no overall
local shadow = self.shadow
local shadow_objeto
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_damage_group [#_detalhes.cache_damage_group+1] = novo_objeto
--> se tiver o espelho (não for a tabela overall já)
if (shadow) then
--> apenas verifica se ele existe ou não
shadow_objeto = shadow:PegarCombatente (_, nome)
--> se não existir, cria-lo
if (not shadow_objeto) then
--> tira o nome do pet
local novo_nome = nome:gsub ((" <.*"), "")
--> cria o objeto
shadow_objeto = shadow:PegarCombatente (serial, novo_nome, flag, true)
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
if (novo_objeto.isTank) then
novo_objeto.avoidance = _detalhes:CreateActorAvoidanceTable()
end
elseif (self.tipo == container_heal) then --> CONTAINER HEALING
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_healing_group [#_detalhes.cache_healing_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_energy) then --> CONTAINER ENERGY
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_misc) then --> CONTAINER MISC
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
--local teste_classe =
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_damage_target) then --> CONTAINER ALVO DO DAMAGE
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
end
elseif (self.tipo == container_heal_target) then --> CONTAINER ALVOS DO HEALING
novo_objeto.overheal = 0
novo_objeto.absorbed = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
end
elseif (self.tipo == container_energy_target) then --> CONTAINER ALVOS DO ENERGY
novo_objeto.mana = 0
novo_objeto.e_rage = 0
novo_objeto.e_energy = 0
novo_objeto.runepower = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_enemydebufftarget_target) then
novo_objeto.uptime = 0
novo_objeto.actived = false
novo_objeto.activedamt = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_misc_target) then --> CONTAINER ALVOS DO MISC
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spell_tables, mas não grava nele mesmo
novo_objeto.nome = nome
-- tipo do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (self.tipo == container_damage) then --> CONTAINER DAMAGE
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_damage_group [#_detalhes.cache_damage_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
if (novo_objeto.isTank) then
novo_objeto.avoidance = _detalhes:CreateActorAvoidanceTable()
end
elseif (self.tipo == container_heal) then --> CONTAINER HEALING
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_healing_group [#_detalhes.cache_healing_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_energy) then --> CONTAINER ENERGY
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_misc) then --> CONTAINER MISC
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
--local teste_classe =
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_damage_target) then --> CONTAINER ALVO DO DAMAGE
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_heal_target) then --> CONTAINER ALVOS DO HEALING
novo_objeto.overheal = 0
novo_objeto.absorbed = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_energy_target) then --> CONTAINER ALVOS DO ENERGY
novo_objeto.mana = 0
novo_objeto.e_rage = 0
novo_objeto.e_energy = 0
novo_objeto.runepower = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_enemydebufftarget_target) then
novo_objeto.uptime = 0
novo_objeto.actived = false
novo_objeto.activedamt = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_misc_target) then --> CONTAINER ALVOS DO MISC
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_friendlyfire) then --> CONTAINER FRIENDLY FIRE
get_actor_class (novo_objeto, nome)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
end
elseif (self.tipo == container_friendlyfire) then --> CONTAINER FRIENDLY FIRE
get_actor_class (novo_objeto, nome)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
shadow_objeto.flag = details_flag
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- grava o objeto no mapa do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[
if (self.tipo == container_damage) then
if (nome:find ("Lyl")) then
if (nome:find ("-")) then
print ("nome FIM com -", isOwner)
else
--print ("nome FIM okey", isOwner)
end
local size = #self._ActorTable+1
self._ActorTable [size] = novo_objeto --> grava na tabela de indexes
self._NameIndexTable [nome] = size --> grava no hash map o index deste jogador
return novo_objeto, dono_do_pet, nome
else
return nil, nil, nil
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function container_combatentes:FuncaoDeCriacao (tipo)
if (tipo == container_damage_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_damage) then
return atributo_damage.NovaTabela
elseif (tipo == container_heal_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_heal) then
return atributo_heal.NovaTabela
elseif (tipo == container_friendlyfire) then
return atributo_damage.FF_funcao_de_criacao
elseif (tipo == container_enemydebufftarget_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_energy) then
return atributo_energy.NovaTabela
elseif (tipo == container_energy_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_misc) then
return atributo_misc.NovaTabela
elseif (tipo == container_misc_target) then
return alvo_da_habilidade.NovaTabela
end
end
--> chama a função para ser executada em todos os atores
function container_combatentes:ActorCallFunction (funcao, ...)
for index, actor in _ipairs (self._ActorTable) do
funcao (nil, actor, ...)
end
end
function container_combatentes:remapear()
local mapa = self._NameIndexTable
local conteudo = self._ActorTable
for i = 1, #conteudo do
mapa [conteudo[i].nome] = i
end
end
function _detalhes.refresh:r_container_combatentes (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_combatentes)
container.__index = _detalhes.container_combatentes
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
--> repara mapa
local mapa = {}
for i = 1, #container._ActorTable do
mapa [container._ActorTable[i].nome] = i
end
end
--]]
container._NameIndexTable = mapa
local size = #self._ActorTable+1
self._ActorTable [size] = novo_objeto --> grava na tabela de indexes
self._NameIndexTable [nome] = size --> grava no hash map o index deste jogador
return novo_objeto, dono_do_pet, nome
else
return nil, nil, nil
--> seta a shadow
container.shadow = shadow
end
end
function container_combatentes:FuncaoDeCriacao (tipo)
if (tipo == container_damage_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_damage) then
return atributo_damage.NovaTabela
elseif (tipo == container_heal_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_heal) then
return atributo_heal.NovaTabela
elseif (tipo == container_friendlyfire) then
return atributo_damage.FF_funcao_de_criacao
elseif (tipo == container_enemydebufftarget_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_energy) then
return atributo_energy.NovaTabela
elseif (tipo == container_energy_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_misc) then
return atributo_misc.NovaTabela
elseif (tipo == container_misc_target) then
return alvo_da_habilidade.NovaTabela
end
end
--> chama a função para ser executada em todos os atores
function container_combatentes:ActorCallFunction (funcao, ...)
for index, actor in _ipairs (self._ActorTable) do
funcao (nil, actor, ...)
end
end
function container_combatentes:remapear()
local mapa = self._NameIndexTable
local conteudo = self._ActorTable
for i = 1, #conteudo do
mapa [conteudo[i].nome] = i
end
end
function _detalhes.refresh:r_container_combatentes (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_combatentes)
container.__index = _detalhes.container_combatentes
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
--> repara mapa
local mapa = {}
for i = 1, #container._ActorTable do
mapa [container._ActorTable[i].nome] = i
end
container._NameIndexTable = mapa
--> seta a shadow
container.shadow = shadow
end
function _detalhes.clear:c_container_combatentes (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container._NameIndexTable = nil
container.need_refresh = nil
container.funcao_de_criacao = nil
end
function _detalhes.clear:c_container_combatentes (container)
container.__index = nil
container.shadow = nil
container._NameIndexTable = nil
container.need_refresh = nil
container.funcao_de_criacao = nil
end
+105 -110
View File
@@ -1,129 +1,124 @@
-- spells container file
local _detalhes = _G._detalhes
--local AceLocale = LibStub ("AceLocale-3.0")
--local Loc = AceLocale:GetLocale ( "Details" )
local gump = _detalhes.gump
local _setmetatable = setmetatable
local _
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local habilidade_dano = _detalhes.habilidade_dano
local habilidade_cura = _detalhes.habilidade_cura
local habilidade_e_energy = _detalhes.habilidade_e_energy
local habilidade_misc = _detalhes.habilidade_misc
local _setmetatable = setmetatable --lua local
local container_habilidades = _detalhes.container_habilidades
function container_habilidades:NovoContainer (tipo_do_container)
local _newContainer = {
funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
_ActorTable = {}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
_setmetatable (_newContainer, container_habilidades)
return _newContainer
end
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
function container_habilidades:Dupe (who)
local novo_objeto = {}
if (_getmetatable (who)) then
_setmetatable (novo_objeto, _getmetatable (who))
end
for cprop, value in _pairs (who) do
novo_objeto[cprop] = value
end
return novo_objeto
end
local habilidade_dano = _detalhes.habilidade_dano
local habilidade_cura = _detalhes.habilidade_cura
local habilidade_e_energy = _detalhes.habilidade_e_energy
local habilidade_misc = _detalhes.habilidade_misc
function container_habilidades:GetSpell (id)
return self._ActorTable [id]
end
local container_habilidades = _detalhes.container_habilidades
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
local esta_habilidade = self._ActorTable [id]
if (esta_habilidade) then
return esta_habilidade
else
if (criar) then
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function container_habilidades:NovoContainer (tipo_do_container)
local _newContainer = {
funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
_ActorTable = {}
}
if (cria_shadow) then
local novo_objeto = self.funcao_de_criacao (nil, id, nil, "")
self._ActorTable [id] = novo_objeto
return novo_objeto
end
local shadow = self.shadow --> retorna o container semelhante a esta na tabela overall
local shadow_objeto = nil
if (shadow) then --> talvez possa mandar todos os parâmetros de criação logo no inicio
shadow_objeto = shadow:PegaHabilidade (id) --> apenas verifica se ele existe ou não
if (not shadow_objeto) then --> se não existir, cria-lo
shadow_objeto = shadow:PegaHabilidade (id, true, token)
end
end
--local novo_objeto = habilidade_dano:NovaTabela (id, shadow_objeto)
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
if (shadow_objeto) then --> link é esta mesma tabela mas no container do overall
novo_objeto.shadow = shadow_objeto --> diz ao objeto qual a shadow dele na tabela overall
--novo_objeto:CriaLink (shadow_objeto) --> cria o link entre o objeto e a sua shadow
end
_setmetatable (_newContainer, container_habilidades)
self._ActorTable [id] = novo_objeto
return novo_objeto
return _newContainer
end
function container_habilidades:GetSpell (id)
return self._ActorTable [id]
end
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
local esta_habilidade = self._ActorTable [id]
if (esta_habilidade) then
return esta_habilidade
else
return nil
if (criar) then
if (cria_shadow) then
local novo_objeto = self.funcao_de_criacao (nil, id, nil, "")
self._ActorTable [id] = novo_objeto
return novo_objeto
end
local shadow = self.shadow
local shadow_objeto = nil
if (shadow) then
--> apenas verifica se ele existe ou não
shadow_objeto = shadow:PegaHabilidade (id)
--> se não existir, cria-lo
if (not shadow_objeto) then
shadow_objeto = shadow:PegaHabilidade (id, true, token)
end
end
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
self._ActorTable [id] = novo_objeto
return novo_objeto
else
return nil
end
end
end
end
function container_habilidades:FuncaoDeCriacao (tipo)
if (tipo == container_damage) then
return habilidade_dano.NovaTabela
elseif (tipo == container_heal) then
return habilidade_cura.NovaTabela
function container_habilidades:FuncaoDeCriacao (tipo)
if (tipo == container_damage) then
return habilidade_dano.NovaTabela
elseif (tipo == container_heal) then
return habilidade_cura.NovaTabela
elseif (tipo == container_energy) then
return habilidade_e_energy.NovaTabela
elseif (tipo == container_misc) then
return habilidade_misc.NovaTabela
elseif (tipo == container_energy) then
return habilidade_e_energy.NovaTabela
elseif (tipo == container_misc) then
return habilidade_misc.NovaTabela
end
end
end
function _detalhes.refresh:r_container_habilidades (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_habilidades)
container.__index = _detalhes.container_habilidades
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
container.funcao_de_criacao = func_criacao
--> seta a shadow
container.shadow = shadow
end
function _detalhes.refresh:r_container_habilidades (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_habilidades)
container.__index = _detalhes.container_habilidades
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
container.funcao_de_criacao = func_criacao
--> seta a shadow
container.shadow = shadow
end
function _detalhes.clear:c_container_habilidades (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container.funcao_de_criacao = nil
end
function _detalhes.clear:c_container_habilidades (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container.funcao_de_criacao = nil
end