From fa4e6376c6c1323f32230d7b25717ced4beeefb1 Mon Sep 17 00:00:00 2001 From: Tercio Date: Tue, 29 Oct 2013 03:33:50 -0200 Subject: [PATCH] - added ignore list for pets which owner can't be found. - added class color and icon for frags. - added an options to capture only frags on enemy players. - fixed an issue with report during combat lockdown. - fixed some bugs with pet owner recognition. - parser code clean up. - added API: _detalhes:hex (number) return a hex stringr. - segment available freeze text are more brighter now. --- boot.lua | 5 +- classes/classe_damage.lua | 35 ++++-- classes/classe_heal.lua | 2 +- classes/container_historico.lua | 3 +- classes/container_pets.lua | 79 +++++++++--- core/control.lua | 8 +- core/meta.lua | 9 +- core/parser.lua | 205 +++++++++++--------------------- core/util.lua | 12 ++ functions/savedata.lua | 6 +- functions/slash.lua | 36 +++++- gumps/janela_options.lua | 11 +- gumps/janela_principal.lua | 13 +- locales/Details-enUS.lua | 2 +- locales/Details-ptBR.lua | 2 +- startup.lua | 4 + 16 files changed, 240 insertions(+), 192 deletions(-) diff --git a/boot.lua b/boot.lua index 2c7b91b2..e141bda4 100644 --- a/boot.lua +++ b/boot.lua @@ -8,7 +8,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.userversion = "v1.5.2" + _detalhes.userversion = "v1.5.3" _detalhes.version = "Alpha 009" _detalhes.realversion = 9 @@ -54,6 +54,9 @@ do --> cache de grupo _detalhes.cache_damage_group = {} _detalhes.cache_healing_group = {} + --> ignored pets + _detalhes.pets_ignored = {} + _detalhes.pets_no_owner = {} --> Plugins --> raid ------------------------------------------------------------------- diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index dfd42ea2..24db20c2 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -323,11 +323,19 @@ function atributo_damage:AtualizarFrags (tabela, qual_barra, colocacao, instanci end --> ele nao come o texto quando a instância esta muito pequena - - esta_barra.textura:SetVertexColor (1, 1, 1) - 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) + + esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [tabela [3]])) + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + + if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER") 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 ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (_unpack (_detalhes.class_coords [tabela [3]])) --very slow method + 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) @@ -403,11 +411,22 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex index = index + 1 + local actor_classe = showing._NameIndexTable [fragName] --> get index + if (actor_classe) then + actor_classe = showing._ActorTable [actor_classe] --> get object + actor_classe = actor_classe.classe + end + + if (not actor_classe) then + actor_classe = "UNGROUPPLAYER" + end + if (ntable [index]) then ntable [index] [1] = fragName ntable [index] [2] = fragAmount + ntable [index] [3] = actor_classe else - ntable [index] = {fragName, fragAmount} + ntable [index] = {fragName, fragAmount, actor_classe} end end @@ -432,7 +451,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex if (exportar) then local export = {} for i = 1, index do - export [i] = {ntable[i][1], ntable[i][2]} + export [i] = {ntable[i][1], ntable[i][2], ntable[i][3]} end return export end @@ -485,7 +504,7 @@ function atributo_damage:RefreshWindow (instancia, tabela_do_combate, forcar, ex --> organiza as tabelas - if (_detalhes.in_combat and instancia.segmento == 0) then + if (_detalhes.in_combat and instancia.segmento == 0 and not exportar) then using_cache = true end diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 14221fb1..421fe8fa 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -247,7 +247,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo elseif (instancia.modo == modo_GROUP) then --> mostrando GROUP - if (_detalhes.in_combat and instancia.segmento == 0) then + if (_detalhes.in_combat and instancia.segmento == 0 and not exportar) then using_cache = true end diff --git a/classes/container_historico.lua b/classes/container_historico.lua index a6c931b7..1fb35bf1 100644 --- a/classes/container_historico.lua +++ b/classes/container_historico.lua @@ -155,9 +155,10 @@ function historico:resetar() end _table_wipe (_detalhes.tabela_vigente) _table_wipe (_detalhes.tabela_overall) - _table_wipe (_detalhes.tabela_pets.pets) _table_wipe (_detalhes.spellcache) + _detalhes:LimparPets() + -- novo container de historico _detalhes.tabela_historico = historico:NovoHistorico() --joga fora a tabela antiga e cria uma nova --novo container para armazenar pets diff --git a/classes/container_pets.lua b/classes/container_pets.lua index 8d6be25d..6dc7c971 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -13,6 +13,13 @@ local _GetNumGroupMembers = GetNumGroupMembers -- lua locals local _setmetatable = setmetatable +local _bit_band = bit.band --lua local +local _pairs = pairs +local _ipairs = ipairs +local _table_wipe = table.wipe + +--details locals +local is_ignored = _detalhes.pets_ignored function container_pets:NovoContainer() local esta_tabela = {} @@ -22,19 +29,27 @@ function container_pets:NovoContainer() return esta_tabela end +local OBJECT_TYPE_PET = 0x00001000 +local EM_GRUPO = 0x00000007 +local PET_EM_GRUPO = 0x00001007 + function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) + --> sair se o pet estiver na ignore + if (is_ignored [pet_serial]) then + return + end + + --> buscar pelo pet no container de pets local busca = self.pets [pet_serial] - local dono_nome, dono_serial, dono_flags - if (busca) then - --debug: print ("achou o pet no container de donos") - dono_nome, dono_serial, dono_flags = busca[1], busca[2], busca[3] - return pet_nome .." <"..dono_nome..">", dono_nome, dono_serial, dono_flags + return pet_nome .." <"..busca[1]..">", busca[1], busca[2], busca[3] --> [1] dono nome [2] dono serial [3] dono flag end + --> buscar pelo pet na raide + local dono_nome, dono_serial, dono_flags + if (_IsInRaid()) then - --print ("estou em RAIDE") for i = 1, _GetNumGroupMembers() do if (pet_serial == _UnitGUID ("raidpet"..i)) then dono_serial = _UnitGUID ("raid"..i) @@ -47,16 +62,15 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) end dono_nome = nome - if (nome:find ("Unknown")) then + --if (nome:find ("Unknown")) then --print ("owner name with Unknown: ", nome) - end + --end --print ("Dono encontrado na raide",nome,realm) end end elseif (_IsInGroup()) then - --print ("DEBUG estou em PARTY") for i = 1, _GetNumGroupMembers()-1 do if (pet_serial == _UnitGUID ("partypet"..i)) then dono_serial = _UnitGUID ("party"..i) @@ -89,17 +103,27 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) if (dono_nome) then --print ("dono encontrado, adicionando ao cache") - self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo} --> adicionada a flag emulada + self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true} --> adicionada a flag emulada return pet_nome .." <"..dono_nome..">", dono_nome, dono_serial, dono_flags else --if (_GetNumGroupMembers() > 0) then --print ("DEBUG: Pet sem dono: "..pet_nome) --end --print ("DEBUG Nao foi possivel achar o dono de "..pet_nome) + + if (pet_flags and _bit_band (pet_flags, OBJECT_TYPE_PET) ~= 0) then --> é um pet + if (not _detalhes.pets_no_owner [pet_serial] and _bit_band (pet_flags, EM_GRUPO) ~= 0) then + _detalhes.pets_no_owner [pet_serial] = {pet_nome, pet_flags} + _detalhes:Msg ("PET sem dono:", pet_nome) + end + else + is_ignored [pet_serial] = true + end end - return nil, nil, nil, nil - + --> não pode encontrar o dono do pet, coloca-lo na ignore + + return end --> ao ter raid roster update, precisa dar foreach no container de pets e verificar as flags @@ -122,7 +146,7 @@ function container_pets:BuscarPets() end --print ("pet found: ", nome) --print ("bp dono encontrado na raide:",nome, realm) - _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("raidpet"..i), 2600, _UnitGUID ("raid"..i), nome, 0x514, true) + _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("raidpet"..i), 0x1114, _UnitGUID ("raid"..i), nome, 0x514) end end end @@ -142,7 +166,7 @@ function container_pets:BuscarPets() end --print ("pet found: ", nome) --print ("bp dono encontrado no grupo:",nome, realm) - _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("partypet"..i), 2600, _UnitGUID ("party"..i), nome, 0x514) + _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("partypet"..i), 0x1114, _UnitGUID ("party"..i), nome, 0x514) end end end @@ -150,9 +174,15 @@ function container_pets:BuscarPets() end end -function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags, fromSearch) +-- 4372 = 1114 -> pet control player -> friendly -> aff raid + +function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, dono_nome, dono_flags) - self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo} + if (pet_flags and _bit_band (pet_flags, OBJECT_TYPE_PET) ~= 0 and _bit_band (pet_flags, EM_GRUPO) ~= 0) then + self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true} + else + self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo} + end --if (fromSearch) then -- local d = self.pets [pet_serial] @@ -165,6 +195,23 @@ function container_pets:Adicionar (pet_serial, pet_nome, pet_flags, dono_serial, end +function _detalhes:WipePets() + return _table_wipe (_detalhes.tabela_pets.pets) +end + +function _detalhes:LimparPets() + --> elimina pets antigos + local _new_PetTable = {} + for PetSerial, PetTable in _pairs (_detalhes.tabela_pets.pets) do + if ( (PetTable[4] + _detalhes.intervalo_coleta > _detalhes._tempo + 1) or (PetTable[5] and PetTable[4] + 43200 > _detalhes._tempo) ) then + _new_PetTable [PetSerial] = PetTable + end + end + --a tabela antiga será descartada pelo garbage collector. + --_table_wipe (_detalhes.tabela_pets.pets) + _detalhes.tabela_pets.pets = _new_PetTable +end + local have_schedule = false function _detalhes:UpdatePets() have_schedule = false diff --git a/core/control.lua b/core/control.lua index 76e75dfb..328e0834 100644 --- a/core/control.lua +++ b/core/control.lua @@ -216,9 +216,7 @@ _detalhes:InstanciaCallFunction (_detalhes.InstanciaFadeBarras, -1) --> esconde todas as barras _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) --> atualiza o showing end - - _table_wipe (_detalhes.encounter) - + --> conta o tempo na tabela overall -- start time at overall table if (_detalhes.tabela_overall.end_time) then _detalhes.tabela_overall.start_time = _tempo - (_detalhes.tabela_overall.end_time - _detalhes.tabela_overall.start_time) @@ -246,6 +244,10 @@ --> é o timer que ve se o jogador ta em combate ou não -- check if any party or raid members are in combat _detalhes.tabela_vigente.verifica_combate = _detalhes:ScheduleRepeatingTimer ("EstaEmCombate", 1) + _table_wipe (_detalhes.encounter) + + _table_wipe (_detalhes.pets_ignored) + _table_wipe (_detalhes.pets_no_owner) _detalhes.container_pets:BuscarPets() _table_wipe (_detalhes.cache_damage_group) diff --git a/core/meta.lua b/core/meta.lua index c5ee775e..6638be61 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -914,14 +914,7 @@ end --> elimina pets antigos - local _new_PetTable = {} - for PetSerial, PetTable in _pairs (_detalhes.tabela_pets.pets) do - if (PetTable[4] + _detalhes.intervalo_coleta > _detalhes._tempo + 1) then - _new_PetTable [PetSerial] = PetTable - end - end - _table_wipe (_detalhes.tabela_pets.pets) - _detalhes.tabela_pets.pets = _new_PetTable + _detalhes:LimparPets() --> wipa container de escudos _table_wipe (_detalhes.escudos) diff --git a/core/parser.lua b/core/parser.lua index 71d90c2c..8978c4a7 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -125,10 +125,6 @@ ------------------------------------------------------------------------------------------------ --> early checks and fixes - --if (alvo_name == "Ditador") then - --print ("resisted",resisted, "blocked",blocked, "absorbed",absorbed, "critical",critical, "glacing",glacing, "crushing",crushing) - --end - if (who_serial == "0x0000000000000000") then if (who_flags and _bit_band (who_flags, OBJECT_TYPE_PETS) ~= 0) then --> é um pet --> pets must have an serial @@ -144,16 +140,7 @@ --> no actor name, use spell name instead who_name = "[*] "..spellname end - - --[[ - if (who_name:find ("[*]")) then - print ("Objeto [*]:", who_name, "flag:", who_flags) - if (_bit_band (who_flags, AFFILIATION_GROUP) ~= 0) then - print ("A flag ja veio com grupo") - end - end - --]] - + ------------------------------------------------------------------------------------------------ --> check if need start an combat @@ -176,13 +163,6 @@ ------------------------------------------------------------------------------------------------ --> get actors - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true) - local jogador_alvo, alvo_dono, alvo_name = _current_damage_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - --]] - --[ - --> damager local este_jogador, meu_dono = damage_cache [who_name] or damage_cache_pets [who_serial], damage_cache_petsOwners [who_serial] @@ -234,8 +214,6 @@ --> last event este_jogador.last_event = _tempo - --jogador_alvo.last_event = _tempo - --shadow.last_event = _tempo ------------------------------------------------------------------------------------------------ --> group checks and avoidance @@ -326,13 +304,9 @@ ------------------------------------------------------------------------------------------------ --> firendly fire - --if (_bit_band (who_flags, REACTION_FRIENDLY) ~= 0 and _bit_band (alvo_flags, REACTION_FRIENDLY) ~= 0) then + --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 - - --> investigation about mind control and reaction switch done - --> details will do count mind control and reaction switch as normal damage. - --> reaction switch normally came as 0x548 flag on players and 0x1148 for pets. - + este_jogador.friendlyfire_total = este_jogador.friendlyfire_total + amount shadow.friendlyfire_total = shadow.friendlyfire_total + amount @@ -366,6 +340,7 @@ meu_dono.total = meu_dono.total + amount --> e adiciona o dano ao pet meu_dono.shadow.total = meu_dono.shadow.total + amount --> e adiciona o dano ao pet + --> add owner targets local owner_target = meu_dono.targets._NameIndexTable [alvo_name] if (not owner_target) then owner_target = meu_dono.targets:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --retorna o objeto classe_target -> ALVO_DA_HABILIDADE:NovaTabela() @@ -451,8 +426,6 @@ end return spell:AddMiss (alvo_serial, alvo_name, alvo_flags, who_name, missType) end - - ----------------------------------------------------------------------------------------------------------------------------------------- --> SUMMON serach key: ~summon | @@ -460,23 +433,20 @@ function parser:summon (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, spellid, spellName) + --> pet summon another pet local sou_pet = _detalhes.tabela_pets.pets [who_serial] if (sou_pet) then --> okey, ja é um pet - --print ("PET sumonando PET: who_name -> " .. who_name .. " meu dono -> "..sou_pet[1]) who_name, who_serial, who_flags = sou_pet[1], sou_pet[2], sou_pet[3] end local alvo_pet = _detalhes.tabela_pets.pets [alvo_serial] if (alvo_pet) then - --print ("PET ALVO sumonando PET ALVO: who_name -> " .. who_name .. " meu dono -> "..sou_pet[1]) who_name, who_serial, who_flags = alvo_pet[1], alvo_pet[2], alvo_pet[3] end return _detalhes.tabela_pets:Adicionar (alvo_serial, alvo_name, alvo_flags, who_serial, who_name, who_flags) end - - ----------------------------------------------------------------------------------------------------------------------------------------- --> HEALING serach key: ~heal | ----------------------------------------------------------------------------------------------------------------------------------------- @@ -520,11 +490,6 @@ --> get actors --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_heal_container:PegarCombatente (who_serial, who_name, who_flags, true) - local jogador_alvo, alvo_dono, alvo_name = _current_heal_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - --]] - --[ local este_jogador, meu_dono = healing_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_heal_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -540,13 +505,11 @@ healing_cache [alvo_name] = jogador_alvo end end - --]] + local shadow = este_jogador.shadow local shadow_of_target = jogador_alvo.shadow este_jogador.last_event = _tempo - --jogador_alvo.last_event = _tempo - --shadow.last_event = _tempo ------------------------------------------------------------------------------------------------ --> an enemy healing enemy or an player actor healing a enemy @@ -1136,12 +1099,6 @@ --> get actors --> main actor - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_energy_container:PegarCombatente (who_serial, who_name, who_flags, true) - local jogador_alvo, alvo_dono, alvo_name = _current_energy_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - --]] - --[ local este_jogador, meu_dono = energy_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_energy_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -1158,7 +1115,6 @@ energy_cache [alvo_name] = jogador_alvo end end - --]] --> actor targets local este_alvo = este_jogador.targets._NameIndexTable [alvo_name] @@ -1172,7 +1128,6 @@ local shadow_of_target = jogador_alvo.shadow este_jogador.last_event = _tempo - --shadow.last_event = _tempo ------------------------------------------------------------------------------------------------ --> amount add @@ -1237,12 +1192,6 @@ --> get actors --> main actor - - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - --]] - --[ local este_jogador, meu_dono = misc_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -1250,7 +1199,6 @@ misc_cache [who_name] = este_jogador end end - --]] local shadow = este_jogador.shadow ------------------------------------------------------------------------------------------------ @@ -1322,7 +1270,6 @@ --> update last event este_jogador.last_event = _tempo - --shadow.last_event = _tempo --> actor targets local este_alvo = este_jogador.cooldowns_defensive_targets._NameIndexTable [alvo_name] @@ -1362,11 +1309,6 @@ --> get actors --> main actor - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - --]] - --[ local este_jogador, meu_dono = misc_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -1374,7 +1316,6 @@ misc_cache [who_name] = este_jogador end end - --]] local shadow = este_jogador.shadow ------------------------------------------------------------------------------------------------ @@ -1453,6 +1394,9 @@ --print (token, time, "WHO:",who_serial, who_name, who_flags, "TARGET:",alvo_serial, alvo_name, alvo_flags, "SPELL:",spellid, spellname, spelltype) + ------------------------------------------------------------------------------------------------ + --> record cooldowns cast which can't track with buff applyed. + if (raid_members_cache [who_serial]) then --> check if is a cooldown :D if (defensive_cooldown_spell_list_no_buff [spellid]) then @@ -1469,44 +1413,29 @@ return end else - - - - --> spells de boss + --> return end + + ------------------------------------------------------------------------------------------------ + --> record how many times the spell has been casted successfully if (not who_name) then - --print ( "DISPELL sem who_name: [*] "..extraSpellName ) - --print (alvo_name) - --print (spellname) who_name = "[*] ".. spellname end if (not alvo_name) then - --print ("DISPELL sem alvo_name: [*] "..extraSpellName) - --print (who_name) - --print (spellname) alvo_name = "[*] ".. spellid end _current_misc_container.need_refresh = true _overall_misc_container.need_refresh = true - - - + ------------------------------------------------------------------------------------------------ --> get actors --> main actor - --> debug - no cache - --[[ - local este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) - --]] - --[ - - - + local este_jogador, meu_dono = misc_cache [who_name] if (not este_jogador) then --> pode ser um desconhecido ou um pet este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true) @@ -1514,7 +1443,6 @@ misc_cache [who_name] = este_jogador end end - --]] local shadow = este_jogador.shadow ------------------------------------------------------------------------------------------------ @@ -1550,8 +1478,6 @@ spell = este_jogador.spellcast_spell_tables:PegaHabilidade (spellid, true, token) end return spell:Add (alvo_serial, alvo_name, alvo_flags, who_name, token) - - -- FIM FIM end @@ -1563,15 +1489,9 @@ --> esta dando erro onde o nome é NIL, fazendo um fix para isso if (not who_name) then - --print ( "DISPELL sem who_name: [*] "..extraSpellName ) - --print (alvo_name) - --print (spellname) who_name = "[*] "..extraSpellName end if (not alvo_name) then - --print ("DISPELL sem alvo_name: [*] "..extraSpellName) - --print (who_name) - --print (spellname) alvo_name = "[*] "..spellid end @@ -1903,60 +1823,67 @@ ------------------------------------------------------------------------------------------------ --> build dead - --> frags - if (alvo_flags and _bit_band (alvo_flags, 0x00000008) ~= 0 and _in_combat) then + + if (alvo_flags and _bit_band (alvo_flags, 0x00000008) ~= 0) then -- and _in_combat --byte 1 = 8 (AFFILIATION_OUTSIDER) --> outsider death while in combat - if (not _current_combat.frags [alvo_name]) then - _current_combat.frags [alvo_name] = 1 - else - _current_combat.frags [alvo_name] = _current_combat.frags [alvo_name] + 1 - end + --> frags - if (not _overall_combat.frags [alvo_name]) then - _overall_combat.frags [alvo_name] = 1 - else - _overall_combat.frags [alvo_name] = _overall_combat.frags [alvo_name] + 1 - end + if (_detalhes.only_pvp_frags and (_bit_band (alvo_flags, 0x00000400) == 0 or (_bit_band (alvo_flags, 0x00000040) == 0 and _bit_band (alvo_flags, 0x00000020) == 0))) then --byte 2 = 4 (HOSTILE) byte 3 = 4 (OBJECT_TYPE_PLAYER) + -- 10528 // 66856 + -- print ("recusando actor ",alvo_name, " flag: ", _detalhes:hex (alvo_flags), " sem hex: ", alvo_flags) + return + end - _current_combat.frags_need_refresh = true - _overall_combat.frags_need_refresh = true - - --print (alvo_name) - - local encounter_type = _detalhes.encounter.type - if (encounter_type) then - if (encounter_type == 1 or encounter_type == 2) then + if (not _current_combat.frags [alvo_name]) then + _current_combat.frags [alvo_name] = 1 + else + _current_combat.frags [alvo_name] = _current_combat.frags [alvo_name] + 1 + end - local npcTable = _detalhes.encounter.data - local serial = tonumber (alvo_serial:sub (6, 10), 16) + if (not _overall_combat.frags [alvo_name]) then + _overall_combat.frags [alvo_name] = 1 + else + _overall_combat.frags [alvo_name] = _overall_combat.frags [alvo_name] + 1 + end + + _current_combat.frags_need_refresh = true + _overall_combat.frags_need_refresh = true - --vardump (npcTable) + --> encounter end + local encounter_type = _detalhes.encounter.type + if (encounter_type) then + if (encounter_type == 1 or encounter_type == 2) then - if (npcTable [serial] ~= nil) then --> ~= default false - - _detalhes.encounter.data [serial] = true + local npcTable = _detalhes.encounter.data + local serial = tonumber (alvo_serial:sub (6, 10), 16) - --> check if it's done - local its_done = true - for _, killed in pairs (_detalhes.encounter.data) do - if (not killed) then - its_done = false - break + --vardump (npcTable) + + if (npcTable [serial] ~= nil) then --> ~= default false + + _detalhes.encounter.data [serial] = true + + --> check if it's done + local its_done = true + for _, killed in pairs (_detalhes.encounter.data) do + if (not killed) then + its_done = false + break + end + end + + --> combat finished + if (its_done) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) combat finished: encounter objective is completed") + end + _detalhes:SairDoCombate (true) end end - --> combat finished - if (its_done) then - if (_detalhes.debug) then - _detalhes:Msg ("(debug) combat finished: encounter objective is completed") - end - _detalhes:SairDoCombate (true) - end end - end - end --> player death elseif (not _UnitIsFeignDeath (alvo_name)) then @@ -2416,13 +2343,19 @@ if (_detalhes.in_group) then --> entrou num grupo _detalhes:IniciarColetaDeLixo (true) + _detalhes:WipePets() + _detalhes:SchedulePetUpdate (1) end else _detalhes.in_group = IsInGroup() or IsInRaid() if (not _detalhes.in_group) then + --> saiu do grupo _detalhes:IniciarColetaDeLixo (true) + _detalhes:WipePets() + _detalhes:SchedulePetUpdate (1) _table_wipe (_detalhes.details_users) else + _detalhes:SchedulePetUpdate (2) _detalhes:CheckDetailsUsers() end end diff --git a/core/util.lua b/core/util.lua index 4a39e6c4..e5776b26 100644 --- a/core/util.lua +++ b/core/util.lua @@ -85,6 +85,18 @@ end return false end + + function _detalhes:hex (num) + local hexstr = '0123456789abcdef' + local s = '' + while num > 0 do + local mod = math.fmod(num, 16) + s = string.sub(hexstr, mod+1, mod+1) .. s + num = math.floor(num / 16) + end + if s == '' then s = '0' end + return s + end --> unpack more than 1 table -- thanks http://www.dzone.com/snippets/lua-unpack-multiple-tables diff --git a/functions/savedata.lua b/functions/savedata.lua index 80f7e05b..e03a5980 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -22,7 +22,8 @@ function _detalhes:SaveDataOnLogout() --> nicktag cache _detalhes_database.nick_tag_cache = _detalhes.nick_tag_cache - + _detalhes_database.only_pvp_frags = _detalhes.only_pvp_frags + --> save instances (windows) _detalhes_database.tabela_instancias = _detalhes.tabela_instancias --> options data @@ -45,7 +46,7 @@ function _detalhes:SaveDataOnLogout() _detalhes_database.animate_scroll = _detalhes.animate_scroll _detalhes_database.use_scroll = _detalhes.use_scroll -- death log - _detalhes_database.deadlog_limit = _detalhes.deadlog_limit + _detalhes_database.deadlog_limit = _detalhes.deadlog_limit -- report _detalhes_database.report_lines = _detalhes.report_lines _detalhes_database.report_to_who = _detalhes.report_to_who @@ -152,6 +153,7 @@ end --]] --> nicktag cache _detalhes.nick_tag_cache = _detalhes_database.nick_tag_cache or {} _detalhes:NickTagSetCache (_detalhes.nick_tag_cache) + _detalhes.only_pvp_frags = _detalhes_database.only_pvp_frags --> build basic containers _detalhes.tabela_historico = _detalhes_database.tabela_historico or _detalhes.historico:NovoHistorico() -- segments diff --git a/functions/slash.lua b/functions/slash.lua index 07fd0e30..982458c8 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -83,6 +83,27 @@ function SlashCmdList.DETAILS (msg, editbox) -------- debug --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + elseif (msg == "pets") then + local f = _detalhes:CreateListPanel() + + local i = 1 + for k, v in pairs (_detalhes.tabela_pets.pets) do + _detalhes.ListPanel:add (k..": " .. v[1] .. " | " .. v[2] .. " | " .. v[3], i) + i = i + 1 + end + + f:Show() + + elseif (msg == "savepets") then + + _detalhes.tabela_vigente.saved_pets = {} + + for k, v in pairs (_detalhes.tabela_pets.pets) do + _detalhes.tabela_vigente.saved_pets [k] = {v[1], v[2], v[3]} + end + + _detalhes:Msg ("pet table has been saved on current combat.") + elseif (msg == "time") then print ("GetTime()", GetTime()) print ("time()", time()) @@ -478,7 +499,7 @@ function SlashCmdList.DETAILS (msg, editbox) --end print (" ") - print (Loc ["STRING_DETAILS1"] .. Loc ["STRING_COMMAND_LIST"]) + print (Loc ["STRING_DETAILS1"] .. "(" .. _detalhes.userversion .. ") " .. Loc ["STRING_COMMAND_LIST"]) print ("|cffffaeae/details " .. Loc ["STRING_SLASH_NEW"] .. "|r: " .. Loc ["STRING_SLASH_NEW_DESC"]) print ("|cffffaeae/details " .. Loc ["STRING_SLASH_SHOW"] .. "|r: " .. Loc ["STRING_SLASH_SHOW_DESC"]) print ("|cffffaeae/details " .. Loc ["STRING_SLASH_ENABLE"] .. "|r: " .. Loc ["STRING_SLASH_ENABLE_DESC"]) @@ -492,6 +513,12 @@ function SlashCmdList.DETAILS (msg, editbox) end function _detalhes:CreateListPanel() + + local f = _detalhes.ListPanel + if (f) then + return f + end + _detalhes.ListPanel = _detalhes.gump:NewPanel (UIParent, nil, "DetailsActorsFrame", nil, 300, 600) _detalhes.ListPanel:SetPoint ("center", UIParent, "center", 300, 0) _detalhes.ListPanel.barras = {} @@ -503,6 +530,9 @@ function _detalhes:CreateListPanel() local container_barras = CreateFrame ("Frame", "Details_ActorsBarras", container_barras_window) _detalhes.ListPanel.container = container_barras + _detalhes.ListPanel.width = 500 + _detalhes.ListPanel.locked = false + container_barras_window:SetBackdrop({ edgeFile = "Interface\\DialogFrame\\UI-DialogBox-gold-Border", tile = true, tileSize = 16, edgeSize = 5, insets = {left = 1, right = 1, top = 0, bottom = 1},}) @@ -514,13 +544,13 @@ function _detalhes:CreateListPanel() container_barras:SetBackdropColor (0, 0, 0, 0) container_barras:SetAllPoints (container_barras_window) - container_barras:SetWidth (300) + container_barras:SetWidth (500) container_barras:SetHeight (150) container_barras:EnableMouse (true) container_barras:SetResizable (false) container_barras:SetMovable (true) - container_barras_window:SetWidth (260) + container_barras_window:SetWidth (460) container_barras_window:SetHeight (550) container_barras_window:SetScrollChild (container_barras) container_barras_window:SetPoint ("TOPLEFT", _detalhes.ListPanel.widget, "TOPLEFT", 21, -10) diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 00f95f0b..cea4798e 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -328,7 +328,16 @@ function _detalhes:OpenOptionsWindow (instance) end) window.maxInstancesSlider.tooltip = "Amount of windows which can be created." - + --------------- Frags PVP Mode + g:NewLabel (window, _, "$parentLabelFragsPvP", "fragsPvpLabel", "only pvp frags") + window.fragsPvpLabel:SetPoint (10, -329) + -- + g:NewSwitch (window, _, "$parentFragsPvpSlider", "fragsPvpSlider", 60, 20, _, _, _detalhes.only_pvp_frags) + window.fragsPvpSlider:SetPoint ("left", window.fragsPvpLabel, "right") + window.fragsPvpSlider.OnSwitch = function (self, _, amount) --> slider, fixedValue, sliderValue + _detalhes.only_pvp_frags = amount + end + window.fragsPvpSlider.tooltip = "Only record frags from player characters." -- Current Instalnce -------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index d1ff034d..f9b33751 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1808,13 +1808,11 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) BackGroundDisplay:SetPoint ("BOTTOMRIGHT", BaseFrame, "BOTTOMRIGHT") BackGroundDisplay:SetBackdrop (gump_fundo_backdrop) BackGroundDisplay:SetBackdropColor (instancia.bg_r, instancia.bg_g, instancia.bg_b, instancia.bg_alpha) - --BackGroundDisplay:SetBackdropColor (0, 0, 0, 1) - -- congelamento da instância ------------------------------------------------------------------------------------------------------------------------------------------------- - instancia.freeze_icon = BaseFrame:CreateTexture (nil, "OVERLAY") + instancia.freeze_icon = BackGroundDisplay:CreateTexture (nil, "OVERLAY") instancia.freeze_icon:SetTexture ("Interface\\CHARACTERFRAME\\Disconnect-Icon") instancia.freeze_icon:SetWidth (64) instancia.freeze_icon:SetHeight (64) @@ -1822,7 +1820,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) instancia.freeze_icon:SetPoint ("left", BackGroundDisplay, "left") instancia.freeze_icon:Hide() - instancia.freeze_texto = BaseFrame:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") + instancia.freeze_texto = BackGroundDisplay:CreateFontString (nil, "OVERLAY", "GameFontHighlightSmall") instancia.freeze_texto:SetHeight (64) instancia.freeze_texto:SetPoint ("left", instancia.freeze_icon, "right", -18, 0) instancia.freeze_texto:SetTextColor (1, 1, 1) @@ -1836,12 +1834,7 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando) if (not _detalhes.initializing) then instancia._version:Hide() end - --[[ - BaseFrame.wallpaper = BaseFrame:CreateTexture (nil, "border") - BaseFrame.wallpaper:Hide() - BaseFrame.wallpaperUP = BackGroundDisplay:CreateTexture (nil, "overlay") - BaseFrame.wallpaperUP:Hide() - --]] + BaseFrame.wallpaper = BackGroundDisplay:CreateTexture (nil, "overlay") BaseFrame.wallpaper:Hide() diff --git a/locales/Details-enUS.lua b/locales/Details-enUS.lua index 5506c40b..ce33701d 100644 --- a/locales/Details-enUS.lua +++ b/locales/Details-enUS.lua @@ -4,7 +4,7 @@ if not Loc then return end -------------------------------------------------------------------------------------------------------------------------------------------- -- \n\n|cFFFFFF00-|r - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.5.2|r\n\n|cFFFFFF00-|r Fixed a issue were turning off buff uptime was disabling healing done too.\n\n|cFFFFFF00-|r Avoidance statistics will not be recorded for pets, ungrouped players and monsters.\n\n|cFFFFFF00-|r Fixed a issue were sometimes buff uptime was taking too long to save data on logout.\n\n|cFFFFFF00v1.5.1|r\n\n|cFFFFFF00-|r Fixed a issue with report data were sometimes wasn't working.\n\n|cFFFFFF00v1.5.0|r\n\n|cFFFFFF00-|r Buff Uptime was been implemented over Miscellaneous attribute.\n\n|cFFFFFF00-|r Death Logs now also display cooldowns and last cooldown used.\n\n|cFFFFFF00-|r Added this window showing the latest changes.\n\n|cFFFFFF00-|r Fixed the issue were sometimes the instance stops to update when clicking on the attribute name over sword menu.\n\n|cFFFFFF00-|r Disabling Healing now shutdown the absorbs too, disabling auras doesn't interrupt absorbs any more.\n\n|cFFFFFF00-|r Friendly Fire now only track players which is inside a group.\n\n|cFFFFFF00-|r Fixed a issue were pet damage on target isn't added to owner target.\n\n|cFFFFFF00-|r Fixed a bug were refreshing a cooldown isn't counting.\n\n|cFFFFFF00-|r Added absorbs for shammy and monk 2P tier 16.\n\n|cFFFFFF00-|r Added slash command 'worldboss' and 'updates'.\n\n" + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.5.3|r\n\n|cFFFFFF00-|r Fixed a issue with report data during combat lockdown.\n\n|cFFFFFF00-|r Improved pet owner recognition and added a ignore list if couldn't find his owner.\n\n|cFFFFFF00-|r Added an option to display only frags on enemy players.\n\n|cFFFFFF00-|r Added class colors for frags.\n\n|cFFFFFF00v1.5.2|r\n\n|cFFFFFF00-|r Fixed a issue were turning off buff uptime was disabling healing done too.\n\n|cFFFFFF00-|r Avoidance statistics will not be recorded for pets, ungrouped players and monsters.\n\n|cFFFFFF00-|r Fixed a issue were sometimes buff uptime was taking too long to save data on logout.\n\n|cFFFFFF00v1.5.1|r\n\n|cFFFFFF00-|r Fixed a issue with report data were sometimes wasn't working.\n\n|cFFFFFF00v1.5.0|r\n\n|cFFFFFF00-|r Buff Uptime was been implemented over Miscellaneous attribute.\n\n|cFFFFFF00-|r Death Logs now also display cooldowns and last cooldown used.\n\n|cFFFFFF00-|r Added this window showing the latest changes.\n\n|cFFFFFF00-|r Fixed the issue were sometimes the instance stops to update when clicking on the attribute name over sword menu.\n\n|cFFFFFF00-|r Disabling Healing now shutdown the absorbs too, disabling auras doesn't interrupt absorbs any more.\n\n|cFFFFFF00-|r Friendly Fire now only track players which is inside a group.\n\n|cFFFFFF00-|r Fixed a issue were pet damage on target isn't added to owner target.\n\n|cFFFFFF00-|r Fixed a bug were refreshing a cooldown isn't counting.\n\n|cFFFFFF00-|r Added absorbs for shammy and monk 2P tier 16.\n\n|cFFFFFF00-|r Added slash command 'worldboss' and 'updates'.\n\n" Loc ["STRING_DETAILS1"] = "|cffffaeaeDetails:|r " --> color and details name diff --git a/locales/Details-ptBR.lua b/locales/Details-ptBR.lua index de93b9a3..ffcf4f64 100644 --- a/locales/Details-ptBR.lua +++ b/locales/Details-ptBR.lua @@ -3,7 +3,7 @@ if not Loc then return end -------------------------------------------------------------------------------------------------------------------------------------------- - Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.5.2|r\n\n|cFFFFFF00-|r Corrigido problema onde desativando o tempo dos buffs estava desativando tambem a cura feita.\n\n|cFFFFFF00-|r Estatisticas de Avoidance nao seram mais capturadas para pessoas foram do grupo, monstros ou ajudantes.\n\n|cFFFFFF00-|r Corrigido problema onde as vezes estava demorando muito para salvar o tempo dos buffs ao sair do jogo.\n\n|cFFFFFF00v1.5.1|r\n\n|cFFFFFF00-|r Corrigido problema ao reportar o Dps onde as vezes nao mostrava nenhum jogador.\n\n|cFFFFFF00v1.5.0|r\n\n|cFFFFFF00-|r Buff Uptime foi implementado no atributo miscelanea.\n\n|cFFFFFF00-|r Cooldowns usados agora aparecem nos registros da morte.\n\n|cFFFFFF00-|r Implementado esta janela mostrando as atualizacoes.\n\n|cFFFFFF00-|r Corrigido problema onde algumas vezes clicando no nome do atributo fazia a instancia parar de atualizar.\n\n|cFFFFFF00-|r Desativando a cura agora para as absorcoes tambem. Desligando as Auras nao interrompe as absorcoes. \n\n|cFFFFFF00-|r Fogo Amigo agora conta apenas jogadores dentro do grupo.\n\n|cFFFFFF00-|r Corrigido problema onde o dano feito por um ajudando nao estava contando no alvo do dono.\n\n|cFFFFFF00-|r Corrigido problema onde a atualizacao de um cooldown nao estava sendo contada.\n\n|cFFFFFF00-|r Adicionada as magias de absorcao para 2P tier 16.\n\n|cFFFFFF00-|r Adicionado os comandos de barra 'worldboss' e 'updates'.\n\n|cFFFFFF00-|r Corrigido problema ao reportar onde algumas vezes nao estava funcionando." + Loc ["STRING_VERSION_LOG"] = "|cFFFFFF00v1.5.3|r\n\n|cFFFFFF00-|r Corrigido problema ao reportar durante o combate.\n\n|cFFFFFF00-|r Melhorado a reconhecimento dos donos de ajudantes.\n\n|cFFFFFF00-|r Adicionada uma opcao para mostrar apenas frags em cima de jogadores inimigos.\n\n|cFFFFFF00-|r Adicionado cor e icone aos frags.\n\n|cFFFFFF00v1.5.2|r\n\n|cFFFFFF00-|r Corrigido problema onde desativando o tempo dos buffs estava desativando tambem a cura feita.\n\n|cFFFFFF00-|r Estatisticas de Avoidance nao seram mais capturadas para pessoas foram do grupo, monstros ou ajudantes.\n\n|cFFFFFF00-|r Corrigido problema onde as vezes estava demorando muito para salvar o tempo dos buffs ao sair do jogo.\n\n|cFFFFFF00v1.5.1|r\n\n|cFFFFFF00-|r Corrigido problema ao reportar o Dps onde as vezes nao mostrava nenhum jogador.\n\n|cFFFFFF00v1.5.0|r\n\n|cFFFFFF00-|r Buff Uptime foi implementado no atributo miscelanea.\n\n|cFFFFFF00-|r Cooldowns usados agora aparecem nos registros da morte.\n\n|cFFFFFF00-|r Implementado esta janela mostrando as atualizacoes.\n\n|cFFFFFF00-|r Corrigido problema onde algumas vezes clicando no nome do atributo fazia a instancia parar de atualizar.\n\n|cFFFFFF00-|r Desativando a cura agora para as absorcoes tambem. Desligando as Auras nao interrompe as absorcoes. \n\n|cFFFFFF00-|r Fogo Amigo agora conta apenas jogadores dentro do grupo.\n\n|cFFFFFF00-|r Corrigido problema onde o dano feito por um ajudando nao estava contando no alvo do dono.\n\n|cFFFFFF00-|r Corrigido problema onde a atualizacao de um cooldown nao estava sendo contada.\n\n|cFFFFFF00-|r Adicionada as magias de absorcao para 2P tier 16.\n\n|cFFFFFF00-|r Adicionado os comandos de barra 'worldboss' e 'updates'.\n\n|cFFFFFF00-|r Corrigido problema ao reportar onde algumas vezes nao estava funcionando." Loc ["STRING_DETAILS1"] = "|cffffaeaeDetalhes:|r " --> color and details name diff --git a/startup.lua b/startup.lua index f8ce9359..65585a2a 100644 --- a/startup.lua +++ b/startup.lua @@ -36,6 +36,10 @@ function _G._detalhes:Start() self.memory_ram = self.memory_ram or 64 self.deadlog_limit = self.deadlog_limit or 12 self.minimum_combat_time = self.minimum_combat_time or 5 + + if (type (self.only_pvp_frags) ~= "boolean") then + self.only_pvp_frags = false + end if (type (self.remove_realm_from_name) ~= "boolean") then self.remove_realm_from_name = true