diff --git a/boot.lua b/boot.lua index 8c8c5d17..dde7028b 100644 --- a/boot.lua +++ b/boot.lua @@ -7,9 +7,9 @@ --> global name declaration _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.userversion = "v1.4.9" - _detalhes.version = "Alpha 006" - _detalhes.realversion = 6 + _detalhes.userversion = "v1.4.12" + _detalhes.version = "Alpha 007" + _detalhes.realversion = 7 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff diff --git a/classes/classe_combate.lua b/classes/classe_combate.lua index e45cd7b9..664f5224 100644 --- a/classes/classe_combate.lua +++ b/classes/classe_combate.lua @@ -21,7 +21,6 @@ local _ipairs = ipairs --> lua api local _pairs = pairs --> lua api local _bit_band = bit.band --> lua api local _date = date --> lua api -local _UnitName = UnitName --> wow api --time hold local _tempo = time() diff --git a/classes/classe_custom.lua b/classes/classe_custom.lua index 4753b654..17fd1209 100644 --- a/classes/classe_custom.lua +++ b/classes/classe_custom.lua @@ -20,7 +20,6 @@ local _type = type --api locals local _GetSpellInfo = _detalhes.getspellinfo -local _UnitName = UnitName local _IsInRaid = IsInRaid local _IsInGroup = IsInGroup local _GetNumGroupMembers = GetNumGroupMembers diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index 612b4800..e7edbf29 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -639,6 +639,8 @@ function _detalhes:FastRefreshWindow (instancia) end end +local actor_class_color_r, actor_class_color_g, actor_class_color_b + --self = esta classe de dano function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time) -- instância, container das barras, qual barra, colocação, total?, sub atributo, forçar refresh, key @@ -713,6 +715,12 @@ function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, forcar = true end + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) end @@ -739,10 +747,11 @@ end esta_barra.statusbar:SetValue (esta_porcentagem) gump:Fade (esta_barra, "out") - if (self.classe == "PET" and self.owner) then - esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [self.owner.classe])) - else - esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [self.classe])) + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) end return self:RefreshBarra (esta_barra, instancia) @@ -787,33 +796,28 @@ end end ---[[ exported]] function _detalhes:RefreshBarra (esta_barra, instancia) - --print (self.classe) +--[[ exported]] function _detalhes:RefreshBarra (esta_barra, instancia, from_resize) - if (self.classe == "PET" and self.owner) then - esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [self.owner.classe])) - else - esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [self.classe])) + if (from_resize) then + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end end - - --esta_barra.textura:SetVertexColor (_unpack (_detalhes.class_colors [self.classe])) + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end if (self.classe == "UNKNOW") then - - --esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Pet_Type_Undead") - --esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\INV_Misc_Bone_Skull_02") - --esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Icon_PetFamily_Undead") - - --esta_barra.icone_classe:SetTexture ("Interface\\CHARACTERFRAME\\UI-StateIcon") - --esta_barra.icone_classe:SetTexCoord (0.5625, 0.90625, 0.078125, 0.4375) - - --esta_barra.icone_classe:SetTexture ("Interface\\LFGFRAME\\UI-LFG-ICON-HEROIC") - --esta_barra.icone_classe:SetTexCoord (0, 0.5625, 0, 0.5625) - 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) - + elseif (self.classe == "UNGROUPPLAYER") then if (self.enemy) then if (_detalhes.faction_against == "Horde") then @@ -833,25 +837,15 @@ end end end esta_barra.icone_classe:SetVertexColor (1, 1, 1) - + elseif (self.classe == "PET") then - --esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Ability_Hunter_Pet_Wolf") - --esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Pet_Type_Beast") - --esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) - --esta_barra.icone_classe:SetTexCoord (0, 0.25, 0.75, 1) - esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) - if (self.owner) then - esta_barra.icone_classe:SetVertexColor (_unpack (_detalhes.class_colors [self.owner.classe])) - else - esta_barra.icone_classe:SetVertexColor (_unpack (_detalhes.class_colors [self.classe])) - end - - + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + else esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") - esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method esta_barra.icone_classe:SetVertexColor (1, 1, 1) end @@ -861,11 +855,21 @@ end else esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY end - esta_barra.textura:SetVertexColor (240/255, 0, 5/255, 1) + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (240/255, 0, 5/255, 1) + end else esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". "..self.displayName) --seta o texto da esqueda end + if (instancia.row_textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) end @@ -1977,7 +1981,10 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra) local T = (meu_tempo*esta_magia.c_dmg)/esta_magia.total local P = media/media_critico*100 T = P*T/100 - local crit_dps =_cstr("%.1f", esta_magia.c_dmg/T) + local crit_dps = esta_magia.c_dmg/T + if (not crit_dps) then + crit_dps = 0 + end data[#data+1] = { esta_magia.c_amt, @@ -2082,11 +2089,6 @@ function atributo_damage:MontaTooltipAlvos (esta_barra, index) end - ---if (esta_magia.counter == esta_magia.c_amt) then --> só teve critico --- gump:SetaDetalheInfoTexto (1, nil, nil, nil, nil, nil, "DPS: "..crit_dps) ---end - --controla se o dps do jogador esta travado ou destravado function atributo_damage:Iniciar (iniciar) if (iniciar == nil) then @@ -2281,6 +2283,9 @@ atributo_damage.__sub = function (tabela1, tabela2) friendlyfire.shadow.total = friendlyfire.shadow.total - friendlyfire.total for spellid, habilidade in _pairs (friendlyfire.spell_tables._ActorTable) do -- eu di reload para trocar os talentos + if (not habilidade.shadow) then --> tapa buraco + return + end habilidade.shadow.total = habilidade.shadow.total - habilidade.total -- attempt to index field 'shadow' (a nil value) -- Deu erro denovo depois de um /reload end end diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index b9fa46b5..fdfce869 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -276,6 +276,8 @@ function atributo_energy:Custom (_customName, _combat, sub_atributo, spell, alvo end end +local actor_class_color_r, actor_class_color_g, actor_class_color_b + function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar) local esta_barra = instancia.barras[qual_barra] --> pega a referência da barra na janela @@ -303,10 +305,163 @@ function atributo_energy:AtualizaBarra (instancia, barras_container, qual_barra, gump:UpdateTooltip (qual_barra, esta_barra, instancia) end + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) end +function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) + + --> primeiro colocado + if (esta_barra.colocacao == 1) then + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then + esta_barra.statusbar:SetValue (100) + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + return self:RefreshBarra (esta_barra, instancia) + else + return + end + else + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + + esta_barra.statusbar:SetValue (esta_porcentagem) + gump:Fade (esta_barra, "out") + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + return self:RefreshBarra (esta_barra, instancia) + + else + --> agora esta comparando se a tabela da barra é diferente da tabela na atualização anterior + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posição ou se ela apenas será atualizada + + esta_barra.statusbar:SetValue (esta_porcentagem) + + esta_barra.last_value = esta_porcentagem --> reseta o ultimo valor da barra + + if (instancia.use_row_animations and forcar) then + esta_barra.tem_animacao = 0 + esta_barra:SetScript ("OnUpdate", nil) + end + + return self:RefreshBarra (esta_barra, instancia) + + elseif (esta_porcentagem ~= esta_barra.last_value) then --> continua mostrando a mesma tabela então compara a porcentagem + --> apenas atualizar + if (instancia.use_row_animations) then + + local upRow = barras_container [qual_barra-1] + if (upRow) then + if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then + esta_barra.statusbar:SetValue (esta_porcentagem) + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + esta_barra.statusbar:SetValue (esta_porcentagem) + end + esta_barra.last_value = esta_porcentagem + end + end + + end + +end + +function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) + + if (from_resize) then + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + if (self.classe == "UNKNOW") 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) + + elseif (self.classe == "UNGROUPPLAYER") then + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + else + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + end + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "PET") then + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + else + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + end + + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (240/255, 0, 5/255, 1) + end + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". "..self.displayName) --seta o texto da esqueda + end + + if (instancia.row_textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + +end --------------------------------------------- // TOOLTIPS // --------------------------------------------- function atributo_energy:KeyNames (sub_atributo) diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index d65de0ed..e5cb1305 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -323,6 +323,8 @@ function atributo_heal:Custom (_customName, _combat, sub_atributo, spell, alvo) end end +local actor_class_color_r, actor_class_color_g, actor_class_color_b + --function atributo_heal:AtualizaBarra (instancia, qual_barra, lugar, total, sub_atributo, forcar) function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time) @@ -398,9 +400,164 @@ function atributo_heal:AtualizaBarra (instancia, barras_container, qual_barra, l gump:UpdateTooltip (qual_barra, esta_barra, instancia) end + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) end +function atributo_heal:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) + + --> primeiro colocado + if (esta_barra.colocacao == 1) then + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then + esta_barra.statusbar:SetValue (100) + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + return self:RefreshBarra (esta_barra, instancia) + else + return + end + else + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + + esta_barra.statusbar:SetValue (esta_porcentagem) + gump:Fade (esta_barra, "out") + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + return self:RefreshBarra (esta_barra, instancia) + + else + --> agora esta comparando se a tabela da barra é diferente da tabela na atualização anterior + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posição ou se ela apenas será atualizada + + esta_barra.statusbar:SetValue (esta_porcentagem) + + esta_barra.last_value = esta_porcentagem --> reseta o ultimo valor da barra + + if (instancia.use_row_animations and forcar) then + esta_barra.tem_animacao = 0 + esta_barra:SetScript ("OnUpdate", nil) + end + + return self:RefreshBarra (esta_barra, instancia) + + elseif (esta_porcentagem ~= esta_barra.last_value) then --> continua mostrando a mesma tabela então compara a porcentagem + --> apenas atualizar + if (instancia.use_row_animations) then + + local upRow = barras_container [qual_barra-1] + if (upRow) then + if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then + esta_barra.statusbar:SetValue (esta_porcentagem) + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + esta_barra.statusbar:SetValue (esta_porcentagem) + end + esta_barra.last_value = esta_porcentagem + end + end + + end + +end + +function atributo_heal:RefreshBarra (esta_barra, instancia, from_resize) + + if (from_resize) then + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + if (self.classe == "UNKNOW") 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) + + elseif (self.classe == "UNGROUPPLAYER") then + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + else + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + end + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "PET") then + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + else + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + end + + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (240/255, 0, 5/255, 1) + end + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". "..self.displayName) --seta o texto da esqueda + end + + if (instancia.row_textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + +end + --------------------------------------------- // TOOLTIPS // --------------------------------------------- @@ -1202,7 +1359,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) if (esta_magia.counter > esta_magia.c_amt) then this_hps = Loc ["STRING_HPS"]..": ".._cstr ("%.1f", esta_magia.total/meu_tempo) --> localiza-me else - this_hps = Loc ["STRING_HPS"]..": 0" --> localiza-me + this_hps = Loc ["STRING_HPS"]..": "..Loc ["STRING_SEE_BELOW"] end gump:SetaDetalheInfoTexto ( index, 100, --> Localize-me @@ -1226,15 +1383,11 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) esta_magia.n_amt, normal_hits/total_hits*100, --esta_magia.n_curado/esta_magia.total*100, - "Curas Normais", --> localiza-me - "Minimo: ".._detalhes:comma_value (esta_magia.n_min), --> localiza-me - "Maximo: ".._detalhes:comma_value (esta_magia.n_max), --> localiza-me - "Media: ".._cstr ("%.1f", media_normal), --> localiza-me - "HPS: ".._cstr ("%.1f", normal_curado/T), --> localiza-me - --normal_hits.. " / ".. _cstr ("%.1f", normal_hits/total_hits*100).."%" - --normal_hits.. " / ".. _cstr ("%.1f", esta_magia.n_curado/total*100).."%" - --esta_magia.n_curado.. " / " .. normal_hits .. " / ".. _cstr ("%.1f", esta_magia.n_curado/esta_magia.total*100).."%" - --esta_magia.n_curado.. " / " .. normal_hits .. " / ".. _cstr ("%.1f", normal_hits/total_hits*100).."%" + Loc ["STRING_HEAL"], --> localiza-me + Loc ["STRING_MINIMUM"] .. ": " .. _detalhes:comma_value (esta_magia.n_min), --> localiza-me + Loc ["STRING_MAXIMUM"] .. ": " .. _detalhes:comma_value (esta_magia.n_max), --> localiza-me + Loc ["STRING_MEDIA"] .. ": " .. _cstr ("%.1f", media_normal), --> localiza-me + Loc ["STRING_HPS"] .. ": " .. _cstr ("%.1f", normal_curado/T), --> localiza-me normal_hits .. " / ".. _cstr ("%.1f", normal_hits/total_hits*100).."%" } end @@ -1245,21 +1398,20 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) local T = (meu_tempo*esta_magia.c_curado)/esta_magia.total local P = media/media_critico*100 T = P*T/100 - local crit_dps = _cstr ("%.1f", esta_magia.c_curado/T) + local crit_hps = esta_magia.c_curado/T + if (not crit_hps) then + crit_hps = 0 + end data[#data+1] = { esta_magia.c_amt, esta_magia.c_amt/total_hits*100, --esta_magia.c_curado/esta_magia.total*100, - "Curas Criticas", --> localiza-me - "Minimo: ".._detalhes:comma_value (esta_magia.c_min), --> localiza-me - "Maximo: ".._detalhes:comma_value (esta_magia.c_max), --> localiza-me - "Media: ".._cstr ("%.1f", media_critico), --> localiza-me - "HPS: ".._cstr ("%.1f", crit_dps), --> localiza-me - --esta_magia.c_amt.. " / ".._cstr ("%.1f", esta_magia.c_amt/total_hits*100).."%" - --esta_magia.c_amt.. " / ".._cstr ("%.1f", esta_magia.c_curado/total*100).."%" - --esta_magia.c_curado.. " / " .. esta_magia.c_amt .. " / ".._cstr ("%.1f", esta_magia.c_curado/esta_magia.total*100).."%" - --esta_magia.c_curado.. " / " .. esta_magia.c_amt .. " / ".._cstr ("%.1f", esta_magia.c_amt/total_hits*100).."%" + Loc ["STRING_HEAL_CRIT"], --> localiza-me + Loc ["STRING_MINIMUM"] .. ": " .. _detalhes:comma_value (esta_magia.c_min), --> localiza-me + Loc ["STRING_MAXIMUM"] .. ": " .. _detalhes:comma_value (esta_magia.c_max), --> localiza-me + Loc ["STRING_MEDIA"] .. ": " .. _cstr ("%.1f", media_critico), --> localiza-me + Loc ["STRING_HPS"] .. ": " .. _cstr ("%.1f", crit_hps), --> localiza-me esta_magia.c_amt .. " / ".._cstr ("%.1f", esta_magia.c_amt/total_hits*100).."%" } end @@ -1277,7 +1429,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) data[#data+1] = { absorbed, {["p"] = porcentagem_absorbed, ["c"] = {117/255, 58/255, 0/255}}, - "Cura Absorvida", --> localiza-me + Loc ["STRING_HEAL_ABSORBED"], --> localiza-me "", --esta_magia.glacing.curado "", "", @@ -1297,7 +1449,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) data[4] = { overheal, {["p"] = porcentagem_overheal, ["c"] = {0.5, 0.1, 0.1}}, - "Sobrecura", --> localiza-me + Loc ["STRING_OVERHEAL"], --> localiza-me "", "", "", @@ -1321,10 +1473,6 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) end ---if (esta_magia.counter == esta_magia.c_amt) then --> só teve critico --- gump:SetaDetalheInfoTexto (1, nil, nil, nil, nil, nil, "DPS: "..crit_dps) ---end - --controla se o dps do jogador esta travado ou destravado function atributo_heal:Iniciar (iniciar) if (iniciar == nil) then diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index bfab84e8..92d2c0b0 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -156,6 +156,10 @@ end self.ativa = false _detalhes:GetLowerInstanceNumber() + if (_detalhes.switch.current_instancia and _detalhes.switch.current_instancia == self) then + _detalhes.switch:CloseMe() + end + _detalhes.opened_windows = _detalhes.opened_windows-1 self:ResetaGump() gump:Fade (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_in)) @@ -629,11 +633,6 @@ end nova_instancia.meu_id = ID - --meu_nome ficará aqui pois no futuro pode ser que ponha uma opção para monitorar um jogador específico - nova_instancia.meu_nome = UnitName ("player") - - --> quantidade de habilidades que aparece no tooltip - nova_instancia.barras = {} --container que irá armazenar todas as barras nova_instancia.barraS = {nil, nil} --de x até x são as barras que estão sendo mostradas na tela nova_instancia.rolagem = false --barra de rolagem não esta sendo mostrada @@ -648,7 +647,11 @@ end ["font"] = SharedMedia:Fetch ("font", "Arial Narrow"), ["fontName"] = "Arial Narrow", ["textura"] = _detalhes.default_texture, + ["texturaBackground"] = _detalhes.default_texture, + ["texturaBackgroundColor"] = {0, 0, 0, 0}, + ["texturaBackgroundByClass"] = false, ["textureName"] = _detalhes.default_texture_name, + ["textureNameBackground"] = _detalhes.default_texture_name, ["textura_mouseover"] = "Interface\\FriendsFrame\\UI-FriendsList-Highlight", ["animar"] = true, ["fade"] = true, @@ -669,6 +672,13 @@ end nova_instancia.bg_b = _detalhes.default_bg_color nova_instancia.auto_current = true + nova_instancia.row_texture_class_colors = true + nova_instancia.row_textL_class_colors = false + nova_instancia.row_textR_class_colors = false + nova_instancia.row_textL_outline = false + nova_instancia.row_textR_outline = false + nova_instancia.fixed_row_texture_color = {0, 0, 0} + nova_instancia.fixed_row_text_color = {1, 1, 1} nova_instancia.barrasInfo["alturaReal"] = nova_instancia.barrasInfo.altura+nova_instancia.barrasInfo.espaco.entre @@ -774,10 +784,6 @@ end --> ao reiniciar o addon esta função é rodada para recriar a janela da instância --> search key: ~restaura function _detalhes:RestauraJanela (index, temp) - - --if (index ~= self.meu_id) then - --print ("DEBUG: Algo de errado, o index esta diferente do meu_id") - --end self.bg_alpha = self.bg_alpha or _detalhes.default_bg_alpha self.bg_r = self.bg_r or _detalhes.default_bg_color @@ -788,6 +794,37 @@ function _detalhes:RestauraJanela (index, temp) self.auto_current = true end + if (self.row_texture_class_colors == nil) then + self.row_texture_class_colors = true + end + + if (self.row_textL_class_colors == nil) then + self.row_textL_class_colors = false + end + if (self.row_textR_class_colors == nil) then + self.row_textR_class_colors = false + end + if (self.row_textL_outline == nil) then + self.row_textL_outline = false + end + if (self.row_textR_outline == nil) then + self.row_textR_outline = false + end + + if (self.fixed_row_texture_color == nil) then + self.fixed_row_texture_color = {0, 0, 0} + end + if (self.fixed_row_text_color == nil) then + self.fixed_row_text_color = {1, 1, 1} + end + + if (not self.barrasInfo.texturaBackground) then + self.barrasInfo.texturaBackground = _detalhes.default_texture + self.barrasInfo.texturaBackgroundColor = {0, 0, 0, 0} + self.barrasInfo.texturaBackgroundByClass = false + self.barrasInfo.textureNameBackground = _detalhes.default_texture_name + end + local _baseframe, _bgframe, _bgframe_display, _scrollframe = gump:CriaJanelaPrincipal (self.meu_id, self) self.baseframe = _baseframe @@ -887,9 +924,7 @@ function _detalhes:RestauraJanela (index, temp) self.barrasInfo.altura = self.barrasInfo.altura or 14 self.barrasInfo.alturaReal = self.barrasInfo.altura+self.barrasInfo.espaco.entre - - self:DefaultIcons (true, true, true, true) - + if (self.modo == modo_alone) then if (_detalhes.solo and _detalhes.solo ~= self.meu_id) then --> proteção para ter apenas uma instância com a janela SOLO self.modo = modo_grupo @@ -908,19 +943,43 @@ function _detalhes:RestauraJanela (index, temp) self:ReajustaGump() self:SaveMainWindowPosition() + self:DefaultIcons (true, true, true, true) + self.iniciada = true self:AtivarInstancia (temp) - end ------------------------------------------------------------------------------------------------------------------------ +function _detalhes:InstanceReset (instance) + if (instance) then + self = instance + end + _detalhes.gump:Fade (self, "in", nil, "barras") + self:AtualizaSegmentos (self) + self:AtualizaSoloMode_AfertReset() + self:ResetaGump() + _detalhes:AtualizaGumpPrincipal (-1, true) --atualiza todas as instancias +end + function _detalhes:RefreshBars (instance) if (instance) then self = instance end if (self.barras and self.barras[1]) then for index, row in _ipairs (self.barras) do + row.textura:SetTexture (self.barrasInfo.textura) + + row.background:SetTexture (self.barrasInfo.texturaBackground) + if (not self.barrasInfo.texturaBackgroundByClass) then + local c = self.barrasInfo.texturaBackgroundColor + row.background:SetVertexColor (c[1], c[2], c[3], c[4]) + else + local c = self.barrasInfo.texturaBackgroundColor + local r, g, b = row.background:GetVertexColor() + row.background:SetVertexColor (r, g, b, c[4]) + end + row.texto_esquerdo:SetFont (self.barrasInfo.font or "GameFontHighlight", self.barrasInfo.fontSize or self.barrasInfo.altura*0.75) row.texto_direita:SetFont (self.barrasInfo.font or "GameFontHighlight", self.barrasInfo.fontSize or self.barrasInfo.altura*0.75) end @@ -930,15 +989,28 @@ end function _detalhes:SetBackgroundColor (...) local r, g, b = gump:ParseColors (...) self.bgdisplay:SetBackdropColor (r, g, b, self.bg_alpha or _detalhes.default_bg_alpha) + self.baseframe:SetBackdropColor (r, g, b, self.bg_alpha or _detalhes.default_bg_alpha) self.bg_r = r self.bg_g = g self.bg_b = b end function _detalhes:SetBackgroundAlpha (alpha) + + --self.bgdisplay:SetBackdropColor (1, 1, 1, 1) + alpha = alpha or _detalhes.default_bg_alpha + + --print ("antes",alpha) + alpha = _detalhes:Scale (0, 1, 0.2, 1, alpha) - 0.8 + --print ("depois",alpha) + self.bgdisplay:SetBackdropColor (self.bg_r or _detalhes.default_bg_color, self.bg_g or _detalhes.default_bg_color, self.bg_b or _detalhes.default_bg_color, alpha) + self.baseframe:SetBackdropColor (self.bg_r or _detalhes.default_bg_color, self.bg_g or _detalhes.default_bg_color, self.bg_b or _detalhes.default_bg_color, alpha) self.bg_alpha = alpha + + --local r, g, b, a = self.bgdisplay:GetBackdropColor() + --print (a) end function _detalhes:GetSize() diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 940cd34e..69d23bcc 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -469,6 +469,8 @@ function atributo_misc:Custom (_customName, _combat, sub_atributo, spell, alvo) end end +local actor_class_color_r, actor_class_color_g, actor_class_color_b + function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, is_dead) --print (self.ress) @@ -500,11 +502,164 @@ function atributo_misc:AtualizaBarra (instancia, barras_container, qual_barra, l if (esta_barra.mouse_over and not instancia.baseframe.isMoving) then --> precisa atualizar o tooltip gump:UpdateTooltip (qual_barra, esta_barra, instancia) end + + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end return self:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) end +function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, qual_barra, barras_container) + + --> primeiro colocado + if (esta_barra.colocacao == 1) then + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then + esta_barra.statusbar:SetValue (100) + + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + gump:Fade (esta_barra, "out") + end + + return self:RefreshBarra (esta_barra, instancia) + else + return + end + else + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then + + esta_barra.statusbar:SetValue (esta_porcentagem) + gump:Fade (esta_barra, "out") + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + return self:RefreshBarra (esta_barra, instancia) + + else + --> agora esta comparando se a tabela da barra é diferente da tabela na atualização anterior + if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --> aqui diz se a barra do jogador mudou de posição ou se ela apenas será atualizada + + esta_barra.statusbar:SetValue (esta_porcentagem) + + esta_barra.last_value = esta_porcentagem --> reseta o ultimo valor da barra + + if (instancia.use_row_animations and forcar) then + esta_barra.tem_animacao = 0 + esta_barra:SetScript ("OnUpdate", nil) + end + + return self:RefreshBarra (esta_barra, instancia) + + elseif (esta_porcentagem ~= esta_barra.last_value) then --> continua mostrando a mesma tabela então compara a porcentagem + --> apenas atualizar + if (instancia.use_row_animations) then + + local upRow = barras_container [qual_barra-1] + if (upRow) then + if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then + esta_barra.statusbar:SetValue (esta_porcentagem) + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + instancia:AnimarBarra (esta_barra, esta_porcentagem) + end + else + esta_barra.statusbar:SetValue (esta_porcentagem) + end + esta_barra.last_value = esta_porcentagem + end + end + + end + +end + +function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) + + if (from_resize) then + if (self.owner) then + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.owner.classe]) + else + actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (_detalhes.class_colors [self.classe]) + end + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.barrasInfo.texturaBackgroundByClass) then + esta_barra.background:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + if (self.classe == "UNKNOW") 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) + + elseif (self.classe == "UNGROUPPLAYER") then + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + else + if (_detalhes.faction_against == "Horde") then + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Human_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + else + esta_barra.icone_classe:SetTexture ("Interface\\ICONS\\Achievement_Character_Orc_Male") + esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + end + end + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + + elseif (self.classe == "PET") then + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + + else + esta_barra.icone_classe:SetTexture ("Interface\\AddOns\\Details\\images\\classes_small") + esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method + esta_barra.icone_classe:SetVertexColor (1, 1, 1) + end + + if (self.enemy) then + if (_detalhes.faction_against == "Horde") then + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:0:32:0:32|t"..self.displayName) --seta o texto da esqueda -- HORDA + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". |TInterface\\AddOns\\Details\\images\\icones_barra:"..instancia.barrasInfo.altura..":"..instancia.barrasInfo.altura..":0:0:256:32:32:64:0:32|t"..self.displayName) --seta o texto da esqueda -- ALLY + end + + if (instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (240/255, 0, 5/255, 1) + end + else + esta_barra.texto_esquerdo:SetText (esta_barra.colocacao..". "..self.displayName) --seta o texto da esqueda + end + + if (instancia.row_textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + if (instancia.row_textR_class_colors) then + esta_barra.texto_direita:SetTextColor (actor_class_color_r, actor_class_color_g, actor_class_color_b) + end + + esta_barra.texto_esquerdo:SetSize (esta_barra:GetWidth() - esta_barra.texto_direita:GetStringWidth() - 20, 15) + +end --------------------------------------------- // TOOLTIPS // --------------------------------------------- diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index 8c3be7f9..cf4019e9 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -22,6 +22,7 @@ local container_misc_target = _detalhes.container_type.CONTAINER_MISCTARGET_CLAS --api locals local _UnitClass = UnitClass +local _IsInInstance = IsInInstance --lua locals local _setmetatable = setmetatable local _getmetatable = getmetatable @@ -114,6 +115,18 @@ end function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwner) +--[[ +if (self.tipo == container_damage) then + if (nome:find ("Lyl")) then + if (nome:find ("-")) then + print ("nome com -", isOwner) + else + --print ("nome okey", isOwner) + end + end +end +--]] + --> 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 @@ -127,14 +140,12 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn if (nome_dele) then nome = nome_dele - --> aqui pode ocorrer bug caso o dono tenha sido adicionado ao container de pets enquanto não estava na party ou raide - --[[ old debug lines - if (self.shadow and self.tipo == container_damage and not self._NameIndexTable [dono_nome]) then - print ("CONTAINER 1: Criando Actor do Dono:", dono_nome, "Pet: ", nome) - elseif (self.shadow and self.tipo == container_damage and self._NameIndexTable [dono_nome]) then - print ("CONTAINER 1: criado actor repedido",nome) - end - --]] + --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) end @@ -147,14 +158,6 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn elseif (criar) then - --[[ old debug lines - if (isOwner and self.shadow and self.tipo == container_damage) then - print ("CONTAINER 2: Criando actor do Dono do Pet: OWNER:", nome, "PET:", isOwner) - if (self._NameIndexTable [nome]) then - print ("Repetido") - end - end - --]] -- rotinas de criação do objeto shadow ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ local shadow = self.shadow --> espelho do container no overall @@ -171,6 +174,7 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn 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 + --print (nome) -- converte a flag do wow em flag do details ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -186,8 +190,9 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent if (not novo_objeto.displayName) then - if (IsInInstance()) then + if (_IsInInstance() and _detalhes.remove_realm_from_name) then novo_objeto.displayName = nome:gsub (("%-.*"), "") + --print (novo_objeto.displayName) else novo_objeto.displayName = nome end @@ -208,7 +213,7 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn novo_objeto.owner = dono_do_pet novo_objeto.ownerName = dono_do_pet.nome - if (IsInInstance()) then + if (_IsInInstance() and _detalhes.remove_realm_from_name) then novo_objeto.displayName = nome:gsub (("%-.*"), ">") else novo_objeto.displayName = nome @@ -401,12 +406,19 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn -- grava o objeto no mapa do container ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - -- novo_objeto.combatID = _detalhes:NumeroCombate() --> grava no objeto qual o ID do combate que ele pertence -- Não serve pra nada? melhor DELETAR - - --if (self.shadow and self.tipo == container_damage and self._NameIndexTable [nome]) then - -- print ("CONTAINER 3: criado actor repedido",nome, isOwner) - --end - + + --[[ + 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 + end + 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 diff --git a/classes/container_historico.lua b/classes/container_historico.lua index f417f1ec..523ff8a1 100644 --- a/classes/container_historico.lua +++ b/classes/container_historico.lua @@ -41,26 +41,30 @@ function historico:adicionar (tabela) --> fazer limpeza na tabela - for index, container in ipairs (self.tabelas[2]) do - if (index < 3) then - for _, jogador in ipairs (container._ActorTable) do - - --> remover a tabela de last events - jogador.last_events_table = nil - - --> verifica se ele ainda esta registrado na time machine - if (jogador.timeMachine) then - jogador:DesregistrarNaTimeMachine() - end - - end - else - break + local _segundo_combate = self.tabelas[2] + + local container_damage = _segundo_combate [1] + local container_heal = _segundo_combate [2] + + for _, jogador in ipairs (container_damage._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = nil + --> verifica se ele ainda esta registrado na time machine + if (jogador.timeMachine) then + jogador:DesregistrarNaTimeMachine() + end + end + for _, jogador in ipairs (container_heal._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = nil + --> verifica se ele ainda esta registrado na time machine + if (jogador.timeMachine) then + jogador:DesregistrarNaTimeMachine() end end if (self.tabelas[3]) then - if (self.tabelas[3].is_trash and self.tabelas[2].is_trash) then + if (self.tabelas[3].is_trash and self.tabelas[2].is_trash and not self.tabelas[3].is_boss and not self.tabelas[2].is_boss) then --> tabela 2 deve ser deletada e somada a tabela 1 if (_detalhes.debug) then detalhes:Msg ("(debug) concatenating two trash segments.") @@ -167,6 +171,10 @@ function historico:resetar() --> reinicia a time machine timeMachine:Reiniciar() + + _table_wipe (_detalhes.cache_damage_group) + _table_wipe (_detalhes.cache_healing_group) + _detalhes:UpdateParserGears() _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) -- atualiza o instancia.showing para as novas tabelas criadas _detalhes:InstanciaCallFunction (_detalhes.AtualizaSoloMode_AfertReset) -- verifica se precisa zerar as tabela da janela solo mode @@ -175,8 +183,6 @@ function historico:resetar() _detalhes:AtualizaGumpPrincipal (-1) --atualiza todas as instancias - _detalhes:UpdateParserGears() - _detalhes:SendEvent ("DETAILS_DATA_RESET", nil, nil) end diff --git a/classes/container_pets.lua b/classes/container_pets.lua index d4275caa..a3ce1fba 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -41,11 +41,13 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) dono_flags = 0x00000417 --> emulate sourceflag flag local nome, realm = _UnitName ("raid"..i) - if (realm) then + if (realm and realm ~= "") then nome = nome.."-"..realm + --print ("tem realm: ", realm, nome) end dono_nome = nome - --print ("Dono encontrado na raide") + + --print ("Dono encontrado na raide",nome,realm) end end @@ -57,10 +59,12 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) dono_flags = 0x00000417 --> emulate sourceflag flag local nome, realm = _UnitName ("party"..i) - if (realm) then + if (realm and realm ~= "") then + --print ("tem realm: ", realm) nome = nome.."-"..realm end dono_nome = nome + --print ("Dono encontrado na party",nome,realm) --print ("DEBUG Dono encontrado na party") end end @@ -103,11 +107,12 @@ function container_pets:BuscarPets() if (pet_serial) then if (not _detalhes.tabela_pets.pets [pet_serial]) then local nome, realm = _UnitName ("raid"..i) - if (realm) then + if (realm and realm ~= "") then nome = nome.."-"..realm + --print ("tem realm: ", realm, nome) end + --print ("bp dono encontrado na raide:",nome, realm) _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("raidpet"..i), 2600, _UnitGUID ("raid"..i), nome, 0x514, true) - --print ("PET FOUND on Buscar Pets!", _GetUnitName ("raid"..i, true), _detalhes:trim (_GetUnitName ("raid"..i, true))) end end end @@ -117,9 +122,10 @@ function container_pets:BuscarPets() if (pet_serial) then if (not _detalhes.tabela_pets.pets [pet_serial]) then local nome, realm = _UnitName ("party"..i) - if (realm) then + if (realm and realm ~= "") then nome = nome.."-"..realm end + --print ("bp dono encontrado no grupo:",nome, realm) _detalhes.tabela_pets:Adicionar (pet_serial, _UnitName ("partypet"..i), 2600, _UnitGUID ("party"..i), nome, 0x514) end end diff --git a/core/control.lua b/core/control.lua index 9058e05c..ad3e75d3 100644 --- a/core/control.lua +++ b/core/control.lua @@ -217,7 +217,7 @@ _detalhes:InstanciaCallFunction (_detalhes.AtualizaSegmentos) --> atualiza o showing end - table.wipe (_detalhes.encounter) + _table_wipe (_detalhes.encounter) --> conta o tempo na tabela overall -- start time at overall table if (_detalhes.tabela_overall.end_time) then @@ -248,8 +248,8 @@ _detalhes.container_pets:BuscarPets() - table.wipe (_detalhes.cache_damage_group) - table.wipe (_detalhes.cache_healing_group) + _table_wipe (_detalhes.cache_damage_group) + _table_wipe (_detalhes.cache_healing_group) _detalhes:UpdateParserGears() _detalhes.host_of = nil @@ -258,7 +258,7 @@ if (_detalhes.in_group and _detalhes.cloud_capture) then if (_detalhes:IsInInstance() or _detalhes.debug) then if (not _detalhes:CaptureIsAllEnabled()) then - _detalhes:SendCloudRequest() + _detalhes:ScheduleSendCloudRequest() if (_detalhes.debug) then _detalhes:Msg ("(debug) requesting a cloud server.") end @@ -281,15 +281,26 @@ function _detalhes:SairDoCombate (bossKilled) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) ended a combat.") + end + --> pega a zona do jogador e vê se foi uma luta contra um Boss -- identifica se a luta foi com um boss if (not _detalhes.tabela_vigente.is_boss) then _detalhes.tabela_vigente.is_boss = _detalhes:FindBoss() end - if (_detalhes.debug) then - _detalhes:Msg ("(debug) ended a combat.") + if (_detalhes.tabela_vigente.bossFunction) then + _detalhes:CancelTimer (_detalhes.tabela_vigente.bossFunction) + _detalhes.bossFunction = nil end - + + --> finaliza a checagem se esta ou não no combate -- finish combat check + if (_detalhes.tabela_vigente.verifica_combate) then + _detalhes:CancelTimer (_detalhes.tabela_vigente.verifica_combate) + _detalhes.tabela_vigente.verifica_combate = nil + end + if (not _detalhes.tabela_vigente.is_boss) then local inimigo = _detalhes:FindEnemy() @@ -315,19 +326,14 @@ _detalhes:FlagActorsOnBossFight() if (_detalhes:GetBossDetails (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index)) then + _detalhes.tabela_vigente.enemy = _detalhes.tabela_vigente.is_boss.encounter - _detalhes:CaptureSet (false, "damage", false, 30) - _detalhes:CaptureSet (false, "heal", false, 30) - - if (_detalhes.debug) then - _detalhes:Msg ("(debug) found encounter on last fight, freezing parser for 30 seconds.") - end - + if (bossKilled) then _detalhes.tabela_vigente.is_boss.killed = true end - - + + --> encounter boss function local bossFunction, bossFunctionType = _detalhes:GetBossFunction (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index) if (bossFunction) then if (_bit_band (bossFunctionType, 0x2) ~= 0) then --end of combat @@ -335,9 +341,19 @@ end end + --> schedule captures off + if (_detalhes.debug) then + _detalhes:Msg ("(debug) found encounter on last fight, freezing parser for 30 seconds.") + end + _detalhes:CaptureSet (false, "damage", false, 30) + _detalhes:CaptureSet (false, "heal", false, 30) + + --> schedule sync _detalhes:EqualizeActorsSchedule (_detalhes.host_of) - _detalhes:IniciarColetaDeLixo (true) + --> schedule clean up + _detalhes:ScheduleTimer ("IniciarColetaDeLixo", 15, true) + else if (_detalhes.debug) then _detalhes:EqualizeActorsSchedule (_detalhes.host_of) @@ -345,17 +361,6 @@ end end - if (_detalhes.tabela_vigente.bossFunction) then - _detalhes:CancelTimer (_detalhes.tabela_vigente.bossFunction) - _detalhes.bossFunction = nil - end - - --> finaliza a checagem se esta ou não no combate -- finish combat check - if (_detalhes.tabela_vigente.verifica_combate) then - _detalhes:CancelTimer (_detalhes.tabela_vigente.verifica_combate) - _detalhes.tabela_vigente.verifica_combate = nil - end - --> lock timers _detalhes.tabela_vigente:TravarTempos() @@ -372,7 +377,7 @@ local tempo_do_combate = _detalhes.tabela_vigente.end_time - _detalhes.tabela_vigente.start_time --if ( tempo_do_combate >= _detalhes.minimum_combat_time) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico - if ( tempo_do_combate >= 5) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico + if ( tempo_do_combate >= 5 or not _detalhes.tabela_historico.tabelas[1]) then --> tempo minimo precisa ser 5 segundos pra acrecentar a tabela ao historico _detalhes.tabela_historico:adicionar (_detalhes.tabela_vigente) --move a tabela atual para dentro do histórico else --> this is a little bit complicated, need a specific function for combat cancellation @@ -387,10 +392,7 @@ _table_wipe (_detalhes.tabela_vigente) --> descarta ela, não será mais usada _detalhes.tabela_vigente = _detalhes.tabela_historico.tabelas[1] --> pega a tabela do ultimo combate - if (not _detalhes.tabela_vigente) then --> provavel foi o primeiro combate após um reset - _detalhes.tabela_vigente = _detalhes.combate:NovaTabela (false, _detalhes.tabela_overall) --cria uma nova tabela de combate caso não tenha nenhuma no historico - end - + if (_detalhes.tabela_vigente.start_time == 0) then _detalhes.tabela_vigente.start_time = _detalhes._tempo _detalhes.tabela_vigente.end_time = _detalhes._tempo @@ -417,7 +419,6 @@ end _detalhes:NumeroCombate (-1) - _detalhes:UpdateParserGears() end _detalhes.host_of = nil @@ -429,8 +430,8 @@ _detalhes.in_combat = false --sinaliza ao addon que não há combate no momento - table.wipe (_detalhes.cache_damage_group) - table.wipe (_detalhes.cache_healing_group) + _table_wipe (_detalhes.cache_damage_group) + _table_wipe (_detalhes.cache_healing_group) _detalhes:UpdateParserGears() @@ -487,6 +488,9 @@ if (damage) then if (damage.total < receivedActor [1][1]) then + if (_detalhes.debug) then + _detalhes:Msg (player .. " damage before: " .. damage.total .. " damage received: " .. receivedActor [1][1]) + end damage.total = receivedActor [1][1] end if (damage.damage_taken < receivedActor [1][2]) then @@ -576,7 +580,7 @@ if (host_of) then damage, heal, energy, misc = _detalhes:GetAllActors ("current", host_of) else - damage, heal, energy, misc = _detalhes:GetAllActors ("current", UnitName ("player")) + damage, heal, energy, misc = _detalhes:GetAllActors ("current", _detalhes.playername) end if (damage) then diff --git a/core/meta.lua b/core/meta.lua index 0b3b7b94..6e4a4158 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -140,6 +140,36 @@ tabelas_de_combate [#tabelas_de_combate+1] = _tabela _tabela.__call = _detalhes.call_combate end + + --> restaura last_events_table + local _primeiro_combate = _detalhes.tabela_historico.tabelas[1] + if (_primeiro_combate) then + local _container_damage =_primeiro_combate [1] + local _container_heal = _primeiro_combate [2] + + for _, jogador in ipairs (_container_damage._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = _detalhes:CreateActorLastEventTable() + end + for _, jogador in ipairs (_container_heal._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = _detalhes:CreateActorLastEventTable() + end + end + local _segundo_combate = _detalhes.tabela_historico.tabelas[2] + if (_segundo_combate) then + local _container_damage = _segundo_combate [1] + local _container_heal = _segundo_combate [2] + + for _, jogador in ipairs (_container_damage._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = _detalhes:CreateActorLastEventTable() + end + for _, jogador in ipairs (_container_heal._ActorTable) do + --> remover a tabela de last events + jogador.last_events_table = _detalhes:CreateActorLastEventTable() + end + end tabela_overall.end_time = _tempo tabela_overall.start_time = _tempo diff --git a/core/network.lua b/core/network.lua index 262eff05..11bf52d9 100644 --- a/core/network.lua +++ b/core/network.lua @@ -7,7 +7,13 @@ local _detalhes = _G._detalhes local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" ) - + local _UnitName = UnitName + local _GetRealmName = GetRealmName + local _select = select + local _table_wipe = table.wipe + local _math_min = math.min + local _string_gmatch = string.gmatch + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> local pointers @@ -21,12 +27,12 @@ if (IsInRaid()) then for i = 1, GetNumGroupMembers() do - if (_detalhes.details_users [ UnitName ("raid"..i)]) then + if (_detalhes.details_users [ _UnitName ("raid"..i)]) then end end elseif (IsInGroup()) then for i = 1, GetNumGroupMembers()-1 do - if (_detalhes.details_users [ UnitName ("party"..i)]) then + if (_detalhes.details_users [ _UnitName ("party"..i)]) then end end end @@ -36,17 +42,22 @@ function _detalhes:RaidComm (_, data, _, source) - local type, player, realm, dversion, arg6, arg7 = select (2, _detalhes:Deserialize (data)) + local type, player, realm, dversion, arg6, arg7 = _select (2, _detalhes:Deserialize (data)) if (_detalhes.debug) then _detalhes:Msg ("(debug) network received:", type, "length:",string.len (data)) end if (type == "highfive") then - if (player ~= _detalhes.playername and not _detalhes.details_users [player]) then - _detalhes.details_users [player] = {player, realm, dversion} - end + _detalhes:SendRaidData ("highfive_response") + + elseif (type == "highfive_response") then + + if (_detalhes.sent_highfive and _detalhes.sent_highfive+30 > GetTime()) then + _detalhes.users [#_detalhes.users+1] = {player, realm, dversion} + end + elseif (type == "petowner") then dversion, serial, nome, owner_table = player, realm, dversion, arg6 @@ -140,8 +151,8 @@ if (IsInRaid()) then for i = 1, GetNumGroupMembers() do if (name:find ("-")) then --> other realm - local nname, server = UnitName ("raid"..i) - if (server) then + local nname, server = _UnitName ("raid"..i) + if (server and server ~= "") then nname = nname.."-"..server end if (nname == name) then @@ -149,7 +160,7 @@ break end else - if (UnitName ("raid"..i) == name) then + if (_UnitName ("raid"..i) == name) then actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true) break end @@ -159,8 +170,8 @@ elseif (IsInGroup()) then for i = 1, GetNumGroupMembers()-1 do if (name:find ("-")) then --> other realm - local nname, server = UnitName ("party"..i) - if (server) then + local nname, server = _UnitName ("party"..i) + if (server and server ~= "") then nname = nname.."-"..server end if (nname == name) then @@ -168,7 +179,7 @@ break end else - if (UnitName ("party"..i) == name or _detalhes.playername == name) then + if (_UnitName ("party"..i) == name or _detalhes.playername == name) then actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true) break end @@ -215,7 +226,7 @@ if (data) then local export = temp local container = _detalhes.tabela_vigente [atributo]._ActorTable - for i = 1, math.min (6, #container) do + for i = 1, _math_min (6, #container) do local actor = container [i] if (actor.grupo) then export [#export+1] = {actor.nome, actor [atributo_name]} @@ -223,7 +234,7 @@ end _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatareceived", atributo, atributo_name, export), "WHISPER", _detalhes.host_of) - table.wipe (temp) + _table_wipe (temp) end elseif (type == "foundcloud") then @@ -232,7 +243,7 @@ return end - if (realm ~= GetRealmName()) then + if (realm ~= _GetRealmName()) then player = player .."-"..realm end _detalhes.host_by = player @@ -256,7 +267,7 @@ end elseif (type == "custom_broadcast") then - _detalhes:OnReceiveCustom (select (3, _detalhes:Deserialize (data))) + _detalhes:OnReceiveCustom (_select (3, _detalhes:Deserialize (data))) elseif (type == "equalize_actors") then @@ -278,7 +289,7 @@ function _detalhes:SendCustomRaidData (type, player, realm, ...) if (not realm) then --> check if realm is already inside player name - for _name, _realm in string.gmatch (player, "(%w+)-(%w+)") do + for _name, _realm in _string_gmatch (player, "(%w+)-(%w+)") do if (_realm) then player = _name realm = _realm @@ -287,41 +298,44 @@ end if (not realm) then --> doesn't have realm at all, so we assume the actor is in same realm as player - realm = GetRealmName() + realm = _GetRealmName() end _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, player, realm, _detalhes.realversion, ...), "RAID") end function _detalhes:SendRaidData (type, ...) - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, UnitName ("player"), GetRealmName(), _detalhes.realversion, ...), "RAID") + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize (type, _UnitName ("player"), _GetRealmName(), _detalhes.realversion, ...), "RAID") end function _detalhes:SendHighFive() if (true) then --> disabled return end - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("highfive", UnitName ("player"), GetRealmName(), _detalhes.realversion), "RAID") + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("highfive", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "RAID") end function _detalhes:SendPetOwnerRequest (petserial, petnome) if (_detalhes.debug) then _detalhes:Msg ("(debug) sent request for a pet",petserial, petnome) end - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needpetowner", UnitName ("player"), GetRealmName(), _detalhes.realversion, petserial, petnome), "RAID") + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needpetowner", _UnitName ("player"), _GetRealmName(), _detalhes.realversion, petserial, petnome), "RAID") end + function _detalhes:ScheduleSendCloudRequest() + _detalhes:ScheduleTimer ("SendCloudRequest", 1) + end function _detalhes:SendCloudRequest() - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needcloud", UnitName ("player"), GetRealmName(), _detalhes.realversion), "RAID") + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("needcloud", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "RAID") end function _detalhes:SendCloudResponse (player, realm) - if (realm ~= GetRealmName()) then + if (realm ~= _GetRealmName()) then player = player .."-"..realm end _detalhes.host_of = player if (_detalhes.debug) then _detalhes:Msg ("(debug) sent 'okey' answer for a cloud parser request.") end - _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("foundcloud", UnitName ("player"), GetRealmName(), _detalhes.realversion), "WHISPER", player) + _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("foundcloud", _UnitName ("player"), _GetRealmName(), _detalhes.realversion), "WHISPER", player) end function _detalhes:RequestData() diff --git a/core/parser.lua b/core/parser.lua index 19dc0a32..3f2ba391 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -159,6 +159,18 @@ local jogador_alvo, alvo_dono, alvo_name = _current_damage_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) --]] --[ + + + --[[ + if (who_name:find ("Lyl")) then + if (who_name:find ("-")) then + print ("nome com -", isOwner) + else + --print ("nome okey", isOwner) + end + end + --]] + --> damager local este_jogador, meu_dono = damage_cache [who_name] or damage_cache_pets [who_serial], damage_cache_petsOwners [who_serial] @@ -169,6 +181,10 @@ if (meu_dono) then --> é um pet damage_cache_pets [who_serial] = este_jogador damage_cache_petsOwners [who_serial] = meu_dono + --conferir se o dono já esta no cache + if (not damage_cache [meu_dono.nome]) then + damage_cache [meu_dono.nome] = meu_dono + end else if (who_flags) then --> ter certeza que não é um pet damage_cache [who_name] = este_jogador @@ -184,9 +200,13 @@ jogador_alvo, alvo_dono, alvo_name = _current_damage_container:PegarCombatente (alvo_serial, alvo_name, alvo_flags, true) - if (meu_dono) then + if (alvo_dono) then damage_cache_pets [alvo_serial] = jogador_alvo damage_cache_petsOwners [alvo_serial] = alvo_dono + --conferir se o dono já esta no cache + if (not damage_cache [alvo_dono.nome]) then + damage_cache [alvo_dono.nome] = alvo_dono + end else if (alvo_flags) then --> ter certeza que não é um pet damage_cache [alvo_name] = jogador_alvo @@ -695,6 +715,11 @@ return false end end + + --else + --> record buff uptime + + end ------------------------------------------------------------------------------------------------ @@ -2034,6 +2059,8 @@ _current_combat.pvp = false end end + + _detalhes.container_pets:BuscarPets() return @@ -2088,7 +2115,6 @@ if (_detalhes.in_group) then --> entrou num grupo _detalhes:IniciarColetaDeLixo (true) - _detalhes:SendHighFive() end else _detalhes.in_group = IsInGroup() or IsInRaid() @@ -2301,23 +2327,25 @@ end if (not _actorname) then - _actorname = UnitName ("player") + _actorname = _detalhes.playername end if (_combat == 0 or _combat == "current") then - local actor = _current_combat (_attribute, _actorname) + local actor = _detalhes.tabela_vigente (_attribute, _actorname) if (actor) then return actor else return nil --_detalhes:NewError ("Current combat doesn't have an actor called ".. _actorname) - end + end + elseif (_combat == -1 or _combat == "overall") then - local actor = _overall_combat (_attribute, _actorname) + local actor = _detalhes.tabela_overall (_attribute, _actorname) if (actor) then return actor else return nil --_detalhes:NewError ("Combat overall doesn't have an actor called ".. _actorname) end + elseif (type (_combat) == "number") then local _combatOnHistoryTables = _detalhes.tabela_historico.tabelas [_combat] if (_combatOnHistoryTables) then diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index e91beaa3..f5a57468 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -12,7 +12,7 @@ local DEFAULT_CHILD_WIDTH = 60 local DEFAULT_CHILD_HEIGHT = 16 local DEFAULT_CHILD_FONTFACE = "Friz Quadrata TT" - local DEFAULT_CHILD_FONTCOLOR = {1, 0.7333333333333333, 0, 1} + local DEFAULT_CHILD_FONTCOLOR = {1, 0.733333, 0, 1} local DEFAULT_CHILD_FONTSIZE = 10 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -805,48 +805,305 @@ do end ----------> BUILT-IN CLEAR PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---[[ +---------> BUILT-IN PFS PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + do --> Create the plugin Object - local PClear1 = _detalhes:NewPluginObject ("Details_Attribute", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") - local PClear2 = _detalhes:NewPluginObject ("Details_Attribute", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") - local PClear3 = _detalhes:NewPluginObject ("Details_Attribute", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") + local PFps = _detalhes:NewPluginObject ("Details_Statusbar_Fps", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") --> Handle events (must have) - function PClear1:OnDetailsEvent (event) + function PFps:OnDetailsEvent (event) return end - function PClear2:OnDetailsEvent (event) + + function PFps:UpdateFps() + self.text:SetText (_math_floor (GetFramerate()) .. " fps") + end + + function PFps:OnDisable() + self:CancelTimer (self.srt) + end + + function PFps:OnEnable() + self.srt = self:ScheduleRepeatingTimer ("UpdateFps", 1, self) + self:UpdateFps() + end + + function PFps:CreateChildObject (instance) + local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPFpsInstance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) + local new_child = _detalhes.StatusBar:CreateChildTable (instance, PFps, myframe) + return new_child + end + + --> Install + local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_FPS"], "Interface\\Icons\\Spell_Shadow_MindTwisting", PFps, "DETAILS_STATUSBAR_PLUGIN_PFPS") + if (type (install) == "table" and install.error) then + print (install.errortext) + return + end + +end + +---------> BUILT-IN LATENCY PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +do + --> Create the plugin Object + local PLatency = _detalhes:NewPluginObject ("Details_Statusbar_Latency", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") + --> Handle events (must have) + function PLatency:OnDetailsEvent (event) return end - function PClear3:OnDetailsEvent (event) + + function PLatency:UpdateLatency() + local _, _, _, lagWorld = GetNetStats() + self.text:SetText (_math_floor (lagWorld) .. " ms") + end + + function PLatency:OnDisable() + self:CancelTimer (self.srt) + end + + function PLatency:OnEnable() + self.srt = self:ScheduleRepeatingTimer ("UpdateLatency", 30, self) + self:UpdateLatency() + end + + function PLatency:CreateChildObject (instance) + local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPLatencyInstance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) + local new_child = _detalhes.StatusBar:CreateChildTable (instance, PLatency, myframe) + return new_child + end + + --> Install + local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_LATENCY"], "Interface\\FriendsFrame\\PlusManz-BattleNet", PLatency, "DETAILS_STATUSBAR_PLUGIN_PLATENCY") + if (type (install) == "table" and install.error) then + print (install.errortext) return + end + +end + +---------> BUILT-IN DURABILITY PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +do + + local _GetInventoryItemDurability = GetInventoryItemDurability + + --> Create the plugin Object + local PDurability = _detalhes:NewPluginObject ("Details_Statusbar_Latency", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") + --> Handle events (must have) + function PDurability:OnDetailsEvent (event) + return + end + + function PDurability:UpdateDurability() + local percent, items = 0, 0 + for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do + local durability, maxdurability = _GetInventoryItemDurability (i) + if (durability and maxdurability) then + local p = durability / maxdurability * 100 + percent = percent + p + items = items + 1 + end + end + + if (items == 0) then + self.text:SetText (Loc ["STRING_UPTADING"]) + return self:ScheduleTimer ("UpdateDurability", 5, self) + end + + percent = percent / items + self.text:SetText (_math_floor (percent) .. "%") + end + + function PDurability:OnDisable() + self.frame.widget:UnregisterEvent ("PLAYER_DEAD") + self.frame.widget:UnregisterEvent ("PLAYER_UNGHOST") + self.frame.widget:UnregisterEvent ("UPDATE_INVENTORY_DURABILITY") + self.frame.widget:UnregisterEvent ("MERCHANT_SHOW") + self.frame.widget:UnregisterEvent ("MERCHANT_CLOSED") + self.frame.widget:UnregisterEvent ("ZONE_CHANGED_NEW_AREA") + end + + function PDurability:OnEnable() + self.frame.widget:RegisterEvent ("PLAYER_DEAD") + self.frame.widget:RegisterEvent ("PLAYER_UNGHOST") + self.frame.widget:RegisterEvent ("UPDATE_INVENTORY_DURABILITY") + self.frame.widget:RegisterEvent ("MERCHANT_SHOW") + self.frame.widget:RegisterEvent ("MERCHANT_CLOSED") + self.frame.widget:RegisterEvent ("ZONE_CHANGED_NEW_AREA") + self:UpdateDurability() + end + + function PDurability:CreateChildObject (instance) + local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPDurabilityInstance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) + local new_child = _detalhes.StatusBar:CreateChildTable (instance, PDurability, myframe) + + local texture = myframe:CreateTexture (nil, "overlay") + texture:SetTexture ("Interface\\AddOns\\Details\\images\\icons") + texture:SetPoint ("right", myframe.text.widget, "left", -2, -1) + texture:SetWidth (10) + texture:SetHeight (10) + texture:SetTexCoord (0.216796875, 0.26171875, 0.0078125, 0.052734375) + + myframe.widget:SetScript ("OnEvent", function() + new_child:UpdateDurability() + end) + + return new_child + end + + --> Install + local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_DURABILITY"], "Interface\\ICONS\\INV_Chest_Chain_10", PDurability, "DETAILS_STATUSBAR_PLUGIN_PDURABILITY") + if (type (install) == "table" and install.error) then + print (install.errortext) + return + end + +end + + +---------> BUILT-IN GOLD PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +do + --> Create the plugin Object + local PGold = _detalhes:NewPluginObject ("Details_Statusbar_Gold", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") + --> Handle events (must have) + function PGold:OnDetailsEvent (event) + return + end + + function PGold:GoldPluginTick() + for index, child in _ipairs (PGold.childs) do + local instance = child.instance + if (child.enabled and instance:IsEnabled()) then + child:UpdateGold() + end + end + end + + function PGold:UpdateGold() + self.text:SetText (_math_floor (GetMoney() / 100 / 100)) + end + + function PGold:OnEnable() + self:UpdateGold() + end + + function PGold:CreateChildObject (instance) + local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPGoldInstance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) + local new_child = _detalhes.StatusBar:CreateChildTable (instance, PGold, myframe) + + local texture = myframe:CreateTexture (nil, "overlay") + texture:SetTexture ("Interface\\MONEYFRAME\\UI-GoldIcon") + texture:SetPoint ("right", myframe.text.widget, "left") + texture:SetWidth (12) + texture:SetHeight (12) + + myframe.widget:RegisterEvent ("PLAYER_MONEY") + myframe.widget:RegisterEvent ("PLAYER_ENTERING_WORLD") + myframe.widget:SetScript ("OnEvent", function (event) + if (event == "PLAYER_ENTERING_WORLD") then + return PGold:ScheduleTimer ("GoldPluginTick", 10) + end + PGold:GoldPluginTick() + end) + + return new_child + end + + --> Install + local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_GOLD"], "Interface\\Icons\\INV_Ore_Gold_01", PGold, "DETAILS_STATUSBAR_PLUGIN_PGold") + if (type (install) == "table" and install.error) then + print (install.errortext) + return + end + +end + +---------> BUILT-IN TIME PLUGIN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +do + --> Create the plugin Object + local PTime = _detalhes:NewPluginObject ("Details_Statusbar_Time", DETAILSPLUGIN_ALWAYSENABLED, "STATUSBAR") + --> Handle events (must have) + function PTime:OnDetailsEvent (event) + return + end + + function PTime:UpdateClock() + + if (self.options.timeType == 1) then + self.text:SetText (date ("%I:%M %p")) + elseif (self.options.timeType == 2) then + self.text:SetText (date ("%H:%M")) + end + + end + + function PTime:OnDisable() + self:CancelTimer (self.srt) + end + + function PTime:OnEnable() + self.srt = self:ScheduleRepeatingTimer ("UpdateClock", 60, self) + self:UpdateClock() + end + + function PTime:ExtraOptions() + + --> all widgets need to be placed on a table + local widgets = {} + --> reference of extra window for custom options + local window = _G.DetailsStatusBarOptions2.MyObject + + --> build all your widgets ----------------------------------------------------------------------------------------------------------------------------- + _detalhes.gump:NewLabel (window, _, "$parentTimeTypeLabel", "TimeTypeLabel", Loc ["STRING_PLUGIN_CLOCKTYPE"]) + window.TimeTypeLabel:SetPoint (10, -15) + + local onSelectClockType = function (_, child, thistype) + child.options.timeType = thistype + child:UpdateClock() + end + + local clockTypes = {{value = 1, label = date ("%I:%M %p"), onclick = onSelectClockType}, + {value = 2, label = date ("%H:%M"), onclick = onSelectClockType} + } + + _detalhes.gump:NewDropDown (window, _, "$parentTimeTypeDropdown", "TimeTypeDropdown", 200, 20, function() return clockTypes end, 1) -- func, default + window.TimeTypeDropdown:SetPoint ("left", window.TimeTypeLabel, "right", 2) + ----------------------------------------------------------------------------------------------------------------------------- + + --> now we insert all widgets created on widgets table + table.insert (widgets, window.TimeTypeLabel) + table.insert (widgets, window.TimeTypeDropdown) + + --> after first call we replace this function with widgets table + PTime.ExtraOptions = widgets + end + + --> ExtraOptionsOnOpen is called when options are opened and plugin have custom options + --> here we setup options widgets for get the values of clicked child and also for tell options window what child we are configuring + function PTime:ExtraOptionsOnOpen (child) + _G.DetailsStatusBarOptions2TimeTypeDropdown.MyObject:SetFixedParameter (child) + _G.DetailsStatusBarOptions2TimeTypeDropdown.MyObject:Select (child.options.timeType, true) end --> Create Plugin Frames (must have) - function PClear1:CreateChildObject (instance) - local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPClear1Instance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) - local new_child = _detalhes.StatusBar:CreateChildTable (instance, PClear1, myframe) - return new_child - end - function PClear2:CreateChildObject (instance) - local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPClear2Instance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) - local new_child = _detalhes.StatusBar:CreateChildTable (instance, PClear2, myframe) - return new_child - end - function PClear3:CreateChildObject (instance) - local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPClear3Instance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) - local new_child = _detalhes.StatusBar:CreateChildTable (instance, PClear3, myframe) + function PTime:CreateChildObject (instance) + local myframe = _detalhes.StatusBar:CreateChildFrame (instance, "DetailsPTimeInstance" .. instance:GetInstanceId(), DEFAULT_CHILD_WIDTH, DEFAULT_CHILD_HEIGHT) + local new_child = _detalhes.StatusBar:CreateChildTable (instance, PTime, myframe) + new_child.options.timeType = new_child.options.timeType or 1 return new_child end ---]] --> Install --- _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_CLEAN"].." 1", [[Interface\Buttons\UI-GroupLoot-Pass-Down]], PClear1, "DETAILS_STATUSBAR_PLUGIN_PCLEAR1") --- _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_CLEAN"].." 2", [[Interface\Buttons\UI-GroupLoot-Pass-Down]], PClear2, "DETAILS_STATUSBAR_PLUGIN_PCLEAR2") --- _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_CLEAN"].." 3", [[Interface\Buttons\UI-GroupLoot-Pass-Down]], PClear3, "DETAILS_STATUSBAR_PLUGIN_PCLEAR3") + --> Install + local install = _detalhes:InstallPlugin ("STATUSBAR", Loc ["STRING_PLUGIN_TIME"], "Interface\\Icons\\Spell_Shadow_LastingAfflictions", PTime, "DETAILS_STATUSBAR_PLUGIN_PTIME") + if (type (install) == "table" and install.error) then + print (install.errortext) + return + end ---end - +end ---------> default options panel ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -898,6 +1155,7 @@ end) local colorpick = function() ColorPickerFrame.func = selectedColor ColorPickerFrame.cancelFunc = canceledColor + ColorPickerFrame.opacityFunc = nil ColorPickerFrame.hasOpacity = false ColorPickerFrame.previousValues = window.child.options.textColor ColorPickerFrame:SetParent (window.widget) @@ -905,14 +1163,23 @@ end) ColorPickerFrame:Show() end - _detalhes.gump:NewImage (window, _, "$parentTextColorTexture", "textcolortexture", 200, 16) + _detalhes.gump:NewImage (window, _, "$parentTextColorTexture", "textcolortexture", 150, 16) window.textcolortexture:SetPoint ("left", window.textcolor, "right", 2) window.textcolortexture:SetTexture (1, 1, 1) - _detalhes.gump:NewButton (window, _, "$parentTextColorButton", "textcolorbutton", 200, 20, colorpick) + _detalhes.gump:NewButton (window, _, "$parentTextColorButton", "textcolorbutton", 150, 20, colorpick) window.textcolorbutton:SetPoint ("left", window.textcolor, "right", 2) - + local applyToAll = function() + _detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.left, "textcolor", window.child.options.textColor) + _detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.center, "textcolor", window.child.options.textColor) + _detalhes.StatusBar:ApplyOptions (window.instance.StatusBar.right, "textcolor", window.child.options.textColor) + end + _detalhes.gump:NewButton (window, _, "$parentTextColorApplyToAllButton", "applyToAll", 45, 16, applyToAll, nil, nil, nil, "->") + window.applyToAll:InstallCustomTexture() + window.applyToAll:SetPoint ("left", window.textcolorbutton, "right", 5) + window.applyToAll.tooltip = "apply this color to all micro displays" + --> text size _detalhes.gump:NewLabel (window, _, "$parentFontSizeLabel", "fonsizeLabel", Loc ["STRING_PLUGINOPTIONS_TEXTSIZE"]) window.fonsizeLabel:SetPoint (10, -55) @@ -934,6 +1201,8 @@ end) window.alignSlider:SetThumbSize (75) window.alignSlider:SetHook ("OnValueChange", function (self, child, side) + side = _math_floor (side) + child.options.textAlign = side if (side == 0) then diff --git a/core/plugins_toolbar.lua b/core/plugins_toolbar.lua index 12790dff..0a4bd2e1 100644 --- a/core/plugins_toolbar.lua +++ b/core/plugins_toolbar.lua @@ -186,7 +186,7 @@ for _, instancia in pairs (_detalhes.tabela_instancias) do if (instancia.baseframe and instancia:IsAtiva()) then - instancia:ReajustaGump() + instancia:ReajustaGump() -- aqui end end diff --git a/core/util.lua b/core/util.lua index 1d2d3541..8c341649 100644 --- a/core/util.lua +++ b/core/util.lua @@ -136,7 +136,20 @@ return fontface end - + --> font outline + function _detalhes:SetFontOutline (fontString, outline) + local fonte, size = fontString:GetFont() + if (outline) then + if (_type (outline) == "boolean" and outline) then + outline = "OUTLINE" + elseif (outline == 1) then + outline = "OUTLINE" + elseif (outline == 2) then + outline = "THICKOUTLINE" + end + end + fontString:SetFont (fonte, size, outline) + end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> internal functions diff --git a/core/windows.lua b/core/windows.lua index 82e896de..a7f24f66 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -464,7 +464,7 @@ if (tabela._custom) then tabela (esta_barra, self) else - tabela:RefreshBarra (esta_barra, self) + tabela:RefreshBarra (esta_barra, self, true) end if (esta_barra.minha_tabela.enemy) then diff --git a/framework/slider.lua b/framework/slider.lua index 45fb2a90..1d976e97 100644 --- a/framework/slider.lua +++ b/framework/slider.lua @@ -20,6 +20,11 @@ local SliderMetaFunctions = {} SliderMetaFunctions.__call = function (_table, value) if (not value) then if (_table.isSwitch) then + + if (type (value) == "boolean") then --> false + return _table.slider:SetValue (1) + end + if (_table.slider:GetValue() == 1) then return false else diff --git a/functions/savedata.lua b/functions/savedata.lua index 1a7f5fa4..805c4794 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -119,6 +119,7 @@ function _detalhes:SaveDataOnLogout() _detalhes_global.time_type = _detalhes.time_type _detalhes_global.memory_threshold = _detalhes.memory_threshold _detalhes_global.memory_ram = _detalhes.memory_ram + _detalhes_global.remove_realm_from_name = _detalhes.remove_realm_from_name _detalhes_global.SpellOverwriteUser = _detalhes.SpellOverwriteUser @@ -313,6 +314,7 @@ end --]] _detalhes.time_type = _detalhes_global.time_type or _detalhes.time_type _detalhes.memory_threshold = _detalhes_global.memory_threshold _detalhes.memory_ram = _detalhes_global.memory_ram + _detalhes.remove_realm_from_name = _detalhes_global.remove_realm_from_name _detalhes.SpellOverwriteUser = _detalhes_global.SpellOverwriteUser or _detalhes.SpellOverwriteUser else diff --git a/functions/slash.lua b/functions/slash.lua index 2ce51afb..d523e619 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -77,6 +77,14 @@ function SlashCmdList.DETAILS (msg, editbox) end table.wipe (a) + elseif (msg == "unitname") then + + local nome, realm = UnitName ("target") + if (realm) then + nome = nome.."-"..realm + end + print (nome, realm) + elseif (msg == "raid") then local player, realm = "Marleyieu", "Azralon" @@ -296,6 +304,58 @@ function SlashCmdList.DETAILS (msg, editbox) end --> debug + + elseif (msg == "users") then + _detalhes.users = {} + _detalhes.sent_highfive = GetTime() + _detalhes:SendRaidData ("highfive") + + elseif (command == "showusers") then + local users = _detalhes.users + if (not users) then + return _detalhes:Msg ("there is no users.") + end + + local f = _detalhes.ListPanel + if (not f) then + f = _detalhes:CreateListPanel() + end + + local i = 0 + for _, t in ipairs (users) do + i = i + 1 + f:add (t [1] .. " | " .. t [2] .. " | " .. t [3] , i) + end + + print (i, "users found.") + + f:Show() + + elseif (command == "names") then + local t, filter = rest:match("^(%S*)%s*(.-)$") + + t = tonumber (t) + if (not t) then + return print ("not T found.") + end + + local f = _detalhes.ListPanel + if (not f) then + f = _detalhes:CreateListPanel() + end + + local container = _detalhes.tabela_vigente [t]._NameIndexTable + + local i = 0 + for name, _ in pairs (container) do + i = i + 1 + f:add (name, i) + end + + print (i, "names found.") + + f:Show() + elseif (command == "actors") then local t, filter = rest:match("^(%S*)%s*(.-)$") @@ -305,71 +365,19 @@ function SlashCmdList.DETAILS (msg, editbox) return print ("not T found.") end - local f = _detalhes.actorsFrame + local f = _detalhes.ListPanel if (not f) then - _detalhes.actorsFrame = _detalhes.gump:NewPanel (UIParent, nil, "DetailsActorsFrame", nil, 300, 600) - _detalhes.actorsFrame:SetPoint ("center", UIParent, "center", 300, 0) - _detalhes.actorsFrame.barras = {} - - local container_barras_window = CreateFrame ("ScrollFrame", "Details_ActorsBarrasScroll", _detalhes.actorsFrame.widget) - local container_barras = CreateFrame ("Frame", "Details_ActorsBarras", container_barras_window) - _detalhes.actorsFrame.container = container_barras - - 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},}) - container_barras_window:SetBackdropBorderColor (0, 0, 0, 0) - - container_barras:SetBackdrop({ - bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, - insets = {left = 1, right = 1, top = 0, bottom = 1},}) - container_barras:SetBackdropColor (0, 0, 0, 0) - - container_barras:SetAllPoints (container_barras_window) - container_barras:SetWidth (300) - container_barras:SetHeight (150) - container_barras:EnableMouse (true) - container_barras:SetResizable (false) - container_barras:SetMovable (true) - - container_barras_window:SetWidth (260) - container_barras_window:SetHeight (550) - container_barras_window:SetScrollChild (container_barras) - container_barras_window:SetPoint ("TOPLEFT", _detalhes.actorsFrame.widget, "TOPLEFT", 21, -10) - - _detalhes.gump:NewScrollBar (container_barras_window, container_barras, -10, -17) - container_barras_window.slider:Altura (560) - container_barras_window.slider:cimaPoint (0, 1) - container_barras_window.slider:baixoPoint (0, -3) - container_barras_window.slider:SetFrameLevel (10) - - container_barras_window.ultimo = 0 - - container_barras_window.gump = container_barras - --container_barras_window.slider = slider_gump + f = _detalhes:CreateListPanel() end local container = _detalhes.tabela_vigente [t]._ActorTable print (#container, "actors found.") for index, actor in ipairs (container) do - - local row = _detalhes.actorsFrame.barras [index] - if (not row) then - row = {text = _detalhes.actorsFrame.container:CreateFontString (nil, "overlay", "GameFontNormal")} - _detalhes.actorsFrame.barras [index] = row - row.text:SetPoint ("topleft", _detalhes.actorsFrame.container, "topleft", 0, -index * 15) - end - - if (filter and actor.nome:find (filter)) then - row.text:SetTextColor (1, 1, 0) - else - row.text:SetTextColor (1, 1, 1) - end - - row.text:SetText (actor.nome) - + f:add (actor.nome, index, filter) end + f:Show() + --> debug elseif (msg == "id") then local one, two = rest:match("^(%S*)%s*(.-)$") @@ -401,13 +409,17 @@ function SlashCmdList.DETAILS (msg, editbox) print ("Wow combatlog record turned ON.") _detalhes.isLoggingCombat = true end - - --> debug - elseif (msg == "tables") then - _detalhes:tables() elseif (msg == "gs") then _detalhes:teste_grayscale() + + elseif (msg == "outline") then + + local instancia = _detalhes.tabela_instancias [1] + for _, barra in ipairs (instancia.barras) do + local _, _, flags = barra.texto_esquerdo:GetFont() + print ("outline:",flags) + end else @@ -427,443 +439,66 @@ function SlashCmdList.DETAILS (msg, editbox) end end -function _detalhes:tables () - -- generate a graphviz graph from a lua table structure - - local string_result = "" +function _detalhes:CreateListPanel() + _detalhes.ListPanel = _detalhes.gump:NewPanel (UIParent, nil, "DetailsActorsFrame", nil, 300, 600) + _detalhes.ListPanel:SetPoint ("center", UIParent, "center", 300, 0) + _detalhes.ListPanel.barras = {} - local function append( tab, ... ) - for i = 1, select( '#', ... ) do - tab[ #tab + 1 ] = (select( i, ... )) - end - return tab - end + tinsert (UISpecialFrames, "DetailsActorsFrame") + _detalhes.ListPanel.close_with_right = true - local function abbrev( str, data ) - local escape = "\\\\" - if data.use_html then - escape = "\\" - end - local s = string.gsub( str, "[^%w?!=/+*-_.:,; ]", function( c ) - -- local s = string.gsub( str, "[^%w_]", function( c ) - return escape .. string.byte( c ) - end ) - if string.len( s ) > 20 then - s = string.sub( s, 1, 17 ) .. "..." - end - return "'" .. s .. "'" - end + local container_barras_window = CreateFrame ("ScrollFrame", "Details_ActorsBarrasScroll", _detalhes.ListPanel.widget) + local container_barras = CreateFrame ("Frame", "Details_ActorsBarras", container_barras_window) + _detalhes.ListPanel.container = container_barras - local function update_node_depth( val, data, depth ) - data.node2depth[ val ] = math.min( data.node2depth[ val ] or depth, depth ) - end + 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},}) + container_barras_window:SetBackdropBorderColor (0, 0, 0, 0) + + container_barras:SetBackdrop({ + bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, + insets = {left = 1, right = 1, top = 0, bottom = 1},}) + container_barras:SetBackdropColor (0, 0, 0, 0) - local function define_node( data, node ) - assert( not data.node2id[ node.value ] ) - local id = data.n_nodes - data.n_nodes = data.n_nodes + 1 - data.node2id[ node.value ] = id - append( data.nodes, node ) - return id - end + container_barras:SetAllPoints (container_barras_window) + container_barras:SetWidth (300) + container_barras:SetHeight (150) + container_barras:EnableMouse (true) + container_barras:SetResizable (false) + container_barras:SetMovable (true) + + container_barras_window:SetWidth (260) + container_barras_window:SetHeight (550) + container_barras_window:SetScrollChild (container_barras) + container_barras_window:SetPoint ("TOPLEFT", _detalhes.ListPanel.widget, "TOPLEFT", 21, -10) - local function define_edge( data, edge ) - append( data.edges, edge ) - end + _detalhes.gump:NewScrollBar (container_barras_window, container_barras, -10, -17) + container_barras_window.slider:Altura (560) + container_barras_window.slider:cimaPoint (0, 1) + container_barras_window.slider:baixoPoint (0, -3) + container_barras_window.slider:SetFrameLevel (10) - local function get_metatable( val, enabled ) - if enabled then - if type( debug ) == "table" and - type( debug.getmetatable ) == "function" then - return debug.getmetatable( val ) - elseif type( getmetatable ) == "function" then - return getmetatable( val ) - end - end - end - - local function get_environment( val, enabled ) - if enabled then - if type( debug ) == "table" and - type( debug.getfenv ) == "function" then - return debug.getfenv( val ) - elseif type( getfenv ) == "function" and - type( val ) == "function" then - return getfenv( val ) - end - end - end - - - - -- generate dot code for references - local function dottify_metatable_ref( val, id1, mt, id2, data ) - append( data.edges, { - A = val, A_id = id1, - B = mt, B_id = id2, - style = "dashed", - arrowtail = "odiamond", - label = "metatable", - color = "blue" - } ) - data.nodes[ data.node2id[ val ] ].important = true - data.nodes[ data.node2id[ mt ] ].important = true - end - local function dottify_environment_ref( val, id1, env, id2, data ) - append( data.edges, { - A = val, A_id = id1, - B = env, B_id = id2, - style = "dotted", - arrowtail = "dot", - label = "environment", - color = "red" - } ) - data.nodes[ data.node2id[ val ] ].important = true - data.nodes[ data.node2id[ env ] ].important = true - end - local function dottify_upvalue_ref( val, id1, upv, id2, data, name ) - append( data.edges, { - A = val, A_id = id1, - B = upv, B_id = id2, - style = "dashed", - label = name or "#upvalue", - color = "green" - } ) - data.nodes[ data.node2id[ val ] ].important = true - data.nodes[ data.node2id[ upv ] ].important = true - end - local function dottify_ref( val1, id1, val2, id2, data ) - append( data.edges, { - A = val1, A_id = id1, - B = val2, B_id = id2, - style = "solid", - arrowhead = "normal", - } ) - end - - - -- forward declarations - local dottify_table, dottify_userdata, dottify_thread, dottify_function - - - local function make_label( tab, v, data, id, subid, depth ) - if type( v ) == "table" then - local id2 = dottify_table( v, data, depth+1 ) - dottify_ref( tab, id..":"..subid, v, id2..":0", data ) - return tostring( v ) - elseif type( v ) == "userdata" then - local id2 = dottify_userdata( v, data, depth+1 ) - dottify_ref( tab, id..":"..subid, v, id2, data ) - return tostring( v ) - elseif type( v ) == "function" then - local id2 = dottify_function( v, data, depth+1 ) - dottify_ref( tab, id..":"..subid, v, id2, data ) - return tostring( v ) - elseif type( v ) == "thread" then - local id2 = dottify_thread( v, data, depth+1 ) - dottify_ref( tab, id..":"..subid, v, id2, data ) - return tostring( v ) - elseif type( v ) == "string" then - return abbrev( v, data ) - elseif type( v ) == "number" or type( v ) == "boolean" then - return tostring( v ) - else - error( "unsupported primitive lua type" ) - end - end - - - function dottify_table( tab, data, depth ) - assert( type( tab ) == "table" ) - update_node_depth( tab, data, depth ) - if not data.node2id[ tab ] then - local node = { - value = tab - } - local id = define_node( data, node ) - local label - -- build label for this table - if data.use_html then - node.shape = "plaintext" - label = [[
| ]] .. tostring( tab ) .. [[ | |
| ]] .. el_label .. [[ | |
| ]] .. k_label .. [[ | ]] .. v_label .. [[ |