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

- Fixed window alerts which was showing behind the bars.
- Fixed a issue where Details! windows wasn't hidden when a pet battle starts.
- Fixed a issue with segments menu when a window is placed on the right side of the screen.
- Fixed death log issue with friendly fire hits.
This commit is contained in:
tercio
2014-06-03 16:42:40 -03:00
parent 079b784c72
commit 710a1e6031
27 changed files with 2889 additions and 2332 deletions
+3 -4
View File
@@ -8,7 +8,7 @@
_ = nil
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners")
_detalhes.userversion = "v1.15.3a" --tirar guardian of ancient kingss
_detalhes.userversion = "v1.15.3b" --tirar guardian of ancient kingss
_detalhes.version = "Alpha 019"
_detalhes.realversion = 19
@@ -40,8 +40,6 @@ do
_detalhes.refresh = {}
--> armazena as funções para limpar e guardas os dados - Metatable functions
_detalhes.clear = {}
--> armazena as fontstring usadas no addon - Store labels (fontstrings)
_detalhes.font_pool = {}
--> armazena a config do painel de fast switch
_detalhes.switch = {}
--> armazena os estilos salvos
@@ -127,6 +125,7 @@ do
all = 3, --> Everything
raid = 4 --> Raid
}
--[[
_detalhes.flags = {
--> Player and Pet
player = 0x00000001,--> player character
@@ -141,7 +140,7 @@ do
neutral = 0x00000020,--> neutral
enemy = 0x00000040--> enemy
}
--]]
_detalhes.divisores = {
abre = "(", --> open
fecha = ")", --> close
+363 -398
View File
@@ -1,415 +1,380 @@
--[[
-------Details! Addon
-------Class Combat
-------This file control combat class. A combat is a object wich hold combat attributes.
-------The numeric part of table is compost by 4 indexes: [1] damage, [2] heal, [3] energies and [4] misc
]]
-- combat class object
local _detalhes = _G._detalhes
--shortcuts
local combate = _detalhes.combate
local container_combatentes = _detalhes.container_combatentes
--flags
local REACTION_HOSTILE = 0x00000040
local CONTROL_PLAYER = 0x00000100
--locals
local _setmetatable = setmetatable --> lua api
local _ipairs = ipairs --> lua api
local _pairs = pairs --> lua api
local _bit_band = bit.band --> lua api
local _date = date --> lua api
local _table_remove = table.remove
--time hold
local _tempo = time()
local _
--constants
local class_type_dano = _detalhes.atributos.dano
local class_type_cura = _detalhes.atributos.cura
local class_type_e_energy = _detalhes.atributos.e_energy
local class_type_misc = _detalhes.atributos.misc
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[ __call function, get an actor from current combat.
combatTable ( index, actorName )
index: container number [1] damage, [2] heal, [3] energies and [4] misc
actorName: name of an actor (player, npc, pet, etc) --]]
_detalhes.call_combate = function (self, class_type, name)
local container = self[class_type]
local index_mapa = container._NameIndexTable [name]
local actor = container._ActorTable [index_mapa]
return actor
end
combate.__call = _detalhes.call_combate
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[ Class Constructor ]]
function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
local esta_tabela = {true, true, true, true, true}
esta_tabela [1] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> Damage
esta_tabela [2] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_HEAL_CLASS, esta_tabela, combatId) --> Healing
esta_tabela [3] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENERGY_CLASS, esta_tabela, combatId) --> Energies
esta_tabela [4] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS, esta_tabela, combatId) --> Misc
esta_tabela [5] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> place holder for customs
_setmetatable (esta_tabela, combate)
--> try discover if is a pvp combat
local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ...
if (who_serial) then --> aqui irá identificar o boss ou o oponente
if (alvo_name and _bit_band (alvo_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo alvo
esta_tabela.contra = alvo_name
if (_bit_band (alvo_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o alvo é da facção oposta ou foi dado mind control
end
elseif (who_name and _bit_band (who_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo who caso o mob é quem deu o primeiro hit
esta_tabela.contra = who_name
if (_bit_band (who_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o who é da facção oposta ou foi dado mind control
end
else
esta_tabela.pvp = true --> se ambos são friendly, seria isso um PVP entre jogadores da mesma facções?
end
end
--> start/end time (duration)
esta_tabela.data_fim = 0
esta_tabela.data_inicio = 0
--> record last event before dead
esta_tabela.last_events_tables = {}
--> frags
esta_tabela.frags = {}
esta_tabela.frags_need_refresh = false
--> time data container
esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
--> Skill cache (not used)
esta_tabela.CombatSkillCache = {}
-- a tabela sem o tempo de inicio é a tabela descartavel do inicio do addon
if (iniciada) then
esta_tabela.start_time = _tempo
esta_tabela.end_time = nil
else
esta_tabela.start_time = 0
esta_tabela.end_time = nil
end
-- o container irá armazenar as classes de dano -- cria um novo container de indexes de seriais de jogadores --parâmetro 1 classe armazenada no container, parâmetro 2 = flag da classe
esta_tabela[1].need_refresh = true
esta_tabela[2].need_refresh = true
esta_tabela[3].need_refresh = true
esta_tabela[4].need_refresh = true
esta_tabela[5].need_refresh = true
if (_tabela_overall) then --> link é a tabela de combate do overall
esta_tabela[1].shadow = _tabela_overall[1] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[2].shadow = _tabela_overall[2] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[3].shadow = _tabela_overall[3] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[4].shadow = _tabela_overall[4] --> diz ao objeto qual a shadow dele na tabela overall
end
-- abriga a tabela contendo o total de cada atributo
-- esta_tabela.barra_total = barra_total:NovaBarra()
--> barra total movido para um simples membro do combate:
esta_tabela.totals = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa pessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0, --> armazena quantos cooldowns a raid usou
debuff_uptime = 0 --> armazena quantos cooldowns a raid usou
}
}
esta_tabela.totals_grupo = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa oessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0,
debuff_uptime = 0
}
}
return esta_tabela
end
function combate:GetTimeData (name)
return self.TimeData [name]
end
function combate:TravarTempos()
--é necessário travar o tempo em todos os atributos do combate.
if (self [1]) then
for _, jogador in _ipairs (self [1]._ActorTable) do --> damage
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
--jogador.last_events_table = _detalhes:CreateActorLastEventTable()
end
end
else
--print ("combat [1] doesn't exist.")
end
if (self [2]) then
for _, jogador in _ipairs (self [2]._ActorTable) do --> healing
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
--print ("travando o tempo de",jogador.nome, jogador.end_time)
--jogador.last_events_table = _detalhes:CreateActorLastEventTable()
end
end
else
--print ("combat [2] doesn't exist.")
end
end
function combate:UltimaAcao (tempo)
if (tempo) then
self.last_event = tempo
else
return self.last_event
end
end
function combate:GetDate()
return self.data_inicio, self.data_fim
end
function combate:seta_data (tipo)
if (tipo == _detalhes._detalhes_props.DATA_TYPE_START) then
self.data_inicio = _date ("%H:%M:%S")
elseif (tipo == _detalhes._detalhes_props.DATA_TYPE_END) then
self.data_fim = _date ("%H:%M:%S")
end
end
function combate:GetCombatName (try_find)
if (self.is_pvp) then
return self.is_pvp.name
elseif (self.is_boss) then
return self.is_boss.encounter
elseif (self.is_tras) then
return Loc ["STRING_SEGMENT_TRASH"]
else
if (self.enemy) then
return self.enemy
end
if (try_find) then
return _detalhes:FindEnemy()
end
end
return Loc ["STRING_UNKNOW"]
end
function combate:GetActorList (container)
return self [container]._ActorTable
end
function combate:GetCombatTime()
if (self.end_time) then
--print ("tem end time")
return self.end_time - self.start_time
elseif (self.start_time and _detalhes.in_combat) then
--print ("tem start time e esta em combate")
return _tempo - self.start_time
else
--print ("retornando zero")
return 0
end
end
local _detalhes = _G._detalhes
local _
--[[global]] DETAILS_TOTALS_ONLYGROUP = true
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
if (onlyGroup) then
return self.totals_grupo [attribute]
else
return self.totals [attribute]
end
elseif (attribute == 3 or attribute == 4) then
local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute)
if (onlyGroup) then
return self.totals_grupo [attribute] [subName]
else
return self.totals [attribute] [subName]
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable -- lua local
local _ipairs = ipairs -- lua local
local _pairs = pairs -- lua local
local _bit_band = bit.band -- lua local
local _date = date -- lua local
local _table_remove = table.remove -- lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local combate = _detalhes.combate
local container_combatentes = _detalhes.container_combatentes
local class_type_dano = _detalhes.atributos.dano
local class_type_cura = _detalhes.atributos.cura
local class_type_e_energy = _detalhes.atributos.e_energy
local class_type_misc = _detalhes.atributos.misc
local REACTION_HOSTILE = 0x00000040
local CONTROL_PLAYER = 0x00000100
local _tempo = time()
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> api functions
--combat (container type, actor name)
_detalhes.call_combate = function (self, class_type, name)
local container = self[class_type]
local index_mapa = container._NameIndexTable [name]
local actor = container._ActorTable [index_mapa]
return actor
end
return 0
end
combate.__call = _detalhes.call_combate
function combate:seta_tempo_decorrido()
self.end_time = _tempo
end
function _detalhes.refresh:r_combate (tabela_combate, shadow)
_setmetatable (tabela_combate, _detalhes.combate)
tabela_combate.__index = _detalhes.combate
tabela_combate.shadow = shadow
end
function _detalhes.clear:c_combate (tabela_combate)
--tabela_combate.__index = {}
tabela_combate.__index = nil
tabela_combate.__call = {}
tabela_combate._combat_table = nil
tabela_combate.shadow = nil
end
combate.__sub = function (combate1, combate2)
if (combate1 ~= _detalhes.tabela_overall) then
return
--get the start date and end date
function combate:GetDate()
return self.data_inicio, self.data_fim
end
--> sub dano
for index, actor_T2 in _ipairs (combate2[1]._ActorTable) do
local actor_T1 = combate1[1]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [1].need_refresh = true
--> sub heal
for index, actor_T2 in _ipairs (combate2[2]._ActorTable) do
local actor_T1 = combate1[2]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [2].need_refresh = true
--> sub energy
for index, actor_T2 in _ipairs (combate2[3]._ActorTable) do
local actor_T1 = combate1[3]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [3].need_refresh = true
--> sub misc
for index, actor_T2 in _ipairs (combate2[4]._ActorTable) do
local actor_T1 = combate1[4]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [4].need_refresh = true
--> reduz o tempo
combate1.start_time = combate1.start_time + (combate2.end_time - combate2.start_time)
--> apaga as mortes da luta diminuida
local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
if (amt_mortes > 0) then
for i = #combate1.last_events_tables, #combate1.last_events_tables-amt_mortes, -1 do
_table_remove (combate1.last_events_tables, #combate1.last_events_tables)
--return data for charts
function combate:GetTimeData (name)
return self.TimeData [name]
end
--return the name of the encounter or enemy
function combate:GetCombatName (try_find)
if (self.is_pvp) then
return self.is_pvp.name
elseif (self.is_boss) then
return self.is_boss.encounter
elseif (self.is_tras) then
return Loc ["STRING_SEGMENT_TRASH"]
else
if (self.enemy) then
return self.enemy
end
if (try_find) then
return _detalhes:FindEnemy()
end
end
return Loc ["STRING_UNKNOW"]
end
--return a numeric table with all actors on the specific containter
function combate:GetActorList (container)
return self [container]._ActorTable
end
--return the combat time in seconds
function combate:GetCombatTime()
if (self.end_time) then
return self.end_time - self.start_time
elseif (self.start_time and _detalhes.in_combat) then
return _tempo - self.start_time
else
return 0
end
end
--return the total of a specific attribute
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
if (onlyGroup) then
return self.totals_grupo [attribute]
else
return self.totals [attribute]
end
elseif (attribute == 3 or attribute == 4) then
local subName = _detalhes:GetInternalSubAttributeName (attribute, subAttribute)
if (onlyGroup) then
return self.totals_grupo [attribute] [subName]
else
return self.totals [attribute] [subName]
end
end
return 0
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
--class constructor
function combate:NovaTabela (iniciada, _tabela_overall, combatId, ...)
local esta_tabela = {true, true, true, true, true}
--> frags
for fragName, fragAmount in pairs (combate2.frags) do
if (fragAmount) then
if (combate1.frags [fragName]) then
combate1.frags [fragName] = combate1.frags [fragName] - fragAmount
else
combate1.frags [fragName] = fragAmount
esta_tabela [1] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> Damage
esta_tabela [2] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_HEAL_CLASS, esta_tabela, combatId) --> Healing
esta_tabela [3] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_ENERGY_CLASS, esta_tabela, combatId) --> Energies
esta_tabela [4] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS, esta_tabela, combatId) --> Misc
esta_tabela [5] = container_combatentes:NovoContainer (_detalhes.container_type.CONTAINER_DAMAGE_CLASS, esta_tabela, combatId) --> place holder for customs
_setmetatable (esta_tabela, combate)
--> try discover if is a pvp combat
local who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags = ...
if (who_serial) then --> aqui irá identificar o boss ou o oponente
if (alvo_name and _bit_band (alvo_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo alvo
esta_tabela.contra = alvo_name
if (_bit_band (alvo_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o alvo é da facção oposta ou foi dado mind control
end
elseif (who_name and _bit_band (who_flags, REACTION_HOSTILE) ~= 0) then --> tentando pegar o inimigo pelo who caso o mob é quem deu o primeiro hit
esta_tabela.contra = who_name
if (_bit_band (who_flags, CONTROL_PLAYER) ~= 0) then
esta_tabela.pvp = true --> o who é da facção oposta ou foi dado mind control
end
else
esta_tabela.pvp = true --> se ambos são friendly, seria isso um PVP entre jogadores da mesma facções?
end
end
--> start/end time (duration)
esta_tabela.data_fim = 0
esta_tabela.data_inicio = 0
--> record last event before dead
esta_tabela.last_events_tables = {}
--> frags
esta_tabela.frags = {}
esta_tabela.frags_need_refresh = false
--> time data container
esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
--> Skill cache (not used)
esta_tabela.CombatSkillCache = {}
-- a tabela sem o tempo de inicio é a tabela descartavel do inicio do addon
if (iniciada) then
esta_tabela.start_time = _tempo
esta_tabela.end_time = nil
else
esta_tabela.start_time = 0
esta_tabela.end_time = nil
end
-- o container irá armazenar as classes de dano -- cria um novo container de indexes de seriais de jogadores --parâmetro 1 classe armazenada no container, parâmetro 2 = flag da classe
esta_tabela[1].need_refresh = true
esta_tabela[2].need_refresh = true
esta_tabela[3].need_refresh = true
esta_tabela[4].need_refresh = true
esta_tabela[5].need_refresh = true
if (_tabela_overall) then --> link é a tabela de combate do overall
esta_tabela[1].shadow = _tabela_overall[1] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[2].shadow = _tabela_overall[2] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[3].shadow = _tabela_overall[3] --> diz ao objeto qual a shadow dele na tabela overall
esta_tabela[4].shadow = _tabela_overall[4] --> diz ao objeto qual a shadow dele na tabela overall
end
esta_tabela.totals = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa pessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0, --> armazena quantos cooldowns a raid usou
debuff_uptime = 0 --> armazena quantos cooldowns a raid usou
}
}
esta_tabela.totals_grupo = {
0, --> dano
0, --> cura
{--> e_energy
mana = 0, --> mana
e_rage = 0, --> rage
e_energy = 0, --> energy (rogues cat)
runepower = 0 --> runepower (dk)
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
ress = 0, --> armazena quantos pessoas ele reviveu
interrupt = 0, --> armazena quantos interrupt a pessoa deu
dispell = 0, --> armazena quantos dispell esta pessoa recebeu
dead = 0, --> armazena quantas vezes essa oessia morreu
cooldowns_defensive = 0, --> armazena quantos cooldowns a raid usou
buff_uptime = 0,
debuff_uptime = 0
}
}
return esta_tabela
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--trava o tempo dos jogadores após o término do combate.
function combate:TravarTempos()
if (self [1]) then
for _, jogador in _ipairs (self [1]._ActorTable) do --> damage
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
end
end
end
combate1.frags_need_refresh = true
return combate1
end
combate.__add = function (combate1, combate2)
local all_containers = {combate2 [class_type_dano]._ActorTable, combate2 [class_type_cura]._ActorTable, combate2 [class_type_e_energy]._ActorTable, combate2 [class_type_misc]._ActorTable}
--actor.boss_fight_component
--actor.fight_component
--combat.is_boss
--combat.instance_type -- party raid
for class_type, actor_container in ipairs (all_containers) do
for _, actor in ipairs (actor_container) do
local shadow
if (class_type == class_type_dano) then
shadow = _detalhes.atributo_damage:r_connect_shadow (actor, true)
elseif (class_type == class_type_cura) then
shadow = _detalhes.atributo_heal:r_connect_shadow (actor, true)
elseif (class_type == class_type_e_energy) then
shadow = _detalhes.atributo_energy:r_connect_shadow (actor, true)
elseif (class_type == class_type_misc) then
shadow = _detalhes.atributo_misc:r_connect_shadow (actor, true)
if (self [2]) then
for _, jogador in _ipairs (self [2]._ActorTable) do --> healing
if (jogador:Iniciar()) then -- retorna se ele esta com o dps ativo
jogador:TerminarTempo()
jogador:Iniciar (false) --trava o dps do jogador
end
end
shadow.boss_fight_component = actor.boss_fight_component
shadow.fight_component = actor.fight_component
shadow.grupo = actor.grupo
--if (shadow:EstaoLinkados (actor)) then
-- shadow:FazLinkagem (actor)
--end
end
end
--if (combate2.end_time and combate2.start_time) then
-- combate1.start_time = combate1.start_time - (combate1.end_time - combate1.start_time)
--end
return combate1
end
function _detalhes:UpdateCombat()
_tempo = _detalhes._tempo
end
function combate:UltimaAcao (tempo)
if (tempo) then
self.last_event = tempo
else
return self.last_event
end
end
function combate:seta_data (tipo)
if (tipo == _detalhes._detalhes_props.DATA_TYPE_START) then
self.data_inicio = _date ("%H:%M:%S")
elseif (tipo == _detalhes._detalhes_props.DATA_TYPE_END) then
self.data_fim = _date ("%H:%M:%S")
end
end
function combate:seta_tempo_decorrido()
self.end_time = _tempo
end
function _detalhes.refresh:r_combate (tabela_combate, shadow)
_setmetatable (tabela_combate, _detalhes.combate)
tabela_combate.__index = _detalhes.combate
tabela_combate.shadow = shadow
end
function _detalhes.clear:c_combate (tabela_combate)
--tabela_combate.__index = {}
tabela_combate.__index = nil
tabela_combate.__call = {}
tabela_combate._combat_table = nil
tabela_combate.shadow = nil
end
combate.__sub = function (combate1, combate2)
if (combate1 ~= _detalhes.tabela_overall) then
return
end
--> sub dano
for index, actor_T2 in _ipairs (combate2[1]._ActorTable) do
local actor_T1 = combate1[1]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [1].need_refresh = true
--> sub heal
for index, actor_T2 in _ipairs (combate2[2]._ActorTable) do
local actor_T1 = combate1[2]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [2].need_refresh = true
--> sub energy
for index, actor_T2 in _ipairs (combate2[3]._ActorTable) do
local actor_T1 = combate1[3]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [3].need_refresh = true
--> sub misc
for index, actor_T2 in _ipairs (combate2[4]._ActorTable) do
local actor_T1 = combate1[4]:PegarCombatente (actor_T2.serial, actor_T2.nome, actor_T2.flag_original, true)
actor_T1 = actor_T1 - actor_T2
actor_T2:subtract_total (combate1)
end
combate1 [4].need_refresh = true
--> reduz o tempo
combate1.start_time = combate1.start_time + (combate2.end_time - combate2.start_time)
--> apaga as mortes da luta diminuida
local amt_mortes = #combate2.last_events_tables --> quantas mortes teve nessa luta
if (amt_mortes > 0) then
for i = #combate1.last_events_tables, #combate1.last_events_tables-amt_mortes, -1 do
_table_remove (combate1.last_events_tables, #combate1.last_events_tables)
end
end
--> frags
for fragName, fragAmount in pairs (combate2.frags) do
if (fragAmount) then
if (combate1.frags [fragName]) then
combate1.frags [fragName] = combate1.frags [fragName] - fragAmount
else
combate1.frags [fragName] = fragAmount
end
end
end
combate1.frags_need_refresh = true
return combate1
end
combate.__add = function (combate1, combate2)
local all_containers = {combate2 [class_type_dano]._ActorTable, combate2 [class_type_cura]._ActorTable, combate2 [class_type_e_energy]._ActorTable, combate2 [class_type_misc]._ActorTable}
for class_type, actor_container in ipairs (all_containers) do
for _, actor in ipairs (actor_container) do
local shadow
if (class_type == class_type_dano) then
shadow = _detalhes.atributo_damage:r_connect_shadow (actor, true)
elseif (class_type == class_type_cura) then
shadow = _detalhes.atributo_heal:r_connect_shadow (actor, true)
elseif (class_type == class_type_e_energy) then
shadow = _detalhes.atributo_energy:r_connect_shadow (actor, true)
elseif (class_type == class_type_misc) then
shadow = _detalhes.atributo_misc:r_connect_shadow (actor, true)
end
shadow.boss_fight_component = actor.boss_fight_component
shadow.fight_component = actor.fight_component
shadow.grupo = actor.grupo
end
end
return combate1
end
function _detalhes:UpdateCombat()
_tempo = _detalhes._tempo
end
+429 -429
View File
@@ -1,132 +1,73 @@
--why do a cleanup on classes today if i can do tomorrow?
-- damage object
--lua locals
local _cstr = string.format
local _math_floor = math.floor
local _table_sort = table.sort
local _table_insert = table.insert
local _table_size = table.getn
local _setmetatable = setmetatable
local _getmetatable = getmetatable
local _ipairs = ipairs
local _pairs = pairs
local _rawget= rawget
local _math_min = math.min
local _math_max = math.max
local _bit_band = bit.band
local _unpack = unpack
local _type = type
--api locals
local _GetSpellInfo = _detalhes.getspellinfo
local GameTooltip = GameTooltip
local _IsInRaid = IsInRaid
local _IsInGroup = IsInGroup
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local gump = _detalhes.gump
local _
local _detalhes = _G._detalhes
local AceLocale = LibStub ("AceLocale-3.0")
local Loc = AceLocale:GetLocale ( "Details" )
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--constants
local gump = _detalhes.gump
local _
local _cstr = string.format --lua local
local _math_floor = math.floor --lua local
local _table_sort = table.sort --lua local
local _table_insert = table.insert --lua local
local _table_size = table.getn --lua local
local _setmetatable = setmetatable --lua local
local _getmetatable = getmetatable --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
local _rawget= rawget --lua local
local _math_min = math.min --lua local
local _math_max = math.max --lua local
local _bit_band = bit.band --lua local
local _unpack = unpack --lua local
local _type = type --lua local
local GameTooltip = GameTooltip --api local
local _IsInRaid = IsInRaid --api local
local _IsInGroup = IsInGroup --api local
local _GetSpellInfo = _detalhes.getspellinfo --details api
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local container_habilidades = _detalhes.container_habilidades
local container_combatentes = _detalhes.container_combatentes
local container_pets = _detalhes.container_pets
local atributo_damage = _detalhes.atributo_damage
local atributo_misc = _detalhes.atributo_misc
local habilidade_dano = _detalhes.habilidade_dano
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local container_habilidades = _detalhes.container_habilidades
local container_combatentes = _detalhes.container_combatentes
local atributo_damage = _detalhes.atributo_damage
local atributo_misc = _detalhes.atributo_misc
local habilidade_dano = _detalhes.habilidade_dano
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local modo_ALONE = _detalhes.modos.alone
local modo_GROUP = _detalhes.modos.group
local modo_ALL = _detalhes.modos.all
local modo_GROUP = _detalhes.modos.group
local modo_ALL = _detalhes.modos.all
local class_type = _detalhes.atributos.dano
local class_type = _detalhes.atributos.dano
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local UsingCustomRightText = false
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
local key_overlay = {1, 1, 1, .1}
local key_overlay_press = {1, 1, 1, .2}
local headerColor = "yellow"
local ToKFunctions = _detalhes.ToKFunctions
local SelectedToKFunction = ToKFunctions [1]
local UsingCustomRightText = false
local info = _detalhes.janela_info
local keyName
local FormatTooltipNumber = ToKFunctions [8]
local TooltipMaximizedMethod = 1
local CLASS_ICON_TCOORDS = _G.CLASS_ICON_TCOORDS
local key_overlay = {1, 1, 1, .1}
local key_overlay_press = {1, 1, 1, .2}
local headerColor = "yellow"
local info = _detalhes.janela_info
local keyName
function atributo_damage:NovaTabela (serial, nome, link)
--> constructor
local _new_damageActor = {
--> dps do objeto inicia sempre desligado
tipo = class_type, --> atributo 1 = dano
total = 0,
total_without_pet = 0,
custom = 0,
damage_taken = 0, --> total de dano que este jogador levou
damage_from = {}, --> armazena os nomes que deram dano neste jogador
dps_started = false,
last_event = 0,
on_hold = false,
delay = 0,
last_value = nil, --> ultimo valor que este jogador teve, salvo quando a barra dele é atualizada
last_dps = 0,
end_time = nil,
start_time = 0,
pets = {}, --> armazena os nomes dos pets já com a tag do dono: pet name <owner nome>
friendlyfire_total = 0,
friendlyfire = container_combatentes:NovoContainer (container_friendlyfire),
--container armazenará os seriais dos alvos que o player aplicou dano
targets = container_combatentes:NovoContainer (container_damage_target),
--container armazenará os IDs das habilidades usadas por este jogador
spell_tables = container_habilidades:NovoContainer (container_damage)
}
local OBJECT_TYPE_PLAYER = 0x00000400
_setmetatable (_new_damageActor, atributo_damage)
if (link) then --> se não for a shadow
_new_damageActor.last_events_table = _detalhes:CreateActorLastEventTable()
_new_damageActor.last_events_table.original = true
_new_damageActor.targets.shadow = link.targets
_new_damageActor.spell_tables.shadow = link.spell_tables
_new_damageActor.friendlyfire.shadow = link.friendlyfire
end
return _new_damageActor
end
local ntable = {} --temp
local vtable = {} --temp
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> exported functions
--[[exported]] function _detalhes:CreateActorLastEventTable()
local t = { {}, {}, {}, {}, {}, {}, {}, {} }
@@ -187,29 +128,14 @@ end
end
--[[ exported]] function _detalhes:IsPlayer()
if (self.flags) then
if (_bit_band (self.flag, 0x00000001) ~= 0) then
if (self.flag_original) then
if (_bit_band (self.flag_original, OBJECT_TYPE_PLAYER) ~= 0) then
return true
end
end
return false
end
local sortEnemies = function (t1, t2)
local a = _bit_band (t1.flag_original, 0x00000060)
local b = _bit_band (t2.flag_original, 0x00000060)
if (a ~= 0 and b ~= 0) then
return t1.total > t2.total
elseif (a ~= 0 and b == 0) then
return true
elseif (a == 0 and b ~= 0) then
return false
end
return false
end
--[[exported]] function _detalhes:ContainerSortEnemies (container, amount, keyName2)
keyName = keyName2
@@ -230,338 +156,428 @@ end
return amount, total
end
function atributo_damage:ContainerRefreshDps (container, combat_time)
--[[Exported]] function _detalhes:TooltipForCustom (barra)
GameCooltip:AddLine (Loc ["STRING_LEFT_CLICK_SHARE"])
return true
end
if (_detalhes.time_type == 2 or not _detalhes:CaptureGet ("damage")) then
for _, actor in _ipairs (container) do
if (actor.grupo) then
actor.last_dps = actor.total / combat_time
else
--[[exported]] function _detalhes.Sort1 (table1, table2)
return table1 [1] > table2 [1]
end
--[[exported]] function _detalhes.Sort2 (table1, table2)
return table1 [2] > table2 [2]
end
--[[exported]] function _detalhes.Sort3 (table1, table2)
return table1 [3] > table2 [3]
end
--[[exported]] function _detalhes.Sort4 (table1, table2)
return table1 [4] > table2 [4]
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function atributo_damage:NovaTabela (serial, nome, link)
--> constructor
local _new_damageActor = {
tipo = class_type,
total = 0,
total_without_pet = 0,
custom = 0,
damage_taken = 0,
damage_from = {},
dps_started = false,
last_event = 0,
on_hold = false,
delay = 0,
last_value = nil,
last_dps = 0,
end_time = nil,
start_time = 0,
pets = {},
friendlyfire_total = 0,
friendlyfire = container_combatentes:NovoContainer (container_friendlyfire),
targets = container_combatentes:NovoContainer (container_damage_target),
spell_tables = container_habilidades:NovoContainer (container_damage)
}
_setmetatable (_new_damageActor, atributo_damage)
if (link) then
_new_damageActor.last_events_table = _detalhes:CreateActorLastEventTable()
_new_damageActor.last_events_table.original = true
_new_damageActor.targets.shadow = link.targets
_new_damageActor.spell_tables.shadow = link.spell_tables
_new_damageActor.friendlyfire.shadow = link.friendlyfire
end
return _new_damageActor
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> special cases
-- enemies (sort function)
local sortEnemies = function (t1, t2)
local a = _bit_band (t1.flag_original, 0x00000060)
local b = _bit_band (t2.flag_original, 0x00000060)
if (a ~= 0 and b ~= 0) then
return t1.total > t2.total
elseif (a ~= 0 and b == 0) then
return true
elseif (a == 0 and b ~= 0) then
return false
end
return false
end
-- dps (calculate dps for actors)
function atributo_damage:ContainerRefreshDps (container, combat_time)
if (_detalhes.time_type == 2 or not _detalhes:CaptureGet ("damage")) then
for _, actor in _ipairs (container) do
if (actor.grupo) then
actor.last_dps = actor.total / combat_time
else
actor.last_dps = actor.total / actor:Tempo()
end
end
else
for _, actor in _ipairs (container) do
actor.last_dps = actor.total / actor:Tempo()
end
end
else
for _, actor in _ipairs (container) do
actor.last_dps = actor.total / actor:Tempo()
end
end
end
function _detalhes:ToolTipFrags (instancia, frag, esta_barra, keydown)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> frags
--vardump (frag)
local name = frag [1]
local GameCooltip = GameCooltip
--> mantendo a função o mais low level possível
local damage_container = instancia.showing [1]
local frag_actor = damage_container._ActorTable [damage_container._NameIndexTable [ name ]]
function _detalhes:ToolTipFrags (instancia, frag, esta_barra, keydown)
if (frag_actor) then
local name = frag [1]
local GameCooltip = GameCooltip
local damage_taken_table = {}
local took_damage_from = frag_actor.damage_from
local total_damage_taken = frag_actor.damage_taken
for aggressor, _ in _pairs (took_damage_from) do
--> mantendo a função o mais low level possível
local damage_container = instancia.showing [1]
local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]]
local frag_actor = damage_container._ActorTable [damage_container._NameIndexTable [ name ]]
if (frag_actor) then
if (damager_actor and not damager_actor.owner) then --> checagem por causa do total e do garbage collector que não limpa os names que deram dano
local damage_taken_table = {}
local took_damage_from = frag_actor.damage_from
local total_damage_taken = frag_actor.damage_taken
for aggressor, _ in _pairs (took_damage_from) do
local targets = damager_actor.targets
local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]]
local specific_target = targets._ActorTable [targets._NameIndexTable [ name ]] --> é ele mesmo
if (specific_target) then
damage_taken_table [#damage_taken_table+1] = {aggressor, specific_target.total, damager_actor.classe}
if (damager_actor and not damager_actor.owner) then --> checagem por causa do total e do garbage collector que não limpa os names que deram dano
local targets = damager_actor.targets
local specific_target = targets._ActorTable [targets._NameIndexTable [ name ]] --> é ele mesmo
if (specific_target) then
damage_taken_table [#damage_taken_table+1] = {aggressor, specific_target.total, damager_actor.classe}
end
end
end
end
if (#damage_taken_table > 0) then
if (#damage_taken_table > 0) then
_table_sort (damage_taken_table, _detalhes.Sort2)
GameCooltip:AddLine (Loc ["STRING_DAMAGE_FROM"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
_table_sort (damage_taken_table, _detalhes.Sort2)
GameCooltip:AddLine (Loc ["STRING_DAMAGE_FROM"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
local min = 6
local ismaximized = false
if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then
min = 99
ismaximized = true
end
if (ismaximized) then
--highlight shift key
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay_press)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, 1)
else
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3)
end
for i = 1, math.min (min, #damage_taken_table) do
local t = damage_taken_table [i]
GameCooltip:AddLine (t [1], FormatTooltipNumber (_, t [2]))
local classe = t [3]
if (not classe) then
classe = "UNKNOW"
local min = 6
local ismaximized = false
if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then
min = 99
ismaximized = true
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
if (ismaximized) then
--highlight shift key
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay_press)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, 1)
else
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe]))
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, 24, 12, 0, 1, 0, 0.640625, key_overlay)
GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3)
end
_detalhes:AddTooltipBackgroundStatusbar()
for i = 1, math.min (min, #damage_taken_table) do
local t = damage_taken_table [i]
GameCooltip:AddLine (t [1], FormatTooltipNumber (_, t [2]))
local classe = t [3]
if (not classe) then
classe = "UNKNOW"
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
else
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe]))
end
_detalhes:AddTooltipBackgroundStatusbar()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
else
GameCooltip:AddLine (Loc ["STRING_NO_DATA"], nil, 1, "white")
GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"]))
GameCooltip:ShowCooltip()
end
end
local function RefreshBarraFrags (tabela, barra, instancia)
atributo_damage:AtualizarFrags (tabela, tabela.minha_barra, barra.colocacao, instancia)
end
local function RefreshBarraFrags (tabela, barra, instancia)
atributo_damage:AtualizarFrags (tabela, tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_damage:ReportSingleFragsLine (frag, instancia)
local barra = instancia.barras [frag.minha_barra]
function atributo_damage:ReportSingleFragsLine (frag, instancia)
local barra = instancia.barras [frag.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"].. ": " .. frag [1]} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"].. ": " .. frag [1]} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
end
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instancia)
function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instancia)
tabela ["frags"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = tabela
tabela.nome = tabela [1] --> evita dar erro ao redimencionar a janela
tabela.minha_barra = qual_barra
esta_barra.colocacao = colocacao
if (not _getmetatable (tabela)) then
_setmetatable (tabela, {__call = RefreshBarraFrags})
tabela._custom = true
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. tabela [1])
esta_barra.texto_direita:SetText (tabela [2])
if (colocacao == 1) then
esta_barra.statusbar:SetValue (100)
else
esta_barra.statusbar:SetValue (tabela [2] / instancia.top * 100)
end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
--> ele nao come o texto quando a instância esta muito pequena
esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [tabela [3]]))
if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then
esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\LFGROLE_BW")
esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (_detalhes.class_coords [tabela [3]]))
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
function atributo_damage:ReportSingleVoidZoneLine (actor, instancia)
local barra = instancia.barras [actor.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. ": " .. actor.nome} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
tabela ["frags"] = true --> marca que esta tabela é uma tabela de frags, usado no controla na hora de montar o tooltip
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = tabela
tabela.nome = tabela [1] --> evita dar erro ao redimencionar a janela
tabela.minha_barra = qual_barra
esta_barra.colocacao = colocacao
if (not _getmetatable (tabela)) then
_setmetatable (tabela, {__call = RefreshBarraFrags})
tabela._custom = true
end
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. tabela [1])
esta_barra.texto_direita:SetText (tabela [2])
if (colocacao == 1) then
esta_barra.statusbar:SetValue (100)
else
esta_barra.statusbar:SetValue (tabela [2] / instancia.top * 100)
end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
--> ele nao come o texto quando a instância esta muito pequena
esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [tabela [3]]))
if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then
esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\LFGROLE_BW")
esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (_detalhes.class_coords [tabela [3]]))
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> void zones
function atributo_damage:ReportSingleVoidZoneLine (actor, instancia)
local barra = instancia.barras [actor.minha_barra]
local reportar = {"Details! " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. ": " .. actor.nome} --> localize-me
for i = 1, GameCooltip:GetNumLines() do
local texto_left, texto_right = GameCooltip:GetText (i)
if (texto_left and texto_right) then
texto_left = texto_left:gsub (("|T(.*)|t "), "")
reportar [#reportar+1] = ""..texto_left.." "..texto_right..""
end
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
return _detalhes:Reportar (reportar, {_no_current = true, _no_inverse = true, _custom = true})
end
function _detalhes:ToolTipVoidZones (instancia, actor, barra, keydown)
local damage_actor = instancia.showing[1]:PegarCombatente (_, actor.damage_twin)
local habilidade
local alvos
if (damage_actor) then
habilidade = damage_actor.spell_tables._ActorTable [actor.damage_spellid]
end
if (habilidade) then
alvos = habilidade.targets
end
local container = actor.debuff_uptime_targets._ActorTable
for _, alvo in _ipairs (container) do
if (alvos) then
local damage_alvo = alvos._NameIndexTable [alvo.nome]
if (damage_alvo) then
damage_alvo = alvos._ActorTable [damage_alvo]
alvo.damage = damage_alvo.total
function _detalhes:ToolTipVoidZones (instancia, actor, barra, keydown)
local damage_actor = instancia.showing[1]:PegarCombatente (_, actor.damage_twin)
local habilidade
local alvos
if (damage_actor) then
habilidade = damage_actor.spell_tables._ActorTable [actor.damage_spellid]
end
if (habilidade) then
alvos = habilidade.targets
end
local container = actor.debuff_uptime_targets._ActorTable
for _, alvo in _ipairs (container) do
if (alvos) then
local damage_alvo = alvos._NameIndexTable [alvo.nome]
if (damage_alvo) then
damage_alvo = alvos._ActorTable [damage_alvo]
alvo.damage = damage_alvo.total
else
alvo.damage = 0
end
else
alvo.damage = 0
end
else
alvo.damage = 0
end
end
--> sort no container:
_table_sort (container, function (tabela1, tabela2)
if (tabela1.damage > tabela2.damage) then
return true;
elseif (tabela1.damage == tabela2.damage) then
return tabela1.uptime > tabela2.uptime;
end
return false;
end)
actor.debuff_uptime_targets:remapear()
--> monta o cooltip
local GameCooltip = GameCooltip
GameCooltip:AddLine (Loc ["STRING_VOIDZONE_TOOLTIP"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
for _, alvo in _ipairs (container) do
--> sort no container:
_table_sort (container, function (tabela1, tabela2)
if (tabela1.damage > tabela2.damage) then
return true;
elseif (tabela1.damage == tabela2.damage) then
return tabela1.uptime > tabela2.uptime;
end
return false;
end)
actor.debuff_uptime_targets:remapear()
--> monta o cooltip
local GameCooltip = GameCooltip
GameCooltip:AddLine (Loc ["STRING_VOIDZONE_TOOLTIP"], nil, nil, headerColor, nil, 12)
GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875)
for _, alvo in _ipairs (container) do
local minutos, segundos = _math_floor (alvo.uptime / 60), _math_floor (alvo.uptime % 60)
if (minutos > 0) then
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. minutos .. "m " .. segundos .. "s" .. ")")
else
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. segundos .. "s" .. ")")
local minutos, segundos = _math_floor (alvo.uptime / 60), _math_floor (alvo.uptime % 60)
if (minutos > 0) then
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. minutos .. "m " .. segundos .. "s" .. ")")
else
GameCooltip:AddLine (alvo.nome, FormatTooltipNumber (_, alvo.damage) .. " (" .. segundos .. "s" .. ")")
end
local classe = _detalhes:GetClass (alvo.nome)
if (classe) then
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe]))
else
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
end
_detalhes:AddTooltipBackgroundStatusbar()
end
local classe = _detalhes:GetClass (alvo.nome)
if (classe) then
GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, nil, 14, 14, unpack (_detalhes.class_coords [classe]))
else
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
end
local function RefreshBarraVoidZone (tabela, barra, instancia)
tabela:AtualizarVoidZone (tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_misc:AtualizarVoidZone (qual_barra, colocacao, instancia)
--> pega a referência da barra na janela
local esta_barra = instancia.barras [qual_barra]
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
_detalhes:AddTooltipBackgroundStatusbar()
end
GameCooltip:AddLine ("")
GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, _unpack (self.click_to_report_color))
GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625)
GameCooltip:ShowCooltip()
end
local function RefreshBarraVoidZone (tabela, barra, instancia)
tabela:AtualizarVoidZone (tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_misc:AtualizarVoidZone (qual_barra, colocacao, instancia)
local esta_barra = instancia.barras [qual_barra] --> pega a referência da barra na janela
if (not esta_barra) then
print ("DEBUG: problema com <instancia.esta_barra> "..qual_barra.." "..lugar)
return
end
self._refresh_window = RefreshBarraVoidZone
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = self
self.minha_barra = qual_barra
esta_barra.colocacao = colocacao
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome)
esta_barra.texto_direita:SetText (self.debuff_uptime)
--if (colocacao == 1) then
self._refresh_window = RefreshBarraVoidZone
local tabela_anterior = esta_barra.minha_tabela
esta_barra.minha_tabela = self
self.minha_barra = qual_barra
esta_barra.colocacao = colocacao
esta_barra.texto_esquerdo:SetText (colocacao .. ". " .. self.nome)
esta_barra.texto_direita:SetText (self.debuff_uptime)
esta_barra.statusbar:SetValue (100)
--else
-- esta_barra.statusbar:SetValue (self.debuff_uptime / instancia.top * 100)
--end
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
local _, _, icon = GetSpellInfo (self.damage_spellid)
local school_color = _detalhes.school_colors [self.spellschool]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
esta_barra.textura:SetVertexColor (_unpack (school_color))
esta_barra.icone_classe:SetTexture (icon)
esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then
gump:Fade (esta_barra, "out")
end
local _, _, icon = GetSpellInfo (self.damage_spellid)
local school_color = _detalhes.school_colors [self.spellschool]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
esta_barra.textura:SetVertexColor (_unpack (school_color))
esta_barra.icone_classe:SetTexture (icon)
esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1)
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then
--need call a refresh function
end
if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip
--gump:UpdateTooltip (qual_barra, esta_barra, instancia)
end
end
local ntable = {}
local vtable = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> main refresh function
function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, exportar, refresh_needed)
@@ -849,7 +865,6 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex
if (not using_cache) then
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
@@ -1401,11 +1416,7 @@ end
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
--[[Exported]] function _detalhes:TooltipForCustom (barra)
--GameCooltip:AddLine (barra.colocacao..". "..self.nome)
GameCooltip:AddLine (Loc ["STRING_LEFT_CLICK_SHARE"])
return true
end
---------> TOOLTIPS BIFURCAÇÃO
@@ -1428,18 +1439,7 @@ end
local r, g, b
local barAlha = .6
--[[exported]] function _detalhes.Sort1 (table1, table2)
return table1 [1] > table2 [1]
end
--[[exported]] function _detalhes.Sort2 (table1, table2)
return table1 [2] > table2 [2]
end
--[[exported]] function _detalhes.Sort3 (table1, table2)
return table1 [3] > table2 [3]
end
--[[exported]] function _detalhes.Sort4 (table1, table2)
return table1 [4] > table2 [4]
end
---------> DAMAGE DONE & DPS
+217 -243
View File
@@ -1,131 +1,123 @@
--[[ classe do dano aplicado, usado nos eventos:
- SPELL_PERIODIC_DAMAGE
- SPELL_DAMAGE
- SWING_DAMAGE
- RANGE_DAMAGE
-- damage ability file
Parents:
addon -> combate atual -> Npc/Player Swicth -> Container de Habilidades -> esta tabela
]]
local _detalhes = _G._detalhes
local _
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local _setmetatable = setmetatable--lua local
local _ipairs = ipairs--lua local
local _pairs = pairs--lua local
local _UnitAura = UnitAura--api local
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_dano = _detalhes.habilidade_dano
local container_combatentes = _detalhes.container_combatentes
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
--lua locals
local _setmetatable = setmetatable
local _ipairs = ipairs
local _pairs = pairs
local _
--api locals
local _UnitAura = UnitAura
--local _GetSpellInfo = _detalhes.getspellinfo
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_dano = _detalhes.habilidade_dano
local container_combatentes = _detalhes.container_combatentes
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _recording_ability_with_buffs = false
local _recording_ability_with_buffs = false
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
--id, nome, type, miss, dano, cura, overkill, school, resisted, blocked, absorbed, critico, glacing, crushing
function habilidade_dano:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
function habilidade_dano:NovaTabela (id, link, token)
local _newDamageSpell = {
total = 0, --total de dano aplicado por esta habilidade
counter = 0, --conta quantas vezes a habilidade foi chamada
id = id,
successful_casted = 0,
local _newDamageSpell = {
--> normal
n_min = 0,
n_max = 0,
n_amt = 0,
n_dmg = 0,
total = 0, --total damage
counter = 0, --counter
id = id, --spellid
successful_casted = 0, --successful casted times (only for enemies)
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_dmg = 0,
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_dmg = 0,
--> glacing hits
g_amt = 0,
g_dmg = 0,
--> resisted
r_amt = 0,
r_dmg = 0,
--> blocked
b_amt = 0,
b_dmg = 0,
--> obsorved
a_amt = 0,
a_dmg = 0,
targets = container_combatentes:NovoContainer (container_damage_target)
}
--> criticos
c_min = 0,
c_max = 0,
c_amt = 0,
c_dmg = 0,
--> glacing
g_amt = 0,
g_dmg = 0,
_setmetatable (_newDamageSpell, habilidade_dano)
--> resisted
r_amt = 0,
r_dmg = 0,
if (link) then
_newDamageSpell.targets.shadow = link.targets
end
--> blocked
b_amt = 0,
b_dmg = 0,
--> obsorved
a_amt = 0,
a_dmg = 0,
if (token == "SPELL_PERIODIC_DAMAGE") then
_detalhes:SpellIsDot (id)
end
targets = container_combatentes:NovoContainer (container_damage_target)
}
_setmetatable (_newDamageSpell, habilidade_dano)
if (link) then
_newDamageSpell.targets.shadow = link.targets
end
if (token == "SPELL_PERIODIC_DAMAGE") then
_detalhes:SpellIsDot (id)
end
return _newDamageSpell
end
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
self.counter = self.counter + 1
local miss = self [missType] or 0
miss = miss + 1
self [missType] = miss
local alvo = self.targets:PegarCombatente (serial, nome, flags, true)
return alvo:AddQuantidade (0)
end
function habilidade_dano:AddFF (amount)
self.counter = self.counter + 1
self.total = self.total + amount
end
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
return _newDamageSpell
end
if (resisted and resisted > 0) then
self.r_dmg = self.r_dmg+amount --> tabela.total é o total de dano
self.r_amt = self.r_amt+1 --> tabela.total é o total de dano
function habilidade_dano:AddMiss (serial, nome, flags, who_nome, missType)
self.counter = self.counter + 1
local miss = self [missType] or 0
miss = miss + 1
self [missType] = miss
self.targets:PegarCombatente (serial, nome, flags, true) --apenas criar o alvo para a abilidade
end
if (blocked and blocked > 0) then
self.b_dmg = self.b_dmg+amount --> amount é o total de dano
self.b_amt = self.b_amt+1 --> amount é o total de dano
function habilidade_dano:AddFF (amount)
self.counter = self.counter + 1
self.total = self.total + amount
end
if (absorbed and absorbed > 0) then
self.a_dmg = self.a_dmg+amount --> amount é o total de dano
self.a_amt = self.a_amt+1 --> amount é o total de dano
end
function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
if (resisted and resisted > 0) then
self.r_dmg = self.r_dmg+amount --> tabela.total é o total de dano
self.r_amt = self.r_amt+1 --> tabela.total é o total de dano
end
if (blocked and blocked > 0) then
self.b_dmg = self.b_dmg+amount --> amount é o total de dano
self.b_amt = self.b_amt+1 --> amount é o total de dano
end
if (absorbed and absorbed > 0) then
self.a_dmg = self.a_dmg+amount --> amount é o total de dano
self.a_amt = self.a_amt+1 --> amount é o total de dano
end
self.total = self.total + amount
alvo.total = alvo.total + amount
@@ -152,157 +144,139 @@ function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, bl
self.n_min = amount
end
end
--end
if (_recording_ability_with_buffs) then
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
if (_recording_ability_with_buffs) then
if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada
local SpellBuffDetails = self.BuffTable
if (not SpellBuffDetails) then
self.BuffTable = {}
SpellBuffDetails = self.BuffTable
end
if (token == "SPELL_PERIODIC_DAMAGE") then
--> precisa ver se ele tinha na hora que aplicou
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
if (SoloDebuffPower) then
local ThisDebuff = SoloDebuffPower [self.id]
if (ThisDebuff) then
local ThisDebuffOnTarget = ThisDebuff [serial]
if (ThisDebuffOnTarget) then
for index, buff_name in _ipairs (ThisDebuffOnTarget.buffs) do
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
buff_info.counter = buff_info.counter+1
buff_info.total = buff_info.total+amount
if (critical ~= nil) then
buff_info.critico = buff_info.critico+1
buff_info.critico_dano = buff_info.critico_dano+amount
local buffsNames = _detalhes.SoloTables.BuffsTableNameCache
local SpellBuffDetails = self.BuffTable
if (not SpellBuffDetails) then
self.BuffTable = {}
SpellBuffDetails = self.BuffTable
end
if (token == "SPELL_PERIODIC_DAMAGE") then
--> precisa ver se ele tinha na hora que aplicou
local SoloDebuffPower = _detalhes.tabela_vigente.SoloDebuffPower
if (SoloDebuffPower) then
local ThisDebuff = SoloDebuffPower [self.id]
if (ThisDebuff) then
local ThisDebuffOnTarget = ThisDebuff [serial]
if (ThisDebuffOnTarget) then
for index, buff_name in _ipairs (ThisDebuffOnTarget.buffs) do
local buff_info = SpellBuffDetails [buff_name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
buff_info.counter = buff_info.counter+1
buff_info.total = buff_info.total+amount
if (critical ~= nil) then
buff_info.critico = buff_info.critico+1
buff_info.critico_dano = buff_info.critico_dano+amount
end
SpellBuffDetails [buff_name] = buff_info
end
SpellBuffDetails [buff_name] = buff_info
end
end
end
end
else
else
for BuffName, _ in _pairs (_detalhes.Buffs.BuffsTable) do
local name = _UnitAura ("player", BuffName)
if (name ~= nil) then
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
buff_info.counter = buff_info.counter+1
buff_info.total = buff_info.total+amount
if (critical ~= nil) then
buff_info.critico = buff_info.critico+1
buff_info.critico_dano = buff_info.critico_dano+amount
for BuffName, _ in _pairs (_detalhes.Buffs.BuffsTable) do
local name = _UnitAura ("player", BuffName)
if (name ~= nil) then
local buff_info = SpellBuffDetails [name] or {["counter"] = 0, ["total"] = 0, ["critico"] = 0, ["critico_dano"] = 0}
buff_info.counter = buff_info.counter+1
buff_info.total = buff_info.total+amount
if (critical ~= nil) then
buff_info.critico = buff_info.critico+1
buff_info.critico_dano = buff_info.critico_dano+amount
end
SpellBuffDetails [name] = buff_info
end
SpellBuffDetails [name] = buff_info
end
end
end
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_dano)
habilidade.__index = habilidade_dano
habilidade.shadow = shadow._ActorTable [habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
end
function _detalhes.refresh:r_habilidade_dano (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_dano)
habilidade.__index = habilidade_dano
habilidade.shadow = shadow._ActorTable [habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
end
function _detalhes.clear:c_habilidade_dano (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_dano (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_dano.__add = function (tabela1, tabela2)
tabela1.total = tabela1.total + tabela2.total
tabela1.counter = tabela1.counter + tabela2.counter
tabela1.successful_casted = tabela1.successful_casted + tabela2.successful_casted
tabela1.n_min = tabela1.n_min + tabela2.n_min
tabela1.n_max = tabela1.n_max + tabela2.n_max
tabela1.n_amt = tabela1.n_amt + tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg + tabela2.n_dmg
habilidade_dano.__add = function (tabela1, tabela2)
tabela1.total = tabela1.total + tabela2.total
tabela1.counter = tabela1.counter + tabela2.counter
tabela1.successful_casted = tabela1.successful_casted + tabela2.successful_casted
tabela1.n_min = tabela1.n_min + tabela2.n_min
tabela1.n_max = tabela1.n_max + tabela2.n_max
tabela1.n_amt = tabela1.n_amt + tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg + tabela2.n_dmg
tabela1.c_min = tabela1.c_min + tabela2.c_min
tabela1.c_max = tabela1.c_max + tabela2.c_max
tabela1.c_amt = tabela1.c_amt + tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg + tabela2.c_dmg
--tabela1.g_min = tabela1.g_min + tabela2.g_min
--tabela1.g_max = tabela1.g_max + tabela2.g_max
tabela1.g_amt = tabela1.g_amt + tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg + tabela2.g_dmg
--tabela1.r_min = tabela1.r_min + tabela2.r_min
--tabela1.r_max = tabela1.r_max + tabela2.r_max
tabela1.r_amt = tabela1.r_amt + tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg + tabela2.r_dmg
--tabela1.b_min = tabela1.b_min + tabela2.b_min
--tabela1.b_max = tabela1.b_max + tabela2.b_max
tabela1.b_amt = tabela1.b_amt + tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg + tabela2.b_dmg
--tabela1.a_min = tabela1.a_min + tabela2.a_min
--tabela1.a_max = tabela1.a_max + tabela2.a_max
tabela1.a_amt = tabela1.a_amt + tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg + tabela2.a_dmg
--tabela1.crushing = tabela1.crushing + tabela2.crushing
return tabela1
end
tabela1.c_min = tabela1.c_min + tabela2.c_min
tabela1.c_max = tabela1.c_max + tabela2.c_max
tabela1.c_amt = tabela1.c_amt + tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg + tabela2.c_dmg
tabela1.g_amt = tabela1.g_amt + tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg + tabela2.g_dmg
tabela1.r_amt = tabela1.r_amt + tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg + tabela2.r_dmg
tabela1.b_amt = tabela1.b_amt + tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg + tabela2.b_dmg
tabela1.a_amt = tabela1.a_amt + tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg + tabela2.a_dmg
return tabela1
end
habilidade_dano.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.successful_casted = tabela1.successful_casted - tabela2.successful_casted
habilidade_dano.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.successful_casted = tabela1.successful_casted - tabela2.successful_casted
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg - tabela2.n_dmg
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_dmg = tabela1.n_dmg - tabela2.n_dmg
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg - tabela2.c_dmg
--tabela1.g_min = tabela1.g_min - tabela2.g_min
--tabela1.g_max = tabela1.g_max - tabela2.g_max
tabela1.g_amt = tabela1.g_amt - tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg - tabela2.g_dmg
--tabela1.r_min = tabela1.r_min - tabela2.r_min
--tabela1.r_max = tabela1.r_max - tabela2.r_max
tabela1.r_amt = tabela1.r_amt - tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg - tabela2.r_dmg
--tabela1.b_min = tabela1.b_min - tabela2.b_min
--tabela1.b_max = tabela1.b_max - tabela2.b_max
tabela1.b_amt = tabela1.b_amt - tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg - tabela2.b_dmg
--tabela1.a_min = tabela1.a_min - tabela2.a_min
--tabela1.a_max = tabela1.a_max - tabela2.a_max
tabela1.a_amt = tabela1.a_amt - tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg - tabela2.a_dmg
--tabela1.crushing = tabela1.crushing - tabela2.crushing
return tabela1
end
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_dmg = tabela1.c_dmg - tabela2.c_dmg
tabela1.g_amt = tabela1.g_amt - tabela2.g_amt
tabela1.g_dmg = tabela1.g_dmg - tabela2.g_dmg
tabela1.r_amt = tabela1.r_amt - tabela2.r_amt
tabela1.r_dmg = tabela1.r_dmg - tabela2.r_dmg
tabela1.b_amt = tabela1.b_amt - tabela2.b_amt
tabela1.b_dmg = tabela1.b_dmg - tabela2.b_dmg
tabela1.a_amt = tabela1.a_amt - tabela2.a_amt
tabela1.a_dmg = tabela1.a_dmg - tabela2.a_dmg
return tabela1
end
function _detalhes:UpdateDamageAbilityGears()
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
end
function _detalhes:UpdateDamageAbilityGears()
_recording_ability_with_buffs = _detalhes.RecordPlayerAbilityWithBuffs
end
-5
View File
@@ -53,10 +53,6 @@ local class_type = _detalhes.atributos.e_energy
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -253,7 +249,6 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
end)
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+94 -84
View File
@@ -1,102 +1,112 @@
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-- energy ability file
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_energy = _detalhes.habilidade_e_energy
local container_combatentes = _detalhes.container_combatentes
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local _detalhes = _G._detalhes
local _
--lua locals
local _setmetatable = setmetatable
local _ipairs = ipairs
--api locals
local _UnitAura = UnitAura
local _
--local _GetSpellInfo = _detalhes.getspellinfo
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _UnitAura = UnitAura --api local
function habilidade_energy:NovaTabela (id, link, token)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local _newEnergySpell = {
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_energy = _detalhes.habilidade_e_energy
local container_combatentes = _detalhes.container_combatentes
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
id = id,
counter = 0,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function habilidade_energy:NovaTabela (id, link, token)
local _newEnergySpell = {
id = id,
counter = 0,
mana = 0,
e_rage = 0,
e_energy = 0,
runepower = 0,
targets = container_combatentes:NovoContainer (container_energy_target)
}
mana = 0,
e_rage = 0,
e_energy = 0,
runepower = 0,
_setmetatable (_newEnergySpell, habilidade_energy)
targets = container_combatentes:NovoContainer (container_energy_target)
}
_setmetatable (_newEnergySpell, habilidade_energy)
if (link) then
_newEnergySpell.targets.shadow = link.targets
end
return _newEnergySpell
end
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype)
self.counter = self.counter + 1
--local alvo = self.targets:PegarCombatente (serial, nome, flag, true)
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
if (link) then
_newEnergySpell.targets.shadow = link.targets
end
return _newEnergySpell
end
if (powertype == 0) then --> MANA
self.mana = self.mana + amount
alvo.mana = alvo.mana + amount
elseif (powertype == 1) then --> e_rage
self.e_rage = self.e_rage + amount
alvo.e_rage = alvo.e_rage + amount
elseif (powertype == 3) then --> ENERGIA
self.e_energy = self.e_energy + amount
alvo.e_energy = alvo.e_energy + amount
elseif (powertype == 6) then --> RUNEPOWER
self.runepower = self.runepower + amount
alvo.runepower = alvo.runepower + amount
function habilidade_energy:Add (serial, nome, flag, amount, who_nome, powertype)
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
if (powertype == 0) then --> MANA
self.mana = self.mana + amount
alvo.mana = alvo.mana + amount
elseif (powertype == 1) then --> e_rage
self.e_rage = self.e_rage + amount
alvo.e_rage = alvo.e_rage + amount
elseif (powertype == 3) then --> ENERGIA
self.e_energy = self.e_energy + amount
alvo.e_energy = alvo.e_energy + amount
elseif (powertype == 6) then --> RUNEPOWER
self.runepower = self.runepower + amount
alvo.runepower = alvo.runepower + amount
end
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_energy)
habilidade.__index = habilidade_energy
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
function _detalhes.refresh:r_habilidade_e_energy (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_energy)
habilidade.__index = habilidade_energy
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
end
function _detalhes.clear:c_habilidade_e_energy (habilidade)
--habilidade.__index = {}
habilidade.__index = {}
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_e_energy (habilidade)
--habilidade.__index = {}
habilidade.__index = {}
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_energy.__sub = function (tabela1, tabela2)
habilidade_energy.__sub = function (tabela1, tabela2)
tabela1.mana = tabela1.mana - tabela2.mana
tabela1.e_rage = tabela1.e_rage - tabela2.e_rage
tabela1.e_energy = tabela1.e_energy - tabela2.e_energy
tabela1.runepower = tabela1.runepower - tabela2.runepower
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.mana = tabela1.mana - tabela2.mana
tabela1.e_rage = tabela1.e_rage - tabela2.e_rage
tabela1.e_energy = tabela1.e_energy - tabela2.e_energy
tabela1.runepower = tabela1.runepower - tabela2.runepower
tabela1.counter = tabela1.counter - tabela2.counter
return tabela1
end
return tabela1
end
-5
View File
@@ -52,10 +52,6 @@ local class_type = _detalhes.atributos.cura
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -331,7 +327,6 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
end)--]]
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+130 -130
View File
@@ -1,154 +1,154 @@
--[[ classe do dano aplicado, usado nos eventos:
- SPELL_HEAL
- SPELL_PERIODIC_HEAL
Parents:
addon -> combate atual -> Npc/Player Swicth -> Container de Habilidades -> esta tabela
]]
-- heal ability file
local _detalhes = _G._detalhes
local gump = _detalhes.gump
local _detalhes = _G._detalhes
local _
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_cura = _detalhes.habilidade_cura
local container_combatentes = _detalhes.container_combatentes
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
--lua locals
local _setmetatable = setmetatable
--api locals
function habilidade_cura:NovaTabela (id, link) --aqui eu não sei que parâmetros passar
local _newHealSpell = {
local _setmetatable = setmetatable --lua local
total = 0,
totalabsorb = 0,
counter = 0,
id = id,
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_curado = 0,
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_cura = _detalhes.habilidade_cura
local container_combatentes = _detalhes.container_combatentes
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function habilidade_cura:NovaTabela (id, link)
local _newHealSpell = {
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_curado = 0,
total = 0,
totalabsorb = 0,
counter = 0,
id = id,
absorbed = 0,
overheal = 0,
--> normal hits
n_min = 0,
n_max = 0,
n_amt = 0,
n_curado = 0,
--> critical hits
c_min = 0,
c_max = 0,
c_amt = 0,
c_curado = 0,
absorbed = 0,
overheal = 0,
targets = container_combatentes:NovoContainer (container_heal_target)
}
targets = container_combatentes:NovoContainer (container_heal_target)
}
_setmetatable (_newHealSpell, habilidade_cura)
if (link) then
_newHealSpell.targets.shadow = link.targets
end
return _newHealSpell
end
--> o primeiro parametro "spell" vira self a atrasa 1 parâmetro em todos os argumentos.
function habilidade_cura:Add (serial, nome, flag, amount, who_nome, absorbed, critical, overhealing, is_shield)
self.counter = self.counter + 1
--local alvo = self.targets:PegarCombatente (serial, nome, flag, true)
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
if (absorbed and absorbed > 0) then
self.absorbed = self.absorbed + absorbed
alvo.absorbed = alvo.absorbed + absorbed
end
if (overhealing and overhealing > 0) then
self.overheal = self.overheal + overhealing
alvo.overheal = alvo.overheal + overhealing
end
if (amount and amount > 0) then
self.total = self.total + amount
if (is_shield) then
self.totalabsorb = self.totalabsorb + amount
_setmetatable (_newHealSpell, habilidade_cura)
if (link) then
_newHealSpell.targets.shadow = link.targets
end
return _newHealSpell
end
alvo:AddQuantidade (amount)
function habilidade_cura:Add (serial, nome, flag, amount, who_nome, absorbed, critical, overhealing, is_shield)
if (critical) then
self.c_curado = self.c_curado+amount --> amount é o total de dano
self.c_amt = self.c_amt+1 --> amount é o total de dano
if (amount > self.c_max) then
self.c_max = amount
end
if (self.c_min > amount or self.c_min == 0) then
self.c_min = amount
end
self.counter = self.counter + 1
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
self.n_curado = self.n_curado+amount
self.n_amt = self.n_amt+1
if (amount > self.n_max) then
self.n_max = amount
alvo = self.targets._ActorTable [alvo]
end
if (absorbed and absorbed > 0) then
self.absorbed = self.absorbed + absorbed
alvo.absorbed = alvo.absorbed + absorbed
end
if (overhealing and overhealing > 0) then
self.overheal = self.overheal + overhealing
alvo.overheal = alvo.overheal + overhealing
end
if (amount and amount > 0) then
self.total = self.total + amount
alvo.total = alvo.total + amount
if (is_shield) then
self.totalabsorb = self.totalabsorb + amount
end
if (self.n_min > amount or self.n_min == 0) then
self.n_min = amount
if (critical) then
self.c_curado = self.c_curado+amount --> amount é o total de dano
self.c_amt = self.c_amt+1 --> amount é o total de dano
if (amount > self.c_max) then
self.c_max = amount
end
if (self.c_min > amount or self.c_min == 0) then
self.c_min = amount
end
else
self.n_curado = self.n_curado+amount
self.n_amt = self.n_amt+1
if (amount > self.n_max) then
self.n_max = amount
end
if (self.n_min > amount or self.n_min == 0) then
self.n_min = amount
end
end
end
else
alvo:AddQuantidade (0)
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_habilidade_cura (habilidade, shadow)
_setmetatable (habilidade, habilidade_cura)
habilidade.__index = habilidade_cura
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
function _detalhes.refresh:r_habilidade_cura (habilidade, shadow)
_setmetatable (habilidade, habilidade_cura)
habilidade.__index = habilidade_cura
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
end
function _detalhes.clear:c_habilidade_cura (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
function _detalhes.clear:c_habilidade_cura (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_cura.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorb = tabela1.totalabsorb - tabela2.totalabsorb
tabela1.counter = tabela1.counter - tabela2.counter
habilidade_cura.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorb = tabela1.totalabsorb - tabela2.totalabsorb
tabela1.counter = tabela1.counter - tabela2.counter
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_curado = tabela1.n_curado - tabela2.n_curado
tabela1.n_min = tabela1.n_min - tabela2.n_min
tabela1.n_max = tabela1.n_max - tabela2.n_max
tabela1.n_amt = tabela1.n_amt - tabela2.n_amt
tabela1.n_curado = tabela1.n_curado - tabela2.n_curado
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_curado = tabela1.c_curado - tabela2.c_curado
tabela1.c_min = tabela1.c_min - tabela2.c_min
tabela1.c_max = tabela1.c_max - tabela2.c_max
tabela1.c_amt = tabela1.c_amt - tabela2.c_amt
tabela1.c_curado = tabela1.c_curado - tabela2.c_curado
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
tabela1.overheal = tabela1.overheal - tabela2.overheal
return tabela1
end
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
tabela1.overheal = tabela1.overheal - tabela2.overheal
return tabela1
end
-5
View File
@@ -53,10 +53,6 @@ local class_type = _detalhes.atributos.misc
local DATA_TYPE_START = _detalhes._detalhes_props.DATA_TYPE_START
local DATA_TYPE_END = _detalhes._detalhes_props.DATA_TYPE_END
local DFLAG_player = _detalhes.flags.player
local DFLAG_group = _detalhes.flags.in_group
local DFLAG_player_group = _detalhes.flags.player_in_group
local div_abre = _detalhes.divisores.abre
local div_fecha = _detalhes.divisores.fecha
local div_lugar = _detalhes.divisores.colocacao
@@ -547,7 +543,6 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo
--end
for index, player in _ipairs (conteudo) do
--if (_bit_band (player.flag, DFLAG_player_group) >= 0x101) then --> é um player e esta em grupo
if (player.grupo) then --> é um player e esta em grupo
if (not player[keyName] or player[keyName] < 1) then --> dano menor que 1, interromper o loop
amount = index - 1
+233 -226
View File
@@ -1,58 +1,198 @@
local _detalhes = _G._detalhes
--local gump = _detalhes.gump
-- misc ability file
local _detalhes = _G._detalhes
local _
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_misc = _detalhes.habilidade_misc
local container_combatentes = _detalhes.container_combatentes
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--lua locals
local _
local _setmetatable = setmetatable
local _ipairs = ipairs
--api locals
local _UnitAura = UnitAura
local _setmetatable = setmetatable --lua local
local _ipairs = ipairs --lua local
local _UnitAura = UnitAura --api local
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
function habilidade_misc:NovaTabela (id, link, token) --aqui eu não sei que parâmetros passar
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local habilidade_misc = _detalhes.habilidade_misc
local container_combatentes = _detalhes.container_combatentes
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local _newMiscSpell = {
id = id,
counter = 0,
targets = container_combatentes:NovoContainer (container_misc_target)
}
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
_newMiscSpell.uptime = 0
_newMiscSpell.actived = false
_newMiscSpell.activedamt = 0
elseif (token == "SPELL_INTERRUPT") then
_newMiscSpell.interrompeu_oque = {}
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
_newMiscSpell.dispell_oque = {}
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
_newMiscSpell.cc_break_oque = {}
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
_setmetatable (_newMiscSpell, habilidade_misc)
if (link) then
_newMiscSpell.targets.shadow = link.targets
end
return _newMiscSpell
end
function habilidade_misc:NovaTabela (id, link, token)
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
--alvo:AddQuantidade (1)
if (spellID == "BUFF_OR_DEBUFF") then
local _newMiscSpell = {
id = id,
counter = 0,
targets = container_combatentes:NovoContainer (container_misc_target)
}
if (spellName == "COOLDOWN") then
self.counter = self.counter + 1
if (token == "BUFF_UPTIME" or token == "DEBUFF_UPTIME") then
_newMiscSpell.uptime = 0
_newMiscSpell.actived = false
_newMiscSpell.activedamt = 0
elseif (token == "SPELL_INTERRUPT") then
_newMiscSpell.interrompeu_oque = {}
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
_newMiscSpell.dispell_oque = {}
elseif (token == "SPELL_AURA_BROKEN" or token == "SPELL_AURA_BROKEN_SPELL") then
_newMiscSpell.cc_break_oque = {}
end
_setmetatable (_newMiscSpell, habilidade_misc)
if (link) then
_newMiscSpell.targets.shadow = link.targets
end
return _newMiscSpell
end
function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spellName)
if (spellID == "BUFF_OR_DEBUFF") then
--> alvo
if (spellName == "COOLDOWN") then
self.counter = self.counter + 1
--> alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (spellName == "BUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "BUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived = false
self.actived_at = nil
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
self.actived = true
self.activedamt = self.activedamt + 1
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
--> ja esta ativo em outro mob e jogou num novo
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "DEBUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.activedamt = self.activedamt - 1
if (self.activedamt == 0) then
self.actived = false
self.actived_at = nil
else
self.actived_at = _detalhes._tempo
end
end
elseif (token == "SPELL_INTERRUPT") then
self.counter = self.counter + 1
if (not self.interrompeu_oque [spellID]) then --> interrompeu_oque a NIL value
self.interrompeu_oque [spellID] = 1
else
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_RESURRECT") then
if (not self.ress) then
self.ress = 1
else
self.ress = self.ress + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
if (not self.dispell) then
self.dispell = 1
else
self.dispell = self.dispell + 1
end
if (not self.dispell_oque [spellID]) then
self.dispell_oque [spellID] = 1
else
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
if (not self.cc_break) then
self.cc_break = 1
else
self.cc_break = self.cc_break + 1
end
if (not self.cc_break_oque [spellID]) then
self.cc_break_oque [spellID] = 1
else
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
@@ -60,190 +200,57 @@ function habilidade_misc:Add (serial, nome, flag, who_nome, token, spellID, spel
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (spellName == "BUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "BUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.buff_uptime = token.buff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.actived = false
self.actived_at = nil
elseif (spellName == "BUFF_UPTIME_IN" or spellName == "DEBUFF_UPTIME_IN") then
self.actived = true
self.activedamt = self.activedamt + 1
if (self.actived_at and self.actived and spellName == "DEBUFF_UPTIME_IN") then
--> ja esta ativo em outro mob e jogou num novo
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
elseif (spellName == "DEBUFF_UPTIME_REFRESH") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at
end
self.actived_at = _detalhes._tempo
self.actived = true
elseif (spellName == "DEBUFF_UPTIME_OUT") then
if (self.actived_at and self.actived) then
self.uptime = self.uptime + _detalhes._tempo - self.actived_at
token.debuff_uptime = token.debuff_uptime + _detalhes._tempo - self.actived_at --> token = actor misc object
end
self.activedamt = self.activedamt - 1
if (self.activedamt == 0) then
self.actived = false
self.actived_at = nil
else
self.actived_at = _detalhes._tempo
end
end
elseif (token == "SPELL_INTERRUPT") then
self.counter = self.counter + 1
if (not self.interrompeu_oque [spellID]) then --> interrompeu_oque a NIL value
self.interrompeu_oque [spellID] = 1
else
self.interrompeu_oque [spellID] = self.interrompeu_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_RESURRECT") then
if (not self.ress) then
self.ress = 1
else
self.ress = self.ress + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_DISPEL" or token == "SPELL_STOLEN") then
if (not self.dispell) then
self.dispell = 1
else
self.dispell = self.dispell + 1
end
if (not self.dispell_oque [spellID]) then
self.dispell_oque [spellID] = 1
else
self.dispell_oque [spellID] = self.dispell_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
elseif (token == "SPELL_AURA_BROKEN_SPELL" or token == "SPELL_AURA_BROKEN") then
if (not self.cc_break) then
self.cc_break = 1
else
self.cc_break = self.cc_break + 1
end
if (not self.cc_break_oque [spellID]) then
self.cc_break_oque [spellID] = 1
else
self.cc_break_oque [spellID] = self.cc_break_oque [spellID] + 1
end
--alvo
local alvo = self.targets._NameIndexTable [nome]
if (not alvo) then
alvo = self.targets:PegarCombatente (serial, nome, flag, true)
else
alvo = self.targets._ActorTable [alvo]
end
alvo.total = alvo.total + 1
end
end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
--> habilidade atual e o container de habilidades da shadow
function _detalhes.refresh:r_habilidade_misc (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_misc)
habilidade.__index = habilidade_misc
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
function _detalhes.clear:c_habilidade_misc (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_misc.__sub = function (tabela1, tabela2)
--interrupts & cooldowns
tabela1.counter = tabela1.counter - tabela2.counter
--buff uptime ou debuff uptime
if (tabela1.uptime and tabela2.uptime) then
tabela1.uptime = tabela1.uptime - tabela2.uptime
end
--ressesrs
if (tabela1.ress and tabela2.ress) then
tabela1.ress = tabela1.ress - tabela2.ress
end
--dispells
if (tabela1.dispell and tabela2.dispell) then
tabela1.dispell = tabela1.dispell - tabela2.dispell
end
--cc_breaks
if (tabela1.cc_break and tabela2.cc_break) then
tabela1.cc_break = tabela1.cc_break - tabela2.cc_break
function _detalhes.refresh:r_habilidade_misc (habilidade, shadow) --recebeu o container shadow
_setmetatable (habilidade, habilidade_misc)
habilidade.__index = habilidade_misc
if (shadow ~= -1) then
habilidade.shadow = shadow._ActorTable[habilidade.id]
_detalhes.refresh:r_container_combatentes (habilidade.targets, habilidade.shadow.targets)
else
_detalhes.refresh:r_container_combatentes (habilidade.targets, -1)
end
end
return tabela1
end
function _detalhes.clear:c_habilidade_misc (habilidade)
--habilidade.__index = {}
habilidade.__index = nil
habilidade.shadow = nil
_detalhes.clear:c_container_combatentes (habilidade.targets)
end
habilidade_misc.__sub = function (tabela1, tabela2)
--interrupts & cooldowns
tabela1.counter = tabela1.counter - tabela2.counter
--buff uptime ou debuff uptime
if (tabela1.uptime and tabela2.uptime) then
tabela1.uptime = tabela1.uptime - tabela2.uptime
end
--ressesrs
if (tabela1.ress and tabela2.ress) then
tabela1.ress = tabela1.ress - tabela2.ress
end
--dispells
if (tabela1.dispell and tabela2.dispell) then
tabela1.dispell = tabela1.dispell - tabela2.dispell
end
--cc_breaks
if (tabela1.cc_break and tabela2.cc_break) then
tabela1.cc_break = tabela1.cc_break - tabela2.cc_break
end
return tabela1
end
+45 -43
View File
@@ -1,49 +1,51 @@
-- class target file
local _detalhes = _G._detalhes
--local AceLocale = LibStub ("AceLocale-3.0")
--local Loc = AceLocale:GetLocale ( "Details" )
local gump = _detalhes.gump
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
--lua locals
local _setmetatable = setmetatable
--api locals
--esta tabela irá ser usada por todas os tipos? tipo dano, cura, interrupts?
function alvo_da_habilidade:NovaTabela (link)
local esta_tabela = {total = 0}
_setmetatable (esta_tabela, alvo_da_habilidade)
local _detalhes = _G._detalhes
return esta_tabela
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
function alvo_da_habilidade:AddQuantidade (amt)
self.total = self.total + amt
if (self.shadow) then
return self.shadow:AddQuantidade (amt)
local _setmetatable = setmetatable --lua local
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function alvo_da_habilidade:NovaTabela (link)
local esta_tabela = {total = 0}
_setmetatable (esta_tabela, alvo_da_habilidade)
return esta_tabela
end
end
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
_setmetatable (este_alvo, alvo_da_habilidade)
este_alvo.__index = alvo_da_habilidade
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
end
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
este_alvo.shadow = nil
--este_alvo.__index = {}
este_alvo.__index = nil
end
alvo_da_habilidade.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
if (tabela1.overheal) then
tabela1.overheal = tabela1.overheal - tabela2.overheal
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
function alvo_da_habilidade:AddQuantidade (amt)
self.total = self.total + amt
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function _detalhes.refresh:r_alvo_da_habilidade (este_alvo, shadow)
_setmetatable (este_alvo, alvo_da_habilidade)
este_alvo.__index = alvo_da_habilidade
este_alvo.shadow = shadow._ActorTable [shadow._NameIndexTable [este_alvo.nome]]
end
function _detalhes.clear:c_alvo_da_habilidade (este_alvo)
este_alvo.shadow = nil
--este_alvo.__index = {}
este_alvo.__index = nil
end
alvo_da_habilidade.__sub = function (tabela1, tabela2)
tabela1.total = tabela1.total - tabela2.total
if (tabela1.overheal) then
tabela1.overheal = tabela1.overheal - tabela2.overheal
tabela1.absorbed = tabela1.absorbed - tabela2.absorbed
end
end
end
+421 -468
View File
@@ -1,511 +1,464 @@
local _detalhes = _G._detalhes
local gump = _detalhes.gump
-- actor container file
local combatente = _detalhes.combatente
local container_combatentes = _detalhes.container_combatentes
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local atributo_damage = _detalhes.atributo_damage
local atributo_heal = _detalhes.atributo_heal
local atributo_energy = _detalhes.atributo_energy
local atributo_misc = _detalhes.atributo_misc
local _detalhes = _G._detalhes
local _
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_enemydebufftarget_target = _detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
--api locals
local _UnitClass = UnitClass
local _IsInInstance = IsInInstance
--lua locals
local _setmetatable = setmetatable
local _getmetatable = getmetatable
local _bit_band = bit.band
local _ipairs = ipairs
local _pairs = pairs
local _
--local table_insert = table.insert
--> FLAGS <== qual o tipo do objeto
local OBJECT_TYPE_MASK = 0x0000FC00
local OBJECT_TYPE_OBJECT = 0x00004000
local OBJECT_TYPE_PETGUARDIAN = 0x00003000
local OBJECT_TYPE_GUARDIAN = 0x00002000
local OBJECT_TYPE_PET = 0x00001000
local OBJECT_TYPE_NPC = 0x00000800
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_PETS = OBJECT_TYPE_PET + OBJECT_TYPE_GUARDIAN
local EM_GRUPO = 0x00000007
local REACTION_HOSTILE = COMBATLOG_OBJECT_REACTION_HOSTILE or 0x00000040
function container_combatentes:NovoContainer (tipo_do_container, combatTable, combatId)
local _newContainer = {
local _UnitClass = UnitClass --api local
local _IsInInstance = IsInInstance --api local
funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
combatId = combatId,
_ActorTable = {},
_NameIndexTable = {}
}
local _setmetatable = setmetatable --lua local
local _getmetatable = getmetatable --lua local
local _bit_band = bit.band --lua local
local _ipairs = ipairs --lua local
local _pairs = pairs --lua local
_setmetatable (_newContainer, container_combatentes)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
return _newContainer
end
local combatente = _detalhes.combatente
local container_combatentes = _detalhes.container_combatentes
local alvo_da_habilidade = _detalhes.alvo_da_habilidade
local atributo_damage = _detalhes.atributo_damage
local atributo_heal = _detalhes.atributo_heal
local atributo_energy = _detalhes.atributo_energy
local atributo_misc = _detalhes.atributo_misc
local function get_actor_class (novo_objeto, nome, flag)
local _, engClass = _UnitClass (nome)
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
local container_enemydebufftarget_target = _detalhes.container_type.CONTAINER_ENEMYDEBUFFTARGET_CLASS
if (engClass) then
novo_objeto.classe = engClass
return
else
if (flag) then
--> conferir se o jogador é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.classe = "UNGROUPPLAYER"
return
elseif (_bit_band (flag, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
novo_objeto.classe = "PET"
return
end
--> flags
local REACTION_HOSTILE = 0x00000040
local IS_GROUP_OBJECT = 0x00000007
local OBJECT_TYPE_MASK = 0x0000FC00
local OBJECT_TYPE_OBJECT = 0x00004000
local OBJECT_TYPE_PETGUARDIAN = 0x00003000
local OBJECT_TYPE_GUARDIAN = 0x00002000
local OBJECT_TYPE_PET = 0x00001000
local OBJECT_TYPE_NPC = 0x00000800
local OBJECT_TYPE_PLAYER = 0x00000400
local OBJECT_TYPE_PETS = OBJECT_TYPE_PET + OBJECT_TYPE_GUARDIAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> api functions
function container_combatentes:GetAmount (actorName, key)
key = key or "total"
local index = self._NameIndexTable [actorName]
if (index) then
return self._ActorTable [index] [key] or 0
else
return 0
end
novo_objeto.classe = "UNKNOW"
return
end
end
function container_combatentes:GetAmount (actorName, key)
key = key or "total"
local index = self._NameIndexTable [actorName]
if (index) then
return self._ActorTable [index] [key] or 0
else
return 0
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
local read_actor_flag = function (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
-- converte a flag do wow em flag do details
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> pega afiliação
local details_flag = 0x00000000
if (flag) then
--print ("tem flag")
if (_bit_band (flag, 0x00000400) ~= 0) then --> é um player
details_flag = details_flag+0x00000001
--> build a new actor container
function container_combatentes:NovoContainer (tipo_do_container, combat_table, combat_id)
local _newContainer = {
funcao_de_criacao = container_combatentes:FuncaoDeCriacao (tipo_do_container),
novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent
if (not novo_objeto.displayName) then
tipo = tipo_do_container,
combatId = combat_id,
_ActorTable = {},
_NameIndexTable = {}
}
_setmetatable (_newContainer, container_combatentes)
return _newContainer
end
--> try to get the actor class from name
local function get_actor_class (novo_objeto, nome, flag)
local _, engClass = _UnitClass (nome)
if (engClass) then
novo_objeto.classe = engClass
return
else
if (flag) then
--> conferir se o jogador é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.classe = "UNGROUPPLAYER"
return
elseif (_bit_band (flag, OBJECT_TYPE_PETGUARDIAN) ~= 0) then
novo_objeto.classe = "PET"
return
end
end
novo_objeto.classe = "UNKNOW"
return
end
end
--> read the actor flag
local read_actor_flag = function (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (flag) then
--> é um player
if (_bit_band (flag, OBJECT_TYPE_PLAYER) ~= 0) then
novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent
if (not novo_objeto.displayName) then
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), "")
else
novo_objeto.displayName = nome
end
end
if (_bit_band (flag, IS_GROUP_OBJECT) ~= 0 and novo_objeto.classe ~= "UNGROUPPLAYER") then --> faz parte do grupo
novo_objeto.grupo = true
if (shadow_objeto) then
shadow_objeto.grupo = true
end
if (_detalhes:IsATank (serial)) then
novo_objeto.isTank = true
if (shadow_objeto) then
shadow_objeto.isTank = true
end
end
end
--> é um pet
elseif (dono_do_pet) then
novo_objeto.owner = dono_do_pet
novo_objeto.ownerName = dono_do_pet.nome
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), "")
--print (novo_objeto.displayName)
novo_objeto.displayName = nome:gsub (("%-.*"), ">")
else
novo_objeto.displayName = nome
end
end
if (_bit_band (flag, EM_GRUPO) ~= 0 and novo_objeto.classe ~= "UNGROUPPLAYER") then --> faz parte do grupo
details_flag = details_flag+0x00000100
novo_objeto.grupo = true
if (shadow_objeto) then
shadow_objeto.grupo = true
end
if (_detalhes:IsATank (serial)) then
novo_objeto.isTank = true
if (shadow_objeto) then
shadow_objeto.isTank = true
end
end
end
elseif (dono_do_pet) then --> é um pet
details_flag = details_flag+0x00000002
novo_objeto.owner = dono_do_pet
novo_objeto.ownerName = dono_do_pet.nome
if (_IsInInstance() and _detalhes.remove_realm_from_name) then
novo_objeto.displayName = nome:gsub (("%-.*"), ">")
else
novo_objeto.displayName = nome
end
--if (not novo_objeto.displayName:find (">")) then
-- novo_objeto.displayName = novo_objeto.displayName .. ">"
--end
--print ("pet -> " .. nome)
else
novo_objeto.displayName = nome
end
-- 0x00000060 --> inimigo neutro
if (_bit_band (flag, 0x00000010) ~= 0) then --> é amigo
details_flag = details_flag+0x00000010
elseif (_bit_band (flag, 0x00000020) ~= 0) then --> é neutro
details_flag = details_flag+0x00000020
--print ("neutro -> " .. nome)
elseif (_bit_band (flag, 0x00000040) ~= 0) then --> é inimigo
details_flag = details_flag+0x00000040
if (_bit_band (flag, 0x00000400) == 0 and _bit_band (flag, OBJECT_TYPE_PETGUARDIAN) == 0) then
novo_objeto.monster = true
end
--print ("inimigos -> " .. nome)
end
else
--print (flag)
end
novo_objeto.flag = details_flag
novo_objeto.flag_original = flag
novo_objeto.serial = serial
end
function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwner)
--> antes de mais nada, vamos verificar se é um pet
local dono_do_pet
if (flag and _bit_band (flag, OBJECT_TYPE_PETS) ~= 0) then --> é um pet
--> aqui ele precisaria achar as tag < > pra saber se o nome passado já não veio com o dono imbutido
--> se não tiver as tags, terá que ser posto aqui
if (not nome:find ("<") or not nome:find (">")) then --> find é lento, não teria outra forma de fazer isso?
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
if (nome_dele) then
nome = nome_dele
--if (_detalhes.debug) then
-- print ("creating actor for pet:", nome, "owner:", dono_nome)
--end
--> e se olharmos no cache do parser antes de tentar cria-lo?
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
--> é inimigo
if (_bit_band (flag, 0x00000040) ~= 0) then
if (_bit_band (flag, OBJECT_TYPE_PLAYER) == 0 and _bit_band (flag, OBJECT_TYPE_PETGUARDIAN) == 0) then
novo_objeto.monster = true
end
end
end
novo_objeto.flag_original = flag
novo_objeto.serial = serial
end
local index = self._NameIndexTable [nome] --> pega o index no mapa
if (index) then
return self._ActorTable [index], dono_do_pet, nome
elseif (criar) then
function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwner)
-- rotinas de criação do objeto shadow
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local shadow = self.shadow --> espelho do container no overall
local shadow_objeto
if (shadow) then --> se tiver o espelho (não for a tabela overall já)
shadow_objeto = shadow:PegarCombatente (_, nome) --> apenas verifica se ele existe ou não
if (not shadow_objeto) then --> se não existir, cria-lo
local novo_nome = nome:gsub ((" <.*"), "") --> tira o nome do pet
shadow_objeto = shadow:PegarCombatente (serial, novo_nome, flag, true)
--> verifica se é um pet, se for confere se tem o nome do dono, se não tiver, precisa por
local dono_do_pet
if (flag and _bit_band (flag, OBJECT_TYPE_PETS) ~= 0) then --> é um pet
--> aqui ele precisaria achar as tag < > pra saber se o nome passado já não veio com o dono imbutido, se não tiver as tags, terá que ser posto aqui
if (not nome:find ("<") or not nome:find (">")) then --> find é lento, não teria outra forma de fazer isso?
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
if (nome_dele) then
nome = nome_dele
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
end
end
end
local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spell_tables, mas não grava nele mesmo
--> pega o index no mapa
local index = self._NameIndexTable [nome]
--> retorna o actor
if (index) then
return self._ActorTable [index], dono_do_pet, nome
novo_objeto.nome = nome
--print (nome)
-- tipo do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> não achou, criar
elseif (criar) then
--if (self.tipo == container_playernpc) then --> CONTAINER COMUM
if (self.tipo == container_damage) then --> CONTAINER DAMAGE
--> espelho do container no overall
local shadow = self.shadow
local shadow_objeto
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_damage_group [#_detalhes.cache_damage_group+1] = novo_objeto
--> se tiver o espelho (não for a tabela overall já)
if (shadow) then
--> apenas verifica se ele existe ou não
shadow_objeto = shadow:PegarCombatente (_, nome)
--> se não existir, cria-lo
if (not shadow_objeto) then
--> tira o nome do pet
local novo_nome = nome:gsub ((" <.*"), "")
--> cria o objeto
shadow_objeto = shadow:PegarCombatente (serial, novo_nome, flag, true)
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
if (novo_objeto.isTank) then
novo_objeto.avoidance = _detalhes:CreateActorAvoidanceTable()
end
elseif (self.tipo == container_heal) then --> CONTAINER HEALING
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_healing_group [#_detalhes.cache_healing_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_energy) then --> CONTAINER ENERGY
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_misc) then --> CONTAINER MISC
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
--local teste_classe =
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
shadow_objeto.flag = details_flag
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_damage_target) then --> CONTAINER ALVO DO DAMAGE
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
end
elseif (self.tipo == container_heal_target) then --> CONTAINER ALVOS DO HEALING
novo_objeto.overheal = 0
novo_objeto.absorbed = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
end
elseif (self.tipo == container_energy_target) then --> CONTAINER ALVOS DO ENERGY
novo_objeto.mana = 0
novo_objeto.e_rage = 0
novo_objeto.e_energy = 0
novo_objeto.runepower = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_enemydebufftarget_target) then
novo_objeto.uptime = 0
novo_objeto.actived = false
novo_objeto.activedamt = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_misc_target) then --> CONTAINER ALVOS DO MISC
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
--shadow_objeto.flag = details_flag
local novo_objeto = self.funcao_de_criacao (_, serial, nome, shadow_objeto) --> shadow_objeto passa para o classe_damage gravar no .targets e .spell_tables, mas não grava nele mesmo
novo_objeto.nome = nome
-- tipo do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (self.tipo == container_damage) then --> CONTAINER DAMAGE
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_damage_group [#_detalhes.cache_damage_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
if (novo_objeto.isTank) then
novo_objeto.avoidance = _detalhes:CreateActorAvoidanceTable()
end
elseif (self.tipo == container_heal) then --> CONTAINER HEALING
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
if (novo_objeto.grupo and _detalhes.in_combat) then
_detalhes.cache_healing_group [#_detalhes.cache_healing_group+1] = novo_objeto
end
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true --print (nome.." EH UM INIMIGO -> " .. engRace)
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_energy) then --> CONTAINER ENERGY
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_misc) then --> CONTAINER MISC
get_actor_class (novo_objeto, nome, flag)
read_actor_flag (novo_objeto, shadow_objeto, dono_do_pet, serial, flag, nome)
--local teste_classe =
if (dono_do_pet) then
dono_do_pet.pets [#dono_do_pet.pets+1] = nome
end
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
novo_objeto:CriaLink (shadow_objeto) --> criando o link
end
if (novo_objeto.classe == "UNGROUPPLAYER") then --> is a player
if (_bit_band (flag, REACTION_HOSTILE ) ~= 0) then --> is hostile
novo_objeto.enemy = true
end
--> try to guess his class
if (shadow) then --> não executar 2x
_detalhes:ScheduleTimer ("GuessClass", 1, {novo_objeto, self, 1})
end
end
elseif (self.tipo == container_damage_target) then --> CONTAINER ALVO DO DAMAGE
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_heal_target) then --> CONTAINER ALVOS DO HEALING
novo_objeto.overheal = 0
novo_objeto.absorbed = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_energy_target) then --> CONTAINER ALVOS DO ENERGY
novo_objeto.mana = 0
novo_objeto.e_rage = 0
novo_objeto.e_energy = 0
novo_objeto.runepower = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_enemydebufftarget_target) then
novo_objeto.uptime = 0
novo_objeto.actived = false
novo_objeto.activedamt = 0
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_misc_target) then --> CONTAINER ALVOS DO MISC
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
elseif (self.tipo == container_friendlyfire) then --> CONTAINER FRIENDLY FIRE
get_actor_class (novo_objeto, nome)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
end
elseif (self.tipo == container_friendlyfire) then --> CONTAINER FRIENDLY FIRE
get_actor_class (novo_objeto, nome)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
shadow_objeto.flag = details_flag
end
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- grava o objeto no mapa do container
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[
if (self.tipo == container_damage) then
if (nome:find ("Lyl")) then
if (nome:find ("-")) then
print ("nome FIM com -", isOwner)
else
--print ("nome FIM okey", isOwner)
end
local size = #self._ActorTable+1
self._ActorTable [size] = novo_objeto --> grava na tabela de indexes
self._NameIndexTable [nome] = size --> grava no hash map o index deste jogador
return novo_objeto, dono_do_pet, nome
else
return nil, nil, nil
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
function container_combatentes:FuncaoDeCriacao (tipo)
if (tipo == container_damage_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_damage) then
return atributo_damage.NovaTabela
elseif (tipo == container_heal_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_heal) then
return atributo_heal.NovaTabela
elseif (tipo == container_friendlyfire) then
return atributo_damage.FF_funcao_de_criacao
elseif (tipo == container_enemydebufftarget_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_energy) then
return atributo_energy.NovaTabela
elseif (tipo == container_energy_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_misc) then
return atributo_misc.NovaTabela
elseif (tipo == container_misc_target) then
return alvo_da_habilidade.NovaTabela
end
end
--> chama a função para ser executada em todos os atores
function container_combatentes:ActorCallFunction (funcao, ...)
for index, actor in _ipairs (self._ActorTable) do
funcao (nil, actor, ...)
end
end
function container_combatentes:remapear()
local mapa = self._NameIndexTable
local conteudo = self._ActorTable
for i = 1, #conteudo do
mapa [conteudo[i].nome] = i
end
end
function _detalhes.refresh:r_container_combatentes (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_combatentes)
container.__index = _detalhes.container_combatentes
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
--> repara mapa
local mapa = {}
for i = 1, #container._ActorTable do
mapa [container._ActorTable[i].nome] = i
end
end
--]]
container._NameIndexTable = mapa
local size = #self._ActorTable+1
self._ActorTable [size] = novo_objeto --> grava na tabela de indexes
self._NameIndexTable [nome] = size --> grava no hash map o index deste jogador
return novo_objeto, dono_do_pet, nome
else
return nil, nil, nil
--> seta a shadow
container.shadow = shadow
end
end
function container_combatentes:FuncaoDeCriacao (tipo)
if (tipo == container_damage_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_damage) then
return atributo_damage.NovaTabela
elseif (tipo == container_heal_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_heal) then
return atributo_heal.NovaTabela
elseif (tipo == container_friendlyfire) then
return atributo_damage.FF_funcao_de_criacao
elseif (tipo == container_enemydebufftarget_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_energy) then
return atributo_energy.NovaTabela
elseif (tipo == container_energy_target) then
return alvo_da_habilidade.NovaTabela
elseif (tipo == container_misc) then
return atributo_misc.NovaTabela
elseif (tipo == container_misc_target) then
return alvo_da_habilidade.NovaTabela
end
end
--> chama a função para ser executada em todos os atores
function container_combatentes:ActorCallFunction (funcao, ...)
for index, actor in _ipairs (self._ActorTable) do
funcao (nil, actor, ...)
end
end
function container_combatentes:remapear()
local mapa = self._NameIndexTable
local conteudo = self._ActorTable
for i = 1, #conteudo do
mapa [conteudo[i].nome] = i
end
end
function _detalhes.refresh:r_container_combatentes (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_combatentes)
container.__index = _detalhes.container_combatentes
container.funcao_de_criacao = container_combatentes:FuncaoDeCriacao (container.tipo)
--> repara mapa
local mapa = {}
for i = 1, #container._ActorTable do
mapa [container._ActorTable[i].nome] = i
end
container._NameIndexTable = mapa
--> seta a shadow
container.shadow = shadow
end
function _detalhes.clear:c_container_combatentes (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container._NameIndexTable = nil
container.need_refresh = nil
container.funcao_de_criacao = nil
end
function _detalhes.clear:c_container_combatentes (container)
container.__index = nil
container.shadow = nil
container._NameIndexTable = nil
container.need_refresh = nil
container.funcao_de_criacao = nil
end
+105 -110
View File
@@ -1,129 +1,124 @@
-- spells container file
local _detalhes = _G._detalhes
--local AceLocale = LibStub ("AceLocale-3.0")
--local Loc = AceLocale:GetLocale ( "Details" )
local gump = _detalhes.gump
local _setmetatable = setmetatable
local _
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
local habilidade_dano = _detalhes.habilidade_dano
local habilidade_cura = _detalhes.habilidade_cura
local habilidade_e_energy = _detalhes.habilidade_e_energy
local habilidade_misc = _detalhes.habilidade_misc
local _setmetatable = setmetatable --lua local
local container_habilidades = _detalhes.container_habilidades
function container_habilidades:NovoContainer (tipo_do_container)
local _newContainer = {
funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
_ActorTable = {}
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> constants
_setmetatable (_newContainer, container_habilidades)
return _newContainer
end
local container_playernpc = _detalhes.container_type.CONTAINER_PLAYERNPC
local container_damage = _detalhes.container_type.CONTAINER_DAMAGE_CLASS
local container_heal = _detalhes.container_type.CONTAINER_HEAL_CLASS
local container_heal_target = _detalhes.container_type.CONTAINER_HEALTARGET_CLASS
local container_friendlyfire = _detalhes.container_type.CONTAINER_FRIENDLYFIRE
local container_damage_target = _detalhes.container_type.CONTAINER_DAMAGETARGET_CLASS
local container_energy = _detalhes.container_type.CONTAINER_ENERGY_CLASS
local container_energy_target = _detalhes.container_type.CONTAINER_ENERGYTARGET_CLASS
local container_misc = _detalhes.container_type.CONTAINER_MISC_CLASS
local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLASS
function container_habilidades:Dupe (who)
local novo_objeto = {}
if (_getmetatable (who)) then
_setmetatable (novo_objeto, _getmetatable (who))
end
for cprop, value in _pairs (who) do
novo_objeto[cprop] = value
end
return novo_objeto
end
local habilidade_dano = _detalhes.habilidade_dano
local habilidade_cura = _detalhes.habilidade_cura
local habilidade_e_energy = _detalhes.habilidade_e_energy
local habilidade_misc = _detalhes.habilidade_misc
function container_habilidades:GetSpell (id)
return self._ActorTable [id]
end
local container_habilidades = _detalhes.container_habilidades
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
local esta_habilidade = self._ActorTable [id]
if (esta_habilidade) then
return esta_habilidade
else
if (criar) then
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
function container_habilidades:NovoContainer (tipo_do_container)
local _newContainer = {
funcao_de_criacao = container_habilidades:FuncaoDeCriacao (tipo_do_container),
tipo = tipo_do_container,
_ActorTable = {}
}
if (cria_shadow) then
local novo_objeto = self.funcao_de_criacao (nil, id, nil, "")
self._ActorTable [id] = novo_objeto
return novo_objeto
end
local shadow = self.shadow --> retorna o container semelhante a esta na tabela overall
local shadow_objeto = nil
if (shadow) then --> talvez possa mandar todos os parâmetros de criação logo no inicio
shadow_objeto = shadow:PegaHabilidade (id) --> apenas verifica se ele existe ou não
if (not shadow_objeto) then --> se não existir, cria-lo
shadow_objeto = shadow:PegaHabilidade (id, true, token)
end
end
--local novo_objeto = habilidade_dano:NovaTabela (id, shadow_objeto)
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
if (shadow_objeto) then --> link é esta mesma tabela mas no container do overall
novo_objeto.shadow = shadow_objeto --> diz ao objeto qual a shadow dele na tabela overall
--novo_objeto:CriaLink (shadow_objeto) --> cria o link entre o objeto e a sua shadow
end
_setmetatable (_newContainer, container_habilidades)
self._ActorTable [id] = novo_objeto
return novo_objeto
return _newContainer
end
function container_habilidades:GetSpell (id)
return self._ActorTable [id]
end
function container_habilidades:PegaHabilidade (id, criar, token, cria_shadow)
local esta_habilidade = self._ActorTable [id]
if (esta_habilidade) then
return esta_habilidade
else
return nil
if (criar) then
if (cria_shadow) then
local novo_objeto = self.funcao_de_criacao (nil, id, nil, "")
self._ActorTable [id] = novo_objeto
return novo_objeto
end
local shadow = self.shadow
local shadow_objeto = nil
if (shadow) then
--> apenas verifica se ele existe ou não
shadow_objeto = shadow:PegaHabilidade (id)
--> se não existir, cria-lo
if (not shadow_objeto) then
shadow_objeto = shadow:PegaHabilidade (id, true, token)
end
end
local novo_objeto = self.funcao_de_criacao (nil, id, shadow_objeto, token)
if (shadow_objeto) then
novo_objeto.shadow = shadow_objeto
end
self._ActorTable [id] = novo_objeto
return novo_objeto
else
return nil
end
end
end
end
function container_habilidades:FuncaoDeCriacao (tipo)
if (tipo == container_damage) then
return habilidade_dano.NovaTabela
elseif (tipo == container_heal) then
return habilidade_cura.NovaTabela
function container_habilidades:FuncaoDeCriacao (tipo)
if (tipo == container_damage) then
return habilidade_dano.NovaTabela
elseif (tipo == container_heal) then
return habilidade_cura.NovaTabela
elseif (tipo == container_energy) then
return habilidade_e_energy.NovaTabela
elseif (tipo == container_misc) then
return habilidade_misc.NovaTabela
elseif (tipo == container_energy) then
return habilidade_e_energy.NovaTabela
elseif (tipo == container_misc) then
return habilidade_misc.NovaTabela
end
end
end
function _detalhes.refresh:r_container_habilidades (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_habilidades)
container.__index = _detalhes.container_habilidades
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
container.funcao_de_criacao = func_criacao
--> seta a shadow
container.shadow = shadow
end
function _detalhes.refresh:r_container_habilidades (container, shadow)
--> reconstrói meta e indexes
_setmetatable (container, _detalhes.container_habilidades)
container.__index = _detalhes.container_habilidades
local func_criacao = container_habilidades:FuncaoDeCriacao (container.tipo)
container.funcao_de_criacao = func_criacao
--> seta a shadow
container.shadow = shadow
end
function _detalhes.clear:c_container_habilidades (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container.funcao_de_criacao = nil
end
function _detalhes.clear:c_container_habilidades (container)
--container.__index = {}
container.__index = nil
container.shadow = nil
container.funcao_de_criacao = nil
end
+1 -1
View File
@@ -62,7 +62,7 @@
for _, actor in _ipairs (_detalhes.tabela_vigente[class_type_dano]._ActorTable) do
if (not actor.grupo and not actor.owner and not actor.nome:find ("[*]") and _bit_band (actor.flag, 0x00000060) ~= 0) then --> 0x20+0x40 neutral + enemy reaction
if (not actor.grupo and not actor.owner and not actor.nome:find ("[*]") and _bit_band (actor.flag_original, 0x00000060) ~= 0) then --> 0x20+0x40 neutral + enemy reaction
if (trash_list) then
local serial = tonumber (actor.serial:sub(6, 10), 16)
-1
View File
@@ -41,7 +41,6 @@
local class_type_cura = _detalhes.atributos.cura
local class_type_e_energy = _detalhes.atributos.e_energy
local class_type_misc = _detalhes.atributos.misc
local DFLAG_pet = _detalhes.flags.pet
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> core
+57 -7
View File
@@ -339,6 +339,27 @@
--if (_bit_band (who_flags, REACTION_FRIENDLY) ~= 0 and _bit_band (alvo_flags, REACTION_FRIENDLY) ~= 0) then (old friendly check)
if (raid_members_cache [who_serial] and raid_members_cache [alvo_serial]) then
--> record death log
local t = jogador_alvo.last_events_table
local i = t.n
t.n = i + 1
t = t [i]
t [1] = true --> true if this is a damage || false for healing
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = amount --> amount of damage or healing
t [4] = time --> parser time
t [5] = _UnitHealth (alvo_name) --> current unit heal
t [6] = who_name --> source name
i = i + 1
if (i == 9) then
jogador_alvo.last_events_table.n = 1
end
--> faz a adução do friendly fire
este_jogador.friendlyfire_total = este_jogador.friendlyfire_total + amount
local amigo = este_jogador.friendlyfire._NameIndexTable [alvo_name]
@@ -1462,7 +1483,7 @@
t = t [i]
t [1] = 1 --> true if this is a damage || false for healing || 1 for cooldown?
t [1] = 1 --> true if this is a damage || false for healing || 1 for cooldown
t [2] = spellid --> spellid || false if this is a battle ress line
t [3] = 1 --> amount of damage or healing
t [4] = time --> parser time
@@ -2104,30 +2125,42 @@
end
end
--_table_sort (esta_morte, _detalhes.Sort4)
_table_sort (esta_morte, _detalhes.Sort4)
--[[
_table_sort (esta_morte, function (table1, table2)
if (not table1) then return false end
if (not table2) then return true end
if (table1 [4] == table2 [4]) then --> os 2 tem o mesmo tempo
if (not table1) then
print (1)
return false
elseif (not table2) then
print (2)
return false
elseif (table1 [4] == table2 [4]) then --> os 2 tem o mesmo tempo
if (type (table1 [1]) == "boolean" and table1 [1] and type (table2 [1]) == "boolean" and table2) then --> ambos sao dano
print (3)
return table1 [5] > table2 [5] --> joga pra cima quem tem mais vida
elseif (type (table1 [1]) == "boolean" and not table1 [1] and type (table2 [1]) == "boolean" and not table2) then --> ambos sao cura
print (4)
return table1 [5] < table2 [5] --> joga pra cima quem tem menos vida
else
if (type (table1 [1]) == "boolean" and table1 and type (table2 [1]) == "boolean" and table2) then --> primeiro é dano e segundo é heal
print (5)
return true --> passa o dano pra frente
elseif (type (table2 [1]) == "boolean" and table2 and type (table1 [1]) == "boolean" and table1) then --> primeiro é heal e o segundo é dano
print (6)
return false --> passa o heal pra frente
else
print (7)
return table1 [5] < table2 [5] --> passa quem tem menos vida
end
end
else
print (8)
return table1 [4] < table2 [4]
end
end)
--]]
if (_hook_deaths) then
--> send event to registred functions
@@ -2627,6 +2660,23 @@
end
end
function _detalhes.parser_functions:PET_BATTLE_OPENING_START (...)
_detalhes.pet_battle = true
for index, instance in _ipairs (_detalhes.tabela_instancias) do
if (instance.ativa) then
instance:SetWindowAlphaForCombat (true, true)
end
end
end
function _detalhes.parser_functions:PET_BATTLE_CLOSE (...)
_detalhes.pet_battle = false
for index, instance in _ipairs (_detalhes.tabela_instancias) do
if (instance.ativa) then
instance:SetWindowAlphaForCombat()
end
end
end
local parser_functions = _detalhes.parser_functions
function _detalhes:OnEvent (evento, ...)
-5
View File
@@ -308,11 +308,6 @@
return nil
end
--> Armazena uma label recém criada - Store a new label on the pool
function _detalhes.font_pool:add (_fontstring)
self [#self+1] = _fontstring
end
local function frame_task (self, elapsed)
self.FrameTime = self.FrameTime + elapsed
+8 -1
View File
@@ -1500,7 +1500,11 @@ function DetailsCreateCoolTip()
if (f2_start_point < f1_end_point) then
local diff = f2_start_point - f1_end_point
CoolTip.overlap_checked = true
return CoolTip:SetMyPoint (host, CoolTip.internal_x_mod + diff, CoolTip.internal_y_mod)
frame2:ClearAllPoints()
frame2:SetPoint ("bottomright", frame1, "bottomleft")
--+ diff
return CoolTip:SetMyPoint (host, CoolTip.internal_x_mod , CoolTip.internal_y_mod)
end
end
@@ -1702,6 +1706,9 @@ function DetailsCreateCoolTip()
--> wipe all data ~reset
function CoolTip:Reset()
frame2:ClearAllPoints()
frame2:SetPoint ("bottomleft", frame1, "bottomright")
CoolTip.FixedValue = nil
CoolTip.HaveSubMenu = false
+8
View File
@@ -99,4 +99,12 @@ do
CONTAINER_MISCTARGET_CLASS = 10,
CONTAINER_ENEMYDEBUFFTARGET_CLASS = 11
}
function _detalhes:Name (actor)
return self.nome or actor.nome
end
function _detalhes:GetName (actor)
return actor.nome or self.nome
end
end
+100 -150
View File
@@ -50,13 +50,29 @@ local function CreateCustomWindow()
insets = {left = 0, right = 0, top = 0, bottom = 0}}
local frame = CreateFrame ("frame", "DetailsCustomPanel", UIParent)
frame:SetPoint ("center", UIParent, "center", 100, -300)
frame:SetPoint ("center", UIParent, "center", 100, -100)
frame:SetWidth (512)
frame:SetHeight (150)
frame:SetHeight (183)
frame:EnableMouse (true)
frame:SetMovable (true)
frame:SetFrameLevel (1)
local frameD = CreateFrame ("frame", "DetailsCustomPanelDisable", frame)
frameD:SetPoint ("center", frame, "center")
frameD:SetWidth (512)
frameD:SetHeight (183)
frameD:EnableMouse (true)
frameD:SetFrameStrata ("fullscreen")
frameD:SetBackdrop ({
bgFile = "Interface\\AddOns\\Details\\images\\background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 16, edgeSize = 4})
frameD:SetBackdropColor (0, 0, 0, .8)
frameD.string = frameD:CreateFontString (nil, "overlay", "GameFontNormal")
frameD.string:SetPoint ("center", frameD, "center")
frameD.string:SetText ("There is a problem connecting some nether tubes\nOur ethereal engineers are already working to fix this issue,\n\nTo avoid mana wyrms proliferation, this panel is disabled for now.\n(Press Escape To Close)")
--frameD:Hide()
frame.fundo = frame:CreateTexture (nil, "border")
frame.fundo:SetTexture ("Interface\\AddOns\\Details\\images\\custom_bg")
frame.fundo:SetPoint ("topleft", frame, "topleft")
@@ -210,16 +226,7 @@ local function CreateCustomWindow()
fundoBrilha:SetPoint ("left", frame.MainMenu [atributo].icon , "right", -20, -10)
--[[
for i = 1, 5 do
if (sub_atributos [atributo].lista[i]) then
frame.SubMenu [i].text:SetText (sub_atributos [atributo].lista[i])
frame.SubMenu [i]:Show()
else
frame.SubMenu [i]:Hide()
end
end
--]]
frame.selectAttributeDropdown:Select (1, true)
end
frame.MainMenu = {}
@@ -245,6 +252,8 @@ local function CreateCustomWindow()
local half = 0.00048828125
local size = 0.03125
local att_names = {Loc ["STRING_CUSTOM_ATT1"], Loc ["STRING_CUSTOM_ATT2"], Loc ["STRING_CUSTOM_ATT3"], Loc ["STRING_CUSTOM_ATT4"]}
for i = 1, 4 do
local button = gump:NewDetailsButton (frame, frame, _, MainMenu, i, nil, 120, 15, "", "", "", "", nil, "DetailsCustomPanelAttributeButton"..i)
@@ -282,8 +291,8 @@ local function CreateCustomWindow()
button.textura:SetWidth (76)
button.textura:SetHeight (40)
button:SetPoint ("topleft", frame, "topleft", x, i*-25 + (y))
button.text:SetText (atributos.lista [i])
button:SetPoint ("topleft", frame, "topleft", x, i*-33 + (y))
button.text:SetText (att_names [i])
button.text:SetPoint ("left", button, "left", 65, 0)
button:SetFrameLevel (frame:GetFrameLevel()+2)
@@ -309,20 +318,52 @@ local function CreateCustomWindow()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> Edit Boxes
--> Edit Boxes
local xStart = 290
local WidthMax = 220
--> labels
local name_text = gump:NewLabel (frame, nil, "$parentNameBoxLabel", nil, Loc ["STRING_CUSTOM_NAME"], "GameFontHighlightLeft", 11)
local spell_text = gump:NewLabel (frame, nil, "$parentSpellBoxLabel", nil, Loc ["STRING_CUSTOM_SPELLID"])
local source_text = gump:NewLabel (frame, nil, "$parentSourceBoxLabel", nil, Loc ["STRING_CUSTOM_SOURCE"])
local target_text = gump:NewLabel (frame, nil, "$parentTargetBoxLabel", nil, Loc ["STRING_CUSTOM_TARGET"])
local subattribute_text = gump:NewLabel (frame, nil, "$parentSubAttributeBoxLabel", nil, Loc ["STRING_CUSTOM_ATTRIBUTE"])
----------> The name of the custom
local MyNameSelected = function (param1, param2, texto, editbox) --print (param1, param2, texto, editbox)
name_text:SetPoint ("topleft", frame, "topleft", xStart, -45)
subattribute_text:SetPoint ("topleft", frame, "topleft", xStart, -65)
source_text:SetPoint ("topleft", frame, "topleft", xStart, -85)
target_text:SetPoint ("topleft", frame, "topleft", xStart, -105)
spell_text:SetPoint ("topleft", frame, "topleft", xStart, -125)
--> name entry
local name_entry = gump:NewTextEntry (frame, frame, "$parentNameEntry", "TextMyNameEntry", 140, 20)
name_entry:SetFrameLevel (frame:GetFrameLevel()+2)
name_entry:SetPoint ("left", name_text, "right", 2, 0)
--> sub attribute
local on_choose_attribute = function (_, _, attribute_number)
frame.sub_atributo = attribute_number
end
local build_attribute_menu = function()
local menu = {}
local attributes = _detalhes.sub_atributos [frame.atributo].lista
local icons = _detalhes.sub_atributos [frame.atributo].icones
for index, attribute_name in ipairs (attributes) do
menu [#menu+1] = {value = index, label = attribute_name, onclick = on_choose_attribute, icon = icons [index] [1], texcoord = icons [index] [2]}
end
return menu
end
gump:NewTextBox (frame, frame, "TextMyNameEntry", SpellIDSelected, "param_1", "param_2", 100, 15, {TabOnEnterPress = true, MySpace = WidthMax})
frame ["TextMyNameEntry"]:SetFrameLevel (frame:GetFrameLevel()+2)
frame ["TextMyNameEntry"]:SetPointAndSpace ("topleft", frame, "topleft", xStart, -45, WidthMax)
frame ["TextMyNameEntry"]:SetLabelText (Loc ["STRING_CUSTOM_NAME"]..":")
----------> Spell Name ou ID
local select_attribute = gump:NewDropDown (frame, frame, "$parentAttributeDropdown", "selectAttributeDropdown", 140, 20, build_attribute_menu)
select_attribute:SetFrameLevel (frame:GetFrameLevel()+2)
select_attribute:SetPoint ("left", subattribute_text, "right", 2, 0)
--> spell id entry
local SpellIDSelected = function (param1, param2, texto, editbox)
local _ThisSpellName, _, _ThisSpellIcon = _GetSpellInfo (tonumber (texto))
if (_ThisSpellName) then
@@ -336,17 +377,12 @@ local function CreateCustomWindow()
end
end
gump:NewTextBox (frame, frame, "TextSpellIDEntry", SpellIDSelected, "param_1", "param_2", 80, 15, {TabOnEnterPress = true, MySpace = WidthMax-20})
local spellid_entry = gump:NewSpellEntry (frame, SpellIDSelected, 140, 20, nil, nil, "TextSpellIDEntry", "$parentSpellidEntry")
spellid_entry:SetPoint ("left", spell_text, "right", 2, 0)
frame ["TextSpellIDEntry"]:SetFrameLevel (frame:GetFrameLevel()+2)
frame ["TextSpellIDEntry"]:SetPointAndSpace ("topleft", frame, "topleft", xStart, -62, WidthMax-20)
frame ["TextSpellIDEntry"]:SetLabelText (Loc ["STRING_CUSTOM_SPELLID"])
local openSpellEncounter = function()
end
local frameEncounterSkill = CreateFrame ("frame", nil, frame)
frameEncounterSkill:SetPoint ("left", frame ["TextSpellIDEntry"], "right")
frameEncounterSkill:SetPoint ("left", frame ["TextSpellIDEntry"].widget, "right")
frameEncounterSkill:SetWidth (20)
frameEncounterSkill:SetHeight (20)
frameEncounterSkill:SetFrameLevel (frame:GetFrameLevel()+2)
@@ -479,8 +515,6 @@ local function CreateCustomWindow()
GameCooltip:SetOption ("HeightAnchorMod", -10)
GameCooltip:ShowCooltip()
--_detalhes.EncounterInformation [instanceTable.id] = InstanceTable
end
frameEncounterSkill:SetScript ("OnEnter", function()
@@ -492,100 +526,17 @@ local function CreateCustomWindow()
frameEncounterSkillImage:SetBlendMode ("BLEND")
end)
frame ["TextSpellIDEntry"].HaveMenu = false
frame ["TextSpellIDEntry"].OnLeaveHook = function()
_detalhes.popup.buttonOver = false
if (_detalhes.popup.ativo) then
local passou = 0
frame ["TextSpellIDEntry"]:SetScript ("OnUpdate", function (self, elapsed)
passou = passou+elapsed
if (passou > 0.3) then
if (not _detalhes.popup.mouseOver and not _detalhes.popup.buttonOver) then
_detalhes.popup:ShowMe (false)
end
frame ["TextSpellIDEntry"]:SetScript ("OnUpdate", nil)
end
end)
else
frame ["TextSpellIDEntry"]:SetScript ("OnUpdate", nil)
end
end
frame ["TextSpellIDEntry"].OnFocusLostHook = function()
frame ["TextSpellIDEntry"].HaveMenu = false
end
local OnClickMenu = function (_, _, SpellID)
frame ["TextSpellIDEntry"]:SetText (SpellID)
frame ["TextSpellIDEntry"]:PressEnter()
frame ["TextSpellIDEntry"].HaveMenu = false
_detalhes.popup:ShowMe (false)
end
local _string_lower = string.lower
local _string_sub = string.sub
frame ["TextSpellIDEntry"].TextChangeedHook = function (userChanged)
if (not userChanged) then
return
end
local texto = frame ["TextSpellIDEntry"]:GetText()
texto = _detalhes:trim (texto)
texto = _string_lower (texto)
local index = _string_sub (texto, 1, 1)
local cached = _detalhes.spellcachefull [index]
if (cached) then
local CoolTip = _G.GameCooltip
CoolTip:Reset()
CoolTip:SetType ("menu")
CoolTip:SetColor ("main", "transparent")
CoolTip:SetOwner (frame ["TextSpellIDEntry"])
CoolTip:SetOption ("NoLastSelectedBar", true)
CoolTip:SetOption ("TextSize", 9.5)
local CoolTipTable = {}
local texcoord = {0, 1, 0, 1}
local i = 1
for SpellID, SpellTable in _pairs (cached) do
if (_string_lower (SpellTable[1]):find (texto)) then
local rank = SpellTable[3]
if (not rank or rank == "") then
rank = ""
else
rank = " ("..rank..")"
end
CoolTip:AddMenu (1, OnClickMenu, SpellID, nil, nil, SpellID..": "..SpellTable[1]..rank, SpellTable[2], true)
if (i > 20) then
break
else
i = i + 1
end
end
end
frame ["TextSpellIDEntry"].HaveMenu = true
CoolTip.buttonOver = true
CoolTip:ShowCooltip()
end
end
----------> Source
--> source
local SourceSelected = function (param1, param2, texto, editbox) end
gump:NewTextBox (frame, frame, "TextSourceEntry", SourceSelected, "param_1", "param_2", 100, 15, {TabOnEnterPress = true, MySpace = WidthMax})
local source_entry = gump:NewTextEntry (frame, frame, "$parentSourceEntry", "TextSourceEntry", 140, 20)
frame ["TextSourceEntry"]:SetFrameLevel (frame:GetFrameLevel()+2)
frame ["TextSourceEntry"]:SetPointAndSpace ("topleft", frame, "topleft", xStart, -79, WidthMax)
frame ["TextSourceEntry"]:SetLabelText (Loc ["STRING_CUSTOM_SOURCE"]..":")
frame ["TextSourceEntry"]:SetPoint ("left", source_text, "right", 2, 0)
frame ["TextSourceEntry"].InputHook = function()
local texto = frame ["TextSourceEntry"]:GetText()
texto:gsub ("[raid]", "|cFFFF00FF|r[raid]")
@@ -604,26 +555,24 @@ local function CreateCustomWindow()
end
end
---------> Actor Name
local ActorNameSelected = function (param1, param2, texto, editbox) end
gump:NewTextBox (frame, frame, "TextActorNameEntry", ActorNameSelected, "param_1", "param_2", 100, 15, {TabOnEnterPress = true})
frame ["TextActorNameEntry"]: SetFrameLevel (frame:GetFrameLevel()+2)
frame ["TextActorNameEntry"]:SetPointAndSpace ("topleft", frame, "topleft", xStart, -96, WidthMax)
frame ["TextActorNameEntry"]:SetLabelText (Loc ["STRING_CUSTOM_TARGET"]..":")
--> target
local target_entry = gump:NewTextEntry (frame, frame, "$parentTargetEntry", "TextActorNameEntry", 140, 20)
frame ["TextActorNameEntry"]:SetFrameLevel (frame:GetFrameLevel()+2)
frame ["TextActorNameEntry"]:SetPoint ("left", target_text, "right", 2, 0)
--> Tab Order
frame ["TextMyNameEntry"]:SetNext (frame ["TextSpellIDEntry"])
frame ["TextSpellIDEntry"]:SetNext (frame ["TextSourceEntry"])
frame ["TextMyNameEntry"]:SetNext (frame ["TextSourceEntry"])
frame ["TextSourceEntry"]:SetNext (frame ["TextActorNameEntry"])
frame ["TextActorNameEntry"]:SetNext (frame ["TextMyNameEntry"])
frame ["TextActorNameEntry"]:Disable()
frame ["TextActorNameEntry"]:SetNext (frame ["TextSpellIDEntry"])
frame ["TextSpellIDEntry"]:SetNext (frame ["TextMyNameEntry"])
--> Tooltips
--> localize-me
frame ["TextMyNameEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPNAME"]
frame ["TextSpellIDEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPSPELL"]
frame ["TextSourceEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPSOURCE"]
frame ["TextActorNameEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPTARGET"].."\n|cFFFF0000"..Loc ["STRING_CUSTOM_TOOLTIPNOTWORKING"]
frame ["TextActorNameEntry"].tooltip = Loc ["STRING_CUSTOM_TOOLTIPTARGET"] -- .."\n|cFFFF0000"..Loc ["STRING_CUSTOM_TOOLTIPNOTWORKING"]
frame.IconTexture = "Interface\\Icons\\TEMP"
@@ -810,7 +759,7 @@ local function CreateCustomWindow()
end
local CustomName = frame ["TextMyNameEntry"].text
local SpellID = frame ["TextSpellIDEntry"].text
local SpellID = tonumber (frame ["TextSpellIDEntry"].text)
local Actor = frame ["TextActorNameEntry"].text
local Source = frame ["TextSourceEntry"].text
@@ -826,15 +775,16 @@ local function CreateCustomWindow()
return
end
if (string.len (SpellID) < 1) then
--print ("Sem id da magia")
print (Loc ["STRING_CUSTOM_NOSPELL"])
frame ["TextSpellIDEntry"]:Blink()
return
end
--if (string.len (SpellID) < 1) then
-- --print ("Sem id da magia")
-- print (Loc ["STRING_CUSTOM_NOSPELL"])
-- frame ["TextSpellIDEntry"]:Blink()
-- return
--end
_detalhes.custom [#_detalhes.custom+1] = {name = CustomName, spell = SpellID, target = Actor, source = Source, inout = InOut, icon = frame.IconTexture, attribute = Atributo, sattribute = SubAtributo}
print (Loc ["STRING_CUSTOM_CREATED"])
_detalhes.custom [#_detalhes.custom+1] = {name = CustomName, spell = SpellID, target = Actor, source = Source, icon = frame.IconTexture, attribute = Atributo, sattribute = SubAtributo}
--print (CustomName, Actor, Source, SpellID, frame.IconTexture, Atributo, SubAtributo)
_detalhes:Msg (Loc ["STRING_CUSTOM_CREATED"])
_detalhes:CloseCustomWindow()
reset()
end
@@ -842,7 +792,7 @@ local function CreateCustomWindow()
local IconButton = gump:NewDetailsButton (frame, frame, _, ChooseIcon, nil, nil, 80, 15, "", "", "", "", nil, "DetailsCustomPanelIconButton")
IconButton.text:SetText (Loc ["STRING_CUSTOM_ICON"])
IconButton.text:SetPoint ("left", IconButton, "left", 3, 0)
IconButton:SetPoint ("topleft", frame, "topleft", xStart+21, -118)
IconButton:SetPoint ("topleft", frame, "topleft", xStart+21, -158)
IconButton:SetFrameLevel (frame:GetFrameLevel()+2)
IconButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = 0, y2 = 0})
frame.iconbutton = IconButton
@@ -856,7 +806,7 @@ local function CreateCustomWindow()
local CreateButton = gump:NewDetailsButton (frame, frame, _, CreateFunction, nil, nil, 80, 15, "", "", "", "", nil, "DetailsCustomPanelCreateButton")
CreateButton.text:SetText (Loc ["STRING_CUSTOM_CREATE"])
CreateButton:SetPoint ("topleft", frame, "topleft", 413, -118)
CreateButton:SetPoint ("topleft", frame, "topleft", 413, -158)
CreateButton:SetFrameLevel (frame:GetFrameLevel()+2)
CreateButton:InstallCustomTexture (_, {x1 = -20, x2 = 0, y1 = 0, y2 = 0})
@@ -970,21 +920,21 @@ function _detalhes:InitCustom()
end
function _detalhes:OpenCustomWindow()
if (InCombatLockdown()) then
print ("|cffFF2222"..Loc ["STRING_CUSTOM_INCOMBAT"])
return
end
--if (InCombatLockdown()) then
-- print ("|cffFF2222"..Loc ["STRING_CUSTOM_INCOMBAT"])
-- return
--end
if (not _detalhes.CustomFrame.oponed) then
_detalhes.CustomFrame.oponed = true
_detalhes:BuildSpellList()
--_detalhes:BuildSpellList()
_detalhes.CustomFrame:Show()
end
end
function _detalhes:CloseCustomWindow()
_detalhes.CustomFrame.oponed = false
_detalhes:ClearSpellList()
--_detalhes:ClearSpellList()
_detalhes.CustomFrame:Hide()
end
+646 -2
View File
@@ -1,5 +1,6 @@
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local gump = _detalhes.gump
local _
@@ -7,7 +8,7 @@ local _
--local _string_len = string.len
local _math_floor = math.floor
local _ipairs = ipairs
--local _pairs = pairs
local _pairs = pairs
local _type = type
--api locals
local _CreateFrame = CreateFrame
@@ -1580,7 +1581,7 @@ function gump:CriaJanelaInfo()
--]]
end
_detalhes:CreatePlayerDetailsTab ("Avoidance", --[1] tab name
function (tabOBject, playerObject) --[2] condition
if (playerObject.isTank) then
@@ -1597,6 +1598,649 @@ function gump:CriaJanelaInfo()
avoidance_create --[5] oncreate
)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local fill_compare_actors = function (self, player, other_players)
--primeiro preenche a nossa barra
local spells_sorted = {}
for spellid, spelltable in _pairs (player.spell_tables._ActorTable) do
spells_sorted [#spells_sorted+1] = {spelltable, spelltable.total}
end
table.sort (spells_sorted, function (t1, t2) return t1[2] > t2[2] end)
self.player = player:Name()
local offset = FauxScrollFrame_GetOffset (self)
local total = player.total_without_pet
local top = spells_sorted [1] [2]
local frame2 = DetailsPlayerComparisonBox2
frame2.player = other_players [1]:Name()
local player_2_total = other_players [1].total_without_pet
local player_2_spells_sorted = {}
for spellid, spelltable in _pairs (other_players [1].spell_tables._ActorTable) do
player_2_spells_sorted [#player_2_spells_sorted+1] = {spelltable, spelltable.total}
end
table.sort (player_2_spells_sorted, function (t1, t2) return t1[2] > t2[2] end)
local player_2_top = player_2_spells_sorted [1] [2]
local player_2_spell_info = {}
for index, spelltable in _ipairs (player_2_spells_sorted) do
player_2_spell_info [spelltable[1].id] = index
end
local frame3 = DetailsPlayerComparisonBox3
frame3.player = other_players [2] and other_players [2]:Name()
local player_3_total = other_players [2] and other_players [2].total_without_pet
local player_3_spells_sorted = {}
local player_3_spell_info = {}
local player_3_top
if (other_players [2]) then
for spellid, spelltable in _pairs (other_players [2].spell_tables._ActorTable) do
player_3_spells_sorted [#player_3_spells_sorted+1] = {spelltable, spelltable.total}
end
table.sort (player_3_spells_sorted, function (t1, t2) return t1[2] > t2[2] end)
player_3_top = player_3_spells_sorted [1] [2]
for index, spelltable in _ipairs (player_3_spells_sorted) do
player_3_spell_info [spelltable[1].id] = index
end
end
for i = 1, 9 do
local bar = self.bars [i]
local index = i + offset
local data = spells_sorted [index]
if (data) then
--seta no box principal
local spellid = data [1].id
local name, _, icon = _GetSpellInfo (spellid)
bar [1]:SetTexture (icon)
bar [2].lefttext:SetText (index .. ". " .. name)
bar [2].lefttext:SetTextColor (1, 1, 1, 1)
bar [2].righttext:SetText (_detalhes:ToK2Min (data [2])) -- .. " (" .. _math_floor (data [2] / total * 100) .. "%)"
bar [2]:SetValue (data [2] / top * 100)
bar [3][1] = data [1].counter --tooltip hits
bar [3][2] = data [2] / data [1].counter --tooltip average
bar [3][3] = _math_floor (data [1].c_amt / data [1].counter * 100) --tooltip critical
bar [3][4] = spellid
--seta no segundo box
local player_2 = other_players [1]
local spell = player_2.spell_tables._ActorTable [spellid]
local bar_2 = frame2.bars [i]
if (spell) then
bar_2 [1]:SetTexture (icon)
bar_2 [2].lefttext:SetText (player_2_spell_info [spellid] .. ". " .. name)
bar_2 [2].lefttext:SetTextColor (1, 1, 1, 1)
if (data [2] > spell.total) then
local diff = data [2] - spell.total
local up = diff / data [2] * 100
bar_2 [2].righttext:SetText (_detalhes:ToK2Min (spell.total) .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = spell.total - data [2]
local down = diff / spell.total * 100
bar_2 [2].righttext:SetText (_detalhes:ToK2Min (spell.total) .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
bar_2 [2]:SetValue (spell.total / player_2_top * 100)
bar_2 [3][1] = spell.counter --tooltip hits
bar_2 [3][2] = spell.total / spell.counter --tooltip average
bar_2 [3][3] = _math_floor (spell.c_amt / spell.counter * 100) --tooltip critical
else
bar_2 [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar_2 [2].lefttext:SetText ("-- x -- x --")
bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar_2 [2].righttext:SetText ("")
bar_2 [2]:SetValue (0)
end
--seta o terceiro box
local bar_3 = frame3.bars [i]
if (player_3_total) then
local player_3 = other_players [2]
local spell = player_3.spell_tables._ActorTable [spellid]
if (spell) then
bar_3 [1]:SetTexture (icon)
bar_3 [2].lefttext:SetText (player_3_spell_info [spellid] .. ". " .. name)
bar_3 [2].lefttext:SetTextColor (1, 1, 1, 1)
if (data [2] > spell.total) then
local diff = data [2] - spell.total
local up = diff / data [2] * 100
bar_3 [2].righttext:SetText (_detalhes:ToK2Min (spell.total) .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = spell.total - data [2]
local down = diff / spell.total * 100
bar_3 [2].righttext:SetText (_detalhes:ToK2Min (spell.total) .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
bar_3 [2]:SetValue (spell.total / player_2_top * 100)
bar_3 [3][1] = spell.counter --tooltip hits
bar_3 [3][2] = spell.total / spell.counter --tooltip average
bar_3 [3][3] = _math_floor (spell.c_amt / spell.counter * 100) --tooltip critical
else
bar_3 [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar_3 [2].lefttext:SetText ("-- x -- x --")
bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar_3 [2].righttext:SetText ("")
bar_3 [2]:SetValue (0)
end
else
bar_3 [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar_3 [2].lefttext:SetText ("-- x -- x --")
bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar_3 [2].righttext:SetText ("")
bar_3 [2]:SetValue (0)
end
else
bar [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar [2].lefttext:SetText ("-- x -- x --")
bar [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar [2].righttext:SetText ("")
bar [2]:SetValue (0)
local bar_2 = frame2.bars [i]
bar_2 [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar_2 [2].lefttext:SetText ("-- x -- x --")
bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar_2 [2].righttext:SetText ("")
bar_2 [2]:SetValue (0)
local bar_3 = frame3.bars [i]
bar_3 [1]:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
bar_3 [2].lefttext:SetText ("-- x -- x --")
bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1)
bar_3 [2].righttext:SetText ("")
bar_3 [2]:SetValue (0)
end
end
for index, spelltable in _ipairs (spells_sorted) do
end
end
local refresh_comparison_box = function (self)
--atualiza a scroll
FauxScrollFrame_Update (self, math.max (self.tab.spells_amt, 10), 9, 15)
fill_compare_actors (self, self.tab.player, self.tab.players)
end
local refresh_target_box = function (self)
end
local compare_fill = function (tab, player, combat)
local players_to_compare = tab.players
DetailsPlayerComparisonBox1.name_label:SetText (player:Name())
local label2 = _G ["DetailsPlayerComparisonBox2"].name_label
local label3 = _G ["DetailsPlayerComparisonBox3"].name_label
if (players_to_compare [1]) then
label2:SetText (players_to_compare [1]:Name())
end
if (players_to_compare [2]) then
label3:SetText (players_to_compare [2]:Name())
else
label3:SetText ("Player 3")
end
refresh_comparison_box (DetailsPlayerComparisonBox1)
end
local on_enter = function (self)
local frame1 = DetailsPlayerComparisonBox1
local frame2 = DetailsPlayerComparisonBox2
local frame3 = DetailsPlayerComparisonBox3
local bar1 = frame1.bars [self.index]
local bar2 = frame2.bars [self.index]
local bar3 = frame3.bars [self.index]
frame1.tooltip:SetPoint ("bottomleft", bar1[2], "topleft", -18, 5)
frame2.tooltip:SetPoint ("bottomleft", bar2[2], "topleft", -18, 5)
frame3.tooltip:SetPoint ("bottomleft", bar3[2], "topleft", -18, 5)
local spellid = bar1[3][4]
local player1 = frame1.player
local player2 = frame2.player
local player3 = frame3.player
local hits = bar1[3][1]
local average = bar1[3][2]
local critical = bar1[3][3]
local player1_misc = info.instancia.showing (4, player1)
local player2_misc = info.instancia.showing (4, player2)
local player3_misc = info.instancia.showing (4, player3)
local player1_uptime
if (bar1[2].righttext:GetText()) then
bar1[2]:SetStatusBarColor (1, 1, 1, 1)
bar1[2].icon:SetTexCoord (.1, .9, .1, .9)
frame1.tooltip.hits_label2:SetText (hits)
frame1.tooltip.average_label2:SetText (_detalhes:ToK2Min (average))
frame1.tooltip.crit_label2:SetText (critical .. "%")
if (player1_misc) then
local spell = player1_misc.debuff_uptime_spell_tables and player1_misc.debuff_uptime_spell_tables._ActorTable and player1_misc.debuff_uptime_spell_tables._ActorTable [spellid]
if (spell) then
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
player1_uptime = spell.uptime
frame1.tooltip.uptime_label2:SetText (minutos .. "m" .. segundos .. "s")
else
frame1.tooltip.uptime_label2:SetText ("--x--x--")
end
else
frame1.tooltip.uptime_label2:SetText ("--x--x--")
end
frame1.tooltip:Show()
end
if (bar2[2].righttext:GetText()) then
bar2[2]:SetStatusBarColor (1, 1, 1, 1)
bar2[2].icon:SetTexCoord (.1, .9, .1, .9)
if (hits > bar2[3][1]) then
local diff = hits - bar2[3][1]
local up = diff / hits * 100
frame2.tooltip.hits_label2:SetText (bar2[3][1] .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar2[3][1] - hits
local down = diff / bar2[3][1] * 100
frame2.tooltip.hits_label2:SetText (bar2[3][1] .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (average > bar2[3][2]) then
local diff = average - bar2[3][2]
local up = diff / average * 100
frame2.tooltip.average_label2:SetText (_detalhes:ToK2Min (bar2[3][2]) .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar2[3][2] - average
local down = diff / bar2[3][2] * 100
frame2.tooltip.average_label2:SetText (_detalhes:ToK2Min (bar2[3][2]) .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (critical > bar2[3][3]) then
local diff = critical - bar2[3][3]
local up = diff / critical * 100
frame2.tooltip.crit_label2:SetText (bar2[3][3] .. "%" .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar2[3][3] - critical
local down = diff / bar2[3][3] * 100
frame2.tooltip.crit_label2:SetText (bar2[3][3] .. "%" .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (player2_misc) then
local spell = player2_misc.debuff_uptime_spell_tables and player2_misc.debuff_uptime_spell_tables._ActorTable and player2_misc.debuff_uptime_spell_tables._ActorTable [spellid]
if (spell) then
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
if (player1_uptime > spell.uptime) then
local diff = player1_uptime - spell.uptime
local up = diff / player1_uptime * 100
frame2.tooltip.uptime_label2:SetText (minutos .. "m" .. segundos .. "s |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = spell.uptime - player1_uptime
local down = diff / spell.uptime * 100
frame2.tooltip.uptime_label2:SetText (minutos .. "m" .. segundos .. "s |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
else
frame2.tooltip.uptime_label2:SetText ("--x--x--")
end
else
frame2.tooltip.uptime_label2:SetText ("--x--x--")
end
frame2.tooltip:Show()
end
if (bar3[2].righttext:GetText()) then
bar3[2]:SetStatusBarColor (1, 1, 1, 1)
bar3[2].icon:SetTexCoord (.1, .9, .1, .9)
if (hits > bar3[3][1]) then
local diff = hits - bar3[3][1]
local up = diff / hits * 100
frame3.tooltip.hits_label2:SetText (bar3[3][1] .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar3[3][1] - hits
local down = diff / bar3[3][1] * 100
frame3.tooltip.hits_label2:SetText (bar3[3][1] .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (average > bar3[3][2]) then
local diff = average - bar3[3][2]
local up = diff / average * 100
frame3.tooltip.average_label2:SetText (_detalhes:ToK2Min (bar3[3][2]) .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar3[3][2] - average
local down = diff / bar3[3][2] * 100
frame3.tooltip.average_label2:SetText (_detalhes:ToK2Min (bar3[3][2]) .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (critical > bar3[3][3]) then
local diff = critical - bar3[3][3]
local up = diff / critical * 100
frame3.tooltip.crit_label2:SetText (bar3[3][3] .. "%" .. " |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = bar3[3][3] - critical
local down = diff / bar3[3][3] * 100
frame3.tooltip.crit_label2:SetText (bar3[3][3] .. "%" .. " |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
if (player3_misc) then
local spell = player3_misc.debuff_uptime_spell_tables and player3_misc.debuff_uptime_spell_tables._ActorTable and player3_misc.debuff_uptime_spell_tables._ActorTable [spellid]
if (spell) then
local minutos, segundos = _math_floor (spell.uptime/60), _math_floor (spell.uptime%60)
if (player1_uptime > spell.uptime) then
local diff = player1_uptime - spell.uptime
local up = diff / player1_uptime * 100
frame3.tooltip.uptime_label2:SetText (minutos .. "m" .. segundos .. "s |cFFFF0000-(" .. _math_floor (up) .. "%)|r")
else
local diff = spell.uptime - player1_uptime
local down = diff / spell.uptime * 100
frame3.tooltip.uptime_label2:SetText (minutos .. "m" .. segundos .. "s |cFF00FF00+(" .. _math_floor (down) .. "%)|r")
end
else
frame3.tooltip.uptime_label2:SetText ("--x--x--")
end
else
frame3.tooltip.uptime_label2:SetText ("--x--x--")
end
frame3.tooltip:Show()
end
end
local on_leave = function (self)
local frame1 = DetailsPlayerComparisonBox1
local frame2 = DetailsPlayerComparisonBox2
local frame3 = DetailsPlayerComparisonBox3
local bar1 = frame1.bars [self.index]
local bar2 = frame2.bars [self.index]
local bar3 = frame3.bars [self.index]
bar1[2]:SetStatusBarColor (.5, .5, .5, 1)
bar1[2].icon:SetTexCoord (0, 1, 0, 1)
bar2[2]:SetStatusBarColor (.5, .5, .5, 1)
bar2[2].icon:SetTexCoord (0, 1, 0, 1)
bar3[2]:SetStatusBarColor (.5, .5, .5, 1)
bar3[2].icon:SetTexCoord (0, 1, 0, 1)
frame1.tooltip:Hide()
frame2.tooltip:Hide()
frame3.tooltip:Hide()
end
local compare_create = function (tab, frame)
local create_bar = function (name, parent, index, main)
local y = ((index-1) * -15) - 7
local spellicon = parent:CreateTexture (nil, "overlay")
spellicon:SetSize (14, 14)
spellicon:SetPoint ("topleft", parent, "topleft", 4, y)
spellicon:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
local bar = CreateFrame ("StatusBar", name, parent)
bar.index = index
bar:SetPoint ("topleft", spellicon, "topright", 0, 0)
bar:SetPoint ("topright", parent, "topright", -4, y)
bar:SetStatusBarTexture (_detalhes.default_texture)
bar:SetStatusBarColor (.5, .5, .5, 1)
bar:SetMinMaxValues (0, 100)
bar:SetValue (100)
bar:SetHeight (14)
bar.icon = spellicon
bar:SetScript ("OnEnter", on_enter)
bar:SetScript ("OnLeave", on_leave)
bar.lefttext = bar:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall")
local _, size, flags = bar.lefttext:GetFont()
local font = SharedMedia:Fetch ("font", "Arial Narrow")
bar.lefttext:SetFont (font, 11, "outline")
bar.lefttext:SetPoint ("left", bar, "left", 2, 0)
bar.lefttext:SetJustifyH ("left")
bar.lefttext:SetTextColor (1, 1, 1, 1)
bar.lefttext:SetNonSpaceWrap (true)
bar.lefttext:SetWordWrap (false)
if (main) then
bar.lefttext:SetWidth (110)
else
bar.lefttext:SetWidth (70)
end
bar.righttext = bar:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall")
bar.righttext:SetPoint ("right", bar, "right", -2, 0)
bar.righttext:SetJustifyH ("right")
bar.righttext:SetTextColor (1, 1, 1, 1)
tinsert (parent.bars, {spellicon, bar, {0, 0, 0}})
end
local create_tooltip = function (name)
local tooltip = CreateFrame ("frame", name, UIParent)
tooltip:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], tile = true, tileSize = 16, edgeSize = 12, insets = {left = 1, right = 1, top = 1, bottom = 1},})
tooltip:SetBackdropColor (0, 0, 0, 1)
tooltip:SetSize (175, 67)
tooltip:SetFrameStrata ("tooltip")
local background = tooltip:CreateTexture (nil, "artwork")
background:SetTexture ([[Interface\SPELLBOOK\Spellbook-Page-1]])
background:SetTexCoord (.6, 0.1, 0, 0.64453125)
background:SetVertexColor (1, 1, 1, 0.2)
background:SetPoint ("topleft", tooltip, "topleft", 2, -4)
background:SetPoint ("bottomright", tooltip, "bottomright", -4, 2)
tooltip.hits_label = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.hits_label:SetPoint ("topleft", tooltip, "topleft", 10, -10)
tooltip.hits_label:SetText ("Total Hits:")
tooltip.hits_label:SetJustifyH ("left")
tooltip.hits_label2 = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.hits_label2:SetPoint ("topright", tooltip, "topright", -10, -10)
tooltip.hits_label2:SetText ("0")
tooltip.hits_label2:SetJustifyH ("right")
tooltip.average_label = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.average_label:SetPoint ("topleft", tooltip, "topleft", 10, -22)
tooltip.average_label:SetText ("Average:")
tooltip.average_label:SetJustifyH ("left")
tooltip.average_label2 = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.average_label2:SetPoint ("topright", tooltip, "topright", -10, -22)
tooltip.average_label2:SetText ("0")
tooltip.average_label2:SetJustifyH ("right")
tooltip.crit_label = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.crit_label:SetPoint ("topleft", tooltip, "topleft", 10, -34)
tooltip.crit_label:SetText ("Critical:")
tooltip.crit_label:SetJustifyH ("left")
tooltip.crit_label2 = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.crit_label2:SetPoint ("topright", tooltip, "topright", -10, -34)
tooltip.crit_label2:SetText ("0")
tooltip.crit_label2:SetJustifyH ("right")
tooltip.uptime_label = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.uptime_label:SetPoint ("topleft", tooltip, "topleft", 10, -46)
tooltip.uptime_label:SetText ("Uptime:")
tooltip.uptime_label:SetJustifyH ("left")
tooltip.uptime_label2 = tooltip:CreateFontString (nil, "overlay", "GameFontHighlightSmall")
tooltip.uptime_label2:SetPoint ("topright", tooltip, "topright", -10, -46)
tooltip.uptime_label2:SetText ("0")
tooltip.uptime_label2:SetJustifyH ("right")
return tooltip
end
local frame1 = CreateFrame ("scrollframe", "DetailsPlayerComparisonBox1", frame, "FauxScrollFrameTemplate")
frame1:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 14, refresh_comparison_box) end)
frame1:SetSize (175, 150)
frame1:SetPoint ("topleft", frame, "topleft", 10, -30)
frame1:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
frame1:SetBackdropColor (0, 0, 0, .7)
frame1.bars = {}
frame1.tab = tab
frame1.tooltip = create_tooltip ("DetailsPlayerComparisonBox1Tooltip")
local playername1 = frame1:CreateFontString (nil, "overlay", "GameFontNormal")
playername1:SetPoint ("bottomleft", frame1, "topleft", 2, 0)
playername1:SetText ("Player 1")
frame1.name_label = playername1
--criar as barras do frame1
for i = 1, 9 do
create_bar ("DetailsPlayerComparisonBox1Bar"..i, frame1, i, true)
end
--cria o box dos targets
local target1 = CreateFrame ("scrollframe", "DetailsPlayerComparisonTarget1", frame, "FauxScrollFrameTemplate")
target1:SetScript ("OnVerticalScroll", function (self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 14, refresh_target_box) end)
target1:SetSize (175, 70)
target1:SetPoint ("topleft", frame1, "bottomleft", 0, -10)
target1:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
target1:SetBackdropColor (0, 0, 0, .7)
target1.bars = {}
target1.tab = tab
--criar as barras do target1
for i = 1, 4 do
create_bar ("DetailsPlayerComparisonTarget1Bar"..i, target1, i, true)
end
--------------------------------------------
local frame2 = CreateFrame ("frame", "DetailsPlayerComparisonBox2", frame)
local frame3 = CreateFrame ("frame", "DetailsPlayerComparisonBox3", frame)
frame2:SetPoint ("topleft", frame1, "topright", 25, 0)
frame2:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
frame2:SetSize (170, 150)
frame2:SetBackdropColor (0, 0, 0, .7)
frame2.bars = {}
frame2.tooltip = create_tooltip ("DetailsPlayerComparisonBox2Tooltip")
local playername2 = frame2:CreateFontString (nil, "overlay", "GameFontNormal")
playername2:SetPoint ("bottomleft", frame2, "topleft", 2, 0)
playername2:SetText ("Player 2")
frame2.name_label = playername2
--criar as barras do frame2
for i = 1, 9 do
create_bar ("DetailsPlayerComparisonBox2Bar"..i, frame2, i)
end
--cria o box dos targets
local target2 = CreateFrame ("frame", "DetailsPlayerComparisonTarget2", frame)
target2:SetSize (170, 70)
target2:SetPoint ("topleft", frame2, "bottomleft", 0, -10)
target2:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
target2:SetBackdropColor (0, 0, 0, .7)
target2.bars = {}
--criar as barras do target2
for i = 1, 4 do
create_bar ("DetailsPlayerComparisonTarget2Bar"..i, target2, i)
end
frame3:SetPoint ("topleft", frame2, "topright", 5, 0)
frame3:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
frame3:SetSize (170, 150)
frame3:SetBackdropColor (0, 0, 0, .7)
frame3.bars = {}
frame3.tooltip = create_tooltip ("DetailsPlayerComparisonBox3Tooltip")
local playername3 = frame3:CreateFontString (nil, "overlay", "GameFontNormal")
playername3:SetPoint ("bottomleft", frame3, "topleft", 2, 0)
playername3:SetText ("Player 3")
frame3.name_label = playername3
--criar as barras do frame3
for i = 1, 9 do
create_bar ("DetailsPlayerComparisonBox3Bar"..i, frame3, i)
end
--cria o box dos targets
local target3 = CreateFrame ("frame", "DetailsPlayerComparisonTarget3", frame)
target3:SetSize (170, 70)
target3:SetPoint ("topleft", frame3, "bottomleft", 0, -10)
target3:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", tile = true, tileSize = 16, edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 1},})
target3:SetBackdropColor (0, 0, 0, .7)
target3.bars = {}
--criar as barras do target1
for i = 1, 4 do
create_bar ("DetailsPlayerComparisonTarget3Bar"..i, target3, i)
end
end
-- ~compare
_detalhes:CreatePlayerDetailsTab ("Compare", --[1] tab name
function (tabOBject, playerObject) --[2] condition
local same_class = {}
local class = playerObject.classe
local my_spells = {}
local my_spells_total = 0
--> build my spell list
for spellid, _ in _pairs (playerObject.spell_tables._ActorTable) do
my_spells [spellid] = true
my_spells_total = my_spells_total + 1
end
tabOBject.players = {}
tabOBject.player = playerObject
tabOBject.spells_amt = my_spells_total
for index, actor in _ipairs (info.instancia.showing [info.atributo]._ActorTable) do
if (actor.classe == class and actor ~= playerObject) then
local same_spells = 0
for spellid, _ in _pairs (actor.spell_tables._ActorTable) do
if (my_spells [spellid]) then
same_spells = same_spells + 1
end
end
local match_percentage = same_spells / my_spells_total * 100
if (match_percentage > 30) then
tinsert (tabOBject.players, actor)
end
end
end
if (#tabOBject.players > 0) then
return true
end
return false
--return true
end,
compare_fill, --[3] fill function
nil, --[4] onclick
compare_create --[5] oncreate
)
function este_gump:ShowTabs()
local amt_positive = 0
+5 -5
View File
@@ -42,7 +42,7 @@ function _detalhes:CreateOrOpenNewsWindow()
local frame_upper = CreateFrame ("scrollframe", nil, frame)
local frame_lower = CreateFrame ("frame", nil, frame_upper)
frame_lower:SetSize (450, 390)
frame_lower:SetSize (450, 2000)
frame_upper:SetPoint ("topleft", frame, "topleft", 15, -70)
frame_upper:SetWidth (465)
frame_upper:SetHeight (400)
@@ -66,7 +66,7 @@ function _detalhes:CreateOrOpenNewsWindow()
slider:SetOrientation ("vertical");
slider:SetSize (16, 399)
slider:SetPoint ("topleft", frame_upper, "topright")
slider:SetMinMaxValues (0, 1000)
slider:SetMinMaxValues (0, 2000)
slider:SetValue(0)
slider:SetScript("OnValueChanged", function (self)
frame_upper:SetVerticalScroll (self:GetValue())
@@ -78,8 +78,8 @@ function _detalhes:CreateOrOpenNewsWindow()
if (IsShiftKeyDown() and (delta > 0)) then
slider:SetValue(0)
elseif (IsShiftKeyDown() and (delta < 0)) then
slider:SetValue (1000)
elseif ((delta < 0) and (current < 1000)) then
slider:SetValue (2000)
elseif ((delta < 0) and (current < 2000)) then
slider:SetValue (current + 20)
elseif ((delta > 0) and (current > 1)) then
slider:SetValue (current - 20)
@@ -93,7 +93,7 @@ function _detalhes:CreateOrOpenNewsWindow()
texto:SetJustifyV ("top")
texto:SetTextColor (1, 1, 1)
texto:SetWidth (450)
texto:SetHeight (1400)
texto:SetHeight (2500)
-- /script _detalhes.OpenNewsWindow()
--> forum text
local forum_button = CreateFrame ("Button", "DetailsNewsWindowForumButton", frame, "OptionsButtonTemplate")
+5 -2
View File
@@ -1932,6 +1932,7 @@ function CreateAlertFrame (baseframe, instancia)
frame_upper:SetPoint ("left", baseframe, "left", 3, 0)
frame_upper:SetPoint ("right", baseframe, "right", -3, 0)
frame_upper:SetHeight (13)
frame_upper:SetFrameStrata ("fullscreen")
local frame_lower = CreateFrame ("frame", "DetailsAlertFrameScrollChild" .. instancia.meu_id, frame_upper)
frame_lower:SetHeight (25)
@@ -2759,11 +2760,9 @@ function gump:CriaNovaBarra (instancia, index)
instancia:SetFontSize (esta_barra.texto_esquerdo, instancia.row_info.font_size)
instancia:SetFontFace (esta_barra.texto_esquerdo, instancia.row_info.font_face_file)
--_detalhes.font_pool:add (esta_barra.texto_esquerdo)
instancia:SetFontSize (esta_barra.texto_direita, instancia.row_info.font_size)
instancia:SetFontFace (esta_barra.texto_direita, instancia.row_info.font_face_file)
--_detalhes.font_pool:add (esta_barra.texto_direita)
if (instancia.row_info.textL_outline) then
instancia:SetFontOutline (esta_barra.texto_esquerdo, instancia.row_info.textL_outline)
@@ -3267,6 +3266,10 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
amount = self.hide_in_combat_alpha / 100
self.combat_changes_alpha = amount
rowsamount = amount
if (_detalhes.pet_battle) then
amount = 0
rowsamount = 0
end
else
if (self.menu_alpha.enabled) then --auto transparency
if (self.is_interacting) then
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
View File
@@ -219,6 +219,9 @@ function _G._detalhes:Start()
self.listener:RegisterEvent ("ENCOUNTER_START")
self.listener:RegisterEvent ("ENCOUNTER_END")
self.listener:RegisterEvent ("PET_BATTLE_OPENING_START")
self.listener:RegisterEvent ("PET_BATTLE_CLOSE")
--self.listener:RegisterAllEvents()
@@ -1039,6 +1042,7 @@ function _G._detalhes:Start()
function _detalhes:OpenOptionsWindowAtStart()
--_detalhes:OpenOptionsWindow (_detalhes.tabela_instancias[1])
--print (_G ["DetailsClearSegmentsButton1"]:GetSize())
--_detalhes:OpenCustomWindow()
end
_detalhes:ScheduleTimer ("OpenOptionsWindowAtStart", 2)