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 = [[]] - else - node.shape = "record" - label = "{ <0> " .. tostring( tab ) - end - local handled = {} - local n = 1 - -- first the array part - for i,v in ipairs( tab ) do - local el_label = make_label( tab, v, data, id, n, depth ) - if data.use_html then - label = label .. [[]] - else - label = label .. " | <" .. n .. "> " .. el_label - end - n = n + 1 - handled[ i ] = true - end - -- and then the hash part - local keys, values = {}, {} - for k,v in pairs( tab ) do - node.important = true - if not handled[ k ] then -- skip array part elements - local k_label = make_label( tab, k, data, id, "k"..n, depth ) - local v_label = make_label( tab, v, data, id, "v"..n, depth ) - if data.use_html then - label = label .. [[ ]] + container_barras_window.ultimo = 0 + + container_barras_window.gump = container_barras + + function _detalhes.ListPanel:add (text, index, filter) + local row = _detalhes.ListPanel.barras [index] + if (not row) then + row = {text = _detalhes.ListPanel.container:CreateFontString (nil, "overlay", "GameFontNormal")} + _detalhes.ListPanel.barras [index] = row + row.text:SetPoint ("topleft", _detalhes.ListPanel.container, "topleft", 0, -index * 15) + end + + if (filter and text:find (filter)) then + row.text:SetTextColor (1, 1, 0) else - append( keys, " " .. k_label ) - append( values, " " .. v_label ) + row.text:SetTextColor (1, 1, 1) end - n = n + 1 - end - end - if data.use_html then - node.label = label .. [[
]] .. tostring( tab ) .. [[
]] .. el_label .. [[
]] .. k_label .. [[]] .. v_label .. [[
]] - else - if next( keys ) ~= nil then - label = label .. " | { { " .. table.concat( keys, " | " ) .. - " } | { " .. table.concat( values, " | " ) .. " } }" - end - node.label = label .. " }" - end - -- and now the metatable - local mt = get_metatable( tab, data.show_metatables ) - if type( mt ) == "table" then - local id2 = dottify_table( mt, data, depth+1 ) - dottify_metatable_ref( tab, id .. ":0", mt, id2 .. ":0", data ) - end - end - return data.node2id[ tab ] - end - - - function dottify_userdata( udata, data, depth ) - assert( type( udata ) == "userdata" ) - update_node_depth( udata, data, depth ) - if not data.node2id[ udata ] then - local id = define_node( data, { - value = udata, - label = tostring( udata ), - shape = "box" - } ) - -- the metatable - local mt = get_metatable( udata, data.show_metatables ) - if type( mt ) == "table" then - local id2 = dottify_table( mt, data, depth+1 ) - dottify_metatable_ref( udata, id, mt, id2..":0", data ) - end - -- the environment - local env = get_environment( udata, data.show_environments ) - if type( env ) == "table" then - local id2 = dottify_table( env, data, depth+1 ) - dottify_environment_ref( udata, id, env, id2..":0", data ) - end - end - return data.node2id[ udata ] - end - - - function dottify_thread( thread, data, depth ) - assert( type( thread ) == "thread" ) - update_node_depth( thread, data, depth ) - if not data.node2id[ thread ] then - local id = define_node( data, { - value = thread, - label = tostring( thread ), - shape = "triangle" - } ) - -- the environment - local env = get_environment( val, data.show_environments ) - if type( env ) == "table" then - local id2 = dottify_table( env, data, depth+1 ) - dottify_environment_ref( thread, id, env, id2..":0", data ) - end - end - return data.node2id[ thread ] - end - - - - function dottify_function( func, data, depth ) - assert( type( func ) == "function" ) - update_node_depth( func, data, depth ) - if not data.node2id[ func ] then - local id = define_node( data, { - value = func, - label = tostring( func ), - shape = "ellipse" - } ) - -- the environment - local env = get_environment( func, data.show_environments ) - if type( env ) == "table" then - local id2 = dottify_table( env, data, depth+1 ) - dottify_environment_ref( func, id, env, id2..":0", data ) - end - -- the upvalues - if data.show_upvalues and - type( debug ) == "table" and - type( debug.getupvalue ) == "function" then - local n = 1 - repeat - local name, upvalue = debug.getupvalue( func, n ) - if type( upvalue ) == "table" then - local id2 = dottify_table( upvalue, data, depth+1 ) - dottify_upvalue_ref( func, id, upvalue, id2..":0", data, name ) - elseif type( upvalue ) == "userdata" then - local id2 = dottify_userdata( upvalue, data, depth+1 ) - dottify_upvalue_ref( func, id, upvalue, id2, data, name ) - elseif type( upvalue ) == "function" then - local id2 = dottify_function( upvalue, data, depth+1 ) - dottify_upvalue_ref( func, id, upvalue, id2, data, name ) - elseif type( upvalue ) == "thread" then - local id2 = dottify_thread( upvalue, data, depth+1 ) - dottify_upvalue_ref( func, id, upvalue, id2, data, name ) - end - n = n + 1 - until name == nil - end - end - return data.node2id[ func ] - end - - local option_names = { - "label", "shape", "style", "dir", "arrowhead", "arrowtail", "color", - "fillcolor" - } - - local function process_options( obj ) - local options = {} - for _,opt in ipairs( option_names ) do - if obj[ opt ] then - local quote_on = "\"" - local quote_off = "\"" - if opt == "label" and type( obj[ opt ] ) == "string" and - obj[ opt ]:match( "^<.*>$" ) then - quote_on, quote_off = "<", ">" - end - append( options, tostring( opt ) .. "=" .. quote_on .. - tostring( obj[ opt ] ) .. quote_off ) - end - end - return options - end - - - local function write_nodes( file, data ) - for _,n in ipairs( data.nodes ) do - if (data.max_depth <= 0 or - data.node2depth[ n.value ] <= data.max_depth) and - (data.show_unimportant or n.important) then - local options = process_options( n ) - - string_result = string_result .. " " .. tostring( data.node2id[ n.value ] ) .. " [" .. table.concat( options, "," ) .. "];--PULALINHA--" - - end - end - end - - - local function write_edges( file, data ) - for _,e in ipairs( data.edges ) do - if (data.max_depth <= 0 or - (data.node2depth[ e.A ] <= data.max_depth and - data.node2depth[ e.B ] <= data.max_depth)) and - (data.show_unimportant or - (data.nodes[ data.node2id[ e.A ] ].important and - data.nodes[ data.node2id[ e.B ] ].important)) then - local id1 = e.A_id or data.node2id[ e.A ] - local id2 = e.B_id or data.node2id[ e.B ] - local options = process_options( e ) - - string_result = string_result .. " " .. tostring( id1 ) .. " -> " .. tostring( id2 ) .. " [" .. table.concat( options, "," ) .. "];--PULALINHA--" - - end - end - end - - - -- main function - local function dottify( filename, val, ... ) - - local data = { - n_nodes = 1, - node2id = {}, - node2depth = {}, - nodes = {}, - edges = {}, - show_metatables = true, - show_upvalues = true, - show_environments = false, - use_html = true, - show_unimportant = false, - max_depth = 0, - } - for i = 1, select( '#', ... ) do - local opt = select( i, ... ) - if opt == "noenvironments" then - data.show_environments = false - elseif opt == "nometatables" then - data.show_metatables = false - elseif opt == "noupvalues" then - data.show_upvalues = false - elseif opt == "nohtml" then - data.use_html = false - elseif opt == "environments" then - data.show_environments = true - elseif opt == "metatables" then - data.show_metatables = true - elseif opt == "upvalues" then - data.show_upvalues = true - elseif opt == "html" then - data.use_html = true - elseif opt == "unimportant" then - data.show_unimportant = true - elseif type( opt ) == "number" then - data.max_depth = opt - end - end - local t = type( val ) - if t == "table" then - local id = dottify_table( val, data, 1 ) - data.nodes[ id ].important = true - elseif t == "function" then - local id = dottify_function( val, data, 1 ) - data.nodes[ id ].important = true - elseif t == "thread" then - local id = dottify_thread( val, data, 1 ) - data.nodes[ id ].important = true - elseif t == "userdata" then - local id = dottify_userdata( val, data, 1 ) - data.nodes[ id ].important = true - else - io.stderr:write( "warning: unsuitable value for dotlua!
" ) - end - - --local file = assert( io.open( filename, "w" ) ) + + row.text:SetText (text) + end - string_result = string_result .. "digraph {--PULALINHA--" - - --file:write( "digraph {\n" ) - write_nodes ( o, data ) - write_edges ( o, data ) - - string_result = string_result .. "}--PULALINHA--" - - --file:write( "}\n" ) - --file:close() - return o - end - - dottify ( nil, _detalhes, "nohtml") - - print ("running...", string.len (string_result)) - - --_G ["_detalhes_database"].aaaaaaaa = string_result - - _detalhes:CopyPaste (string_result) - - - return dottify -end \ No newline at end of file + return _detalhes.ListPanel +end diff --git a/functions/spells.lua b/functions/spells.lua index 210afe5f..45ab4820 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -61,6 +61,7 @@ do [3044] = "HUNTER",--arcane shot [53301] = "HUNTER",--explosive shot [120361] = "HUNTER",--barrage + [53351] = "HUNTER",--kill shot --mage --> Mage Frost diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 5280a8a5..e746328d 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -15,14 +15,14 @@ function _detalhes:OpenOptionsWindow (instance) -- Most of details widgets have the same 6 first parameters: parent, container, global name, parent key, width, height - window = g:NewPanel (UIParent, _, "DetailsOptionsWindow", _, 700, 360) + window = g:NewPanel (UIParent, _, "DetailsOptionsWindow", _, 700, 470) window.instance = instance tinsert (UISpecialFrames, "DetailsOptionsWindow") window:SetPoint ("center", UIParent, "Center") window.locked = false window.close_with_right = true - g:NewLabel (window, _, "$parentTitle", "title", "Options for Details!") + g:NewLabel (window, _, "$parentTitle", "title", "This is a tiny options panel for Alpha Development Stage of Details!, yeah, it's a mess i agree, but in a near future will be changed.") window.title:SetPoint (10, -10) local c = window:CreateRightClickLabel ("medium") @@ -334,8 +334,8 @@ function _detalhes:OpenOptionsWindow (instance) --------------- Row textures - g:NewLabel (window, _, "$parentTextureLabel", "textureLabel", "row style") - window.textureLabel:SetPoint (250, -30) + g:NewLabel (window, _, "$parentTextureLabel", "textureLabel", "bar texture") + window.textureLabel:SetPoint (250, -35) -- local onSelectTexture = function (_, instance, textureName) instance.barrasInfo.textura = SharedMedia:Fetch ("statusbar", textureName) @@ -352,11 +352,11 @@ function _detalhes:OpenOptionsWindow (instance) window.textureDropdown:SetPoint ("left", window.textureLabel, "right", 2) --------------- Text Sizes - g:NewLabel (window, _, "$parentFontSizeLabel", "fonsizeLabel", "font size") - window.fonsizeLabel:SetPoint (250, -65) + g:NewLabel (window, _, "$parentFontSizeLabel", "fonsizeLabel", "text size") + window.fonsizeLabel:SetPoint (250, -53) -- g:NewSlider (window, _, "$parentSliderFontSize", "fonsizeSlider", 90, 20, 8, 15, 1, tonumber (instance.barrasInfo.fontSize)) --parent, container, name, member, w, h, min, max, step, defaultv - window.fonsizeSlider:SetPoint ("left", window.fonsizeLabel, "right") + window.fonsizeSlider:SetPoint ("left", window.fonsizeLabel, "right", 2) window.fonsizeSlider:SetThumbSize (50) window.fonsizeSlider:SetHook ("OnValueChange", function (self, instance, amount) instance.barrasInfo.fontSize = amount @@ -377,8 +377,8 @@ function _detalhes:OpenOptionsWindow (instance) end local buildFontMenu = function() return fontTable end - g:NewLabel (window, _, "$parentFontLabel", "fontLabel", "select font style") - window.fontLabel:SetPoint (250, -82) + g:NewLabel (window, _, "$parentFontLabel", "fontLabel", "text font") + window.fontLabel:SetPoint (250, -71) -- g:NewDropDown (window, _, "$parentFontDropdown", "fontDropdown", 160, 20, buildFontMenu, nil) window.fontDropdown:SetPoint ("left", window.fontLabel, "right", 2) @@ -386,7 +386,7 @@ function _detalhes:OpenOptionsWindow (instance) --------------- Instance Color g:NewLabel (window, _, "$parentInstanceColorLabel", "instancecolor", "instance color") - window.instancecolor:SetPoint (250, -115) + window.instancecolor:SetPoint (250, -89) local selectedColor = function() local r, g, b = ColorPickerFrame:GetColorRGB() @@ -442,9 +442,110 @@ function _detalhes:OpenOptionsWindow (instance) window.instancecolortexture:SetPoint ("left", window.instancecolor, "right", 2) window.instancecolortexture:SetTexture (1, 1, 1) - g:NewButton (window, _, "$parentInstanceColorButton", "instancecolorbutton", 200, 20, colorpick) + g:NewButton (window, _, "$parentInstanceColorButton", "instancecolorbutton", 150, 14, colorpick) window.instancecolorbutton:SetPoint ("left", window.instancecolor, "right", 2) + window.instancecolorbutton:InstallCustomTexture() + -------- bar background + + g:NewLabel (window, _, "$parentRowBackgroundTextureLabel", "rowBackgroundLabel", "bar background texture") + window.rowBackgroundLabel:SetPoint (250, -107) + -- + local onSelectTextureBackground = function (_, instance, textureName) + instance.barrasInfo.texturaBackground = SharedMedia:Fetch ("statusbar", textureName) + instance.barrasInfo.textureNameBackground = textureName + instance:RefreshBars() + instance:InstanceReset() + instance:InstanceRefreshRows() + end + local textures2 = SharedMedia:HashTable ("statusbar") + local texTable2 = {} + for name, texturePath in pairs (textures2) do + texTable2[#texTable2+1] = {value = name, label = name, statusbar = texturePath, onclick = onSelectTextureBackground} + end + local buildTextureMenu2 = function() return texTable2 end + g:NewDropDown (window, _, "$parentRowBackgroundTextureDropdown", "rowBackgroundDropdown", 120, 20, buildTextureMenu2, nil) -- func, default + window.rowBackgroundDropdown:SetPoint ("left", window.rowBackgroundLabel, "right", 2) + + g:NewLabel (window, _, "$parentRowBackgroundColorLabel", "rowBackgroundColorLabel", "bar background color") + window.rowBackgroundColorLabel:SetPoint (250, -125) + + local selectedRowBackgroundColor = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + + local c = window.instance.barrasInfo.texturaBackgroundColor + c [1], c [2], c [3], c [4] = r, g, b, a + + window.instance:RefreshBars() + window.instance:InstanceReset() + window.instance:InstanceRefreshRows() + + window.rowBackgroundColorTexture:SetTexture (r, g, b, a) + end + + local canceledRowBackgroundColor = function() + local c = window.instance.barrasInfo.texturaBackgroundColor + c [1], c [2], c [3], c [4] = unpack (ColorPickerFrame.previousValues) + + window.instance:RefreshBars() + window.instance:InstanceReset() + window.instance:InstanceRefreshRows() + + ColorPickerFrame.func = nil + ColorPickerFrame.opacityFunc = nil + ColorPickerFrame.cancelFunc = nil + end + + local selectedRowBackgroundAlpha = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + local a = OpacitySliderFrame:GetValue() + + local c = window.instance.barrasInfo.texturaBackgroundColor + c [1], c [2], c [3], c [4] = r, g, b, a + + window.instance:RefreshBars() + window.instance:InstanceReset() + window.instance:InstanceRefreshRows() + + window.rowBackgroundColorTexture:SetTexture (r, g, b, a) + end + + local colorpickRowBackground = function() + ColorPickerFrame.func = selectedRowBackgroundColor + ColorPickerFrame.opacityFunc = selectedRowBackgroundAlpha + ColorPickerFrame.cancelFunc = canceledRowBackgroundColor + ColorPickerFrame.hasOpacity = true --false + ColorPickerFrame.opacity = window.instance.barrasInfo.texturaBackgroundColor[4] + ColorPickerFrame.previousValues = window.instance.barrasInfo.texturaBackgroundColor + ColorPickerFrame:SetParent (window.widget) + ColorPickerFrame:SetColorRGB (unpack (window.instance.barrasInfo.texturaBackgroundColor)) + ColorPickerFrame:Show() + end + + g:NewImage (window, _, "$parentRowBackgroundColor", "rowBackgroundColorTexture", 120, 12) + window.rowBackgroundColorTexture:SetPoint ("left", window.rowBackgroundColorLabel, "right", 2) + window.rowBackgroundColorTexture:SetTexture (1, 1, 1) + + g:NewButton (window, _, "$parentRowBackgroundColorButton", "rowBackgroundColorButton", 120, 14, colorpickRowBackground) + window.rowBackgroundColorButton:SetPoint ("left", window.rowBackgroundColorLabel, "right", 2) + window.rowBackgroundColorButton:InstallCustomTexture() + + --------------- back background with class color + + g:NewLabel (window, _, "$parentRowBackgroundClassColorLabel", "rowBackgroundColorByClassLabel", "background by class") + window.rowBackgroundColorByClassLabel:SetPoint (250, -143) + + g:NewSwitch (window, _, "$parentBackgroundClassColorSlider", "rowBackgroundColorByClassSlider", 60, 20, _, _, instance.barrasInfo.texturaBackgroundByClass) + window.rowBackgroundColorByClassSlider:SetPoint ("left", window.rowBackgroundColorByClassLabel, "right", 2) + window.rowBackgroundColorByClassSlider.tooltip = "" + window.rowBackgroundColorByClassSlider.OnSwitch = function (self, instance, value) + instance.barrasInfo.texturaBackgroundByClass = value + instance:RefreshBars() + instance:InstanceReset() + instance:InstanceRefreshRows() + end + --------------- Background local onSelectSecTexture = function (self, instance, texturePath) @@ -630,12 +731,13 @@ function _detalhes:OpenOptionsWindow (instance) } local buildBackgroundMenu = function() return backgroundTable end - g:NewLabel (window, _, "$parentBackgroundLabel", "backgroundLabel", "instance wallpaper") - window.backgroundLabel:SetPoint (250, -145) + g:NewLabel (window, _, "$parentBackgroundLabel", "backgroundLabel", "enable wallpaper") + window.backgroundLabel:SetPoint (250, -185) -- g:NewSwitch (window, _, "$parentUseBackgroundSlider", "useBackgroundSlider", 60, 20, _, _, window.instance.wallpaper.enabled) - window.useBackgroundSlider:SetPoint ("left", window.backgroundLabel, "right") + window.useBackgroundSlider:SetPoint ("left", window.backgroundLabel, "right", 2, 0) window.useBackgroundSlider.OnSwitch = function (self, instance, value) --> slider, fixedValue, sliderValue + window.useBackgroundSlider.tooltip = "enable or disable wallpaper in this instante\nselect the group on the left box and the image on the right.\nalso, you can edit the image through edit image button." instance.wallpaper.enabled = value if (value) then --> primeira vez que roda: @@ -662,15 +764,15 @@ function _detalhes:OpenOptionsWindow (instance) end g:NewLabel (window, _, "$parentBackgroundLabel", "backgroundLabel", "wallpaper group") - window.backgroundLabel:SetPoint (250, -160) + window.backgroundLabel:SetPoint (250, -200) g:NewLabel (window, _, "$parentBackgroundLabel", "backgroundLabel", "select wallpaper") - window.backgroundLabel:SetPoint (370, -160) + window.backgroundLabel:SetPoint (370, -200) -- g:NewDropDown (window, _, "$parentBackgroundDropdown", "backgroundDropdown", 120, 20, buildBackgroundMenu, nil) - window.backgroundDropdown:SetPoint (250, -175) + window.backgroundDropdown:SetPoint (250, -215) -- g:NewDropDown (window, _, "$parentBackgroundDropdown2", "backgroundDropdown2", 120, 20, buildBackgroundMenu2, nil) - window.backgroundDropdown2:SetPoint (370, -175) + window.backgroundDropdown2:SetPoint (370, -215) local onSelectAnchor = function (_, instance, anchor) @@ -707,7 +809,7 @@ function _detalhes:OpenOptionsWindow (instance) end g:NewLabel (window, _, "$parentAnchorLabel", "anchorLabel", "align") - window.anchorLabel:SetPoint (250, -200) + window.anchorLabel:SetPoint (250, -240) -- g:NewDropDown (window, _, "$parentAnchorDropdown", "anchorDropdown", 100, 20, buildAnchorMenu, nil) window.anchorDropdown:SetPoint ("left", window.anchorLabel, "right", 2) @@ -720,9 +822,9 @@ function _detalhes:OpenOptionsWindow (instance) --------------- Alpha g:NewLabel (window, _, "$parentAlphaLabel", "alphaLabel", "transparency") - window.alphaLabel:SetPoint (250, -230) + window.alphaLabel:SetPoint (250, -270) -- - g:NewSlider (window, _, "$parentAlphaSlider", "alphaSlider", 160, 20, 0.02, 1, 0.02, instance.bg_alpha, true) -- min, max, step, defaultv + g:NewSlider (window, _, "$parentAlphaSlider", "alphaSlider", 130, 20, 0.02, 1, 0.02, instance.bg_alpha, true) -- min, max, step, defaultv window.alphaSlider:SetPoint ("left", window.alphaLabel, "right", 2, 0) window.alphaSlider.useDecimals = true window.alphaSlider:SetHook ("OnValueChange", function (self, instance, amount) --> slider, fixedValue, sliderValue @@ -733,10 +835,42 @@ function _detalhes:OpenOptionsWindow (instance) window.alphaSlider.thumb:SetSize (30+(120*0.2)+2, 20*1.2) window.alphaSlider.tooltip = "Change the background alpha for this instance" + local selectedBackgroundColor = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + window.instance:SetBackgroundColor (r, g, b) + window.backgroundColorTexture:SetTexture (r, g, b) + end + + local canceledBackgroundColor = function() + local c = ColorPickerFrame.previousValues + window.instance:SetBackgroundColor (unpack (c)) + window.backgroundColorTexture:SetTexture (unpack (c)) + ColorPickerFrame.func = nil + ColorPickerFrame.cancelFunc = nil + end + + local colorpickBackgroundColor = function() + ColorPickerFrame.func = selectedBackgroundColor + ColorPickerFrame.cancelFunc = canceledBackgroundColor + ColorPickerFrame.opacityFunc = nil + ColorPickerFrame.hasOpacity = false + ColorPickerFrame.previousValues = {window.instance.bg_r, window.instance.bg_g, window.instance.bg_b} + ColorPickerFrame:SetParent (window.widget) + ColorPickerFrame:SetColorRGB (window.instance.bg_r, window.instance.bg_g, window.instance.bg_b) + ColorPickerFrame:Show() + end + + g:NewImage (window, _, "$parentBackgroundColorTexture", "backgroundColorTexture", 40, 14) + window.backgroundColorTexture:SetPoint ("left", window.alphaSlider, "right", 5) + window.backgroundColorTexture:SetTexture (1, 1, 1) + + g:NewButton (window, _, "$parentBackgroundColorButton", "backgroundColorButton", 40, 20, colorpickBackgroundColor) + window.backgroundColorButton:SetPoint ("left", window.alphaSlider, "right", 5) + window.backgroundColorButton:InstallCustomTexture() --------------- Auto Current Segment g:NewLabel (window, _, "$parentAutoCurrentLabel", "autoCurrentLabel", "auto switch to current") - window.autoCurrentLabel:SetPoint (250, -253) + window.autoCurrentLabel:SetPoint (250, -293) g:NewSwitch (window, _, "$parentAutoCurrentSlider", "autoCurrentSlider", 60, 20, _, _, instance.auto_current) window.autoCurrentSlider:SetPoint ("left", window.autoCurrentLabel, "right", 2) @@ -745,27 +879,186 @@ function _detalhes:OpenOptionsWindow (instance) instance.auto_current = value end + --------------- Bar and Text Color + + -- BAR TEXTURE + g:NewLabel (window, _, "$parentUseClassColorsLabel", "classColorsLabel", "bar texture: class color") + window.classColorsLabel:SetPoint (250, -313) + + g:NewSwitch (window, _, "$parentClassColorSlider", "classColorSlider", 60, 20, _, _, instance.row_texture_class_colors) + window.classColorSlider:SetPoint ("left", window.classColorsLabel, "right", 2) + window.classColorSlider.tooltip = "if enabled, bar color matches the class, \nelse, a fixed color is used for all bars." + window.classColorSlider.OnSwitch = function (self, instance, value) + instance.row_texture_class_colors = value + instance:InstanceReset() + instance:InstanceRefreshRows() + end + -- LEFT TEXT + g:NewLabel (window, _, "$parentUseClassColorsLeftText", "classColorsLeftTextLabel", "left text: class color") + window.classColorsLeftTextLabel:SetPoint (250, -333) + + g:NewSwitch (window, _, "$parentUseClassColorsLeftTextSlider", "classColorsLeftTextSlider", 60, 20, _, _, instance.row_textL_class_colors) + window.classColorsLeftTextSlider:SetPoint ("left", window.classColorsLeftTextLabel, "right", 2) + window.classColorsLeftTextSlider.tooltip = "if enabled, left bar text color matches the class, \nelse, a fixed color is used." + window.classColorsLeftTextSlider.OnSwitch = function (self, instance, value) + instance.row_textL_class_colors = value + instance:InstanceReset() + instance:InstanceRefreshRows() + end + -- RIGHT TEXT + g:NewLabel (window, _, "$parentUseClassColorsRightText", "classColorsRightTextLabel", "right text: class color") + window.classColorsRightTextLabel:SetPoint (250, -347) + + g:NewSwitch (window, _, "$parentUseClassColorsRightTextSlider", "classColorsRightTextSlider", 60, 20, _, _, instance.row_textR_class_colors) + window.classColorsRightTextSlider:SetPoint ("left", window.classColorsRightTextLabel, "right", 2) + window.classColorsRightTextSlider.tooltip = "if enabled, right bar text color matches the class, \nelse, a fixed color is used." + window.classColorsRightTextSlider.OnSwitch = function (self, instance, value) + instance.row_textR_class_colors = value + instance:InstanceReset() + instance:InstanceRefreshRows() + end + -- ROW TEXTURE COLOR + local selectedColorClass = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + window.fixedRowColorTexture:SetTexture (r, g, b) + window.instance.fixed_row_texture_color[1], window.instance.fixed_row_texture_color[2], window.instance.fixed_row_texture_color[3] = r, g, b + instance:InstanceReset() + instance:InstanceRefreshRows() + end + + local canceledColorClass = function() + local c = ColorPickerFrame.previousValues + window.fixedRowColorTexture:SetTexture (c [1], c [2], c [3]) + + window.instance.fixed_row_texture_color[1], window.instance.fixed_row_texture_color[2], window.instance.fixed_row_texture_color[3] = c [1], c [2], c [3] + + ColorPickerFrame.func = nil + ColorPickerFrame.cancelFunc = nil + instance:InstanceReset() + instance:InstanceRefreshRows() + end + + local colorpickClass = function() + ColorPickerFrame.func = selectedColorClass + ColorPickerFrame.cancelFunc = canceledColorClass + ColorPickerFrame.opacityFunc = nil + ColorPickerFrame.hasOpacity = false + ColorPickerFrame.previousValues = window.instance.fixed_row_texture_color + ColorPickerFrame:SetParent (window.widget) + ColorPickerFrame:SetColorRGB (unpack (window.instance.fixed_row_texture_color)) + ColorPickerFrame:Show() + end + + g:NewImage (window, _, "$parentFixedRowColorTexture", "fixedRowColorTexture", 55, 14) + window.fixedRowColorTexture:SetPoint ("left", window.classColorSlider, "right", 5) + window.fixedRowColorTexture:SetTexture (1, 1, 1) + + g:NewButton (window, _, "$parentFixedRowColorButton", "fixedRowColorButton", 55, 20, colorpickClass) + window.fixedRowColorButton:SetPoint ("left", window.fixedRowColorTexture, "left") + window.fixedRowColorButton:InstallCustomTexture() + + -- TEXT COLOR + local selectedTextColor = function() + local r, g, b = ColorPickerFrame:GetColorRGB() + window.fixedRowColorText:SetTexture (r, g, b) + window.instance.fixed_row_text_color[1], window.instance.fixed_row_text_color[2], window.instance.fixed_row_text_color[3] = r, g, b + instance:InstanceReset() + instance:InstanceRefreshRows() + end + + local canceledTextColor = function() + local c = ColorPickerFrame.previousValues + window.fixedRowColorText:SetTexture (c [1], c [2], c [3]) + + window.instance.fixed_row_text_color[1], window.instance.fixed_row_text_color[2], window.instance.fixed_row_text_color[3] = c [1], c [2], c [3] + + ColorPickerFrame.func = nil + ColorPickerFrame.cancelFunc = nil + instance:InstanceReset() + instance:InstanceRefreshRows() + end + + local colorpickTextColor = function() + ColorPickerFrame.func = selectedTextColor + ColorPickerFrame.cancelFunc = canceledTextColor + ColorPickerFrame.opacityFunc = nil + ColorPickerFrame.hasOpacity = false + ColorPickerFrame.previousValues = window.instance.fixed_row_text_color + ColorPickerFrame:SetParent (window.widget) + ColorPickerFrame:SetColorRGB (unpack (window.instance.fixed_row_text_color)) + ColorPickerFrame:Show() + end + + g:NewImage (window, _, "$parentFixedRowColorTTexture", "fixedRowColorText", 55, 25) + window.fixedRowColorText:SetPoint ("topleft", window.classColorsLeftTextSlider, "topright", 10, -5) + window.fixedRowColorText:SetPoint ("bottomleft", window.classColorsRightTextSlider, "bottomright", 10, 5) + window.fixedRowColorText:SetTexture (1, 1, 1) + + g:NewButton (window, _, "$parentFixedRowColorTButton", "fixedRowColorTButton", 55, 25, colorpickTextColor) + window.fixedRowColorTButton:SetPoint ("topleft", window.classColorsLeftTextSlider, "topright", 10, -5) + window.fixedRowColorTButton:SetPoint ("bottomleft", window.classColorsRightTextSlider, "bottomright", 10, 5) + window.fixedRowColorTButton:InstallCustomTexture() + + -- LEFT TEXT OUTLINE + g:NewLabel (window, _, "$parentTextLeftOutlineLabel", "textLeftOutlineLabel", "left text: outline") + window.textLeftOutlineLabel:SetPoint (250, -373) + + g:NewSwitch (window, _, "$parentTextLeftOutlineSlider", "textLeftOutlineSlider", 60, 20, _, _, instance.row_textL_outline) + window.textLeftOutlineSlider:SetPoint ("left", window.textLeftOutlineLabel, "right", 2) + window.textLeftOutlineSlider.tooltip = "if enabled, left text is outlined" + window.textLeftOutlineSlider.OnSwitch = function (self, instance, value) + instance.row_textL_outline = value + instance:InstanceReset() + instance:InstanceRefreshRows() + end + -- RIGHT TEXT OUTLINE + g:NewLabel (window, _, "$parentTextRightOutlineLabel", "textRightOutlineLabel", "right text: outline") + window.textRightOutlineLabel:SetPoint (250, -388) + + g:NewSwitch (window, _, "$parentTextRightOutlineSlider", "textRightOutlineSlider", 60, 20, _, _, instance.row_textR_outline) + window.textRightOutlineSlider:SetPoint ("left", window.textRightOutlineLabel, "right", 2) + window.textRightOutlineSlider.tooltip = "if enabled, right text is outlined" + window.textRightOutlineSlider.OnSwitch = function (self, instance, value) + instance.row_textR_outline = value + instance:InstanceReset() + instance:InstanceRefreshRows() + end + ----------------------- Save Style Text Entry and Button ----------------------------------------- ----- style name g:NewTextEntry (window, _, "$parentSaveStyleName", "saveStyleName", nil, 20, _, _, _, 178) --width will be auto adjusted if space parameter is passed window.saveStyleName:SetLabelText ("style name:") - window.saveStyleName:SetPoint (250, -300) + window.saveStyleName:SetPoint (250, -450) local saveStyleFunc = function() if (not window.saveStyleName.text or window.saveStyleName.text == "") then _detalhes:Msg ("Give a name for your style.") return end + local w = window.instance.wallpaper local savedObject = { name = window.saveStyleName.text, texture = window.textureDropdown.value, fontSize = tonumber (window.fonsizeSlider.value), fontFace = window.fontDropdown.value, - color = window.instance.color, - wallpaper = instance.wallpaper, - alpha = tonumber (window.alphaSlider.value) + color = {unpack (window.instance.color)}, + wallpaper = {texture = w.texture, enabled = w.enabled, texcoord = {unpack (w.texcoord)}, overlay = {unpack(w.overlay)}, anchor = w.anchor, height = w.height, alpha = w.alpha, width = w.width}, + bg_colors = {window.instance.bg_r, window.instance.bg_g, window.instance.bg_b}, + alpha = tonumber (window.alphaSlider.value), + texture_class = window.instance.row_texture_class_colors, + row_textL_class = window.instance.row_textL_class_colors, + row_textR_class = window.instance.row_textR_class_colors, + row_textL_outline = window.instance.row_textL_outline, + row_textR_outline = window.instance.row_textR_outline, + fixed_row_texture_color = {unpack (window.instance.fixed_row_texture_color)}, + fixed_row_text_color = {unpack (window.instance.fixed_row_text_color)}, + texture_background = window.instance.barrasInfo.texturaBackground, + texture_background_color = {unpack (window.instance.barrasInfo.texturaBackgroundColor)}, + texture_background_by_class = window.instance.barrasInfo.texturaBackgroundByClass, + texture_name_background = window.instance.barrasInfo.textureNameBackground } + _detalhes.savedStyles [#_detalhes.savedStyles+1] = savedObject window.saveStyleName.text = "" end @@ -795,15 +1088,43 @@ function _detalhes:OpenOptionsWindow (instance) instance:InstanceWallpaper (style.wallpaper) --alpha instance:SetBackgroundAlpha (style.alpha or _detalhes.default_bg_alpha) + instance:SetBackgroundColor (style.bg_colors) + --texture e texts + instance.row_texture_class_colors = style.texture_class + instance.row_textL_class_colors = style.row_textL_class + instance.row_textR_class_colors = style.row_textR_class + instance.row_textL_outline = style.row_textL_outline + instance.row_textR_outline = style.row_textR_outline + instance.fixed_row_texture_color = {unpack (style.fixed_row_texture_color)} + instance.fixed_row_text_color = {unpack (style.fixed_row_text_color)} + --row background + instance.barrasInfo.texturaBackground = style.texture_background + instance.barrasInfo.texturaBackgroundColor = {unpack (style.texture_background_color)} + instance.barrasInfo.texturaBackgroundByClass = style.texture_background_by_class + instance.barrasInfo.textureNameBackground = style.texture_name_background --refresh instance:RefreshBars() + instance:InstanceReset() + instance:InstanceRefreshRows() --update options + _G.DetailsOptionsWindowBackgroundClassColorSlider.MyObject:SetValue (style.texture_background_by_class) + _G.DetailsOptionsWindowRowBackgroundTextureDropdown.MyObject:Select (style.texture_name_background) + _G.DetailsOptionsWindowRowBackgroundColor.MyObject:SetTexture (unpack (style.texture_background_color)) + _G.DetailsOptionsWindowInstanceColorTexture.MyObject:SetTexture (unpack (style.color)) _G.DetailsOptionsWindowTextureDropdown.MyObject:Select (style.texture) _G.DetailsOptionsWindowFontDropdown.MyObject:Select (style.fontFace) _G.DetailsOptionsWindowSliderFontSize.MyObject:SetValue (style.fontSize) _G.DetailsOptionsWindowAlphaSlider.MyObject:SetValue (style.alpha or _detalhes.default_bg_alpha) + + _G.DetailsOptionsWindowClassColorSlider.MyObject:SetValue (style.texture_class) + _G.DetailsOptionsWindowUseClassColorsLeftTextSlider.MyObject:SetValue (style.row_textL_class) + _G.DetailsOptionsWindowUseClassColorsRightTextSlider.MyObject:SetValue (style.row_textR_class) + _G.DetailsOptionsWindowTextLeftOutlineSlider.MyObject:SetValue (style.row_textL_outline) + _G.DetailsOptionsWindowTextRightOutlineSlider.MyObject:SetValue (style.row_textR_outline) + _G.DetailsOptionsWindowUseBackgroundSlider.MyObject:SetValue (style.wallpaper.enabled) + end local createLoadMenu = function() @@ -841,7 +1162,7 @@ function _detalhes:OpenOptionsWindow (instance) ------ apply to all button local applyToAll = function() for _, this_instance in ipairs (_detalhes.tabela_instancias) do - if (this_instance:IsAtiva() and this_instance.meu_id ~= instance.meu_id) then + if (this_instance:IsAtiva() and this_instance.meu_id ~= window.instance.meu_id) then --texture this_instance.barrasInfo.textura = SharedMedia:Fetch ("statusbar", window.textureDropdown.value) this_instance.barrasInfo.textureName = window.textureDropdown.value @@ -854,8 +1175,19 @@ function _detalhes:OpenOptionsWindow (instance) this_instance:InstanceColor (window.instance.color) --wallpaper this_instance:InstanceWallpaper (window.instance.wallpaper) + --alpha + this_instance:SetBackgroundAlpha (window.instance.bg_alpha) + this_instance:SetBackgroundColor (window.instance.bg_r, window.instance.bg_g, window.instance.bg_b) + --texture e texts + this_instance.row_texture_class_colors = window.instance.row_texture_class_colors + this_instance.row_textL_class_colors = window.instance.row_textL_class_colors + this_instance.row_textR_class_colors = window.instance.row_textR_class_colors + this_instance.row_textL_outline = window.instance.row_textL_outline + this_instance.row_textR_outline = window.instance.row_textR_outline --refresh this_instance:RefreshBars() + this_instance:InstanceReset() + this_instance:InstanceRefreshRows() end end end @@ -864,6 +1196,72 @@ function _detalhes:OpenOptionsWindow (instance) window.applyToAll:InstallCustomTexture() window.applyToAll:SetPoint ("bottomright", window.removeStyle, "topright", 1, 3) + _detalhes.defaultStyle = { + texture = "Details D'ictum", + fontSize = 11, + fontFace = "Arial Narrow", + color = {1, 1, 1, 1}, + wallpaper = {enabled = false, texcoord = {0, 1, 0, 1}, overlay = {1, 1, 1, 1}, anchor = "all", height = 0, alpha = 0.5, width = 0}, + alpha = 0.7, + bg_colors = {0.0941, 0.0941, 0.0941}, + texture_class = true, + row_textL_class = false, + row_textR_class = false, + row_textL_outline = false, + row_textR_outline = false + } + + local resetToDefaults = function() + local style = _detalhes.defaultStyle + local instance = window.instance + --texture + instance.barrasInfo.textura = SharedMedia:Fetch ("statusbar", style.texture) + instance.barrasInfo.textureName = style.texture + --fontface + instance.barrasInfo.font = SharedMedia:Fetch ("font", style.fontFace) + instance.barrasInfo.fontName = style.fontFace + --fontsize + instance.barrasInfo.fontSize = tonumber (style.fontSize) + --color + instance:InstanceColor (style.color) + instance:SetBackgroundColor (style.bg_colors) + --wallpaper + instance:InstanceWallpaper (style.wallpaper) + --alpha + instance:SetBackgroundAlpha (style.alpha or _detalhes.default_bg_alpha) + --texture e texts + instance.row_texture_class_colors = style.texture_class + instance.fixed_row_texture_color = {0, 0, 0} + instance.row_textL_class_colors = style.row_textL_class + instance.row_textR_class_colors = style.row_textR_class + instance.fixed_row_text_color = {1, 1, 1} + instance.row_textL_outline = style.row_textL_outline + instance.row_textR_outline = style.row_textR_outline + --refresh + instance:RefreshBars() + instance:InstanceReset() + instance:InstanceRefreshRows() + --update options + + _G.DetailsOptionsWindowInstanceColorTexture.MyObject:SetTexture (unpack (style.color)) + _G.DetailsOptionsWindowBackgroundColorTexture.MyObject:SetTexture (unpack (style.bg_colors)) + _G.DetailsOptionsWindowFixedRowColorTexture.MyObject:SetTexture (0, 0, 0) + _G.DetailsOptionsWindowFixedRowColorTTexture.MyObject:SetTexture (unpack (instance.fixed_row_text_color)) + _G.DetailsOptionsWindowTextureDropdown.MyObject:Select (style.texture) + _G.DetailsOptionsWindowFontDropdown.MyObject:Select (style.fontFace) + _G.DetailsOptionsWindowSliderFontSize.MyObject:SetValue (style.fontSize) + _G.DetailsOptionsWindowAlphaSlider.MyObject:SetValue (style.alpha or _detalhes.default_bg_alpha) + + _G.DetailsOptionsWindowClassColorSlider.MyObject:SetValue (style.texture_class) + _G.DetailsOptionsWindowUseClassColorsLeftTextSlider.MyObject:SetValue (style.row_textL_class) + _G.DetailsOptionsWindowUseClassColorsRightTextSlider.MyObject:SetValue (style.row_textR_class) + _G.DetailsOptionsWindowTextLeftOutlineSlider.MyObject:SetValue (style.row_textL_outline) + _G.DetailsOptionsWindowTextRightOutlineSlider.MyObject:SetValue (style.row_textR_outline) + end + g:NewButton (window, _, "$parentResetToDefaultButton", "resetToDefaults", 100, 14, resetToDefaults, nil, nil, nil, "reset to default") + window.resetToDefaults:InstallCustomTexture() + window.resetToDefaults:SetPoint ("right", window.applyToAll, "left", -5, 0) + -- Persona -------------------------------------------------------------------------------------------------------------------------------------------- @@ -895,6 +1293,18 @@ function _detalhes:OpenOptionsWindow (instance) window.chooseAvatarButton:InstallCustomTexture() window.chooseAvatarButton:SetPoint (510, -55) +-- realm name -------------------------------------------------------------------------------------------------------------------------------------------- + + g:NewLabel (window, _, "$parentRealmNameLabel", "realmNameLabel", "remove realm name") + window.realmNameLabel:SetPoint (510, -80) + + g:NewSwitch (window, _, "$parentRealmNameSlider", "realmNameSlider", 60, 20, _, _, _detalhes.remove_realm_from_name) + window.realmNameSlider:SetPoint ("left", window.realmNameLabel, "right", 2) + window.realmNameSlider.tooltip = "When enabled and inside a instance, the realm name\nwill not be shown after the player name." + window.realmNameSlider.OnSwitch = function (self, _, value) + _detalhes.remove_realm_from_name = value + end + end @@ -902,7 +1312,14 @@ function _detalhes:OpenOptionsWindow (instance) --> Show _G.DetailsOptionsWindowTextureDropdown.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowRowBackgroundTextureDropdown.MyObject:SetFixedParameter (instance) _G.DetailsOptionsWindowTextureDropdown.MyObject:Select (instance.barrasInfo.textureName) + _G.DetailsOptionsWindowRowBackgroundTextureDropdown.MyObject:Select (instance.barrasInfo.textureNameBackground) + _G.DetailsOptionsWindowRowBackgroundColor.MyObject:SetTexture (unpack (instance.barrasInfo.texturaBackgroundColor)) + + _G.DetailsOptionsWindowBackgroundClassColorSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowBackgroundClassColorSlider.MyObject:SetValue (instance.barrasInfo.texturaBackgroundByClass) + -- _G.DetailsOptionsWindowFontDropdown.MyObject:SetFixedParameter (instance) _G.DetailsOptionsWindowFontDropdown.MyObject:Select (instance.barrasInfo.fontName) @@ -913,6 +1330,19 @@ function _detalhes:OpenOptionsWindow (instance) _G.DetailsOptionsWindowAutoCurrentSlider.MyObject:SetFixedParameter (instance) _G.DetailsOptionsWindowAutoCurrentSlider.MyObject:SetValue (instance.auto_current) -- + _G.DetailsOptionsWindowClassColorSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowClassColorSlider.MyObject:SetValue (instance.row_texture_class_colors) + + _G.DetailsOptionsWindowUseClassColorsLeftTextSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowUseClassColorsLeftTextSlider.MyObject:SetValue (instance.row_textL_class_colors) + _G.DetailsOptionsWindowUseClassColorsRightTextSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowUseClassColorsRightTextSlider.MyObject:SetValue (instance.row_textR_class_colors) + + _G.DetailsOptionsWindowTextLeftOutlineSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowTextLeftOutlineSlider.MyObject:SetValue (instance.row_textL_outline) + _G.DetailsOptionsWindowTextRightOutlineSlider.MyObject:SetFixedParameter (instance) + _G.DetailsOptionsWindowTextRightOutlineSlider.MyObject:SetValue (instance.row_textR_outline) + -- _G.DetailsOptionsWindowAlphaSlider.MyObject:SetFixedParameter (instance) _G.DetailsOptionsWindowAlphaSlider.MyObject:SetValue (instance.bg_alpha) -- @@ -935,6 +1365,9 @@ function _detalhes:OpenOptionsWindow (instance) _G.DetailsOptionsWindowTTDropdown.MyObject:Select (_detalhes.time_type, true) -- _G.DetailsOptionsWindowInstanceColorTexture.MyObject:SetTexture (unpack (instance.color)) + _G.DetailsOptionsWindowBackgroundColorTexture.MyObject:SetTexture (instance.bg_r, instance.bg_g, instance.bg_b) + _G.DetailsOptionsWindowFixedRowColorTexture.MyObject:SetTexture (unpack (instance.fixed_row_texture_color)) + _G.DetailsOptionsWindowFixedRowColorTTexture.MyObject:SetTexture (unpack (instance.fixed_row_text_color)) -- GameCooltip:SetFixedParameter (_G.DetailsOptionsWindowLoadStyleButton, instance) diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 9e79cb29..e920b138 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -17,6 +17,7 @@ local _math_floor = math.floor local _ipairs = ipairs local _pairs = pairs local _string_lower = string.lower +local _unpack = unpack --api locals local _CreateFrame = CreateFrame local _GetTime = GetTime @@ -2145,6 +2146,10 @@ function gump:CriaNovaBarra (instancia, index) esta_barra.textura:SetHorizTile (false) esta_barra.textura:SetVertTile (false) esta_barra.textura:SetTexture (instancia.barrasInfo.textura) + + esta_barra.background = esta_barra:CreateTexture (nil, "BACKGROUND") + esta_barra.background:SetTexture() + esta_barra.background:SetAllPoints (esta_barra) esta_barra.statusbar:SetStatusBarColor (0, 0, 0, 0) esta_barra.statusbar:SetStatusBarTexture (esta_barra.textura) @@ -2186,7 +2191,23 @@ function gump:CriaNovaBarra (instancia, index) instancia:SetFontFace (esta_barra.texto_direita, instancia.barrasInfo.font) _detalhes.font_pool:add (esta_barra.texto_direita) + if (instancia.row_textL_outline) then + instancia:SetFontOutline (esta_barra.texto_esquerdo, instancia.row_textL_outline) + end + if (instancia.row_textR_outline) then + instancia:SetFontOutline (esta_barra.texto_direita, instancia.row_textR_outline) + end + if (not instancia.row_texture_class_colors) then + esta_barra.textura:SetVertexColor (_unpack (instancia.fixed_row_texture_color)) + end + + if (not instancia.row_textL_class_colors) then + esta_barra.texto_esquerdo:SetTextColor (_unpack (instancia.fixed_row_text_color)) + end + if (not instancia.row_textR_class_colors) then + esta_barra.texto_direita:SetTextColor (_unpack (instancia.fixed_row_text_color)) + end --> inicia os scripts da barra barra_scripts (esta_barra, instancia, index) @@ -2196,6 +2217,54 @@ function gump:CriaNovaBarra (instancia, index) return esta_barra end +function _detalhes:InstanceRefreshRows (instancia) + if (instancia) then + self = instancia + end + + --outline + local L_outline = self.row_textL_outline + local R_outline = self.row_textR_outline + --texture color + local textureClassColor = self.row_texture_class_colors + local texture_r, texture_g, texture_b + if (not textureClassColor) then + texture_r, texture_g, texture_b = _unpack (self.fixed_row_texture_color) + end + --text color + local leftTextClassColor = self.row_textL_class_colors + local rightTextClassColor = self.row_textR_class_colors + local text_r, text_g, text_b + if (not leftTextClassColor or not rightTextClassColor) then + text_r, text_g, text_b = _unpack (self.fixed_row_text_color) + end + + for _, row in _ipairs (self.barras) do + + if (L_outline) then + self:SetFontOutline (row.texto_esquerdo, L_outline) + else + self:SetFontOutline (row.texto_esquerdo, nil) + end + if (R_outline) then + self:SetFontOutline (row.texto_direita, R_outline) + else + self:SetFontOutline (row.texto_direita, nil) + end + -- + if (not textureClassColor) then + row.textura:SetVertexColor (texture_r, texture_g, texture_b) + end + -- + if (not leftTextClassColor) then + row.texto_esquerdo:SetTextColor (text_r, text_g, text_b) + end + if (not rightTextClassColor) then + row.texto_direita:SetTextColor (text_r, text_g, text_b) + end + end +end + -- search key: ~wallpaper function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, height, overlay) @@ -2211,11 +2280,35 @@ function _detalhes:InstanceWallpaper (texture, anchor, alpha, texcoord, width, h elseif (type (texture) == "table") then anchor = texture.anchor or wallpaper.anchor alpha = texture.alpha or wallpaper.alpha - texcoord = texture.texcoord or wallpaper.texcoord + if (texture.texcoord) then + texcoord = {unpack (texture.texcoord)} + else + texcoord = wallpaper.texcoord + end width = texture.width or wallpaper.width height = texture.height or wallpaper.height - overlay = texture.overlay or wallpaper.overlay + if (texture.overlay) then + overlay = {unpack (texture.overlay)} + else + overlay = wallpaper.overlay + end + + if (type (texture.enabled) == "boolean") then + if (not texture.enabled) then + wallpaper.enabled = false + wallpaper.texture = texture.texture or wallpaper.texture + wallpaper.anchor = anchor + wallpaper.alpha = alpha + wallpaper.texcoord = texcoord + wallpaper.width = width + wallpaper.height = height + wallpaper.overlay = overlay + return self:InstanceWallpaper (false) + end + end + texture = texture.texture or wallpaper.texture + else texture = texture or wallpaper.texture anchor = anchor or wallpaper.anchor @@ -2481,7 +2574,7 @@ function _detalhes:DefaultIcons (_mode, _segment, _attributes, _report) self.lastIcon = baseToolbar.ball end - _detalhes.ToolBar:ReorganizeIcons() + _detalhes.ToolBar:ReorganizeIcons() --> aqui 2553 return true end diff --git a/images/icons.tga b/images/icons.tga index c94dae99..6d9a429c 100644 Binary files a/images/icons.tga and b/images/icons.tga differ diff --git a/locales/Details-enUS.lua b/locales/Details-enUS.lua index 163016ff..ee7d98fb 100644 --- a/locales/Details-enUS.lua +++ b/locales/Details-enUS.lua @@ -20,6 +20,7 @@ if not Loc then return end Loc ["STRING_INSTANCE_LIMIT"] = "max instance number has been reached, you can modify this limit over options panel." Loc ["STRING_PLEASE_WAIT"] = "Please wait" + Loc ["STRING_UPTADING"] = "updating" Loc ["STRING_RIGHTCLICK_CLOSE_SHORT"] = "Right click to close." Loc ["STRING_RIGHTCLICK_CLOSE_MEDIUM"] = "Use right click to close this window." @@ -187,6 +188,7 @@ if not Loc then return end Loc ["STRING_HPS"] = "Hps" Loc ["STRING_HEAL"] = "Heal" + Loc ["STRING_HEAL_CRIT"] = "Heal Critical" Loc ["STRING_HEAL_ABSORBED"] = "Heal absorbed" Loc ["STRING_OVERHEAL"] = "Overheal" Loc ["STRING_"] = "" @@ -203,6 +205,11 @@ if not Loc then return end Loc ["STRING_PLUGIN_CLOCKTYPE"] = "Clock Type" + Loc ["STRING_PLUGIN_DURABILITY"] = "Durability" + Loc ["STRING_PLUGIN_LATENCY"] = "Latency" + Loc ["STRING_PLUGIN_GOLD"] = "Gold" + Loc ["STRING_PLUGIN_FPS"] = "Framerate" + Loc ["STRING_PLUGIN_TIME"] = "Clock" Loc ["STRING_PLUGIN_CLOCKNAME"] = "Encounter Time" Loc ["STRING_PLUGIN_PSEGMENTNAME"] = "Instance Segment" Loc ["STRING_PLUGIN_PDPSNAME"] = "Raid Dps" diff --git a/locales/Details-ptBR.lua b/locales/Details-ptBR.lua index f8df4431..6389468e 100644 --- a/locales/Details-ptBR.lua +++ b/locales/Details-ptBR.lua @@ -20,6 +20,7 @@ if not Loc then return end Loc ["STRING_INSTANCE_LIMIT"] = "o limite de instancias foi atingido, voce pode modificar este limite no painel de opcoes." Loc ["STRING_PLEASE_WAIT"] = "Por favor espere" + Loc ["STRING_UPTADING"] = "atualizando" Loc ["STRING_RIGHTCLICK_CLOSE_SHORT"] = "Botao direito para fechar." Loc ["STRING_RIGHTCLICK_CLOSE_MEDIUM"] = "Use o botao direito para fechar esta janela." @@ -185,6 +186,7 @@ if not Loc then return end Loc ["STRING_HPS"] = "Hps" Loc ["STRING_HEAL"] = "Cura" + Loc ["STRING_HEAL_CRIT"] = "Cura Critica" Loc ["STRING_HEAL_ABSORBED"] = "Cura absorvida" Loc ["STRING_OVERHEAL"] = "Sobrecura" ---------------- @@ -201,6 +203,11 @@ if not Loc then return end Loc ["STRING_PLUGIN_CLOCKTYPE"] = "Tipo do Tempo" + Loc ["STRING_PLUGIN_DURABILITY"] = "Durabilidade" + Loc ["STRING_PLUGIN_LATENCY"] = "Latencia" + Loc ["STRING_PLUGIN_GOLD"] = "Dinheiro" + Loc ["STRING_PLUGIN_FPS"] = "Quadros por Segundo" + Loc ["STRING_PLUGIN_TIME"] = "Relogio" Loc ["STRING_PLUGIN_CLOCKNAME"] = "Tempo de Luta" Loc ["STRING_PLUGIN_PSEGMENTNAME"] = "Segmento Mostrado" Loc ["STRING_PLUGIN_PDPSNAME"] = "Dps da Raide" diff --git a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua index 92351eda..54262f44 100644 --- a/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua +++ b/plugins/Details_RaidInfo-SiegeOfOrgrimmar/SiegeOfOrgrimmar.lua @@ -125,7 +125,7 @@ local siege_of_orgrimmar = { [71772] = true, -- korkron assassin [71773] = true, -- krokron warshaman [71770] = true, -- krokron iron blade - [71715] = true, -- orgrimmar faithful + --[71715] = true, -- orgrimmar faithful -- also is used in nazgrim encounter }, encounters = { diff --git a/plugins/Details_Vanguard/Details_Vanguard.lua b/plugins/Details_Vanguard/Details_Vanguard.lua index b9ab6a7a..1610fe4c 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.lua +++ b/plugins/Details_Vanguard/Details_Vanguard.lua @@ -1139,7 +1139,7 @@ local function CreatePluginFrames (data) --> first, we need to get what we want to track: local MyTarget, Realm = _UnitName ("target") if (MyTarget and _UnitIsPlayer ("target")) then - if (Realm) then + if (Realm and Realm ~= "") then MyTarget = MyTarget.."-"..Realm end _track_player_object = _combat_object (1, MyTarget) diff --git a/startup.lua b/startup.lua index 0cf6b669..a6076eec 100644 --- a/startup.lua +++ b/startup.lua @@ -37,6 +37,10 @@ function _G._detalhes:Start() self.deadlog_limit = self.deadlog_limit or 12 self.minimum_combat_time = self.minimum_combat_time or 5 + if (type (self.remove_realm_from_name) ~= "boolean") then + self.remove_realm_from_name = true + end + if (type (self.cloud_capture) ~= "boolean") then self.cloud_capture = true end @@ -201,9 +205,11 @@ function _G._detalhes:Start() local instance = self.tabela_instancias [index] if (instance:IsAtiva()) then self:ScheduleTimer ("RefreshBars", 1, instance) + self:ScheduleTimer ("InstanceReset", 1, instance) + self:ScheduleTimer ("InstanceRefreshRows", 1, instance) end end - + function self:AtualizaGumps() self:AtualizaGumpPrincipal (-1, true) self.AtualizaGumps = nil @@ -263,10 +269,7 @@ function _G._detalhes:Start() --> group self.details_users = {} self.in_group = IsInGroup() or IsInRaid() - if (self.in_group) then - _detalhes:SendHighFive() - end - + --> send messages gathered on initialization self:ScheduleTimer ("ShowDelayMsg", 7)