diff --git a/.pkgmeta b/.pkgmeta index b5c3db68..9b4e07b6 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -1,3 +1,7 @@ +externals: + !NickTag: + url: http://hg.curseforge.net/wow/nicktag/mainline + move-folders: Details/plugins/Details_DmgRank: Details_DmgRank Details/plugins/Details_EncounterDetails: Details_EncounterDetails diff --git a/boot.lua b/boot.lua index 7ba137d9..57848ca4 100644 --- a/boot.lua +++ b/boot.lua @@ -5,10 +5,10 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> global name declaration - _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0") - _detalhes.userversion = "v1.1.8" - _detalhes.version = "Alpha 003" - _detalhes.realversion = 3 + _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") + _detalhes.userversion = "v1.2.0" + _detalhes.version = "Alpha 004" + _detalhes.realversion = 4 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff @@ -210,8 +210,9 @@ do end --> print messages - function _detalhes:Msg (_string) - print (Loc ["STRING_DETAILS1"] .. _string) + function _detalhes:Msg (_string, arg1, arg2, arg3, arg4) + + print (Loc ["STRING_DETAILS1"] .. _string, arg1 or "", arg2 or "", arg3 or "", arg4 or "") end end diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index 66289e9e..6abf8ca3 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -667,6 +667,7 @@ end end ---------> TOOLTIPS BIFURCAÇÃO + function atributo_damage:ToolTip (instancia, numero, barra) --> seria possivel aqui colocar o icone da classe dele? @@ -682,6 +683,10 @@ function atributo_damage:ToolTip (instancia, numero, barra) end end end +--> tooltip locals +local r, g, b +local headerColor = "yellow" +local barAlha = .6 --[[exported]] function _detalhes.Sort1 (table1, table2) return table1 [1] > table2 [1] @@ -698,15 +703,29 @@ end ---------> DAMAGE DONE & DPS function atributo_damage:ToolTip_DamageDone (instancia, numero, barra) - - do + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + + do --> TOP HABILIDADES local ActorDamage = self.total_without_pet local ActorSkillsContainer = self.spell_tables._ActorTable local ActorSkillsSortTable = {} + + local meu_tempo + if (_detalhes.time_type == 1 or not self.grupo) then + meu_tempo = self:Tempo() + elseif (_detalhes.time_type == 2) then + meu_tempo = self:GetCombatTime() + end + for _spellid, _skill in _pairs (ActorSkillsContainer) do - ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total} + ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo} end _table_sort (ActorSkillsSortTable, _detalhes.Sort2) @@ -719,24 +738,47 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra) _table_sort (ActorTargetsSortTable, _detalhes.Sort2) --> MOSTRA HABILIDADES - GameTooltip:AddLine (Loc ["STRING_SPELLS"]..":") + --leftText, rightText, frame, ColorR, ColorG, ColorB, ColorA, ColorR1, ColorG2, ColorB3, ColorA4, fontSize, fontFace + + GameCooltip:AddLine (Loc ["STRING_SPELLS"].."", nil, nil, headerColor, nil, 12) + GameCooltip:AddIcon ([[Interface\HELPFRAME\HotIssueIcon]], 1, 1, 14, 14, 0.0625, 0.90625, 0, 1) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + + local tooltip_max_abilities = _detalhes.tooltip_max_abilities + + if (instancia.sub_atributo == 2) then + tooltip_max_abilities = 6 + end + if (#ActorSkillsSortTable > 0) then - for i = 1, _math_min (_detalhes.tooltip_max_abilities, #ActorSkillsSortTable) do + for i = 1, _math_min (tooltip_max_abilities, #ActorSkillsSortTable) do local SkillTable = ActorSkillsSortTable [i] local nome_magia, _, icone_magia = _GetSpellInfo (SkillTable [1]) - GameTooltip:AddDoubleLine (nome_magia..": ", _detalhes:comma_value (SkillTable [2]) .." (".._cstr("%.1f", SkillTable [2]/ActorDamage*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + if (instancia.sub_atributo == 1) then + GameCooltip:AddLine (nome_magia..": ", _detalhes:comma_value (SkillTable [2]) .." (".._cstr("%.1f", SkillTable [2]/ActorDamage*100).."%)") + else + GameCooltip:AddLine (nome_magia..": ", _detalhes:comma_value (_math_floor (SkillTable [3])) .." (".._cstr("%.1f", SkillTable [2]/ActorDamage*100).."%)") + end + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end else - GameTooltip:AddLine (Loc ["STRING_NO_SPELL"]) + GameCooltip:AddLine (Loc ["STRING_NO_SPELL"]) end --> MOSTRA INIMIGOS - GameTooltip:AddLine (Loc ["STRING_TARGETS"]..":") - for i = 1, _math_min (_detalhes.tooltip_max_targets, #ActorTargetsSortTable) do - local este_inimigo = ActorTargetsSortTable [i] - GameTooltip:AddDoubleLine (este_inimigo[1]..": ", _detalhes:comma_value (este_inimigo[2]) .." (".._cstr("%.1f", este_inimigo[2]/ActorDamage*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\espadas") + if (instancia.sub_atributo == 1) then + GameCooltip:AddLine (Loc ["STRING_TARGETS"].."", nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0, 0.03125, 0.126953125, 0.15625) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + + for i = 1, _math_min (_detalhes.tooltip_max_targets, #ActorTargetsSortTable) do + local este_inimigo = ActorTargetsSortTable [i] + GameCooltip:AddLine (este_inimigo[1]..": ", _detalhes:comma_value (este_inimigo[2]) .." (".._cstr("%.1f", este_inimigo[2]/ActorDamage*100).."%)") + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\espadas", nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .2) + end end end @@ -759,7 +801,14 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra) local tabela = my_self.spell_tables._ActorTable local meus_danos = {} - totais [nome] = my_self.total_without_pet + --totais [nome] = my_self.total_without_pet + local meu_tempo + if (_detalhes.time_type == 1 or not self.grupo) then + meu_tempo = my_self:Tempo() + elseif (_detalhes.time_type == 2) then + meu_tempo = my_self:GetCombatTime() + end + totais [#totais+1] = {nome, my_self.total_without_pet, my_self.total_without_pet/meu_tempo} for spellid, tabela in _pairs (tabela) do local nome, rank, icone = _GetSpellInfo (spellid) @@ -782,42 +831,83 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra) end end - GameTooltip:AddLine (" ") + --GameTooltip:AddLine (" ") + --GameCooltip:AddLine (" ") local _quantidade = 0 + local added_logo = false + _table_sort (totais, _detalhes.Sort2) - for nome, meus_danos in _pairs (danos) do --> um pet de cada vez - local n = nome:gsub (("%s%<.*"), "") - --GameTooltip:AddDoubleLine ("Ajudante: ", "x"..quantidade[nome].." "..n.." (".._math_floor (totais [nome]/self.total*100).."%)", nil, nil, nil, 1, 1, 1) - --> pintar o nome do pet com a cor da classe do jogador + if (true) then - local cor = self.cor - GameTooltip:AddDoubleLine (Loc ["STRING_PET"]..":", n.." (".._math_floor (totais [nome]/self.total*100).."%)", nil, nil, nil, _unpack (_detalhes.class_colors [self.classe])) --> removido a quantidade - GameTooltip:AddLine (Loc ["STRING_SPELLS"]) - for i = 1, 3 do - if (meus_danos[i]) then - --> meus_danos = { [1] = spellid [2] = total [3] = % [4] = { [1] = nome [2] = rank [3] = icone } } - GameTooltip:AddDoubleLine (meus_danos[i][4][1]..": ", _detalhes:comma_value (meus_danos[i][2]).." (".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (meus_danos[i][4][3]) + for _, _table in _ipairs (totais) do + + if (_table [2] > 0) then + + if (not added_logo) then + added_logo = true + GameCooltip:AddLine (Loc ["STRING_PETS"].."", nil, nil, headerColor, nil, 12) + + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + end + + local n = _table [1]:gsub (("%s%<.*"), "") + if (instancia.sub_atributo == 1) then + GameCooltip:AddLine (n, _detalhes:comma_value (_table [2]) .. " (" .. _math_floor (_table [2]/self.total*100) .. "%)") + else + GameCooltip:AddLine (n, _detalhes:comma_value ( _math_floor (_table [3])) .. " (" .. _math_floor (_table [2]/self.total*100) .. "%)") + end + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) end end - GameTooltip:AddLine (Loc ["STRING_TARGETS"]) - for i = 1, 3 do - local meus_inimigos = alvos [nome] - if (meus_inimigos[i]) then - GameTooltip:AddDoubleLine (meus_inimigos[i][1]..": ", _detalhes:comma_value (meus_inimigos[i][2]).." (".._cstr("%.1f", meus_inimigos[i][3]).."%)", 1, 1, 1, 1, 1, 1) - --GameTooltip:AddTexture ("Interface\\GossipFrame\\BattleMasterGossipIcon.blp") + else + --> old pet display mode + for nome, meus_danos in _pairs (danos) do --> um pet de cada vez + local n = nome:gsub (("%s%<.*"), "") + --GameTooltip:AddDoubleLine ("Ajudante: ", "x"..quantidade[nome].." "..n.." (".._math_floor (totais [nome]/self.total*100).."%)", nil, nil, nil, 1, 1, 1) + --> pintar o nome do pet com a cor da classe do jogador + + local cor = self.cor + GameCooltip:AddLine (Loc ["STRING_PET"]..":", n.." (".._math_floor (totais [nome]/self.total*100).."%)", 1, 1, 1, 1, _unpack (_detalhes.class_colors [self.classe])) --> removido a quantidade + --GameCooltip:AddLine (Loc ["STRING_SPELLS"]) + --GameTooltip:AddDoubleLine (Loc ["STRING_PET"]..":", n.." (".._math_floor (totais [nome]/self.total*100).."%)", nil, nil, nil, _unpack (_detalhes.class_colors [self.classe])) --> removido a quantidade + --GameTooltip:AddLine (Loc ["STRING_SPELLS"]) + for i = 1, 3 do + if (meus_danos[i]) then + --> meus_danos = { [1] = spellid [2] = total [3] = % [4] = { [1] = nome [2] = rank [3] = icone } } + GameCooltip:AddLine (meus_danos[i][4][1]..": ", _detalhes:comma_value (meus_danos[i][2]).." (".._cstr("%.1f", meus_danos[i][3]).."%)") + GameCooltip:AddIcon (meus_danos[i][4][3], nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .2) + --GameTooltip:AddDoubleLine (meus_danos[i][4][1]..": ", _detalhes:comma_value (meus_danos[i][2]).." (".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1) + --GameTooltip:AddTexture (meus_danos[i][4][3]) + end + end + + GameTooltip:AddLine (Loc ["STRING_TARGETS"]) + for i = 1, 3 do + local meus_inimigos = alvos [nome] + if (meus_inimigos[i]) then + GameTooltip:AddLine (meus_inimigos[i][1]..": ", _detalhes:comma_value (meus_inimigos[i][2]).." (".._cstr("%.1f", meus_inimigos[i][3]).."%)") + --GameTooltip:AddDoubleLine (meus_inimigos[i][1]..": ", _detalhes:comma_value (meus_inimigos[i][2]).." (".._cstr("%.1f", meus_inimigos[i][3]).."%)", 1, 1, 1, 1, 1, 1) + --GameTooltip:AddTexture ("Interface\\GossipFrame\\BattleMasterGossipIcon.blp") - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\espadas") + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\espadas", nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .2) + --GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\espadas") + end + end + + --GameTooltip:AddLine (" ") + + _quantidade = _quantidade + 1 + if (_quantidade >= _detalhes.tooltip_max_pets) then + return true end - end - - GameTooltip:AddLine (" ") - - _quantidade = _quantidade + 1 - if (_quantidade >= _detalhes.tooltip_max_pets) then - return true end end end @@ -828,6 +918,13 @@ end ---------> DAMAGE TAKEN function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local agressores = self.damage_from local damage_taken = self.damage_taken @@ -835,7 +932,7 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra) local showing = tabela_do_combate [class_type] --> o que esta sendo mostrado -> [1] - dano [2] - cura --> pega o container com ._NameIndexTable ._ActorTable local meus_agressores = {} - + for nome, _ in _pairs (agressores) do --> agressores seria a lista de nomes local este_agressor = showing._ActorTable[showing._NameIndexTable[nome]] if (este_agressor) then --> checagem por causa do total e do garbage collector que não limpa os nomes que deram dano @@ -849,21 +946,30 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra) _table_sort (meus_agressores, function (a, b) return a[2] > b[2] end) - GameTooltip:AddLine (" ") - + GameCooltip:AddLine (Loc ["STRING_FROM"], nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.1796875, 0, 0.0546875) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + local max = #meus_agressores if (max > 6) then max = 6 end for i = 1, max do - GameTooltip:AddDoubleLine (meus_agressores[i][1]..": ", _detalhes:comma_value (meus_agressores[i][2]).." (".._cstr("%.1f", (meus_agressores[i][2]/damage_taken) * 100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine (meus_agressores[i][1]..": ", _detalhes:comma_value (meus_agressores[i][2]).." (".._cstr("%.1f", (meus_agressores[i][2]/damage_taken) * 100).."%)") local classe = meus_agressores[i][3] + if (not classe) then - classe = "monster" + classe = "UNKNOW" end - - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower().."_small") + + if (classe == "UNKNOW") then + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) + else + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + end + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end return true @@ -872,6 +978,13 @@ end ---------> FRIENDLY FIRE function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local FriendlyFire = self.friendlyfire --> container de jogadores local FriendlyFireTotal = self.friendlyfire_total @@ -880,10 +993,10 @@ function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra) local DamagedPlayers = {} local Skills = {} - + for nome, index in _pairs (FriendlyFire._NameIndexTable) do local TargetActor = FriendlyFire._ActorTable [index] - DamagedPlayers [#DamagedPlayers+1] = {nome, TargetActor.total} + DamagedPlayers [#DamagedPlayers+1] = {nome, TargetActor.total, TargetActor.classe} local SkillTable = TargetActor.spell_tables --> container das habilidades for spellid, tabela in _pairs (SkillTable._ActorTable) do @@ -894,20 +1007,39 @@ function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra) _table_sort (DamagedPlayers, _detalhes.Sort2) _table_sort (Skills, _detalhes.Sort2) - GameTooltip:AddLine (Loc ["STRING_TARGETS"]..":") + GameCooltip:AddLine (Loc ["STRING_TARGETS"].."", nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.126953125, 0.224609375, 0.056640625, 0.140625) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + for i = 1, _math_min (_detalhes.tooltip_max_abilities, #DamagedPlayers) do - GameTooltip:AddDoubleLine (DamagedPlayers[i][1]..": ", _detalhes:comma_value (DamagedPlayers[i][2]).." (".._cstr("%.1f", DamagedPlayers[i][2]/FriendlyFireTotal*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\espadas") + local classe = DamagedPlayers[i][3] + if (not classe) then + classe = "UNKNOW" + end + + GameCooltip:AddLine (DamagedPlayers[i][1]..": ", _detalhes:comma_value (DamagedPlayers[i][2]).." (".._cstr("%.1f", DamagedPlayers[i][2]/FriendlyFireTotal*100).."%)") + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\espadas", nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) + + if (classe == "UNKNOW") then + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords ["UNKNOW"])) + else + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + end + end - GameTooltip:AddLine (" ") + GameCooltip:AddLine (Loc ["STRING_SPELLS"].."", nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\PVPFrame\bg-down-on]], 1, 1, 14, 14, 0, 1, 0, 1) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) - --> Mostra as habilidades no tooltip - GameTooltip:AddLine (Loc ["STRING_SPELLS"]..":") for i = 1, _math_min (_detalhes.tooltip_max_abilities, #Skills) do local nome, _, icone = _GetSpellInfo (Skills[i][1]) - GameTooltip:AddDoubleLine (nome.." (x".. Skills[i][3].."): ", _detalhes:comma_value (Skills[i][2]).." (".._cstr("%.1f", Skills[i][2]/FriendlyFireTotal*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone) + GameCooltip:AddLine (nome.." (x".. Skills[i][3].."): ", _detalhes:comma_value (Skills[i][2]).." (".._cstr("%.1f", Skills[i][2]/FriendlyFireTotal*100).."%)") + GameCooltip:AddIcon (icone, nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end return true diff --git a/classes/classe_energy.lua b/classes/classe_energy.lua index 8f6c5f63..662decdd 100644 --- a/classes/classe_energy.lua +++ b/classes/classe_energy.lua @@ -383,15 +383,25 @@ end ---------> TOOLTIPS BIFURCAÇÃO function atributo_energy:ToolTip (instancia, numero, barra) --> seria possivel aqui colocar o icone da classe dele? - GameTooltip:ClearLines() - GameTooltip:AddLine (barra.colocacao..". "..self.nome) + --GameCooltip:AddLine (barra.colocacao..". "..self.nome) if (instancia.sub_atributo <= 4) then return self:ToolTipRegenRecebido (instancia, numero, barra) end end +--> tooltip locals +local r, g, b +local headerColor = "yellow" +local barAlha = .6 function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local tabela_do_combate = instancia.showing local showing = tabela_do_combate [class_type] @@ -403,7 +413,9 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra) local fontes, habilidades = self:Fontes_e_Habilidades (recebido_from, showing, keyName) ----------------------------------------------------------------- - GameTooltip:AddLine (Loc ["STRING_SPELLS"]) + GameCooltip:AddLine (Loc ["STRING_SPELLS"], nil, nil, headerColor, nil, 12) --> localiza-me + GameCooltip:AddIcon ([[Interface\HELPFRAME\ReportLagIcon-Spells]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) local max = #habilidades if (max > 3) then @@ -412,12 +424,15 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra) for i = 1, max do local nome_magia, _, icone_magia = _GetSpellInfo (habilidades[i][1]) - GameTooltip:AddDoubleLine (nome_magia..": ", _detalhes:comma_value (habilidades[i][2]).." (".._cstr("%.1f", (habilidades[i][2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", _detalhes:comma_value (habilidades[i][2]).." (".._cstr("%.1f", (habilidades[i][2]/total_regenerado) * 100).."%)") + GameCooltip:AddIcon (icone_magia) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end ----------------------------------------------------------------- - GameTooltip:AddLine (Loc ["STRING_PLAYERS"]..":") + GameCooltip:AddLine (Loc ["STRING_PLAYERS"], nil, nil, headerColor, nil, 12) --> localiza-me + GameCooltip:AddIcon ([[Interface\HELPFRAME\HelpIcon-HotIssues]], 1, 1, 14, 14, 0.21875, 0.78125, 0.21875, 0.78125) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) max = #fontes if (max > 3) then @@ -425,13 +440,19 @@ function atributo_energy:ToolTipRegenRecebido (instancia, numero, barra) end for i = 1, max do - GameTooltip:AddDoubleLine (fontes[i][1]..": ", _detalhes:comma_value (fontes[i][2]).." (".._cstr("%.1f", (fontes[i][2]/total_regenerado) * 100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine (fontes[i][1]..": ", _detalhes:comma_value (fontes[i][2]).." (".._cstr("%.1f", (fontes[i][2]/total_regenerado) * 100).."%)") + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) + local classe = fontes[i][3] if (not classe) then - classe = "monster" + classe = "UNKNOW" end - - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower().."_small") + if (classe == "UNKNOW") then + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) + else + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + end + end return true diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 99ea2128..6e8eea04 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -408,10 +408,21 @@ function atributo_heal:ToolTip (instancia, numero, barra) end end end - +--> tooltip locals +local r, g, b +local headerColor = "yellow" +local barAlha = .6 ---------> HEALING TAKEN function atributo_heal:ToolTip_HealingTaken (instancia, numero, barra) + + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local curadores = self.healing_from local total_curado = self.healing_taken @@ -431,7 +442,10 @@ function atributo_heal:ToolTip_HealingTaken (instancia, numero, barra) end end - GameTooltip:AddLine (" ") + GameCooltip:AddLine (Loc ["STRING_FROM"], nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 1, 1, 14, 14, 0.10546875, 0.89453125, 0.05859375, 0.6796875) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) _table_sort (meus_curadores, function (a, b) return a[2] > b[2] end) local max = #meus_curadores @@ -440,12 +454,17 @@ function atributo_heal:ToolTip_HealingTaken (instancia, numero, barra) end for i = 1, max do - GameTooltip:AddDoubleLine (meus_curadores[i][1]..": ", meus_curadores[i][2].." (".._cstr ("%.1f", (meus_curadores[i][2]/total_curado) * 100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine (meus_curadores[i][1]..": ", _detalhes:comma_value (meus_curadores[i][2]).." (".._cstr ("%.1f", (meus_curadores[i][2]/total_curado) * 100).."%)") local classe = meus_curadores[i][3] if (not classe) then - classe = "monster" + classe = "UNKNOW" end - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\"..classe:lower().."_small") + if (classe == "UNKNOW") then + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) + else + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + end + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end return true @@ -454,6 +473,13 @@ end ---------> HEALING DONE / HPS / OVERHEAL function atributo_heal:ToolTip_HealingDone (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local ActorHealingTable = {} local ActorHealingTargets = {} local ActorSkillsContainer = self.spell_tables._ActorTable @@ -463,10 +489,16 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra) key = "totalover", "overheal" end + local meu_tempo + if (_detalhes.time_type == 1 or not self.grupo) then + meu_tempo = self:Tempo() + elseif (_detalhes.time_type == 2) then + meu_tempo = self:GetCombatTime() + end local ActorTotal = self [actor_key] for _spellid, _skill in _pairs (ActorSkillsContainer) do local SkillName, _, SkillIcon = _GetSpellInfo (_spellid) - _table_insert (ActorHealingTable, {_spellid, _skill [skill_key], _skill [skill_key]/ActorTotal*100, {SkillName, nil, SkillIcon}}) + _table_insert (ActorHealingTable, {_spellid, _skill [skill_key], _skill [skill_key]/ActorTotal*100, {SkillName, nil, SkillIcon}, _skill [skill_key]/meu_tempo}) end _table_sort (ActorHealingTable, _detalhes.Sort2) @@ -478,26 +510,146 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra) _table_sort (ActorHealingTargets, _detalhes.Sort2) --> Mostra as habilidades no tooltip - GameTooltip:AddLine (Loc ["STRING_SPELLS"] .. ":") --> localiza-me - for i = 1, _math_min (_detalhes.tooltip_max_abilities, #ActorHealingTable) do + GameCooltip:AddLine (Loc ["STRING_SPELLS"], nil, nil, headerColor, nil, 12) --> localiza-me + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + --GameCooltip:AddIcon ([[Interface\HELPFRAME\HotIssueIcon]], 1, 1, 14, 14, 0, 1, 0, 1) + --GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIALFRAME-SPIRITREZ]], 1, 1, 14, 14, 0.283203125, 0.470703125, 0.0859375, 0.9296875) + GameCooltip:AddIcon ([[Interface\RAIDFRAME\Raid-Icon-Rez]], 1, 1, 14, 14, 0.109375, 0.890625, 0.0625, 0.90625) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + + local tooltip_max_abilities = _detalhes.tooltip_max_abilities + + if (instancia.sub_atributo == 3 or instancia.sub_atributo == 2) then + tooltip_max_abilities = 6 + end + + for i = 1, _math_min (tooltip_max_abilities, #ActorHealingTable) do if (ActorHealingTable[i][2] < 1) then break end - GameTooltip:AddDoubleLine (ActorHealingTable[i][4][1]..": ", _detalhes:comma_value (ActorHealingTable[i][2]).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (ActorHealingTable[i][4][3]) + if (instancia.sub_atributo == 2) then + GameCooltip:AddLine (ActorHealingTable[i][4][1]..": ", _detalhes:comma_value ( _math_floor (ActorHealingTable[i][5])).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)") + else + GameCooltip:AddLine (ActorHealingTable[i][4][1]..": ", _detalhes:comma_value (ActorHealingTable[i][2]).." (".._cstr ("%.1f", ActorHealingTable[i][3]).."%)") + end + GameCooltip:AddIcon (ActorHealingTable[i][4][3], nil, nil, 14, 14) + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) end - if (instancia.sub_atributo < 3) then -- 1 or 2 -> healing done or hps - GameTooltip:AddLine (Loc ["STRING_TARGETS"]..":") --> localiza-me - for i = 1, _math_min (_detalhes.tooltip_max_targets, #ActorHealingTargets) do + local container = instancia.showing [2] + + if (instancia.sub_atributo == 1) then -- 1 or 2 -> healing done or hps + + GameCooltip:AddLine (Loc ["STRING_TARGETS"].."", nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0, 0.03125, 0.126953125, 0.15625) + GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 1, 1, 14, 14, 0.10546875, 0.89453125, 0.05859375, 0.6796875) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + + for i = 1, _math_min (tooltip_max_abilities, #ActorHealingTargets) do if (ActorHealingTargets[i][2] < 1) then break end - GameTooltip:AddDoubleLine (ActorHealingTargets[i][1]..": ", _detalhes:comma_value (ActorHealingTargets[i][2]) .." (".._cstr ("%.1f", ActorHealingTargets[i][3]).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture ("Interface\\AddOns\\Details\\images\\espadas") + + GameCooltip:AddLine (ActorHealingTargets[i][1]..": ", _detalhes:comma_value (ActorHealingTargets[i][2]) .." (".._cstr ("%.1f", ActorHealingTargets[i][3]).."%)") + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) + + local targetActor = container:PegarCombatente (_, ActorHealingTargets[i][1]) + + if (targetActor) then + local classe = targetActor.classe + if (not classe) then + classe = "UNKNOW" + end + if (classe == "UNKNOW") then + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1) + else + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe])) + end + end end end + --> PETS + local meus_pets = self.pets + + if (#meus_pets > 0) then --> teve ajudantes + + local quantidade = {} --> armazena a quantidade de pets iguais + local danos = {} --> armazena as habilidades + local alvos = {} --> armazena os alvos + local totais = {} --> armazena o dano total de cada objeto + + for index, nome in _ipairs (meus_pets) do + if (not quantidade [nome]) then + quantidade [nome] = 1 + + local my_self = instancia.showing [class_type]:PegarCombatente (_, nome) + if (my_self) then + + local meu_total = my_self.total_without_pet + local tabela = my_self.spell_tables._ActorTable + local meus_danos = {} + + local meu_tempo + if (_detalhes.time_type == 1 or not self.grupo) then + meu_tempo = my_self:Tempo() + elseif (_detalhes.time_type == 2) then + meu_tempo = my_self:GetCombatTime() + end + totais [#totais+1] = {nome, my_self.total_without_pet, my_self.total_without_pet/meu_tempo} + + for spellid, tabela in _pairs (tabela) do + local nome, rank, icone = _GetSpellInfo (spellid) + _table_insert (meus_danos, {spellid, tabela.total, tabela.total/meu_total*100, {nome, rank, icone}}) + end + _table_sort (meus_danos, _detalhes.Sort2) + danos [nome] = meus_danos + + local meus_inimigos = {} + tabela = my_self.targets._ActorTable + for _, tabela in _ipairs (tabela) do + _table_insert (meus_inimigos, {tabela.nome, tabela.total, tabela.total/meu_total*100}) + end + _table_sort (meus_inimigos,_detalhes.Sort2) + alvos [nome] = meus_inimigos + end + + else + quantidade [nome] = quantidade [nome]+1 + end + end + + local _quantidade = 0 + local added_logo = false + + _table_sort (totais, _detalhes.Sort2) + + for _, _table in _ipairs (totais) do + + if (_table [2] > 0) then + + if (not added_logo) then + added_logo = true + GameCooltip:AddLine (Loc ["STRING_PETS"].."", nil, nil, headerColor, nil, 12) + --GameCooltip:AddIcon ([[Interface\Addons\Details\images\icons]], 1, 1, 14, 14, 0.03515625, 0.087890625, 0.0234375, 0.09765625, _detalhes.class_colors [self.classe]) + GameCooltip:AddIcon ([[Interface\COMMON\friendship-heart]], 1, 1, 14, 14, 0.21875, 0.78125, 0.09375, 0.6875) + GameCooltip:AddStatusBar (100, 1, r, g, b, barAlha) + end + + local n = _table [1]:gsub (("%s%<.*"), "") + if (instancia.sub_atributo == 2) then + GameCooltip:AddLine (n, _detalhes:comma_value ( _math_floor (_table [3])) .. " (" .. _math_floor (_table [2]/self.total*100) .. "%)") + else + GameCooltip:AddLine (n, _detalhes:comma_value (_table [2]) .. " (" .. _math_floor (_table [2]/self.total*100) .. "%)") + end + GameCooltip:AddStatusBar (100, 1, .1, .1, .1, .3) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) + end + end + + end + return true end diff --git a/classes/classe_instancia.lua b/classes/classe_instancia.lua index 0e3c1cb8..dbe3d8de 100644 --- a/classes/classe_instancia.lua +++ b/classes/classe_instancia.lua @@ -249,9 +249,15 @@ end function _detalhes:CriarInstancia (_, id) if (id and _type (id) == "boolean") then + + if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then + return _detalhes:Msg (Loc ["STRING_INSTANCE_LIMIT"]) + end + local nova_instancia = _detalhes:NovaInstancia (#_detalhes.tabela_instancias+1) _detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = nova_instancia return nova_instancia + elseif (id) then local instancia = _detalhes.tabela_instancias [id] if (instancia and not instancia:IsAtiva()) then @@ -268,6 +274,10 @@ end end end + if (#_detalhes.tabela_instancias >= _detalhes.instances_amount) then + return _detalhes:Msg (Loc ["STRING_INSTANCE_LIMIT"]) + end + local nova_instancia = _detalhes:NovaInstancia (#_detalhes.tabela_instancias+1) _detalhes.tabela_instancias [#_detalhes.tabela_instancias+1] = nova_instancia @@ -1117,38 +1127,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini if (instancia.showing and instancia.showing.contra) then --print ("DEBUG: contra", instancia.showing.contra) end - - if (_detalhes.cloud_process) then - - if (_detalhes.debug) then - _detalhes:Msg ("cloud process running...") - end - - local atributo = instancia.atributo - local time_left = (_detalhes.last_data_requested+7) - _detalhes._tempo - - if (atributo == 1 and _detalhes.in_combat and not _detalhes:CaptureGet ("damage") and _detalhes.host_by) then - - elseif (atributo == 2 and _detalhes.in_combat and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura")) and _detalhes.host_by) then - if (_detalhes.debug) then - _detalhes:Msg ("cofirmed, geting heal.") - end - elseif (atributo == 3 and _detalhes.in_combat and not _detalhes:CaptureGet ("energy") and _detalhes.host_by) then - - elseif (atributo == 4 and _detalhes.in_combat and not _detalhes:CaptureGet ("miscdata") and _detalhes.host_by) then - - else - time_left = nil - end - - if (time_left) then - if (_detalhes.debug) then - _detalhes:Msg ("showing please wait.") - end - instancia:InstanceAlert (Loc ["STRING_PLEASE_WAIT"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, time_left) - end - end - + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGESEGMENT", nil, instancia, segmento) end @@ -1205,6 +1184,43 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini _detalhes.popup:Select (2, instancia.sub_atributo, atributo) end + if (_detalhes.cloud_process) then + + if (_detalhes.debug) then + _detalhes:Msg ("(debug) instancia #"..instancia.meu_id.." found cloud process.") + end + + local atributo = instancia.atributo + local time_left = (_detalhes.last_data_requested+7) - _detalhes._tempo + + if (atributo == 1 and _detalhes.in_combat and not _detalhes:CaptureGet ("damage") and _detalhes.host_by) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) instancia need damage cloud.") + end + elseif (atributo == 2 and _detalhes.in_combat and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura")) and _detalhes.host_by) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) instancia need heal cloud.") + end + elseif (atributo == 3 and _detalhes.in_combat and not _detalhes:CaptureGet ("energy") and _detalhes.host_by) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) instancia need energy cloud.") + end + elseif (atributo == 4 and _detalhes.in_combat and not _detalhes:CaptureGet ("miscdata") and _detalhes.host_by) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) instancia need misc cloud.") + end + else + time_left = nil + end + + if (time_left) then + if (_detalhes.debug) then + _detalhes:Msg ("(debug) showing instance alert.") + end + instancia:InstanceAlert (Loc ["STRING_PLEASE_WAIT"], {[[Interface\COMMON\StreamCircle]], 22, 22, true}, time_left) + end + end + _detalhes:SendEvent ("DETAILS_INSTANCE_CHANGEATTRIBUTE", nil, instancia, atributo, sub_atributo) end diff --git a/classes/classe_others.lua b/classes/classe_others.lua index 40637ef1..ce9edaca 100644 --- a/classes/classe_others.lua +++ b/classes/classe_others.lua @@ -128,8 +128,8 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra) end end - GameCooltip:AddLine (" ", " ", 1, "white", "white") - GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], "--", 1, "white", "white") + --GameCooltip:AddLine (" ", " ", 1, "white", "white") + GameCooltip:AddLine (Loc ["STRING_REPORT_LEFTCLICK"], nil, 1, "white") GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) if (battleress) then @@ -516,17 +516,27 @@ function atributo_misc:ToolTip (instancia, numero, barra) return self:ToolTipDead (instancia, numero, barra) end end +--> tooltip locals +local r, g, b +local headerColor = "yellow" +local barAlha = .6 + function atributo_misc:ToolTipDead (instancia, numero, barra) local last_dead = self.dead_log [#self.dead_log] - - - + end function atributo_misc:ToolTipCC (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local meu_total = self ["cc_break"] local habilidades = self.cc_break_spell_tables._ActorTable @@ -542,8 +552,8 @@ function atributo_misc:ToolTipCC (instancia, numero, barra) for i = 1, _math_min (3, #meus_cc_breaks) do local esta_habilidade = meus_cc_breaks[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end else GameTooltip:AddLine (Loc ["STRING_NO_SPELL"]) @@ -561,8 +571,8 @@ function atributo_misc:ToolTipCC (instancia, numero, barra) for i = 1, _math_min (3, #buffs_dispelados) do local esta_habilidade = buffs_dispelados[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end end @@ -571,6 +581,13 @@ end function atributo_misc:ToolTipDispell (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local meu_total = self ["dispell"] local habilidades = self.dispell_spell_tables._ActorTable @@ -586,8 +603,8 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) for i = 1, _math_min (3, #meus_dispells) do local esta_habilidade = meus_dispells[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end else GameTooltip:AddLine (Loc ["STRING_NO_SPELL"]) @@ -605,8 +622,8 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) for i = 1, _math_min (3, #buffs_dispelados) do local esta_habilidade = buffs_dispelados[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end end @@ -615,6 +632,13 @@ end function atributo_misc:ToolTipRess (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local meu_total = self ["ress"] local minha_tabela = self.ress_spell_tables._ActorTable @@ -631,8 +655,8 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) for i = 1, _math_min (3, #meus_ress) do local esta_habilidade = meus_ress[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end else GameTooltip:AddLine (Loc ["STRING_NO_SPELL"]) @@ -650,8 +674,8 @@ function atributo_misc:ToolTipRess (instancia, numero, barra) GameTooltip:AddLine (Loc ["STRING_TARGETS"]..":") if (#alvos > 0) then for i = 1, _math_min (3, #alvos) do - GameTooltip:AddDoubleLine (alvos[i][1]..": ", alvos[i][2], 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture ("Interface\\Icons\\PALADIN_HOLY") + GameCooltip:AddLine (alvos[i][1]..": ", alvos[i][2]) + GameCooltip:AddIcon ("Interface\\Icons\\PALADIN_HOLY", nil, nil, 14, 14) end end @@ -661,6 +685,13 @@ end function atributo_misc:ToolTipInterrupt (instancia, numero, barra) + local owner = self.owner + if (owner and owner.classe) then + r, g, b = unpack (_detalhes.class_colors [owner.classe]) + else + r, g, b = unpack (_detalhes.class_colors [self.classe]) + end + local meu_total = self ["interrupt"] local minha_tabela = self.interrupt_spell_tables._ActorTable @@ -677,8 +708,8 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) for i = 1, _math_min (3, #meus_interrupts) do local esta_habilidade = meus_interrupts[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end else GameTooltip:AddLine (Loc ["STRING_NO_SPELL"]) @@ -697,8 +728,8 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) for i = 1, _math_min (3, #habilidades_interrompidas) do local esta_habilidade = habilidades_interrompidas[i] local nome_magia, _, icone_magia = _GetSpellInfo (esta_habilidade[1]) - GameTooltip:AddDoubleLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)", 1, 1, 1, 1, 1, 1) - GameTooltip:AddTexture (icone_magia) + GameCooltip:AddLine (nome_magia..": ", esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)") + GameCooltip:AddIcon (icone_magia, nil, nil, 14, 14) end end diff --git a/classes/container_combatentes.lua b/classes/container_combatentes.lua index 7ac63bd6..7a81c674 100644 --- a/classes/container_combatentes.lua +++ b/classes/container_combatentes.lua @@ -178,16 +178,20 @@ function container_combatentes:PegarCombatente (serial, nome, flag, criar, isOwn --> pega afiliação local details_flag = 0x00000000 + if (flag) then --print ("tem flag") if (_bit_band (flag, 0x00000400) ~= 0) then --> é um player details_flag = details_flag+0x00000001 - if (IsInInstance()) then - novo_objeto.displayName = nome:gsub (("%-.*"), "") - else - novo_objeto.displayName = nome + novo_objeto.displayName = _detalhes:GetNickname (serial, false, true) --> serial, default, silent + if (not novo_objeto.displayName) then + if (IsInInstance()) then + novo_objeto.displayName = nome:gsub (("%-.*"), "") + else + novo_objeto.displayName = nome + end end if (_bit_band (flag, EM_GRUPO) ~= 0) then --> faz parte do grupo diff --git a/core/control.lua b/core/control.lua index 475448da..6f181026 100644 --- a/core/control.lua +++ b/core/control.lua @@ -150,7 +150,7 @@ function _detalhes:EntrarEmCombate (...) if (_detalhes.debug) then - print ("Details started a new combat.") + _detalhes:Msg ("(debug) started a new combat.") end --> não tem historico, addon foi resetado, a primeira tabela é descartada -- Erase first table is does not have a firts segment history, this occour after reset or first run @@ -207,17 +207,17 @@ if (not _detalhes:CaptureIsAllEnabled()) then _detalhes:SendCloudRequest() if (_detalhes.debug) then - _detalhes:Msg ("Details: CloudRequest()") + _detalhes:Msg ("(debug) requesting a cloud server.") end end else if (_detalhes.debug) then - _detalhes:Msg ("Details: instance", _detalhes:IsInInstance()) + _detalhes:Msg ("(debug) isn't inside a registred instance", _detalhes:IsInInstance()) end end else if (_detalhes.debug) then - _detalhes:Msg ("Details: group and cloud", _detalhes.in_group, _detalhes.cloud_capture) + _detalhes:Msg ("(debug) isn't in group or cloud is turned off", _detalhes.in_group, _detalhes.cloud_capture) end end @@ -234,19 +234,20 @@ end if (_detalhes.debug) then - print ("Details ended a combat.") + _detalhes:Msg ("(debug) ended a combat.") end if (not _detalhes.tabela_vigente.is_boss) then local inimigo = _detalhes:FindEnemy() if (inimigo) then if (_detalhes.debug) then - print ("Details last fight against: " .. inimigo) + _detalhes:Msg ("(debug) enemy recognized", inimigo) end end _detalhes.tabela_vigente.enemy = inimigo if (_detalhes.debug) then - _detalhes:EqualizeActorsSchedule() + _detalhes:Msg ("(debug) forcing equalize actors behavior.") + _detalhes:EqualizeActorsSchedule (_detalhes.host_of) end else @@ -256,7 +257,7 @@ _detalhes:CaptureSet (false, "heal", false, 30) if (_detalhes.debug) then - print ("Details found a boss on last fight, freezing parser for 30 seconds.") + _detalhes:Msg ("(debug) found encounter on last fight, freezing parser for 30 seconds.") end local bossFunction, bossFunctionType = _detalhes:GetBossFunction (_detalhes.tabela_vigente.is_boss.mapid, _detalhes.tabela_vigente.is_boss.index) @@ -266,10 +267,12 @@ end end - _detalhes:EqualizeActorsSchedule() + _detalhes:EqualizeActorsSchedule (_detalhes.host_of) + + _detalhes:IniciarColetaDeLixo (true) else if (_detalhes.debug) then - _detalhes:EqualizeActorsSchedule() + _detalhes:EqualizeActorsSchedule (_detalhes.host_of) end end end @@ -301,7 +304,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 >= 10) 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 _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 @@ -367,14 +370,47 @@ function _detalhes:MakeEqualizeOnActor (player, realm, receivedActor) + local combat = _detalhes:GetCombat ("current") local damage, heal, energy, misc = _detalhes:GetAllActors ("current", player) - if (not damage and not heal) then - --> add server name + if (not damage and not heal and not energy and not misc) then + + --> try adding server name damage, heal, energy, misc = _detalhes:GetAllActors ("current", player.."-"..realm) + + if (not damage and not heal and not energy and not misc) then + --> not found any actor object, so we need to create + + local actorName + + if (realm ~= GetRealmName()) then + actorName = player.."-"..realm + else + actorName = player + end + + local guid = _detalhes:FindGUIDFromName (player) + + -- 0x512 normal party + -- 0x514 normal raid + + if (guid) then + damage = combat [1]:PegarCombatente (guid, actorName, 0x514, true) + heal = combat [2]:PegarCombatente (guid, actorName, 0x514, true) + energy = combat [3]:PegarCombatente (guid, actorName, 0x514, true) + misc = combat [4]:PegarCombatente (guid, actorName, 0x514, true) + + if (_detalhes.debug) then + _detalhes:Msg ("(debug) equalize received actor:", actorName, damage, heal) + end + else + if (_detalhes.debug) then + _detalhes:Msg ("(debug) equalize couldn't get guid for player ",player) + end + end + end end - local combat = _detalhes:GetCombat ("current") combat[1].need_refresh = true combat[2].need_refresh = true combat[3].need_refresh = true @@ -429,7 +465,7 @@ end end - function _detalhes:EqualizeActorsSchedule() + function _detalhes:EqualizeActorsSchedule (host_of) --> check for pets without owner for _, actor in _ipairs (_detalhes.tabela_vigente[1]._ActorTable) do --> have flag and the flag tell us he is a pet @@ -440,12 +476,21 @@ end end end - _detalhes:ScheduleTimer ("EqualizeActors", 2) + --> do not equilize if there is any disabled capture + if (_detalhes:CaptureIsAllEnabled()) then + _detalhes:ScheduleTimer ("EqualizeActors", 2, host_of) + end end - function _detalhes:EqualizeActors() + function _detalhes:EqualizeActors (host_of) - local damage, heal, energy, misc = _detalhes:GetAllActors ("current", UnitName ("player")) + local damage, heal, energy, misc + + if (host_of) then + damage, heal, energy, misc = _detalhes:GetAllActors ("current", host_of) + else + damage, heal, energy, misc = _detalhes:GetAllActors ("current", UnitName ("player")) + end if (damage) then damage = {damage.total, damage.damage_taken, damage.friendlyfire_total} @@ -472,8 +517,13 @@ end local data = {damage, heal, energy, misc} - - _detalhes:SendRaidData ("equalize_actors", data) + + if (host_of) then + _detalhes:SendCustomRaidData ("equalize_actors", host_of, nil, data) + _detalhes:EqualizeActors() + else + _detalhes:SendRaidData ("equalize_actors", data) + end end @@ -526,23 +576,51 @@ end --> tooltip fork - function _detalhes:MontaTooltip (qual_barra) + local avatarPoint = {"bottomleft", "topleft", -3, -4} + local backgroundPoint = {{"bottomleft", "topleft", 0, -3}, {"bottomright", "topright", 0, -3}} + local textPoint = {"left", "right", -11, -5} + + function _detalhes:MontaTooltip (frame, qual_barra) + GameCooltip:Reset() + GameCooltip:SetType ("tooltip") + GameCooltip:SetOption ("LeftBorderSize", -5) + GameCooltip:SetOption ("RightBorderSize", 5) + GameCooltip:SetOption ("StatusBarTexture", [[Interface\WorldStateFrame\WORLDSTATEFINALSCORE-HIGHLIGHT]]) --[[Interface\Addons\Details\images\bar_flat]] + GameCooltip:SetOwner (frame) + local esta_barra = self.barras [qual_barra] --> barra que o mouse passou em cima e irá mostrar o tooltip local objeto = esta_barra.minha_tabela --> pega a referencia da tabela --> retorna a classe_damage ou classe_heal if (not objeto) then --> a barra não possui um objeto return false end - _detalhes.popup:Close() - + --verifica por tooltips especiais: if (objeto.dead) then --> é uma barra de dead return _detalhes:ToolTipDead (self, objeto, esta_barra) --> instância, [morte], barra end - return objeto:ToolTip (self, qual_barra, esta_barra) --> instância, nº barra, objeto barra + local t = objeto:ToolTip (self, qual_barra, esta_barra) --> instância, nº barra, objeto barra + if (t) then + + if (esta_barra.minha_tabela.serial and esta_barra.minha_tabela.serial ~= "") then + local avatar = NickTag:GetNicknameTable (esta_barra.minha_tabela.serial) + if (avatar) then + GameCooltip:SetBannerImage (1, avatar [2], 80, 40, avatarPoint, nil, nil) --> overlay [2] avatar path + --local l, r, t, b = unpack (avatar [5]) + --local r, g, b = unpack (avatar [6]) + GameCooltip:SetBannerImage (2, avatar [4], 200, 55, backgroundPoint, avatar [5], avatar [6]) --> background + GameCooltip:SetBannerText (1, avatar [1], textPoint) --> text [1] nickname + end + end + + return GameCooltip:ShowCooltip() + end + end + + function _detalhes.gump:UpdateTooltip (qual_barra, esta_barra, instancia) + return instancia:MontaTooltip (esta_barra, qual_barra) end - function _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) _detalhes:EsconderBarrasNaoUsadas (instancia, showing) @@ -576,8 +654,8 @@ if (not tabela_do_combate[self.atributo].need_refresh and not forcar) then return --> não precisa de refresh - else - tabela_do_combate[self.atributo].need_refresh = false + --else + --tabela_do_combate[self.atributo].need_refresh = false end if (self.atributo == 1) then --> damage @@ -603,27 +681,27 @@ end if (instancia == -1) then - - local refresh_poll = {} - - for _, esta_instancia in _ipairs (_detalhes.tabela_instancias) do - + + --> update + for index, esta_instancia in _ipairs (_detalhes.tabela_instancias) do if (esta_instancia.ativa) then if (esta_instancia.modo == modo_GROUP or esta_instancia.modo == modo_ALL) then - local atributo = esta_instancia:AtualizarALL (forcar) - - if (atributo) then - refresh_poll [#refresh_poll+1] = atributo + esta_instancia:AtualizarALL (forcar) + end + end + end + + --> marcar que não precisa ser atualizada + for index, esta_instancia in _ipairs (_detalhes.tabela_instancias) do + if (esta_instancia.ativa and esta_instancia.showing) then + if (esta_instancia.modo == modo_GROUP or esta_instancia.modo == modo_ALL) then + if (esta_instancia.atributo <= 4) then + esta_instancia.showing [esta_instancia.atributo].need_refresh = false end end end - end - - for _, atributo in _ipairs (refresh_poll) do - atributo.need_refresh = false - end - + if (not forcar) then --atualizar o gump de detalhes também se ele estiver aberto if (info.ativo) then return info.jogador:MontaInfo() diff --git a/core/meta.lua b/core/meta.lua index ba463dfa..86dd10d1 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -681,15 +681,25 @@ - function _detalhes:IniciarColetaDeLixo() + function _detalhes:IniciarColetaDeLixo (forcar) - if (_detalhes.ultima_coleta + _detalhes.intervalo_coleta > _detalhes._tempo + 1) then - return - elseif (_detalhes.in_combat or _InCombatLockdown() or _detalhes:IsInInstance()) then - _detalhes:ScheduleTimer ("IniciarColetaDeLixo", 5) - return + if (not forcar) then + if (_detalhes.ultima_coleta + _detalhes.intervalo_coleta > _detalhes._tempo + 1) then + return + elseif (_detalhes.in_combat or _InCombatLockdown() or _detalhes:IsInInstance()) then + _detalhes:ScheduleTimer ("IniciarColetaDeLixo", 5) + return + end end + if (_detalhes.debug) then + if (forcar) then + _detalhes:Msg ("collecting garbage with forced state.") + else + _detalhes:Msg ("collecting garbage.") + end + end + _detalhes:ClearParserCache() local limpados = atributo_damage:ColetarLixo() + atributo_heal:ColetarLixo() + atributo_energy:ColetarLixo() + atributo_misc:ColetarLixo() @@ -797,7 +807,7 @@ local conteudo = _overall_combat [tipo]._ActorTable _iter = {index = 1, data = conteudo[1], cleaned = 0} --> ._ActorTable[1] para pegar o primeiro index - collectgarbage() + --collectgarbage() while (_iter.data) do @@ -817,9 +827,9 @@ _table_wipe (meus_links) end - if (tipo == 1 and #new_weak_table > 0) then + --if (tipo == 1 and #new_weak_table > 0) then -- print (can_garbage, _actor.nome) - end + --end if (can_garbage or not meus_links) then --> não há referências a este objeto diff --git a/core/network.lua b/core/network.lua index 62ab0462..831fde91 100644 --- a/core/network.lua +++ b/core/network.lua @@ -39,7 +39,7 @@ local type, player, realm, dversion, arg6, arg7 = select (2, _detalhes:Deserialize (data)) if (_detalhes.debug) then - print ("comm received", type) + _detalhes:Msg ("(debug) network received command", type) end if (type == "highfive") then @@ -59,7 +59,7 @@ local ownerActor = _detalhes.tabela_vigente[1]:PegarCombatente (owner_table[2], owner_table[1], owner_table[3], true) ownerActor.total = ownerActor.total + petActor.total if (_detalhes.debug) then - _detalhes:Msg ("Received owner for pet ",nome, "assigned to", owner_table[1]) + _detalhes:Msg ("(debug) received owner for pet ",nome, "assigned to", owner_table[1]) end local combat = _detalhes:GetCombat ("current") @@ -82,7 +82,7 @@ player = player .."-"..realm end if (_detalhes.debug) then - _detalhes:Msg ("Received pet owner request of pet, sending owner") + _detalhes:Msg ("(debug) received pet owner request, sending owner") end _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("petowner", petserial, petnome, owner_table), "WHISPER", player) end @@ -109,12 +109,12 @@ nname = nname.."-"..server end if (nname == name) then - actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x00000417, true) + actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true) break end else if (UnitName ("raid"..i) == name) then - actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x00000417, true) + actor = container:PegarCombatente (UnitGUID ("raid"..i), name, 0x514, true) break end end @@ -128,12 +128,12 @@ nname = nname.."-"..server end if (nname == name) then - actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x00000417, true) + actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true) break end else if (UnitName ("party"..i) == name or _detalhes.playername == name) then - actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x00000417, true) + actor = container:PegarCombatente (UnitGUID ("party"..i), name, 0x514, true) break end end @@ -146,7 +146,7 @@ container.need_refresh = true else if (_detalhes.debug) then - print ("Actor not found on cloud data received", name, atributo_name) + _detalhes:Msg ("(debug) actor not found on cloud data received", name, atributo_name) end end @@ -177,17 +177,13 @@ end if (data) then - local export = temp local container = _detalhes.tabela_vigente [atributo]._ActorTable for i = 1, math.min (6, #container) do local actor = container [i] - - if (not actor.grupo) then - break + if (actor.grupo) then + export [#export+1] = {actor.nome, actor [atributo_name]} end - - export [#export+1] = {actor.nome, actor [atributo_name]} end _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatareceived", atributo, atributo_name, export), "WHISPER", _detalhes.host_of) @@ -206,7 +202,7 @@ _detalhes.host_by = player if (_detalhes.debug) then - print ("Details found a cloud for disabled captures.") + _detalhes:Msg ("(debug) cloud found for disabled captures.") end _detalhes.cloud_process = _detalhes:ScheduleRepeatingTimer ("RequestData", 7) @@ -243,6 +239,22 @@ _detalhes:RegisterComm ("details_comm", "RaidComm") + 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 + if (_realm) then + player = _name + realm = _realm + end + end + end + if (not realm) then + --> doesn't have realm at all, so we assume the actor is in same realm as player + 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") end @@ -256,7 +268,7 @@ function _detalhes:SendPetOwnerRequest (petserial, petnome) if (_detalhes.debug) then - _detalhes:Msg ("Sent request for a pet",petserial, petnome) + _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") end @@ -271,7 +283,7 @@ end _detalhes.host_of = player if (_detalhes.debug) then - _detalhes:Msg ("Sent request for a cloud parser") + _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) end @@ -282,7 +294,7 @@ for index = 1, #_detalhes.tabela_instancias do local instancia = _detalhes.tabela_instancias [index] - if (instancia.ativa) then + if (instancia.ativa and _detalhes.host_by) then local atributo = instancia.atributo if (atributo == 1 and not _detalhes:CaptureGet ("damage")) then _detalhes:SendCommMessage ("details_comm", _detalhes:Serialize ("clouddatarequest", atributo, instancia.sub_atributo), "WHISPER", _detalhes.host_by) diff --git a/core/parser.lua b/core/parser.lua index de165147..af2f3d16 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -113,7 +113,7 @@ ------------------------------------------------------------------------------------------------ --> early checks and fixes - + if (who_serial == "0x0000000000000000") then if (who_flags and _bit_band (who_flags, OBJECT_TYPE_PETS) ~= 0) then --> é um pet --> pets must have an serial @@ -1934,21 +1934,26 @@ return elseif (evento == "GROUP_ROSTER_UPDATE") then - _detalhes.container_pets:BuscarPets() + if (not _detalhes.in_group) then _detalhes.in_group = IsInGroup() or IsInRaid() if (_detalhes.in_group) then + --> entrou num grupo + _detalhes:IniciarColetaDeLixo (true) _detalhes:SendHighFive() end else _detalhes.in_group = IsInGroup() or IsInRaid() if (not _detalhes.in_group) then + _detalhes:IniciarColetaDeLixo (true) table.wipe (_detalhes.details_users) else _detalhes:CheckDetailsUsers() end end + _detalhes.container_pets:BuscarPets() + return elseif (evento == "PARTY_MEMBERS_CHANGED") then diff --git a/core/util.lua b/core/util.lua index a2a0ed60..8a69777e 100644 --- a/core/util.lua +++ b/core/util.lua @@ -113,7 +113,7 @@ --> scale function _detalhes:Scale (rangeMin, rangeMax, scaleMin, scaleMax, x) - return 1 + (x-rangeMin)*(scaleMax-scaleMin)/(rangeMax-rangeMin) + return 1 + (x - rangeMin) * (scaleMax - scaleMin) / (rangeMax - rangeMin) end --> font size @@ -189,19 +189,34 @@ LastDps = 0 _detalhes:SairDoCombate() end + + function _detalhes:FindGUIDFromName (name) + if (_IsInRaid()) then + for i = 1, _GetNumGroupMembers(), 1 do + local this_name, _ = UnitName ("raid"..i) + if (this_name == name) then + return UnitGUID ("raid"..i) + end + end + elseif (_IsInGroup()) then + for i = 1, _GetNumGroupMembers()-1, 1 do + local this_name, _ = UnitName ("party"..i) + if (this_name == name) then + return UnitGUID ("party"..i) + end + end + end + if (UnitName ("player") == name) then + return UnitGUID ("player") + end + return nil + end --> Armazena uma label recém criada - Store a new label on the pool function _detalhes.font_pool:add (_fontstring) self [#self+1] = _fontstring end - function gump:UpdateTooltip (qual_barra, esta_barra, instancia) - _GameTooltip:Hide() - _GameTooltip:SetOwner (esta_barra, "ANCHOR_TOPRIGHT") - instancia:MontaTooltip (qual_barra) - _GameTooltip:Show() - end - local function frame_task (self, elapsed) self.FrameTime = self.FrameTime + elapsed diff --git a/framework/cooltip.lua b/framework/cooltip.lua index fd7508b7..ea0f13aa 100644 --- a/framework/cooltip.lua +++ b/framework/cooltip.lua @@ -45,7 +45,7 @@ function DetailsCreateCoolTip() CoolTip.LeftIconTableSub = {} CoolTip.RightIconTable = {} CoolTip.RightIconTableSub = {} - CoolTip.TopIcon = nil + CoolTip.Banner = {false, false, false} CoolTip.TopIconTableSub = {} CoolTip.StatusBarTable = {} CoolTip.StatusBarTableSub = {} @@ -87,7 +87,9 @@ function DetailsCreateCoolTip() ["Anchor"] = true, ["RelativeAnchor"] = true, ["NoLastSelectedBar"] = true, - ["SubMenuIsTooltip"] = true + ["SubMenuIsTooltip"] = true, + ["LeftBorderSize"] = true, + ["RightBorderSize"] = true } CoolTip.OptionsTable = { @@ -116,7 +118,9 @@ function DetailsCreateCoolTip() ["Anchor"] = nil, ["RelativeAnchor"] = nil, ["NoLastSelectedBar"] = nil, - ["SubMenuIsTooltip"] = nil + ["SubMenuIsTooltip"] = nil, + ["LeftBorderSize"] = nil, + ["RightBorderSize"] = nil } --cprops @@ -126,6 +130,7 @@ function DetailsCreateCoolTip() CoolTip.SubIndexes = 0 --> amount of lines current on shown on sub menu CoolTip.Type = 1 --> 1 tooltip 2 tooltip with bars 3 menu 4 menu + submenus CoolTip.Host = nil --> frame to anchor + CoolTip.LastSize = 0 --> last size --defaults CoolTip.default_height = 20 @@ -523,18 +528,32 @@ function DetailsCreateCoolTip() end - function CoolTip:TextAndIcon (frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable, isSub) + function CoolTip:TextAndIcon (index, frame, menuButton, leftTextTable, rightTextTable, leftIconTable, rightIconTable, isSub) --> reset width menuButton.leftText:SetWidth (0) menuButton.leftText:SetHeight (0) menuButton.rightText:SetWidth (0) menuButton.rightText:SetHeight (0) - + --> set text if (leftTextTable) then menuButton.leftText:SetText (leftTextTable [1]) menuButton.leftText:SetTextColor (leftTextTable [2], leftTextTable [3], leftTextTable [4], leftTextTable [5]) + + if (CoolTip.OptionsTable.TextSize and not leftTextTable [6]) then + _detalhes:SetFontSize (menuButton.leftText, CoolTip.OptionsTable.TextSize) + end + + if (CoolTip.OptionsTable.TextFont and not leftTextTable [7]) then + menuButton.leftText:SetFontObject (CoolTip.OptionsTable.TextFont) + end + + local face, size, flags = menuButton.leftText:GetFont() + size = leftTextTable [6] or 10 + face = leftTextTable [7] or [[Fonts\FRIZQT__.TTF]] + flags = leftTextTable [8] + menuButton.leftText:SetFont (face, size, flags) else menuButton.leftText:SetText ("") end @@ -542,17 +561,23 @@ function DetailsCreateCoolTip() if (rightTextTable) then menuButton.rightText:SetText (rightTextTable [1]) menuButton.rightText:SetTextColor (rightTextTable [2], rightTextTable [3], rightTextTable [4], rightTextTable [5]) + + if (CoolTip.OptionsTable.TextSize and not rightTextTable [6]) then + _detalhes:SetFontSize (menuButton.rightText, CoolTip.OptionsTable.TextSize) + end + + if (CoolTip.OptionsTable.TextFont and not rightTextTable [7]) then + menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont) + end + + local face, size, flags = menuButton.rightText:GetFont() + size = rightTextTable [6] or 10 + face = rightTextTable [7] or [[Fonts\FRIZQT__.TTF]] + flags = rightTextTable [8] + menuButton.rightText:SetFont (face, size, flags) else menuButton.rightText:SetText ("") end - - --> overwrite text size - _detalhes:SetFontSize (menuButton.leftText, CoolTip.OptionsTable.TextSize or self.default_text_size) - _detalhes:SetFontSize (menuButton.rightText, CoolTip.OptionsTable.TextSize or self.default_text_size) - - --> overwrite text font object - menuButton.leftText:SetFontObject (CoolTip.OptionsTable.TextFont or self.default_text_font) - menuButton.rightText:SetFontObject (CoolTip.OptionsTable.TextFont or self.default_text_font) --> left icon if (leftIconTable and leftIconTable [1]) then @@ -560,17 +585,13 @@ function DetailsCreateCoolTip() menuButton.leftIcon:SetWidth (leftIconTable [2]) menuButton.leftIcon:SetHeight (leftIconTable [3]) menuButton.leftIcon:SetTexCoord (leftIconTable [4], leftIconTable [5], leftIconTable [6], leftIconTable [7]) - --[[ - if (CoolTip.OptionsTable.IconHeightMod) then - menuButton.leftIcon:SetPoint ("left", menuButton.leftIcon:GetParent(), "left", 0, CoolTip.OptionsTable.IconHeightMod) - else - menuButton.leftIcon:SetPoint ("left", menuButton.leftIcon:GetParent(), "left", 0, 0) - end - --]] + menuButton.leftIcon:SetVertexColor (unpack (leftIconTable [8])) + --menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "right", 3, 0) else menuButton.leftIcon:SetTexture (nil) menuButton.leftIcon:SetWidth (3) menuButton.leftIcon:SetHeight (3) + --menuButton.leftText:SetPoint ("left", menuButton.leftIcon, "left", -5, 0) end --> right icon @@ -579,10 +600,13 @@ function DetailsCreateCoolTip() menuButton.rightIcon:SetWidth (rightIconTable [2]) menuButton.rightIcon:SetHeight (rightIconTable [3]) menuButton.rightIcon:SetTexCoord (rightIconTable [4], rightIconTable [5], rightIconTable [6], rightIconTable [7]) + menuButton.rightIcon:SetVertexColor (unpack (rightIconTable [8])) + --menuButton.rightText:SetPoint ("right", menuButton.rightIcon, "left", -3, 0) else menuButton.rightIcon:SetTexture (nil) - menuButton.rightIcon:SetWidth (3) - menuButton.rightIcon:SetHeight (3) + menuButton.rightIcon:SetWidth (1) + menuButton.rightIcon:SetHeight (1) + --menuButton.rightText:SetPoint ("right", menuButton.rightIcon, "right", 5, 0) end --> overwrite icon size @@ -601,13 +625,13 @@ function DetailsCreateCoolTip() if (not isSub) then --> main frame if (not CoolTip.OptionsTable.FixedWidth) then if (CoolTip.Type == 1 or CoolTip.Type == 2) then - local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() + local stringWidth = menuButton.leftText:GetStringWidth() + menuButton.rightText:GetStringWidth() + menuButton.leftIcon:GetWidth() + menuButton.rightIcon:GetWidth() + 10 if (stringWidth > frame.w) then frame.w = stringWidth end end else - menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - 20) + menuButton.leftText:SetWidth (CoolTip.OptionsTable.FixedWidth - menuButton.leftIcon:GetWidth() - menuButton.rightText:GetStringWidth() - menuButton.rightIcon:GetWidth() - 30) end else if (not CoolTip.OptionsTable.FixedWidthSub) then @@ -655,13 +679,25 @@ function DetailsCreateCoolTip() menuButton.statusbar:SetValue (0) menuButton.spark:Hide() end + + if (CoolTip.OptionsTable.LeftBorderSize) then + menuButton.statusbar:SetPoint ("left", menuButton, "left", 10 + CoolTip.OptionsTable.LeftBorderSize, 0) + else + menuButton.statusbar:SetPoint ("left", menuButton, "left", 10, 0) + end + + if (CoolTip.OptionsTable.RightBorderSize) then + menuButton.statusbar:SetPoint ("right", menuButton, "right", CoolTip.OptionsTable.RightBorderSize + (- 10), 0) + else + menuButton.statusbar:SetPoint ("right", menuButton, "right", -10, 0) + end end function CoolTip:SetupMainButton (menuButton, index) menuButton.index = index --> setup texts and icons - CoolTip:TextAndIcon (frame1, menuButton, CoolTip.LeftTextTable [index], CoolTip.RightTextTable [index], CoolTip.LeftIconTable [index], CoolTip.RightIconTable [index]) + CoolTip:TextAndIcon (index, frame1, menuButton, CoolTip.LeftTextTable [index], CoolTip.RightTextTable [index], CoolTip.LeftIconTable [index], CoolTip.RightIconTable [index]) --> setup statusbar CoolTip:StatusBar (menuButton, CoolTip.StatusBarTable [index]) @@ -687,7 +723,7 @@ function DetailsCreateCoolTip() menuButton.mainIndex = mainMenuIndex --> setup texts and icons - CoolTip:TextAndIcon (frame2, menuButton, CoolTip.LeftTextTableSub [mainMenuIndex] and CoolTip.LeftTextTableSub [mainMenuIndex] [index], + CoolTip:TextAndIcon (index, frame2, menuButton, CoolTip.LeftTextTableSub [mainMenuIndex] and CoolTip.LeftTextTableSub [mainMenuIndex] [index], CoolTip.RightTextTableSub [mainMenuIndex] and CoolTip.RightTextTableSub [mainMenuIndex] [index], CoolTip.LeftIconTableSub [mainMenuIndex] and CoolTip.LeftIconTableSub [mainMenuIndex] [index], CoolTip.RightIconTableSub [mainMenuIndex] and CoolTip.RightIconTableSub [mainMenuIndex] [index], true) @@ -869,7 +905,7 @@ function DetailsCreateCoolTip() button:RegisterForClicks() --> setup texts and icons - CoolTip:TextAndIcon (frame1, button, CoolTip.LeftTextTable [i], CoolTip.RightTextTable [i], CoolTip.LeftIconTable [i], CoolTip.RightIconTable [i]) + CoolTip:TextAndIcon (i, frame1, button, CoolTip.LeftTextTable [i], CoolTip.RightTextTable [i], CoolTip.LeftIconTable [i], CoolTip.RightIconTable [i]) --> setup statusbar CoolTip:StatusBar (button, CoolTip.StatusBarTable [i]) end @@ -903,12 +939,18 @@ function DetailsCreateCoolTip() menuButton:EnableMouse (false) end - --> set frame sizes if (not CoolTip.OptionsTable.FixedWidth) then - if (CoolTip.Type == 2) then + if (CoolTip.Type == 2) then --> with bars frame1:SetWidth (frame1.w + 34) else - frame1:SetWidth (frame1.w + 24) + --> width stability check + local width = frame1.w + 24 + if (width > CoolTip.LastSize-5 and width < CoolTip.LastSize+5) then + width = CoolTip.LastSize + else + CoolTip.LastSize = width + end + frame1:SetWidth (width) end end @@ -1303,10 +1345,17 @@ function DetailsCreateCoolTip() _table_wipe (CoolTip.LeftIconTableSub) _table_wipe (CoolTip.RightIconTable) _table_wipe (CoolTip.RightIconTableSub) - - CoolTip.TopIcon = nil + _table_wipe (CoolTip.TopIconTableSub) + CoolTip.Banner [1] = false + CoolTip.Banner [2] = false + CoolTip.Banner [3] = false + frame1.upperImage:Hide() + frame1.upperImage2:Hide() + frame1.upperImageText:Hide() + frame1.upperImageText2:Hide() + frame2.upperImage:Hide() _table_wipe (CoolTip.StatusBarTable) @@ -1332,6 +1381,8 @@ function DetailsCreateCoolTip() ---------------------------------------------------------------------- --> Menu functions + local _default_color = {1, 1, 1} + local _default_point = {"center", "center", 0, -3} function CoolTip:AddMenu (menuType, func, param1, param2, param3, leftText, leftIcon, indexUp) @@ -1396,6 +1447,7 @@ function DetailsCreateCoolTip() iconTable [5] = 1 --> default 1 iconTable [6] = 0 --> default 0 iconTable [7] = 1 --> default 1 + iconTable [8] = _default_color end if (leftText) then @@ -1411,7 +1463,9 @@ function DetailsCreateCoolTip() lineTable_left [3] = 1 lineTable_left [4] = 1 lineTable_left [5] = 1 - lineTable_left [6] = true + lineTable_left [6] = false + lineTable_left [7] = false + lineTable_left [8] = false end @@ -1480,6 +1534,7 @@ function DetailsCreateCoolTip() subMenuTablesIcons [5] = 1 --> default 1 subMenuTablesIcons [6] = 0 --> default 0 subMenuTablesIcons [7] = 1 --> default 1 + subMenuTablesIcons [8] = _default_color end if (leftText) then @@ -1500,7 +1555,9 @@ function DetailsCreateCoolTip() subMenuTablesTexts [3] = 1 subMenuTablesTexts [4] = 1 subMenuTablesTexts [5] = 1 - subMenuTablesTexts [6] = true + subMenuTablesTexts [6] = false + subMenuTablesTexts [7] = false + subMenuTablesTexts [8] = false end @@ -1591,13 +1648,94 @@ function DetailsCreateCoolTip() end + function CoolTip:SetBannerText (index, text, anchor, color, fontsize, fontface, fontflag) + local fontstring + + if (index == 1) then + fontstring = frame1.upperImageText + elseif (index == 2) then + fontstring = frame1.upperImageText2 + end + + fontstring:SetText (text or "") + + if (anchor and index == 1) then + local myAnchor, hisAnchor, x, y = unpack (anchor) + fontstring:SetPoint (myAnchor, frame1.upperImage, hisAnchor or myAnchor, x or 0, y or 0) + elseif (anchor and index == 2) then + local myAnchor, hisAnchor, x, y = unpack (anchor) + fontstring:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + end + + if (color) then + fontstring:SetTextColor (unpack (color)) + end + + local face, size, flags = fontstring:GetFont() + face = fontface or [[Fonts\FRIZQT__.TTF]] + size = fontsize or 13 + flags = fontflag or nil + fontstring:SetFont (face, size, flags) + fontstring:Show() + end + + function CoolTip:SetBannerImage (index, texturepath, width, height, anchor, texcoord, overlay) + + local texture + + if (index == 1) then + texture = frame1.upperImage + elseif (index == 2) then + texture = frame1.upperImage2 + end + + if (texturepath) then + texture:SetTexture (texturepath) + end + + if (width) then + texture:SetWidth (width) + end + if (height) then + texture:SetHeight (height) + end + + if (anchor) then + if (type (anchor[1]) == "table") then + for _, t in _ipairs (anchor) do + local myAnchor, hisAnchor, x, y = unpack (t) + texture:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + end + else + local myAnchor, hisAnchor, x, y = unpack (anchor) + texture:SetPoint (myAnchor, frame1, hisAnchor or myAnchor, x or 0, y or 0) + end + end + + if (texcoord) then + local L, R, T, B = unpack (texcoord) + texture:SetTexCoord (L, R, T, B) + end + + if (overlay) then + texture:SetVertexColor (unpack (overlay)) + end + + CoolTip.Banner [index] = true + texture:Show() + + end + ---------------------------------------------------------------------- --> adds a icon to the last line added. --> only works with cooltip type 1 and 2 (tooltip and tooltip with bars) --> parameters: icon [, width [, height [, TexCoords L R T B ]]] --> texture support string path or texture object - function CoolTip:AddIcon (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B) + function CoolTip:AddTexture (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point) + return CoolTip:AddIcon (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point) + end + function CoolTip:AddIcon (iconTexture, frame, side, iconWidth, iconHeight, L, R, T, B, overlayColor, point) --> need a previous line if (CoolTip.Indexes == 0) then @@ -1618,11 +1756,10 @@ function DetailsCreateCoolTip() if (not side or (type (side) == "string" and side == "left") or (type (side) == "number" and side == 1)) then frameTable = CoolTip.LeftIconTable + elseif ((type (side) == "string" and side == "right") or (type (side) == "number" and side == 2)) then frameTable = CoolTip.RightIconTable - elseif ((type (side) == "string" and side == "top") or (type (side) == "number" and side == 3)) then - CoolTip.TopIcon = iconTexture - return + end if (CoolTip.isSpecial) then @@ -1652,6 +1789,7 @@ function DetailsCreateCoolTip() CoolTip.TopIconTableSub [CoolTip.Indexes] [5] = R or 1 CoolTip.TopIconTableSub [CoolTip.Indexes] [6] = T or 0 CoolTip.TopIconTableSub [CoolTip.Indexes] [7] = B or 1 + CoolTip.TopIconTableSub [CoolTip.Indexes] [8] = overlayColor or _default_color return end @@ -1683,6 +1821,7 @@ function DetailsCreateCoolTip() iconTable [5] = R or 1 --> default 1 iconTable [6] = T or 0 --> default 0 iconTable [7] = B or 1 --> default 1 + iconTable [8] = overlayColor or _default_color --> default 1, 1, 1 return true end @@ -1692,8 +1831,13 @@ function DetailsCreateCoolTip() --> only works with cooltip type 1 and 2 (tooltip and tooltip with bars) --> parameters: left text, right text [, L color R, L color G, L color B, L color A [, R color R, R color G, R color B, R color A [, wrap]]] + --> alias + function CoolTip:AddDoubleLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) + return CoolTip:AddLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) + end + --> adds a line for tooltips - function CoolTip:AddLine (leftText, rightText, frame, ColorR, ColorG, ColorB, ColorA, ColorR1, ColorG2, ColorB3, ColorA4, wrapLine) + function CoolTip:AddLine (leftText, rightText, frame, ColorR1, ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag) --> check data integrity if (type (leftText) ~= "string") then @@ -1703,20 +1847,24 @@ function DetailsCreateCoolTip() rightText = "" end - if (type (ColorR) == "table" or type (ColorR) == "string") then - ColorR1, ColorG2, ColorB3, ColorA4, wrapLine, ColorR, ColorG, ColorB, ColorA = ColorG, ColorB, ColorA, ColorR1, ColorG2, gump:ParseColors (ColorR) - if (type (ColorR1) == "table" or type (ColorR1) == "string") then - wrapLine = ColorG2 - ColorR1, ColorG2, ColorB3, ColorA4 = gump:ParseColors (ColorR1) + if (type (ColorR1) ~= "number") then + ColorR2, ColorG2, ColorB2, ColorA2, fontSize, fontFace, fontFlag = ColorG1, ColorB1, ColorA1, ColorR2, ColorG2, ColorB2, ColorA2 + + if (type (ColorR1) == "boolean" or not ColorR1) then + ColorR1, ColorG1, ColorB1, ColorA1 = 1, 1, 1, 1 + else + ColorR1, ColorG1, ColorB1, ColorA1 = gump:ParseColors (ColorR1) + end + end + + if (type (ColorR2) ~= "number") then + fontSize, fontFace, fontFlag = ColorG2, ColorB2, ColorA2 + + if (type (ColorR2) == "boolean" or not ColorR2) then + ColorR2, ColorG2, ColorB2, ColorA2 = 1, 1, 1, 1 + else + ColorR2, ColorG2, ColorB2, ColorA2 = gump:ParseColors (ColorR2) end - elseif (type (ColorR) == "boolean") then - wrapLine = ColorR - ColorR, ColorG, ColorB, ColorA = 1, 1, 1, 1 - ColorR1, ColorG2, ColorB3, ColorA4 = 1, 1, 1, 1 - else - ColorR, ColorG, ColorB, ColorA = 1, 1, 1, 1 - ColorR1, ColorG2, ColorB3, ColorA4 = 1, 1, 1, 1 - wrapLine = true end local frameTableLeft @@ -1808,18 +1956,22 @@ function DetailsCreateCoolTip() end lineTable_left [1] = leftText --> line text - lineTable_left [2] = ColorR - lineTable_left [3] = ColorG - lineTable_left [4] = ColorB - lineTable_left [5] = ColorA - lineTable_left [6] = wrapLine + lineTable_left [2] = ColorR1 + lineTable_left [3] = ColorG1 + lineTable_left [4] = ColorB1 + lineTable_left [5] = ColorA1 + lineTable_left [6] = fontSize + lineTable_left [7] = fontFace + lineTable_left [8] = fontFlag lineTable_right [1] = rightText --> line text - lineTable_right [2] = ColorR1 + lineTable_right [2] = ColorR2 lineTable_right [3] = ColorG2 - lineTable_right [4] = ColorB3 - lineTable_right [5] = ColorA4 - lineTable_right [6] = wrapLine + lineTable_right [4] = ColorB2 + lineTable_right [5] = ColorA2 + lineTable_right [6] = fontSize + lineTable_right [7] = fontFace + lineTable_right [8] = fontFlag end function CoolTip:AddSpecial (widgetType, index, subIndex, ...) @@ -1906,7 +2058,7 @@ function DetailsCreateCoolTip() elseif (menu.icon) then CoolTip:AddIcon (menu.icon, menu.type or 1, menu.side or 1, menu.width, menu.height, menu.l, menu.r, menu.t, menu.b) elseif (menu.textleft or menu.textright or menu.text) then - CoolTip:AddLine (menu.text, "", menu.type, menu.color, menu.color, true) + CoolTip:AddLine (menu.text, "", menu.type, menu.color, menu.color) end end end @@ -1915,6 +2067,10 @@ function DetailsCreateCoolTip() --> show cooltip --> serach key: ~start + function CoolTip:Show (frame, menuType, color) + return CoolTip:ShowCooltip (frame, menuType, color) + end + function CoolTip:ShowCooltip (frame, menuType, color) if (frame) then @@ -1943,6 +2099,10 @@ function DetailsCreateCoolTip() local emptyOptions = {} + function CoolTip:Hide() + return CoolTip:Close() + end + function CoolTip:Close() CoolTip.active = false gump:Fade (frame1, 1) diff --git a/framework/cooltip.xml b/framework/cooltip.xml index 16e20ae8..511cb7a9 100644 --- a/framework/cooltip.xml +++ b/framework/cooltip.xml @@ -15,7 +15,7 @@ - + @@ -50,16 +50,34 @@ + - + + + + + + + + + + + + + - - + + @@ -152,8 +170,8 @@ - - + + diff --git a/functions/savedata.lua b/functions/savedata.lua index 8977bf0a..4d224918 100644 --- a/functions/savedata.lua +++ b/functions/savedata.lua @@ -34,6 +34,7 @@ function _detalhes:SaveDataOnLogout() -- max segments _detalhes_database.segments_amount = _detalhes.segments_amount _detalhes_database.segments_amount_to_save = _detalhes.segments_amount_to_save + _detalhes_database.instances_amount = _detalhes.instances_amount _detalhes_database.clear_ungrouped = _detalhes.clear_ungrouped _detalhes_database.clear_graphic = _detalhes.clear_graphic -- row animation @@ -184,6 +185,7 @@ end --]] _detalhes.window_clamp = _detalhes_database.window_clamp -- max segments _detalhes.segments_amount = _detalhes_database.segments_amount + _detalhes.instances_amount = _detalhes_database.instances_amount _detalhes.clear_ungrouped = _detalhes_database.clear_ungrouped _detalhes.clear_graphic = _detalhes_database.clear_graphic --> text sizes diff --git a/functions/slash.lua b/functions/slash.lua index 58410084..dc5181a4 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -65,6 +65,35 @@ function SlashCmdList.DETAILS (msg, editbox) _G.DetailsCopy.MyObject.text:HighlightText() _G.DetailsCopy.MyObject.text:SetFocus() + elseif (msg == "raid") then + + local player, realm = "Marleyieu", "Azralon" + + local actorName + if (realm ~= GetRealmName()) then + actorName = player.."-"..realm + else + actorName = player + end + + print (actorName) + + local guid = _detalhes:FindGUIDFromName ("Marleyieu") + print (guid) + + for i = 1, GetNumGroupMembers()-1, 1 do + local name, realm = UnitName ("party"..i) + print (name, " -- ", realm) + end + + elseif (msg == "captures") then + for k, v in pairs (_detalhes.capture_real) do + print ("real -",k,":",v) + end + for k, v in pairs (_detalhes.capture_current) do + print ("current -",k,":",v) + end + elseif (msg == "slider") then local f = CreateFrame ("frame", "TESTEDESCROLL", UIParent) @@ -129,15 +158,10 @@ function SlashCmdList.DETAILS (msg, editbox) --nname = nname.."-"..server end end - - + elseif (msg == "teste") then - local teste = nil - local tabela = {um = 1, dois = 2} - - local a = tabela [teste] - print (a) + print (time()) elseif (msg == "yesno") then --_detalhes:Show() @@ -172,6 +196,18 @@ function SlashCmdList.DETAILS (msg, editbox) print ("Instances opened: " .. _detalhes.opened_windows) --> debug, get a guid of something + elseif (command == "myguid") then --> localize-me + + local g = UnitGUID ("player") + print (type (g)) + print (g) + print (string.len (g)) + local serial = g:sub (12, 18) + serial = tonumber ("0x"..serial) + print (serial) + + --tonumber((UnitGUID("target")):sub(-12, -9), 16)) + elseif (command == "guid") then --> localize-me local pass_guid = rest:match("^(%S*)%s*(.-)$") diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index cb2f7ab4..5b8ed286 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -15,7 +15,7 @@ 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", _, 500, 320) + window = g:NewPanel (UIParent, _, "DetailsOptionsWindow", _, 700, 340) window.instance = instance tinsert (UISpecialFrames, "DetailsOptionsWindow") window:SetPoint ("center", UIParent, "Center") @@ -256,6 +256,16 @@ function _detalhes:OpenOptionsWindow (instance) _detalhes.cloud_capture = value end + --------------- Max Instances + g:NewLabel (window, _, "$parentLabelMaxInstances", "maxInstancesLabel", "max instances") + window.maxInstancesLabel:SetPoint (10, -288) + -- + g:NewSlider (window, _, "$parentSliderMaxInstances", "maxInstancesSlider", 150, 20, 12, 30, 1, _detalhes.instances_amount) -- min, max, step, defaultv + window.maxInstancesSlider:SetPoint ("left", window.maxInstancesLabel, "right") + window.maxInstancesSlider:SetHook ("OnValueChange", function (self, _, amount) --> slider, fixedValue, sliderValue + _detalhes.instances_amount = amount + end) + window.maxInstancesSlider.tooltip = "Amount of windows which can be created." -- Current Instalnce -------------------------------------------------------------------------------------------------------------------------------------------- @@ -749,10 +759,41 @@ function _detalhes:OpenOptionsWindow (instance) end end - g:NewButton (window, _, "$parentToAllStyleButton", "applyToAll", 130, 14, applyToAll, nil, nil, nil, "apply to all instances") + g:NewButton (window, _, "$parentToAllStyleButton", "applyToAll", 140, 14, applyToAll, nil, nil, nil, "apply to all instances") window.applyToAll:InstallCustomTexture() window.applyToAll:SetPoint ("bottomright", window.removeStyle, "topright", 1, 3) + +-- Persona -------------------------------------------------------------------------------------------------------------------------------------------- + + local onPressEnter = function (_, _, text) + local accepted, errortext = _detalhes:SetNickname (text) + if (not accepted) then + _detalhes:Msg (errortext) + end + --> we call again here, because if not accepted the box return the previous value and if successful accepted, update the value for formated string. + window.nicknameEntry.text = _detalhes:GetNickname (UnitGUID ("player"), UnitName ("player"), true) + end + + g:NewTextEntry (window, _, "$parentNicknameEntry", "nicknameEntry", nil, 20, onPressEnter, _, _, 198) --width will be auto adjusted if space parameter is passed + window.nicknameEntry:SetLabelText ("nickname") + window.nicknameEntry:SetPoint (510, -35) + + local avatarcallback = function (textureAvatar, textureAvatarTexCoord, textureBackground, textureBackgroundTexCoord, textureBackgroundColor) + _detalhes:SetNicknameBackground (textureBackground, textureBackgroundTexCoord, textureBackgroundColor, true) + _detalhes:SetNicknameAvatar (textureAvatar, textureAvatarTexCoord) + _G.AvatarPickFrame.callback = nil + end + + local openAtavarPickFrame = function() + _G.AvatarPickFrame.callback = avatarcallback + _G.AvatarPickFrame:Show() + end + + g:NewButton (window, _, "$parentAvatarFrame", "chooseAvatarButton", 120, 14, openAtavarPickFrame, nil, nil, nil, "Choose Avatar") + window.chooseAvatarButton:InstallCustomTexture() + window.chooseAvatarButton:SetPoint (510, -55) + end @@ -790,6 +831,8 @@ function _detalhes:OpenOptionsWindow (instance) -- GameCooltip:SetFixedParameter (_G.DetailsOptionsWindowLoadStyleButton, instance) + _G.DetailsOptionsWindowNicknameEntry.MyObject.text = _detalhes:GetNickname (UnitGUID ("player"), UnitName ("player"), true) --> serial, default, silent + _G.DetailsOptionsWindow.MyObject.instance = instance window:Show() diff --git a/gumps/janela_principal.lua b/gumps/janela_principal.lua index 45e5af6c..dd06a029 100644 --- a/gumps/janela_principal.lua +++ b/gumps/janela_principal.lua @@ -1089,12 +1089,15 @@ local function barra_scripts (esta_barra, instancia, i) resize_fade (instancia, "out") gump:Fade (instancia.baseframe.button_stretch, "alpha", 0.3) + instancia:MontaTooltip (self, i) + + --[[ _GameTooltip:SetOwner (self, "ANCHOR_TOPRIGHT") if (not instancia:MontaTooltip (i)) then return end - _GameTooltip:Show() + --]] -- self:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", @@ -1154,7 +1157,7 @@ local function barra_scripts (esta_barra, instancia, i) move_janela (parent, false, instancia) --> novo movedor da janela instancia:SaveMainWindowPosition() _GameTooltip:SetOwner (self, "ANCHOR_TOPRIGHT") - if (instancia:MontaTooltip (i)) then + if (instancia:MontaTooltip (self, i)) then _GameTooltip:Show() end diff --git a/images/bar_flat.tga b/images/bar_flat.tga new file mode 100644 index 00000000..020beb0a Binary files /dev/null and b/images/bar_flat.tga differ diff --git a/images/icons.tga b/images/icons.tga new file mode 100644 index 00000000..26b7e6ad Binary files /dev/null and b/images/icons.tga differ diff --git a/locales/Details-enUS.lua b/locales/Details-enUS.lua index 642850e5..685724b3 100644 --- a/locales/Details-enUS.lua +++ b/locales/Details-enUS.lua @@ -15,6 +15,8 @@ if not Loc then return end Loc ["STRING_TOOOLD"] = "could not be installed because your Details! version is too old." Loc ["STRING_TOOOLD2"] = "your Details! version isn't the same." + 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_RIGHTCLICK_CLOSE_SHORT"] = "Right click to close." @@ -150,7 +152,9 @@ if not Loc then return end Loc ["STRING_NO_SPELL"] = "no spell has been used" Loc ["STRING_TARGET"] = "Target" Loc ["STRING_TARGETS"] = "Targets" + Loc ["STRING_FROM"] = "From" Loc ["STRING_PET"] = "Pet" + Loc ["STRING_PETS"] = "Pets" Loc ["STRING_DPS"] = "Dps" Loc ["STRING_SEE_BELOW"] = "see below" Loc ["STRING_GERAL"] = "Geral" diff --git a/locales/Details-ptBR.lua b/locales/Details-ptBR.lua index 27244612..cbc7b367 100644 --- a/locales/Details-ptBR.lua +++ b/locales/Details-ptBR.lua @@ -15,6 +15,8 @@ if not Loc then return end Loc ["STRING_TOOOLD"] = "nao pode ser instalado pois sua versao do Details! e muito antiga." Loc ["STRING_TOOOLD2"] = "a sua versao do Details! nao e a mesma." + 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_RIGHTCLICK_CLOSE_SHORT"] = "Botao direito para fechar." @@ -147,7 +149,9 @@ if not Loc then return end Loc ["STRING_NO_SPELL"] = "Nenhuma habilidade foi usada" Loc ["STRING_TARGET"] = "Alvo" Loc ["STRING_TARGETS"] = "Alvos" + Loc ["STRING_FROM"] = "Fonte" Loc ["STRING_PET"] = "Ajudante" + Loc ["STRING_PETS"] = "Ajudantes" Loc ["STRING_DPS"] = "Dps" Loc ["STRING_SEE_BELOW"] = "veja abaixo" Loc ["STRING_GERAL"] = "Geral" diff --git a/startup.lua b/startup.lua index 9064af97..437dc855 100644 --- a/startup.lua +++ b/startup.lua @@ -28,6 +28,7 @@ function _G._detalhes:Start() --> combat self.in_combat = false self.combat_id = self.combat_id or 0 + self.instances_amount = self.instances_amount or 12 self.segments_amount = self.segments_amount or 8 self.segments_amount_to_save = self.segments_amount_to_save or 2 self.deadlog_limit = self.deadlog_limit or 12 @@ -216,7 +217,7 @@ function _G._detalhes:Start() --> start garbage collector self.ultima_coleta = 0 - self.intervalo_coleta = 1800 + self.intervalo_coleta = 720 self.garbagecollect = self:ScheduleRepeatingTimer ("IniciarColetaDeLixo", self.intervalo_coleta) --> start parser