updates
This commit is contained in:
@@ -0,0 +1,456 @@
|
||||
--[[
|
||||
-------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
|
||||
]]
|
||||
|
||||
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 _UnitName = UnitName --> wow api
|
||||
|
||||
--time hold
|
||||
local _tempo = time()
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--[[ __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 = {}
|
||||
|
||||
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)
|
||||
|
||||
--> debug
|
||||
esta_tabela.meu_tipo = "classe_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
|
||||
--esta_tabela.last_event = 0
|
||||
|
||||
--> record last event before dead
|
||||
esta_tabela.last_events_tables = {}
|
||||
|
||||
--> record damage data
|
||||
--esta_tabela.DpsGraphic = {max = 0}
|
||||
|
||||
--> time data container
|
||||
esta_tabela.TimeData = _detalhes.timeContainer:CreateTimeTable()
|
||||
|
||||
--> 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 oessia morreu
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function combate:GetTimeData (dataType)
|
||||
--if (not dataType) then
|
||||
return self.TimeData
|
||||
--end
|
||||
end
|
||||
|
||||
function combate:TravarTempos()
|
||||
--é necessário travar o tempo em todos os atributos do combate.
|
||||
for index, container in _ipairs (self) do -- aqui ele lista os tipos de atributo listado na lista acima
|
||||
if (index ~= 3 and index ~= 4) then --> 3 é e_energy, não possui tempo // 4 é misc tbm não possui tempo
|
||||
for _, jogador in _ipairs (container._ActorTable) do
|
||||
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 = {} --> elimina a tabela dos danos --não é mais usado desta forma
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
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:GetActorList (container)
|
||||
return self [container]._ActorTable
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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.__call = {}
|
||||
tabela_combate._combat_table = nil
|
||||
tabela_combate.shadow = nil
|
||||
end
|
||||
|
||||
combate.__sub = function (overall, combate)
|
||||
|
||||
--> foreach no dano
|
||||
for index, classe_damage in _ipairs (combate[1]._ActorTable) do
|
||||
local nome = classe_damage.nome
|
||||
local no_overall = overall[1]._ActorTable [overall[1]._NameIndexTable [nome]]
|
||||
no_overall = no_overall - classe_damage
|
||||
|
||||
local alvos = classe_damage.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.targets._ActorTable [no_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
local habilidades = classe_damage.spell_tables
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--> foreach na cura
|
||||
for index, classe_heal in _ipairs (combate[2]._ActorTable) do
|
||||
local nome = classe_heal.nome
|
||||
local no_overall = overall[2]._ActorTable [overall[2]._NameIndexTable [nome]]
|
||||
no_overall = no_overall - classe_heal
|
||||
|
||||
local alvos = classe_heal.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.targets._ActorTable [no_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
local habilidades = classe_heal.spell_tables
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--> foreach na e_energy
|
||||
for index, classe_energy in _ipairs (combate[3]._ActorTable) do
|
||||
local nome = classe_energy.nome
|
||||
local no_overall = overall[3]._ActorTable [overall[3]._NameIndexTable [nome]]
|
||||
no_overall = no_overall - classe_energy
|
||||
|
||||
local alvos = classe_energy.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.targets._ActorTable [no_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
local habilidades = classe_energy.spell_tables
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--> foreach no misc
|
||||
for index, classe_misc in _ipairs (combate[4]._ActorTable) do
|
||||
local nome = classe_misc.nome
|
||||
local no_overall = overall[4]._ActorTable [overall[4]._NameIndexTable [nome]]
|
||||
no_overall = no_overall - classe_misc
|
||||
|
||||
if (classe_misc.interrupt) then
|
||||
local alvos = classe_misc.interrupt_targets
|
||||
local habilidades = classe_misc.interrupt_spell_tables
|
||||
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.interrupt_targets._ActorTable [no_overall.interrupt_targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.interrupt_spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (classe_misc.ress) then
|
||||
local alvos = classe_misc.ress_targets
|
||||
local habilidades = classe_misc.ress_spell_tables
|
||||
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.ress_targets._ActorTable [no_overall.ress_targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.ress_spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (classe_misc.dispell) then
|
||||
local alvos = classe_misc.dispell_targets
|
||||
local habilidades = classe_misc.dispell_spell_tables
|
||||
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.dispell_targets._ActorTable [no_overall.dispell_targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.dispell_spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (classe_misc.cc_break) then
|
||||
local alvos = classe_misc.cc_break_targets
|
||||
local habilidades = classe_misc.cc_break_spell_tables
|
||||
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = no_overall.cc_break_targets._ActorTable [no_overall.cc_break_targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
|
||||
for _spellid, habilidade in _pairs (habilidades._ActorTable) do
|
||||
local habilidade_overall = no_overall.cc_break_spell_tables._ActorTable [_spellid]
|
||||
habilidade_overall = habilidade_overall - habilidade
|
||||
|
||||
local alvos = habilidade.targets
|
||||
for index, alvo in _ipairs (alvos._ActorTable) do
|
||||
local alvo_overall = habilidade_overall.targets._ActorTable [habilidade_overall.targets._NameIndexTable [alvo.nome]]
|
||||
alvo_overall = alvo_overall - alvo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--> diminui o total
|
||||
overall.totals[1] = overall.totals[1] - combate.totals[1]
|
||||
overall.totals[2] = overall.totals[2] - combate.totals[2]
|
||||
|
||||
overall.totals[3].mana = overall.totals[3].mana - combate.totals[3].mana
|
||||
overall.totals[3].e_rage = overall.totals[3].e_rage - combate.totals[3].e_rage
|
||||
overall.totals[3].e_energy = overall.totals[3].e_energy - combate.totals[3].e_energy
|
||||
overall.totals[3].runepower = overall.totals[3].runepower - combate.totals[3].runepower
|
||||
|
||||
overall.totals[4].cc_break = overall.totals[4].cc_break - combate.totals[4].cc_break
|
||||
overall.totals[4].ress = overall.totals[4].ress - combate.totals[4].ress
|
||||
overall.totals[4].interrupt = overall.totals[4].interrupt - combate.totals[4].interrupt
|
||||
overall.totals[4].dispell = overall.totals[4].dispell - combate.totals[4].dispell
|
||||
overall.totals[4].dead = overall.totals[4].dead - combate.totals[4].dead
|
||||
|
||||
|
||||
overall.totals_grupo[1] = overall.totals_grupo[1] - combate.totals_grupo[1]
|
||||
overall.totals_grupo[2] = overall.totals_grupo[2] - combate.totals_grupo[2]
|
||||
|
||||
overall.totals_grupo[3].mana = overall.totals_grupo[3].mana - combate.totals_grupo[3].mana
|
||||
overall.totals_grupo[3].e_rage = overall.totals_grupo[3].e_rage - combate.totals_grupo[3].e_rage
|
||||
overall.totals_grupo[3].e_energy = overall.totals_grupo[3].e_energy - combate.totals_grupo[3].e_energy
|
||||
overall.totals_grupo[3].runepower = overall.totals_grupo[3].runepower - combate.totals_grupo[3].runepower
|
||||
|
||||
overall.totals_grupo[4].cc_break = overall.totals_grupo[4].cc_break - combate.totals_grupo[4].cc_break
|
||||
overall.totals_grupo[4].ress = overall.totals_grupo[4].ress - combate.totals_grupo[4].ress
|
||||
overall.totals_grupo[4].interrupt = overall.totals_grupo[4].interrupt - combate.totals_grupo[4].interrupt
|
||||
overall.totals_grupo[4].dispell = overall.totals_grupo[4].dispell - combate.totals_grupo[4].dispell
|
||||
overall.totals_grupo[4].dead = overall.totals_grupo[4].dead - combate.totals_grupo[4].dead
|
||||
|
||||
|
||||
return overall
|
||||
end
|
||||
|
||||
function _detalhes:UpdateCombat()
|
||||
_tempo = _detalhes._tempo
|
||||
end
|
||||
@@ -0,0 +1,137 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local AceLocale = LibStub ("AceLocale-3.0")
|
||||
local Loc = AceLocale:GetLocale ( "Details" )
|
||||
|
||||
--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 _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 _UnitName = UnitName
|
||||
local _IsInRaid = IsInRaid
|
||||
local _IsInGroup = IsInGroup
|
||||
local _GetNumGroupMembers = GetNumGroupMembers
|
||||
local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers
|
||||
local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers
|
||||
local _GetUnitName = GetUnitName
|
||||
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local atributo_custom = _detalhes.atributo_custom
|
||||
|
||||
function atributo_custom:RefreshWindow (instancia, _combat, forcar, exportar)
|
||||
|
||||
--> partir do principio que:
|
||||
-- sempre vai ter um SPELLID
|
||||
-- não vai ter target ou input output
|
||||
--> instancia.sub_atributo armazena o index da tabela de custons
|
||||
|
||||
local CustomObject = _detalhes.custom [instancia.sub_atributo]
|
||||
|
||||
_combat.totals [CustomObject.name] = 0
|
||||
instancia.customName = CustomObject.name
|
||||
|
||||
--print (CustomObject)
|
||||
--print (CustomObject.source)
|
||||
--print ("source: " .. CustomObject.source)
|
||||
|
||||
if (not CustomObject.source) then
|
||||
print ("Sem Source")
|
||||
return
|
||||
elseif (CustomObject.source == "") then
|
||||
print ("Source esta em branco")
|
||||
return
|
||||
end
|
||||
|
||||
--print ("atributo " .. CustomObject.attribute)
|
||||
|
||||
if (CustomObject.source == "[raid]") then
|
||||
if (_IsInRaid()) then
|
||||
for i = 1, _GetNumGroupMembers(), 1 do
|
||||
local nome = _GetUnitName ("raid"..i, true):gsub (("%s+"), "")
|
||||
local Actor = _combat (CustomObject.attribute, nome)
|
||||
if (Actor) then
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
end
|
||||
elseif (_IsInGroup()) then
|
||||
for i = 1, _GetNumGroupMembers()-1, 1 do
|
||||
local nome = _GetUnitName ("raid"..i, true):gsub (("%s+"), "")
|
||||
local Actor = _combat (CustomObject.attribute, nome)
|
||||
if (Actor) then
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
end
|
||||
local Actor = _combat (CustomObject.attribute, _detalhes.playername)
|
||||
if (Actor) then
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
else
|
||||
local Actor = _combat (CustomObject.attribute, _detalhes.playername)
|
||||
if (Actor) then
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
end
|
||||
|
||||
elseif (CustomObject.source == "[all]") then
|
||||
for _, Actor in _ipairs (_combat [CustomObject.attribute]._ActorTable) do
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
|
||||
elseif (CustomObject.source == "[player]") then
|
||||
local Actor = _combat (CustomObject.attribute, _detalhes.playername)
|
||||
if (Actor) then
|
||||
Actor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
|
||||
else
|
||||
local _thisActor = _combat (CustomObject.attribute, CustomObject.source)
|
||||
if (_thisActor) then
|
||||
_thisActor:Custom (CustomObject.name, _combat, CustomObject.sattribute, CustomObject.spell, CustomObject.target)
|
||||
end
|
||||
end
|
||||
|
||||
--> agora result tem os atores que usaram a habilidade
|
||||
if (CustomObject.attribute == 1) then
|
||||
return _detalhes.atributo_damage:RefreshWindow (instancia, _combat, forcar, exportar)
|
||||
elseif (CustomObject.attribute == 2) then
|
||||
_detalhes.atributo_heal:RefreshWindow (instancia, _combat, forcar, exportar)
|
||||
end
|
||||
|
||||
--> aqui precisa fazer algo para retornar algo pro report reconhecer a tabela
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,364 @@
|
||||
--[[ classe do dano aplicado, usado nos eventos:
|
||||
- SPELL_PERIODIC_DAMAGE
|
||||
- SPELL_DAMAGE
|
||||
- SWING_DAMAGE
|
||||
- RANGE_DAMAGE
|
||||
|
||||
Parents:
|
||||
addon -> combate atual -> Npc/Player Swicth -> Container de Habilidades -> esta tabela
|
||||
]]
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
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
|
||||
|
||||
--lua locals
|
||||
local _setmetatable = setmetatable
|
||||
local _ipairs = ipairs
|
||||
local _pairs = pairs
|
||||
--api locals
|
||||
local _UnitAura = UnitAura
|
||||
--local _GetSpellInfo = _detalhes.getspellinfo
|
||||
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
local _recording_ability_with_buffs = false
|
||||
|
||||
--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
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, habilidade_dano)
|
||||
|
||||
esta_tabela.quem_sou = "classe_damage_habilidade"
|
||||
|
||||
-- esta_tabela.jogador = serial
|
||||
|
||||
esta_tabela.total = 0 --total de dano aplicado por esta habilidade
|
||||
esta_tabela.counter = 0 --conta quantas vezes a habilidade foi chamada
|
||||
esta_tabela.id = id
|
||||
esta_tabela.school = 0
|
||||
|
||||
--> normal hits
|
||||
--esta_tabela.normal = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
|
||||
esta_tabela.n_min = 0
|
||||
esta_tabela.n_max = 0
|
||||
esta_tabela.n_amt = 0
|
||||
esta_tabela.n_dmg = 0
|
||||
|
||||
--> hits criticos
|
||||
--esta_tabela.critico = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
esta_tabela.c_min = 0
|
||||
esta_tabela.c_max = 0
|
||||
esta_tabela.c_amt = 0
|
||||
esta_tabela.c_dmg = 0
|
||||
|
||||
--> hit glacing
|
||||
--esta_tabela.glacing = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
esta_tabela.g_min = 0
|
||||
esta_tabela.g_max = 0
|
||||
esta_tabela.g_amt = 0
|
||||
esta_tabela.g_dmg = 0
|
||||
|
||||
--informações e detalhes gerais desta habilidade
|
||||
|
||||
--esta_tabela.resisted = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
esta_tabela.r_min = 0
|
||||
esta_tabela.r_max = 0
|
||||
esta_tabela.r_amt = 0
|
||||
esta_tabela.r_dmg = 0
|
||||
|
||||
--esta_tabela.blocked = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
esta_tabela.b_min = 0
|
||||
esta_tabela.b_max = 0
|
||||
esta_tabela.b_amt = 0
|
||||
esta_tabela.b_dmg = 0
|
||||
|
||||
--esta_tabela.absorbed = {["min"] = 0, ["max"] = 0, ["amt"] = 0, ["dmg"] = 0}
|
||||
esta_tabela.a_min = 0
|
||||
esta_tabela.a_max = 0
|
||||
esta_tabela.a_amt = 0
|
||||
esta_tabela.a_dmg = 0
|
||||
|
||||
esta_tabela.crushing = 0 -- ??
|
||||
|
||||
esta_tabela.targets = container_combatentes:NovoContainer (container_damage_target)
|
||||
|
||||
if (link) then
|
||||
esta_tabela.targets.shadow = link.targets
|
||||
end
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
_detalhes:SpellIsDot (id)
|
||||
end
|
||||
|
||||
return esta_tabela
|
||||
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
|
||||
if (self.shadow) then
|
||||
return self.shadow:AddFF (amount)
|
||||
end
|
||||
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: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 (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
|
||||
if (amount > self.r_max) then
|
||||
self.r_max = amount
|
||||
end
|
||||
if (self.r_min > amount or self.r_min == 0) then
|
||||
self.r_min = amount
|
||||
end
|
||||
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
|
||||
if (amount > self.b_max) then
|
||||
self.b_max = amount
|
||||
end
|
||||
if (self.b_min > amount or self.b_min == 0) then
|
||||
self.b_min = amount
|
||||
end
|
||||
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
|
||||
if (amount > self.a_max) then
|
||||
self.a_max = amount
|
||||
end
|
||||
if (self.a_min > amount or self.a_min == 0) then
|
||||
self.a_min = amount
|
||||
end
|
||||
end
|
||||
|
||||
if (amount and amount > 0) then
|
||||
|
||||
self.total = self.total + amount
|
||||
|
||||
--alvo:AddQuantidade (amount)
|
||||
alvo.total = alvo.total + amount
|
||||
|
||||
if (glacing) then
|
||||
-- esta_tabela.glacing = {["mim"] = 0, ["max"] = 0, ["total"] = 0, ["dmg"] = 0}
|
||||
self.g_dmg = self.g_dmg+amount --> amount é o total de dano
|
||||
self.g_amt = self.g_amt+1 --> amount é o total de dano
|
||||
if (amount > self.g_max) then
|
||||
self.g_max = amount
|
||||
end
|
||||
if (self.g_min > amount or self.g_min == 0) then
|
||||
self.g_min = amount
|
||||
end
|
||||
elseif (critical) then
|
||||
--esta_tabela.critico = {["mim"] = 0, ["max"] = 0, ["total"] = 0, ["dmg"] = 0}
|
||||
self.c_dmg = self.c_dmg+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
|
||||
--esta_tabela.normal = {["mim"] = 0, ["max"] = 0, ["total"] = 0, ["dmg"] = 0}
|
||||
self.n_dmg = self.n_dmg+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
|
||||
|
||||
if (self.shadow) then
|
||||
|
||||
if (_recording_ability_with_buffs) then
|
||||
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
|
||||
|
||||
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
|
||||
|
||||
local SpellBuffDetails = self.BuffTable
|
||||
if (not SpellBuffDetails) then
|
||||
self.BuffTable = {}
|
||||
SpellBuffDetails = self.BuffTable
|
||||
end
|
||||
|
||||
if (token == "SPELL_PERIODIC_DAMAGE") then
|
||||
--> precisa ver se ele tinha na hora que aplicou
|
||||
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
|
||||
if (SoloDebuffPower) then
|
||||
local ThisDebuff = SoloDebuffPower [self.id]
|
||||
if (ThisDebuff) then
|
||||
local ThisDebuffOnTarget = ThisDebuff [serial]
|
||||
if (ThisDebuffOnTarget) then
|
||||
for index, buff_name in _ipairs (ThisDebuffOnTarget.buffs) do
|
||||
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [buff_name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
for BuffName, _ in _pairs (_detalhes.Buffs.BuffsTable) do
|
||||
local name = _UnitAura ("player", BuffName)
|
||||
if (name ~= nil) then
|
||||
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
|
||||
buff_info.counter = buff_info.counter+1
|
||||
buff_info.total = buff_info.total+amount
|
||||
if (critical ~= nil) then
|
||||
buff_info.critico = buff_info.critico+1
|
||||
buff_info.critico_dano = buff_info.critico_dano+amount
|
||||
end
|
||||
SpellBuffDetails [name] = buff_info
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self.shadow:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow
|
||||
_setmetatable (habilidade, habilidade_dano)
|
||||
habilidade.__index = habilidade_dano
|
||||
|
||||
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_dano (habilidade)
|
||||
habilidade.__index = {}
|
||||
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.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
|
||||
|
||||
habilidade_dano.__sub = function (tabela1, tabela2)
|
||||
tabela1.total = tabela1.total - tabela2.total
|
||||
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_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
|
||||
|
||||
function _detalhes:UpdateDamageAbilityGears()
|
||||
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
|
||||
end
|
||||
@@ -0,0 +1,751 @@
|
||||
--[[ Esta classe irá abrigar todo a e_energy ganha de uma habilidade
|
||||
Parents:
|
||||
addon -> combate atual -> e_energy-> container de jogadores -> esta classe
|
||||
|
||||
]]
|
||||
|
||||
--lua locals
|
||||
local _cstr = string.format
|
||||
local _math_floor = math.floor
|
||||
local _table_sort = table.sort
|
||||
local _table_insert = table.insert
|
||||
local _setmetatable = setmetatable
|
||||
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 _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
|
||||
local container_habilidades = _detalhes.container_habilidades
|
||||
local container_combatentes = _detalhes.container_combatentes
|
||||
local container_pets = _detalhes.container_pets
|
||||
local atributo_energy = _detalhes.atributo_energy
|
||||
local habilidade_energy = _detalhes.habilidade_energy
|
||||
|
||||
--local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
|
||||
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_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 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
|
||||
|
||||
local info = _detalhes.janela_info
|
||||
local keyName
|
||||
|
||||
function atributo_energy:NovaTabela (serial, nome, link)
|
||||
local esta_tabela = {}
|
||||
esta_tabela.quem_sou = "classe_energy" --> DEBUG deleta-me
|
||||
|
||||
--print ("CRIANDO NOVO OBJETO")
|
||||
|
||||
_setmetatable (esta_tabela, atributo_energy)
|
||||
|
||||
--> grava o tempo que a tabela foi criada para o garbage collector interno
|
||||
esta_tabela.CriadaEm = time()
|
||||
esta_tabela.last_event = 0
|
||||
esta_tabela.tipo = class_type --> atributo 3 = e_energy
|
||||
|
||||
esta_tabela.mana = 0
|
||||
esta_tabela.e_rage = 0
|
||||
esta_tabela.e_energy = 0
|
||||
esta_tabela.runepower = 0
|
||||
esta_tabela.focus = 0
|
||||
esta_tabela.holypower = 0
|
||||
|
||||
esta_tabela.mana_r = 0
|
||||
esta_tabela.e_rage_r = 0
|
||||
esta_tabela.e_energy_r = 0
|
||||
esta_tabela.runepower_r = 0
|
||||
esta_tabela.focus_r = 0
|
||||
esta_tabela.holypower_r = 0
|
||||
|
||||
esta_tabela.mana_from = {}
|
||||
esta_tabela.e_rage_from = {}
|
||||
esta_tabela.e_energy_from = {}
|
||||
esta_tabela.runepower_from = {}
|
||||
esta_tabela.focus_from = {}
|
||||
esta_tabela.holypower_from = {}
|
||||
|
||||
esta_tabela.last_value = nil --> ultimo valor que este jogador teve, salvo quando a barra dele é atualizada
|
||||
|
||||
esta_tabela.pets = {}
|
||||
|
||||
--container armazenará os seriais dos alvos que o player aplicou dano
|
||||
esta_tabela.targets = container_combatentes:NovoContainer (container_energy_target)
|
||||
|
||||
--container armazenará os IDs das habilidades usadas por este jogador
|
||||
esta_tabela.spell_tables = container_habilidades:NovoContainer (container_energy)
|
||||
|
||||
if (link) then
|
||||
esta_tabela.targets.shadow = link.targets
|
||||
esta_tabela.spell_tables.shadow = link.spell_tables
|
||||
end
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, exportar)
|
||||
|
||||
local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable
|
||||
|
||||
if (#showing._ActorTable < 1) then --> não há barras para mostrar
|
||||
return _detalhes:EsconderBarrasNaoUsadas (instancia, showing)
|
||||
end
|
||||
|
||||
local total = 0 --> total iniciado como ZERO
|
||||
instancia.top = 0
|
||||
|
||||
local sub_atributo = instancia.sub_atributo --> o que esta sendo mostrado nesta instância
|
||||
local conteudo = showing._ActorTable
|
||||
local amount = #conteudo
|
||||
local modo = instancia.modo
|
||||
|
||||
if (exportar) then
|
||||
if (_type (exportar) == "boolean") then
|
||||
if (sub_atributo == 1) then --> MANA RECUPERADA
|
||||
keyName = "mana"
|
||||
elseif (sub_atributo == 2) then --> e_rage GANHA
|
||||
keyName = "e_rage"
|
||||
elseif (sub_atributo == 3) then --> ENERGIA GANHA
|
||||
keyName = "e_energy"
|
||||
elseif (sub_atributo == 4) then --> RUNEPOWER GANHO
|
||||
keyName = "runepower"
|
||||
end
|
||||
else
|
||||
keyName = exportar.key
|
||||
modo = exportar.modo
|
||||
end
|
||||
|
||||
elseif (instancia.atributo == 5) then --> custom
|
||||
keyName = "custom"
|
||||
total = tabela_do_combate.totals [instancia.customName]
|
||||
|
||||
else
|
||||
if (sub_atributo == 1) then --> MANA RECUPERADA
|
||||
keyName = "mana"
|
||||
elseif (sub_atributo == 2) then --> e_rage GANHA
|
||||
keyName = "e_rage"
|
||||
elseif (sub_atributo == 3) then --> ENERGIA GANHA
|
||||
keyName = "e_energy"
|
||||
elseif (sub_atributo == 4) then --> RUNEPOWER GANHO
|
||||
keyName = "runepower"
|
||||
end
|
||||
end
|
||||
|
||||
if (instancia.atributo == 5) then --> custom
|
||||
--> faz o sort da categoria e retorna o amount corrigido
|
||||
amount = _detalhes:ContainerSort (conteudo, amount, keyName)
|
||||
|
||||
--> grava o total
|
||||
instancia.top = conteudo[1][keyName]
|
||||
|
||||
elseif (modo == modo_ALL) then --> mostrando ALL
|
||||
|
||||
--> faz o sort da categoria
|
||||
_table_sort (conteudo, function (a, b) return a[keyName] > b[keyName] end)
|
||||
|
||||
--> não mostrar resultados com zero
|
||||
for i = amount, 1, -1 do --> de trás pra frente
|
||||
if (conteudo[i][keyName] < 1) then
|
||||
amount = amount-1
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
total = tabela_do_combate.totals [class_type] [keyName] --> pega o total de dano já aplicado
|
||||
|
||||
instancia.top = conteudo[1] [keyName]
|
||||
|
||||
elseif (modo == modo_GROUP) then --> mostrando GROUP
|
||||
|
||||
_table_sort (conteudo, function (a, b)
|
||||
if (a.grupo and b.grupo) then
|
||||
return a[keyName] > b[keyName]
|
||||
elseif (a.grupo and not b.grupo) then
|
||||
return true
|
||||
elseif (not a.grupo and b.grupo) then
|
||||
return false
|
||||
else
|
||||
return a[keyName] > b[keyName]
|
||||
end
|
||||
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[keyName] < 1) then --> dano menor que 1, interromper o loop
|
||||
amount = index - 1
|
||||
break
|
||||
elseif (index == 1) then --> esse IF aqui, precisa mesmo ser aqui? não daria pra pega-lo com uma chave [1] nad grupo == true?
|
||||
instancia.top = conteudo[1][keyName]
|
||||
end
|
||||
|
||||
total = total + player[keyName]
|
||||
else
|
||||
amount = index-1
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
showing:remapear()
|
||||
|
||||
if (exportar) then
|
||||
return total, keyName, instancia.top
|
||||
end
|
||||
|
||||
if (amount < 1) then --> não há barras para mostrar
|
||||
instancia:EsconderScrollBar()
|
||||
return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh
|
||||
end
|
||||
|
||||
instancia:AtualizarScrollBar (amount)
|
||||
|
||||
local qual_barra = 1
|
||||
local barras_container = instancia.barras
|
||||
|
||||
for i = instancia.barraS[1], instancia.barraS[2], 1 do --> vai atualizar só o range que esta sendo mostrado
|
||||
conteudo[i]:AtualizaBarra (instancia, barras_container, qual_barra, i, total, sub_atributo, forcar) --> instância, index, total, valor da 1º barra
|
||||
qual_barra = qual_barra+1
|
||||
end
|
||||
|
||||
if (instancia.atributo == 5) then --> custom
|
||||
--> zerar o .custom dos Actors
|
||||
for index, player in _ipairs (conteudo) do
|
||||
if (player.custom > 0) then
|
||||
player.custom = 0
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--> beta, hidar barras não usadas durante um refresh forçado
|
||||
if (forcar) then
|
||||
if (instancia.modo == 2) then --> group
|
||||
for i = qual_barra, instancia.barrasInfo.cabem do
|
||||
gump:Fade (instancia.barras [i], "in", 0.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --> retorna a tabela que precisa ganhar o refresh
|
||||
|
||||
end
|
||||
|
||||
function atributo_energy:Custom (_customName, _combat, sub_atributo, spell, alvo)
|
||||
local _Skill = self.spell_tables._ActorTable [tonumber (spell)]
|
||||
if (_Skill) then
|
||||
local spellName = _GetSpellInfo (tonumber (spell))
|
||||
local SkillTargets = _Skill.targets._ActorTable
|
||||
|
||||
for _, TargetActor in _ipairs (SkillTargets) do
|
||||
local TargetActorSelf = _combat (class_type, TargetActor.nome)
|
||||
TargetActorSelf.custom = TargetActor.total + TargetActorSelf.custom
|
||||
_combat.totals [_customName] = _combat.totals [_customName] + TargetActor.total
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar)
|
||||
|
||||
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 = self
|
||||
esta_barra.colocacao = lugar
|
||||
|
||||
self.minha_barra = esta_barra
|
||||
self.colocacao = lugar
|
||||
|
||||
local esta_e_energy_total = self [keyName] --> total de dano que este jogador deu
|
||||
local porcentagem = esta_e_energy_total / total * 100
|
||||
local esta_porcentagem = _math_floor ((esta_e_energy_total/instancia.top) * 100)
|
||||
|
||||
esta_barra.texto_direita:SetText (_detalhes:ToK (esta_e_energy_total) .. " " .. div_abre .. _cstr ("%.1f", porcentagem).."%" .. div_fecha) --seta o texto da direita
|
||||
|
||||
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
|
||||
gump:UpdateTooltip (qual_barra, esta_barra, instancia)
|
||||
end
|
||||
|
||||
return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
|
||||
function atributo_energy:KeyNames (sub_atributo)
|
||||
if (sub_atributo == 1) then --> MANA RECUPERADA
|
||||
return "mana", "mana_from"
|
||||
elseif (sub_atributo == 2) then --> e_rage GANHA
|
||||
return "e_rage", "e_rage_from"
|
||||
elseif (sub_atributo == 3) then --> ENERGIA GANHA
|
||||
return "e_energy", "e_energy_from"
|
||||
elseif (sub_atributo == 4) then --> RUNEPOWER GANHO
|
||||
return "runepower", "runepower_from"
|
||||
end
|
||||
end
|
||||
|
||||
function atributo_energy:Fontes_e_Habilidades (recebido_from, showing, keyName, habilidade_alvo)
|
||||
|
||||
local habilidades = {}
|
||||
local fontes = {}
|
||||
local spells_alvo = {}
|
||||
local max = 0
|
||||
|
||||
for nome, _ in _pairs (recebido_from) do
|
||||
local esta_fonte = showing._ActorTable [showing._NameIndexTable [nome]]
|
||||
if (esta_fonte) then
|
||||
|
||||
local alvos = esta_fonte.targets
|
||||
local _habilidades = esta_fonte.spell_tables
|
||||
|
||||
local este_alvo = alvos._ActorTable [alvos._NameIndexTable[self.nome]]
|
||||
if (este_alvo) then
|
||||
fontes [#fontes+1] = {nome, este_alvo [keyName], esta_fonte.classe} --> mostra QUEM deu regen, a QUANTIDADE e a CLASSE
|
||||
--print (nome, este_alvo [keyName], esta_fonte.classe)
|
||||
end
|
||||
|
||||
for spellid, habilidade in _pairs (_habilidades._ActorTable) do
|
||||
local alvos = habilidade.targets
|
||||
local este_alvo = alvos._ActorTable [alvos._NameIndexTable[self.nome]]
|
||||
if (este_alvo) then
|
||||
if (not habilidades [spellid]) then
|
||||
habilidades [spellid] = 0 --> mostra A SPELL e a quantidade que ela deu regen
|
||||
end
|
||||
habilidades [spellid] = habilidades [spellid] + este_alvo [keyName]
|
||||
if (habilidades [spellid] > max) then
|
||||
max = habilidades [spellid]
|
||||
end
|
||||
if (habilidade_alvo and habilidade_alvo == spellid) then
|
||||
spells_alvo [#spells_alvo + 1] = {nome, este_alvo [keyName], esta_fonte.classe}
|
||||
elseif (habilidade_alvo == true) then
|
||||
--print (nome, nome, este_alvo [keyName], spellid)
|
||||
spells_alvo [#spells_alvo + 1] = {nome, este_alvo [keyName], spellid}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local sorted_table = {}
|
||||
for spellid, amt in _pairs (habilidades) do
|
||||
local nome, _, icone = _GetSpellInfo (spellid)
|
||||
sorted_table [#sorted_table+1] = {spellid, amt, amt/max*100, nome, icone}
|
||||
end
|
||||
_table_sort (sorted_table, function (a, b) return a[2] > b[2] end)
|
||||
|
||||
_table_sort (fontes, function (a, b) return a[2] > b[2] end)
|
||||
|
||||
if (habilidade_alvo) then
|
||||
_table_sort (spells_alvo, function (a, b) return a[2] > b[2] end)
|
||||
end
|
||||
|
||||
return fontes, sorted_table, spells_alvo
|
||||
end
|
||||
|
||||
|
||||
---------> TOOLTIPS BIFURCAÇÃO
|
||||
function atributo_energy:ToolTip (instancia, numero, barra)
|
||||
--> seria possivel aqui colocar o icone da classe dele?
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip:AddLine (barra.colocacao..". "..self.nome)
|
||||
if (instancia.sub_atributo <= 4) then
|
||||
return self:ToolTipRegenRecebido (instancia, numero, barra)
|
||||
end
|
||||
end
|
||||
|
||||
function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra)
|
||||
|
||||
local tabela_do_combate = instancia.showing
|
||||
local showing = tabela_do_combate [class_type]
|
||||
|
||||
local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo)
|
||||
|
||||
local total_regenerado = self [keyName]
|
||||
local recebido_from = self [keyName_from]
|
||||
|
||||
local fontes, habilidades = self:Fontes_e_Habilidades (recebido_from, showing, keyName)
|
||||
|
||||
-----------------------------------------------------------------
|
||||
GameTooltip:AddLine (Loc ["STRING_SPELLS"])
|
||||
|
||||
local max = #habilidades
|
||||
if (max > 3) then
|
||||
max = 3
|
||||
end
|
||||
|
||||
for i = 1, max do
|
||||
local nome_magia, _, icone_magia = _GetSpellInfo (habilidades[i][1])
|
||||
GameTooltip:AddDoubleLine (nome_magia..": ", _detalhes:comma_value (habilidades[i][2]).." (".._cstr("%.1f", (habilidades[i][2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddTexture (icone_magia)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------
|
||||
GameTooltip:AddLine (Loc ["STRING_PLAYERS"]..":")
|
||||
|
||||
max = #fontes
|
||||
if (max > 3) then
|
||||
max = 3
|
||||
end
|
||||
|
||||
for i = 1, max do
|
||||
GameTooltip:AddDoubleLine (fontes[i][1]..": ", _detalhes:comma_value (fontes[i][2]).." (".._cstr("%.1f", (fontes[i][2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1)
|
||||
local classe = fontes[i][3]
|
||||
if (not classe) then
|
||||
classe = "monster"
|
||||
end
|
||||
|
||||
GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower().."_small")
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--------------------------------------------- // JANELA DETALHES // ---------------------------------------------
|
||||
|
||||
---------> DETALHES BIFURCAÇÃO
|
||||
function atributo_energy:MontaInfo()
|
||||
if (info.sub_atributo <= 4) then --> damage done & dps
|
||||
return self:MontaInfoRegenRecebido()
|
||||
end
|
||||
end
|
||||
|
||||
---------> DETALHES bloco da direita BIFURCAÇÃO
|
||||
function atributo_energy:MontaDetalhes (spellid, barra)
|
||||
if (info.sub_atributo <= 4) then
|
||||
return self:MontaDetalhesRegenRecebido (spellid, barra)
|
||||
end
|
||||
end
|
||||
|
||||
function atributo_energy:MontaInfoRegenRecebido()
|
||||
|
||||
local barras = info.barras1
|
||||
local barras2 = info.barras2
|
||||
local barras3 = info.barras3
|
||||
|
||||
local instancia = info.instancia
|
||||
|
||||
local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo)
|
||||
|
||||
local tabela_do_combate = instancia.showing
|
||||
local showing = tabela_do_combate [class_type]
|
||||
|
||||
local total_regenerado = self [keyName]
|
||||
local recebido_from = self [keyName_from]
|
||||
|
||||
if (not recebido_from) then
|
||||
return
|
||||
end
|
||||
|
||||
local fontes, habilidades = self:Fontes_e_Habilidades (recebido_from, showing, keyName)
|
||||
|
||||
local amt = #habilidades
|
||||
|
||||
if (amt < 1) then --> caso houve apenas friendly fire
|
||||
return true
|
||||
end
|
||||
|
||||
gump:JI_AtualizaContainerBarras (amt)
|
||||
local max_ = habilidades [1][2]
|
||||
|
||||
for index, tabela in _ipairs (habilidades) do
|
||||
|
||||
local barra = barras [index]
|
||||
|
||||
if (not barra) then
|
||||
barra = gump:CriaNovaBarraInfo1 (instancia, index)
|
||||
barra.textura:SetStatusBarColor (1, 1, 1, 1)
|
||||
|
||||
barra.on_focus = false
|
||||
end
|
||||
|
||||
self:FocusLock (barra, tabela[1])
|
||||
self:UpdadeInfoBar (barra, index, tabela[1], tabela[4], tabela[2], max_, tabela[3], tabela[5], true)
|
||||
|
||||
barra.minha_tabela = self
|
||||
barra.show = tabela[1]
|
||||
barra:Show()
|
||||
|
||||
if (self.detalhes and self.detalhes == barra.show) then
|
||||
self:MontaDetalhes (self.detalhes, barra)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
local amt_fontes = #fontes
|
||||
gump:JI_AtualizaContainerAlvos (amt_fontes)
|
||||
|
||||
local max_fontes = fontes[1][2]
|
||||
|
||||
local barra
|
||||
for index, tabela in _ipairs (fontes) do
|
||||
|
||||
barra = info.barras2 [index]
|
||||
|
||||
if (not barra) then
|
||||
barra = gump:CriaNovaBarraInfo2 (instancia, index)
|
||||
barra.textura:SetStatusBarColor (1, 1, 1, 1)
|
||||
end
|
||||
|
||||
if (index == 1) then
|
||||
barra.textura:SetValue (100)
|
||||
else
|
||||
barra.textura:SetValue (tabela[2]/max_fontes*100)
|
||||
end
|
||||
|
||||
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
|
||||
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2]/total_regenerado * 100) .. instancia.divisores.fecha) --seta o texto da direita
|
||||
|
||||
if (barra.mouse_over) then --> atualizar o tooltip
|
||||
if (barra.isAlvo) then
|
||||
GameTooltip:Hide()
|
||||
GameTooltip:SetOwner (barra, "ANCHOR_TOPRIGHT")
|
||||
if (not barra.minha_tabela:MontaTooltipAlvos (barra, index)) then
|
||||
return
|
||||
end
|
||||
GameTooltip:Show()
|
||||
end
|
||||
end
|
||||
|
||||
barra.minha_tabela = self --> grava o jogador na tabela
|
||||
barra.nome_inimigo = tabela [1] --> salva o nome do inimigo na barra --> isso é necessário?
|
||||
|
||||
barra:Show()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function atributo_energy:MontaDetalhesRegenRecebido (nome, barra)
|
||||
for _, barra in _ipairs (info.barras3) do
|
||||
barra:Hide()
|
||||
end
|
||||
|
||||
local barras = info.barras3
|
||||
local instancia = info.instancia
|
||||
|
||||
local tabela_do_combate = info.instancia.showing
|
||||
local showing = tabela_do_combate [class_type]
|
||||
|
||||
local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo)
|
||||
local recebido_from = self [keyName_from]
|
||||
local total_regenerado = self [keyName]
|
||||
|
||||
local _, _, from = self:Fontes_e_Habilidades (recebido_from, showing, keyName, nome)
|
||||
|
||||
if (not from [1] or not from [1][2]) then
|
||||
return
|
||||
end
|
||||
|
||||
local max_ = from [1][2]
|
||||
|
||||
local barra
|
||||
for index, tabela in _ipairs (from) do
|
||||
barra = barras [index]
|
||||
|
||||
if (not barra) then --> se a barra não existir, criar ela então
|
||||
barra = gump:CriaNovaBarraInfo3 (instancia, index)
|
||||
barra.textura:SetStatusBarColor (1, 1, 1, 1) --> isso aqui é a parte da seleção e desceleção
|
||||
end
|
||||
|
||||
if (index == 1) then
|
||||
barra.textura:SetValue (100)
|
||||
else
|
||||
barra.textura:SetValue (tabela[2]/max_*100) --> muito mais rapido...
|
||||
end
|
||||
|
||||
barra.texto_esquerdo:SetText (index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
|
||||
barra.texto_direita:SetText (_detalhes:comma_value (tabela[2]) .." ".. instancia.divisores.abre .._cstr("%.1f", tabela[2] /total_regenerado *100) .."%".. instancia.divisores.fecha) --seta o texto da direita
|
||||
|
||||
barra.textura:SetStatusBarColor (_unpack (_detalhes.class_colors [tabela[3]]))
|
||||
barra.icone:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small")
|
||||
|
||||
barra.icone:SetTexCoord (_unpack (_detalhes.class_coords [tabela[3]]))
|
||||
|
||||
barra:Show() --> mostra a barra
|
||||
|
||||
if (index == 15) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function atributo_energy:MontaTooltipAlvos (esta_barra, index)
|
||||
local instancia = info.instancia
|
||||
local tabela_do_combate = instancia.showing
|
||||
local showing = tabela_do_combate [class_type]
|
||||
|
||||
local keyName, keyName_from = atributo_energy:KeyNames (instancia.sub_atributo)
|
||||
|
||||
local total_regenerado = self [keyName]
|
||||
local recebido_from = self [keyName_from]
|
||||
|
||||
local _, _, spells_alvo = self:Fontes_e_Habilidades (recebido_from, showing, keyName, true)
|
||||
|
||||
-----------------------------------------------------------------
|
||||
GameTooltip:AddLine (Loc ["STRING_SPELLS"]..":")
|
||||
for _, tabela in _ipairs (spells_alvo) do
|
||||
if (tabela[1] == esta_barra.nome_inimigo) then
|
||||
local nome_magia, _, icone_magia = _GetSpellInfo (tabela[3])
|
||||
GameTooltip:AddDoubleLine (nome_magia..": ", _detalhes:comma_value (tabela[2]).." (".._cstr("%.1f", (tabela[2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1)
|
||||
GameTooltip:AddTexture (icone_magia)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
--controla se o dps do jogador esta travado ou destravado
|
||||
function atributo_energy:Iniciar (iniciar)
|
||||
return false --retorna se o dps esta aberto ou fechado para este jogador
|
||||
end
|
||||
|
||||
function atributo_energy:ColetarLixo()
|
||||
return _detalhes:ColetarLixo (class_type)
|
||||
end
|
||||
|
||||
local function ReconstroiMapa (tabela)
|
||||
local mapa = {}
|
||||
for i = 1, #tabela._ActorTable do
|
||||
mapa [tabela._ActorTable[i].nome] = i
|
||||
end
|
||||
tabela._NameIndexTable = mapa
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_atributo_energy (este_jogador, shadow)
|
||||
_setmetatable (este_jogador, _detalhes.atributo_energy)
|
||||
este_jogador.__index = _detalhes.atributo_energy
|
||||
|
||||
if (shadow ~= -1) then
|
||||
este_jogador.shadow = shadow
|
||||
_detalhes.refresh:r_container_combatentes (este_jogador.targets, shadow.targets)
|
||||
_detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, shadow.spell_tables)
|
||||
else
|
||||
_detalhes.refresh:r_container_combatentes (este_jogador.targets, -1)
|
||||
_detalhes.refresh:r_container_habilidades (este_jogador.spell_tables, -1)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.clear:c_atributo_energy (este_jogador)
|
||||
este_jogador.__index = {}
|
||||
este_jogador.shadow = nil
|
||||
este_jogador.links = nil
|
||||
este_jogador.minha_barra = nil
|
||||
|
||||
_detalhes.clear:c_container_combatentes (este_jogador.targets)
|
||||
_detalhes.clear:c_container_habilidades (este_jogador.spell_tables)
|
||||
end
|
||||
|
||||
atributo_energy.__add = function (shadow, tabela2)
|
||||
|
||||
shadow.mana = shadow.mana + tabela2.mana
|
||||
shadow.e_rage = shadow.e_rage + tabela2.e_rage
|
||||
shadow.e_energy = shadow.e_energy + tabela2.e_energy
|
||||
shadow.runepower = shadow.runepower + tabela2.runepower
|
||||
shadow.focus = shadow.focus + tabela2.focus
|
||||
shadow.holypower = shadow.holypower + tabela2.holypower
|
||||
|
||||
_detalhes.tabela_overall.totals[3]["mana"] = _detalhes.tabela_overall.totals[3]["mana"] + tabela2.mana
|
||||
_detalhes.tabela_overall.totals[3]["e_rage"] = _detalhes.tabela_overall.totals[3]["e_rage"] + tabela2.e_rage
|
||||
_detalhes.tabela_overall.totals[3]["e_energy"] = _detalhes.tabela_overall.totals[3]["e_energy"] + tabela2.e_energy
|
||||
_detalhes.tabela_overall.totals[3]["runepower"] = _detalhes.tabela_overall.totals[3]["runepower"] + tabela2.runepower
|
||||
|
||||
if (tabela2.grupo) then
|
||||
_detalhes.tabela_overall.totals_grupo[3]["mana"] = _detalhes.tabela_overall.totals_grupo[3]["mana"] + tabela2.mana
|
||||
_detalhes.tabela_overall.totals_grupo[3]["e_rage"] = _detalhes.tabela_overall.totals_grupo[3]["e_rage"] + tabela2.e_rage
|
||||
_detalhes.tabela_overall.totals_grupo[3]["e_energy"] = _detalhes.tabela_overall.totals_grupo[3]["e_energy"] + tabela2.e_energy
|
||||
_detalhes.tabela_overall.totals_grupo[3]["runepower"] = _detalhes.tabela_overall.totals_grupo[3]["runepower"] + tabela2.runepower
|
||||
end
|
||||
|
||||
shadow.mana_r = shadow.mana_r + tabela2.mana_r
|
||||
shadow.e_rage_r = shadow.e_rage_r + tabela2.e_rage_r
|
||||
shadow.e_energy_r = shadow.e_energy_r + tabela2.e_energy_r
|
||||
shadow.runepower_r = shadow.runepower_r + tabela2.runepower_r
|
||||
shadow.focus_r = shadow.focus_r + tabela2.focus_r
|
||||
shadow.holypower_r = shadow.holypower_r + tabela2.holypower_r
|
||||
|
||||
for index, alvo in _ipairs (tabela2.targets._ActorTable) do
|
||||
local alvo_shadow = shadow.targets:PegarCombatente (alvo.serial, alvo.nome, _, true)
|
||||
alvo_shadow.total = alvo_shadow.total + alvo.total
|
||||
end
|
||||
|
||||
--> copia o container de habilidades
|
||||
for spellid, habilidade in _pairs (tabela2.spell_tables._ActorTable) do
|
||||
local habilidade_shadow = shadow.spell_tables:PegaHabilidade (spellid, true, nil, true)
|
||||
|
||||
for index, alvo in _ipairs (habilidade.targets._ActorTable) do
|
||||
local alvo_shadow = habilidade_shadow.targets:PegarCombatente (alvo.serial, alvo.nome, _, true)
|
||||
alvo_shadow.total = alvo_shadow.total + alvo.total
|
||||
end
|
||||
|
||||
for key, value in _pairs (habilidade) do
|
||||
if (_type (value) == "number") then
|
||||
if (key ~= "id") then
|
||||
if (not habilidade_shadow [key]) then
|
||||
habilidade_shadow [key] = 0
|
||||
end
|
||||
habilidade_shadow [key] = habilidade_shadow [key] + value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return shadow
|
||||
end
|
||||
|
||||
atributo_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.focus = tabela1.focus - tabela2.focus
|
||||
tabela1.holypower = tabela1.holypower - tabela2.holypower
|
||||
|
||||
tabela1.mana_r = tabela1.mana_r - tabela2.mana_r
|
||||
tabela1.e_rage_r = tabela1.e_rage_r - tabela2.e_rage_r
|
||||
tabela1.e_energy_r = tabela1.e_energy_r - tabela2.e_energy_r
|
||||
tabela1.runepower_r = tabela1.runepower_r - tabela2.runepower_r
|
||||
tabela1.focus_r = tabela1.focus_r - tabela2.focus_r
|
||||
tabela1.holypower_r = tabela1.holypower_r - tabela2.holypower_r
|
||||
|
||||
return tabela1
|
||||
end
|
||||
@@ -0,0 +1,102 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
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
|
||||
|
||||
--lua locals
|
||||
local _setmetatable = setmetatable
|
||||
local _ipairs = ipairs
|
||||
--api locals
|
||||
local _UnitAura = UnitAura
|
||||
--local _GetSpellInfo = _detalhes.getspellinfo
|
||||
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
--id, nome, type, miss, dano, cura, overkill, school, resisted, blocked, absorbed, critico, glacing, crushing
|
||||
function habilidade_energy:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, habilidade_energy)
|
||||
|
||||
esta_tabela.quem_sou = "classe_energy_habilidade"
|
||||
esta_tabela.id = id
|
||||
esta_tabela.counter = 0
|
||||
|
||||
esta_tabela.mana = 0
|
||||
esta_tabela.e_rage = 0
|
||||
esta_tabela.e_energy = 0
|
||||
esta_tabela.runepower = 0
|
||||
|
||||
esta_tabela.targets = container_combatentes:NovoContainer (container_energy_target)
|
||||
|
||||
if (link) then
|
||||
esta_tabela.targets.shadow = link.targets
|
||||
end
|
||||
|
||||
return esta_tabela
|
||||
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]
|
||||
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
|
||||
|
||||
if (self.shadow) then
|
||||
return self.shadow:Add (serial, nome, flag, amount, who_nome, powertype)
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function _detalhes.clear:c_habilidade_e_energy (habilidade)
|
||||
habilidade.__index = {}
|
||||
habilidade.shadow = nil
|
||||
|
||||
_detalhes.clear:c_container_combatentes (habilidade.targets)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
return tabela1
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
do
|
||||
local _detalhes = _G._detalhes
|
||||
|
||||
local _error = {
|
||||
["error"] = true,
|
||||
["errortext"] = ""
|
||||
}
|
||||
_error.__index = _error
|
||||
_error.__newindex = function()
|
||||
assert (false, "Attempt to modify an read-only object.\nUse object() or object.errortext\n"..debugstack (2, 1 , 0))
|
||||
return
|
||||
end
|
||||
_error.__tostring = function()
|
||||
return _error.errortext
|
||||
end
|
||||
_error.__call = function (_this)
|
||||
print (_this.errortext)
|
||||
end
|
||||
|
||||
function _detalhes:NewError (_msg)
|
||||
local this_error = {}
|
||||
this_error.errortext = _msg
|
||||
setmetatable (this_error, _error)
|
||||
return this_error
|
||||
end
|
||||
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +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
|
||||
]]
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
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
|
||||
|
||||
--lua locals
|
||||
local _setmetatable = setmetatable
|
||||
--api locals
|
||||
|
||||
function habilidade_cura:NovaTabela (id, link) --aqui eu não sei que parâmetros passar
|
||||
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, habilidade_cura)
|
||||
|
||||
esta_tabela.CriadaEm = time()
|
||||
esta_tabela.quem_sou = "classe_heal_habilidade"
|
||||
|
||||
-- esta_tabela.jogador = serial
|
||||
|
||||
esta_tabela.total = 0 --total de dano aplicado por esta habilidade
|
||||
esta_tabela.counter = 0 --conta quantas vezes a habilidade foi chamada
|
||||
esta_tabela.id = id
|
||||
|
||||
--> normal hits
|
||||
|
||||
esta_tabela.n_min = 0
|
||||
esta_tabela.n_max = 0
|
||||
esta_tabela.n_amt = 0
|
||||
esta_tabela.n_curado = 0
|
||||
|
||||
--> critical hits
|
||||
|
||||
esta_tabela.c_min = 0
|
||||
esta_tabela.c_max = 0
|
||||
esta_tabela.c_amt = 0
|
||||
esta_tabela.c_curado = 0
|
||||
|
||||
esta_tabela.absorbed = 0
|
||||
esta_tabela.overheal = 0
|
||||
|
||||
esta_tabela.targets = container_combatentes:NovoContainer (container_heal_target)
|
||||
if (link) then
|
||||
esta_tabela.targets.shadow = link.targets
|
||||
end
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
alvo:AddQuantidade (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
|
||||
else
|
||||
alvo:AddQuantidade (0)
|
||||
end
|
||||
|
||||
if (self.shadow) then
|
||||
return self.shadow:Add (serial, nome, flag, amount, who_nome, absorbed, critical, overhealing)
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function _detalhes.clear:c_habilidade_cura (habilidade)
|
||||
habilidade.__index = {}
|
||||
habilidade.shadow = nil
|
||||
|
||||
_detalhes.clear:c_container_combatentes (habilidade.targets)
|
||||
end
|
||||
|
||||
habilidade_cura.__sub = function (tabela1, tabela2)
|
||||
tabela1.total = tabela1.total - tabela2.total
|
||||
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.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
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,160 @@
|
||||
local _detalhes = _G._detalhes
|
||||
--local gump = _detalhes.gump
|
||||
|
||||
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
|
||||
|
||||
--lua locals
|
||||
local _setmetatable = setmetatable
|
||||
local _ipairs = ipairs
|
||||
--api locals
|
||||
local _UnitAura = UnitAura
|
||||
|
||||
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
|
||||
|
||||
function habilidade_misc:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, habilidade_misc)
|
||||
|
||||
esta_tabela.quem_sou = "classe_others_habilidade"
|
||||
|
||||
esta_tabela.id = id
|
||||
|
||||
--print ("token: " .. token)
|
||||
|
||||
if (token == "SPELL_INTERRUPT") then
|
||||
--print ("token de interrupt")
|
||||
esta_tabela.interrompeu_oque = {}
|
||||
end
|
||||
|
||||
if (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
|
||||
--print ("token de interrupt")
|
||||
esta_tabela.dispell_oque = {}
|
||||
end
|
||||
|
||||
if (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
|
||||
--print ("token de interrupt")
|
||||
esta_tabela.cc_break_oque = {}
|
||||
end
|
||||
|
||||
-- isso aqui não pode ser assim... ou pode?
|
||||
esta_tabela.counter = 0
|
||||
--esta_tabela.res = 0
|
||||
|
||||
esta_tabela.targets = container_combatentes:NovoContainer (container_misc_target)
|
||||
|
||||
if (link) then
|
||||
esta_tabela.targets.shadow = link.targets
|
||||
end
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
|
||||
|
||||
--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
|
||||
|
||||
alvo.total = alvo.total + 1
|
||||
|
||||
--alvo:AddQuantidade (1)
|
||||
|
||||
if (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
|
||||
|
||||
elseif (token == "SPELL_RESURRECT") then
|
||||
if (not self.ress) then
|
||||
self.ress = 1
|
||||
else
|
||||
self.ress = self.ress + 1
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
if (self.shadow) then
|
||||
return self.shadow:Add (serial, nome, flag, who_nome, token, spellID, spellName)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--> 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.shadow = nil
|
||||
|
||||
_detalhes.clear:c_container_combatentes (habilidade.targets)
|
||||
end
|
||||
|
||||
habilidade_misc.__sub = function (tabela1, tabela2)
|
||||
|
||||
--interrupts
|
||||
tabela1.counter = tabela1.counter - tabela2.counter
|
||||
|
||||
--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
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
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 = {}
|
||||
_setmetatable (esta_tabela, alvo_da_habilidade)
|
||||
|
||||
esta_tabela.quem_sou = "classe_alvo_da_habilidade"
|
||||
|
||||
esta_tabela.total = 0 --total que a habilidade fez.
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function alvo_da_habilidade:AddQuantidade (amt)
|
||||
self.total = self.total + amt
|
||||
if (self.shadow) then
|
||||
return self.shadow:AddQuantidade (amt)
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
|
||||
--print (shadow)
|
||||
--print (este_alvo.shadow)
|
||||
_setmetatable (este_alvo, alvo_da_habilidade)
|
||||
este_alvo.__index = alvo_da_habilidade
|
||||
if (shadow ~= -1) then
|
||||
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable[este_alvo.nome]]
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
|
||||
este_alvo.shadow = nil
|
||||
este_alvo.__index = {}
|
||||
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
|
||||
@@ -0,0 +1,531 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
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 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
|
||||
|
||||
--api locals
|
||||
local _UnitClass = UnitClass
|
||||
local _GetPlayerInfoByGUID = GetPlayerInfoByGUID
|
||||
--lua locals
|
||||
local _setmetatable = setmetatable
|
||||
local _getmetatable = getmetatable
|
||||
local _bit_band = bit.band
|
||||
local _ipairs = ipairs
|
||||
local _pairs = pairs
|
||||
|
||||
--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 REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE or 0x00000040
|
||||
|
||||
function container_combatentes:NovoContainer (tipo_do_container, combatTable, combatId)
|
||||
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, container_combatentes)
|
||||
|
||||
esta_tabela.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container)
|
||||
if (not esta_tabela.funcao_de_criacao) then
|
||||
print ("Debug: Container criado mas sem funcao de criacao. TIPO: ")
|
||||
print (tipo_do_container)
|
||||
print (debugstack(2))
|
||||
return
|
||||
end
|
||||
|
||||
esta_tabela.tipo = tipo_do_container
|
||||
|
||||
esta_tabela.combatId = combatId
|
||||
|
||||
esta_tabela._ActorTable = {}
|
||||
esta_tabela._NameIndexTable = {}
|
||||
esta_tabela.meu_tipo = "container_combatentes"
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
local function get_class_ (novo_objeto, nome, flag)
|
||||
local _, engClass = _UnitClass (nome)
|
||||
|
||||
if (engClass) then
|
||||
novo_objeto.classe = engClass
|
||||
return
|
||||
else
|
||||
if (flag) then
|
||||
--print ("tem flag: " .. flag)
|
||||
--> conferir se o jogador é um player
|
||||
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
|
||||
--print ("eh um player sem grupo: "..novo_objeto.nome)
|
||||
novo_objeto.classe = "UNGROUPPLAYER"
|
||||
return
|
||||
elseif (_bit_band (flag, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
|
||||
--print ("eh um pet: "..novo_objeto.nome)
|
||||
novo_objeto.classe = "PET"
|
||||
return
|
||||
end
|
||||
end
|
||||
novo_objeto.classe = "UNKNOW"
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local EM_GRUPO = 0x00000007
|
||||
|
||||
function container_combatentes: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
|
||||
|
||||
function container_combatentes:CriarShadow (who)
|
||||
--> o self é o container no combate_overall -- who é o objeto na tabela do historico [1 2 3]
|
||||
local mapa = self._NameIndexTable
|
||||
local conteudo = self._ActorTable
|
||||
|
||||
local novo_objeto = self.funcao_de_criacao (_, who.serial, who.nome)
|
||||
novo_objeto.nome = who.nome
|
||||
|
||||
novo_objeto.flag = who.flag
|
||||
novo_objeto.classe = who.classe
|
||||
|
||||
for _, pet in _ipairs (who.pets) do
|
||||
novo_objeto.pets [#novo_objeto.pets+1] = pet
|
||||
end
|
||||
|
||||
if (who.enemy) then
|
||||
novo_objeto.enemy = true
|
||||
end
|
||||
|
||||
self._ActorTable [#self._ActorTable+1] = novo_objeto
|
||||
self._NameIndexTable[who.nome] = #self._ActorTable
|
||||
|
||||
return novo_objeto
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
--> aqui pode ocorrer bug caso o dono tenha sido adicionado ao container de pets enquanto não estava na party ou raide
|
||||
--[[ old debug lines
|
||||
if (self.shadow and self.tipo == container_damage and not self._NameIndexTable [dono_nome]) then
|
||||
print ("CONTAINER 1: Criando Actor do Dono:", dono_nome, "Pet: ", nome)
|
||||
elseif (self.shadow and self.tipo == container_damage and self._NameIndexTable [dono_nome]) then
|
||||
print ("CONTAINER 1: criado actor repedido",nome)
|
||||
end
|
||||
--]]
|
||||
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
|
||||
|
||||
end
|
||||
end
|
||||
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
|
||||
|
||||
--[[ old debug lines
|
||||
if (isOwner and self.shadow and self.tipo == container_damage) then
|
||||
print ("CONTAINER 2: Criando actor do Dono do Pet: OWNER:", nome, "PET:", isOwner)
|
||||
if (self._NameIndexTable [nome]) then
|
||||
print ("Repetido")
|
||||
end
|
||||
end
|
||||
--]]
|
||||
-- rotinas de criação do objeto shadow
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
local shadow = self.shadow --> espelho do container no overall
|
||||
local shadow_objeto = nil
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
novo_objeto.nome = 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
|
||||
|
||||
if (IsInInstance()) then
|
||||
novo_objeto.displayName = nome:gsub (("%-.*"), "")
|
||||
else
|
||||
novo_objeto.displayName = nome
|
||||
end
|
||||
|
||||
if (_bit_band (flag, EM_GRUPO) ~= 0) then --> faz parte do grupo
|
||||
details_flag = details_flag+0x00000100
|
||||
novo_objeto.grupo = true
|
||||
if (shadow_objeto) then
|
||||
shadow_objeto.grupo = true
|
||||
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()) 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
|
||||
--print ("inimigos -> " .. nome)
|
||||
end
|
||||
else
|
||||
--print (flag)
|
||||
end
|
||||
|
||||
novo_objeto.flag = details_flag
|
||||
novo_objeto.flag_original = flag
|
||||
novo_objeto.serial = serial
|
||||
|
||||
-- tipo do container
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
if (self.tipo == container_playernpc) then --> CONTAINER COMUM
|
||||
|
||||
elseif (self.tipo == container_damage) then --> CONTAINER DAMAGE
|
||||
|
||||
get_class_ (novo_objeto, nome, flag)
|
||||
|
||||
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
|
||||
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_heal) then --> CONTAINER HEALING
|
||||
|
||||
get_class_ (novo_objeto, nome, flag)
|
||||
|
||||
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_energy) then --> CONTAINER ENERGY
|
||||
|
||||
get_class_ (novo_objeto, nome, flag)
|
||||
|
||||
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_class_ (novo_objeto, nome, flag)
|
||||
|
||||
--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
|
||||
shadow_objeto.flag = details_flag
|
||||
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
|
||||
end
|
||||
|
||||
elseif (self.tipo == container_friendlyfire) then --> CONTAINER FRIENDLY FIRE
|
||||
|
||||
get_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
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- novo_objeto.combatID = _detalhes:NumeroCombate() --> grava no objeto qual o ID do combate que ele pertence -- Não serve pra nada? melhor DELETAR
|
||||
|
||||
--if (self.shadow and self.tipo == container_damage and self._NameIndexTable [nome]) then
|
||||
-- print ("CONTAINER 3: criado actor repedido",nome, 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
|
||||
|
||||
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_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
|
||||
|
||||
function container_combatentes:remapear()
|
||||
local mapa = self._NameIndexTable
|
||||
local conteudo = self._ActorTable
|
||||
for i = 1, #conteudo do
|
||||
mapa [conteudo[i].nome] = i
|
||||
end
|
||||
end
|
||||
|
||||
local function ReparaMapa (tabela)
|
||||
local mapa = {}
|
||||
for i = 1, #tabela._ActorTable do
|
||||
mapa [tabela._ActorTable[i].nome] = i
|
||||
end
|
||||
tabela._NameIndexTable = mapa
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_container_combatentes (container, shadow)
|
||||
_setmetatable (container, _detalhes.container_combatentes)
|
||||
container.__index = _detalhes.container_combatentes
|
||||
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
|
||||
ReparaMapa (container)
|
||||
|
||||
if (shadow ~= -1) then
|
||||
container.shadow = shadow
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.clear:c_container_combatentes (container)
|
||||
container.__index = {}
|
||||
container.shadow = nil
|
||||
container._NameIndexTable = nil
|
||||
container.need_refresh = nil
|
||||
container.funcao_de_criacao = nil
|
||||
end
|
||||
|
||||
--[[
|
||||
if (not serial) then
|
||||
print ("DEBUG: objeto sem serial: "..nome)
|
||||
novo_objeto.classe = "UNKNOW"
|
||||
else
|
||||
if (_bit_band (flag, 0x00000400) ~= 0) then --> é player
|
||||
|
||||
local _, engClass, _, engRace = _GetPlayerInfoByGUID (serial)
|
||||
novo_objeto.classe = engClass
|
||||
--print (novo_objeto.classe)
|
||||
--print ("eh um player ".. nome.." da classe "..engClass)
|
||||
else
|
||||
--print ("nao eh um player "..nome)
|
||||
local _, engClass = _UnitClass (nome)
|
||||
--print (engClass)
|
||||
|
||||
if (engClass) then
|
||||
novo_objeto.classe = engClass
|
||||
else
|
||||
novo_objeto.classe = "UNKNOW"
|
||||
end
|
||||
end
|
||||
--novo_objeto.classe = "UNKNOW"
|
||||
end
|
||||
--]]
|
||||
@@ -0,0 +1,130 @@
|
||||
local _detalhes = _G._detalhes
|
||||
--local AceLocale = LibStub ("AceLocale-3.0")
|
||||
--local Loc = AceLocale:GetLocale ( "Details" )
|
||||
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local _setmetatable = setmetatable
|
||||
|
||||
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 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 container_habilidades = _detalhes.container_habilidades
|
||||
|
||||
function container_habilidades:NovoContainer (tipo_do_container)
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, container_habilidades)
|
||||
|
||||
esta_tabela.funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container)
|
||||
if (not esta_tabela.funcao_de_criacao) then
|
||||
print ("DEBUG: Sem funcao de criacao para a habilidade... TIPO: ")
|
||||
print (tipo_do_container)
|
||||
end
|
||||
|
||||
esta_tabela.tipo = tipo_do_container
|
||||
esta_tabela._ActorTable = {}
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
if (criar) then
|
||||
|
||||
if (cria_shadow) then
|
||||
local novo_objeto = self.funcao_de_criacao (_, 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 (_, 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
|
||||
|
||||
self._ActorTable [id] = novo_objeto
|
||||
|
||||
return novo_objeto
|
||||
else
|
||||
return nil
|
||||
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
|
||||
|
||||
elseif (tipo == container_energy) then
|
||||
return habilidade_e_energy.NovaTabela
|
||||
|
||||
elseif (tipo == container_misc) then
|
||||
return habilidade_misc.NovaTabela
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_container_habilidades (container, shadow)
|
||||
_setmetatable (container, _detalhes.container_habilidades)
|
||||
container.__index = _detalhes.container_habilidades
|
||||
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
|
||||
container.funcao_de_criacao = func_criacao
|
||||
|
||||
if (shadow ~= -1) then
|
||||
container.shadow = shadow
|
||||
end
|
||||
end
|
||||
|
||||
function _detalhes.clear:c_container_habilidades (container)
|
||||
container.__index = {}
|
||||
container.shadow = nil
|
||||
container.funcao_de_criacao = nil
|
||||
end
|
||||
@@ -0,0 +1,131 @@
|
||||
--lua api
|
||||
local _table_remove = table.remove
|
||||
local _table_insert = table.insert
|
||||
local _setmetatable = setmetatable
|
||||
local _table_wipe = table.wipe
|
||||
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local combate = _detalhes.combate
|
||||
local historico = _detalhes.historico
|
||||
local barra_total = _detalhes.barra_total
|
||||
local container_pets = _detalhes.container_pets
|
||||
local timeMachine = _detalhes.timeMachine
|
||||
|
||||
function historico:NovoHistorico()
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, historico)
|
||||
|
||||
esta_tabela.tabelas = {} --guarda as tabelas dos combates
|
||||
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
--> sai do combate, chamou adicionar a tabela ao histórico
|
||||
function historico:adicionar (tabela)
|
||||
|
||||
local tamanho = #self.tabelas
|
||||
|
||||
--> verifica se precisa dar UnFreeze()
|
||||
if (tamanho < _detalhes.segments_amount) then --> vai preencher um novo index vazio
|
||||
local ultima_tabela = self.tabelas[tamanho]
|
||||
if (not ultima_tabela) then --> não ha tabelas no historico, esta será a #1
|
||||
--> pega a tabela do combate atual
|
||||
ultima_tabela = tabela
|
||||
end
|
||||
_detalhes:InstanciaCallFunction (_detalhes.CheckFreeze, tamanho+1, ultima_tabela)
|
||||
end
|
||||
|
||||
--> reordena as tabelas
|
||||
_table_insert (self.tabelas, 1, tabela)
|
||||
|
||||
--> chama a função que irá atualizar as instâncias com segmentos no histórico
|
||||
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos_AfterCombat, self)
|
||||
|
||||
--> verifica se precisa apagar a última tabela do histórico
|
||||
if (#self.tabelas > _detalhes.segments_amount) then
|
||||
|
||||
-- BETA subtração do combate overall
|
||||
_detalhes.tabela_overall = _detalhes.tabela_overall - self.tabelas [#self.tabelas]
|
||||
_detalhes.tabela_overall.start_time = _detalhes.tabela_overall.start_time + (self.tabelas[#self.tabelas].end_time-self.tabelas[#self.tabelas].start_time)
|
||||
--print (#self.tabelas)
|
||||
|
||||
local amt_mortes = #self.tabelas[#self.tabelas].last_events_tables --> quantas mortes teve nessa luta
|
||||
if (amt_mortes > 0) then
|
||||
for i = #_detalhes.tabela_overall.last_events_tables, #_detalhes.tabela_overall.last_events_tables-amt_mortes, -1 do
|
||||
_table_remove (_detalhes.tabela_overall.last_events_tables, #_detalhes.tabela_overall.last_events_tables)
|
||||
end
|
||||
end
|
||||
|
||||
_table_remove (self.tabelas, #self.tabelas)
|
||||
_detalhes:SendEvent ("DETAILS_DATA_SEGMENTREMOVED", nil, nil)
|
||||
|
||||
end
|
||||
|
||||
_detalhes:InstanciaCallFunction (_detalhes.AtualizarJanela)
|
||||
end
|
||||
|
||||
--> verifica se tem alguma instancia congelada mostrando o segmento recém liberado
|
||||
function _detalhes:CheckFreeze (instancia, index_liberado, tabela)
|
||||
if (instancia.freezed) then --> esta congelada
|
||||
if (instancia.segmento == index_liberado) then
|
||||
instancia.showing = tabela
|
||||
instancia:UnFreeze()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function historico:resetar()
|
||||
|
||||
if (_detalhes.bosswindow) then
|
||||
_detalhes.bosswindow:Reset()
|
||||
end
|
||||
|
||||
if (_detalhes.tabela_vigente.verifica_combate) then --> finaliza a checagem se esta ou não no combate
|
||||
_detalhes:CancelTimer (_detalhes.tabela_vigente.verifica_combate)
|
||||
end
|
||||
|
||||
--> fecha a janela de informações do jogador
|
||||
_detalhes:FechaJanelaInfo()
|
||||
|
||||
-- novo container de historico
|
||||
_detalhes.tabela_historico = historico:NovoHistorico() --joga fora a tabela antiga e cria uma nova
|
||||
--novo container para armazenar pets
|
||||
_detalhes.tabela_pets = _detalhes.container_pets:NovoContainer()
|
||||
_detalhes.container_pets:BuscarPets()
|
||||
-- nova tabela do overall e current
|
||||
_detalhes.tabela_overall = combate:NovaTabela() --joga fora a tabela antiga e cria uma nova
|
||||
-- cria nova tabela do combate atual
|
||||
_detalhes.tabela_vigente = combate:NovaTabela (_, _detalhes.tabela_overall)
|
||||
|
||||
--marca o addon como fora de combate
|
||||
_detalhes.in_combat = false
|
||||
--zera o contador de combates
|
||||
_detalhes:NumeroCombate (0)
|
||||
|
||||
--> limpa o cache de magias
|
||||
_detalhes:ClearSpellCache()
|
||||
|
||||
--> limpa a tabela de escudos
|
||||
_table_wipe (_detalhes.escudos)
|
||||
|
||||
--> reinicia a time machine
|
||||
timeMachine:Reiniciar()
|
||||
|
||||
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas
|
||||
_detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode
|
||||
_detalhes:InstanciaCallFunction (_detalhes.ResetaGump) --_detalhes:ResetaGump ("de todas as instancias")
|
||||
_detalhes:InstanciaCallFunction (gump.Fade, "in", nil, "barras")
|
||||
|
||||
_detalhes:AtualizaGumpPrincipal (-1) --atualiza todas as instancias
|
||||
|
||||
_detalhes:UpdateParserGears()
|
||||
|
||||
_detalhes:SendEvent ("DETAILS_DATA_RESET", nil, nil)
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_historico (este_historico)
|
||||
_setmetatable (este_historico, historico)
|
||||
--este_historico.__index = historico
|
||||
end
|
||||
@@ -0,0 +1,149 @@
|
||||
local _detalhes = _G._detalhes
|
||||
local gump = _detalhes.gump
|
||||
|
||||
local container_pets = _detalhes.container_pets
|
||||
|
||||
-- api locals
|
||||
local _UnitGUID = UnitGUID
|
||||
local _UnitName = UnitName
|
||||
local _GetUnitName = GetUnitName
|
||||
local _IsInRaid = IsInRaid
|
||||
local _IsInGroup = IsInGroup
|
||||
local _GetNumGroupMembers = GetNumGroupMembers
|
||||
|
||||
-- lua locals
|
||||
local _setmetatable = setmetatable
|
||||
|
||||
function container_pets:NovoContainer()
|
||||
local esta_tabela = {}
|
||||
_setmetatable (esta_tabela, _detalhes.container_pets)
|
||||
esta_tabela.pets = {} --> armazena a pool -> uma dictionary com o [serial do pet] -> nome do dono
|
||||
esta_tabela._ActorTable = {} --> armazena os 15 ultimos pets do jogador -> [jogador nome] -> {nil, nil, nil, ...}
|
||||
return esta_tabela
|
||||
end
|
||||
|
||||
function container_pets:PegaDono (pet_serial, pet_nome, pet_flags)
|
||||
|
||||
local busca = self.pets [pet_serial]
|
||||
local dono_nome, dono_serial, dono_flags
|
||||
|
||||
if (busca) then
|
||||
--debug: print ("achou o pet no container de donos")
|
||||
dono_nome, dono_serial, dono_flags = busca[1], busca[2], busca[3]
|
||||
return pet_nome .." <"..dono_nome..">", dono_nome, dono_serial, dono_flags
|
||||
end
|
||||
|
||||
if (_IsInRaid()) then
|
||||
--print ("estou em RAIDE")
|
||||
for i = 1, _GetNumGroupMembers(), 1 do
|
||||
if (pet_serial == _UnitGUID ("raidpet"..i)) then
|
||||
dono_serial = _UnitGUID ("raid"..i)
|
||||
dono_flags = 0x00000417 --> emulate sourceflag flag
|
||||
|
||||
local nome, realm = _UnitName ("raid"..i)
|
||||
if (realm) then
|
||||
nome = nome.."-"..realm
|
||||
end
|
||||
dono_nome = nome
|
||||
--print ("Dono encontrado na raide")
|
||||
end
|
||||
end
|
||||
|
||||
elseif (_IsInGroup()) then
|
||||
--print ("DEBUG estou em PARTY")
|
||||
for i = 1, _GetNumGroupMembers()-1, 1 do
|
||||
if (pet_serial == _UnitGUID ("partypet"..i)) then
|
||||
dono_serial = _UnitGUID ("party"..i)
|
||||
dono_flags = 0x00000417 --> emulate sourceflag flag
|
||||
|
||||
local nome, realm = _UnitName ("party"..i)
|
||||
if (realm) then
|
||||
nome = nome.."-"..realm
|
||||
end
|
||||
dono_nome = nome
|
||||
--print ("DEBUG Dono encontrado na party")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (not dono_nome) then
|
||||
if (pet_serial == _UnitGUID ("pet")) then
|
||||
dono_nome = _GetUnitName ("player")
|
||||
dono_serial = _UnitGUID ("player")
|
||||
if (_IsInGroup() or _IsInRaid()) then
|
||||
dono_flags = 0x00000417 --> emulate sourceflag flag
|
||||
else
|
||||
dono_flags = 0x00000411 --> emulate sourceflag flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (dono_nome) then
|
||||
--print ("dono encontrado, adicionando ao cache")
|
||||
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo} --> adicionada a flag emulada
|
||||
return pet_nome .." <"..dono_nome..">", dono_nome, dono_serial, dono_flags
|
||||
else
|
||||
--if (_GetNumGroupMembers() > 0) then
|
||||
--print ("DEBUG: Pet sem dono: "..pet_nome)
|
||||
--end
|
||||
--print ("DEBUG Nao foi possivel achar o dono de "..pet_nome)
|
||||
end
|
||||
|
||||
return nil, nil, nil, nil
|
||||
|
||||
end
|
||||
|
||||
--> ao ter raid roster update, precisa dar foreach no container de pets e verificar as flags
|
||||
--> o mesmo precisa ser feito com as tabelas de combate
|
||||
|
||||
function container_pets:BuscarPets()
|
||||
if (_IsInRaid()) then
|
||||
for i = 1, _GetNumGroupMembers(), 1 do
|
||||
local pet_serial = _UnitGUID ("raidpet"..i)
|
||||
if (pet_serial) then
|
||||
if (not _detalhes.tabela_pets.pets [pet_serial]) then
|
||||
local nome, realm = _UnitName ("raid"..i)
|
||||
if (realm) then
|
||||
nome = nome.."-"..realm
|
||||
end
|
||||
_detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("raidpet"..i), 2600, _UnitGUID ("raid"..i), nome, 0x514, true)
|
||||
--print ("PET FOUND on Buscar Pets!", _GetUnitName ("raid"..i, true), _detalhes:trim (_GetUnitName ("raid"..i, true)))
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif (_IsInGroup()) then
|
||||
for i = 1, _GetNumGroupMembers()-1, 1 do
|
||||
local pet_serial = _UnitGUID ("partypet"..i)
|
||||
if (pet_serial) then
|
||||
if (not _detalhes.tabela_pets.pets [pet_serial]) then
|
||||
local nome, realm = _UnitName ("party"..i)
|
||||
if (realm) then
|
||||
nome = nome.."-"..realm
|
||||
end
|
||||
_detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("partypet"..i), 2600, _UnitGUID ("party"..i), nome, 0x514)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags, fromSearch)
|
||||
|
||||
self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo}
|
||||
|
||||
--if (fromSearch) then
|
||||
-- local d = self.pets [pet_serial]
|
||||
--print ("dono nome:",d[1], "dono serial:", d[2], "dono flags:", d[3], "tempo:", d[4])
|
||||
--end
|
||||
|
||||
if (self.pets [dono_serial]) then
|
||||
--print ("debug: a owner is a pet, Owner: ", dono_nome, " Pet: ", pet_nome)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function _detalhes.refresh:r_container_pets (container)
|
||||
_setmetatable (container, container_pets)
|
||||
--container.__index = container_pets
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user