From fedfe341a35a3325dc5dd3ed99ab1a5821cd53df Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 1 Jun 2020 20:51:48 -0300 Subject: [PATCH] More spell reflection implementations - added reflected spells in the player tooltip. - added reflected spell in the player details window. - reflection spells like Warrior's Spell Reflection now has a new spell school called "Reflection". - soft tooltips and player details window improvements. - damage spell object now has the member 'extra' which is a table that can store hash data. - profile.tooltip.tooltip_max_abilities won't be forced to 6 any more, to set your own amount of spells shown on tooltips use: /run Details.tooltip.tooltip_max_abilities = number; --- Libs/DF/cooltip.lua | 2 +- Libs/DF/fw.lua | 2 +- boot.lua | 4 +- classes/classe_damage.lua | 202 +++++++++++++++++++-------- classes/classe_damage_habilidade.lua | 95 ++++++------- classes/classe_heal.lua | 10 +- core/control.lua | 26 +++- core/parser.lua | 39 ++++-- functions/profiles.lua | 2 +- functions/spells.lua | 1 + gumps/janela_info.lua | 95 +++++++++---- startup.lua | 2 +- 12 files changed, 309 insertions(+), 171 deletions(-) diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 0fcb5109..b144dc2a 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -1621,7 +1621,7 @@ function DF:CreateCoolTip() --> height if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then - local height = _math_max (8, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight()) + local height = _math_max (2, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), CoolTip.OptionsTable.AlignAsBlizzTooltipForceHeight or 2) menuButton:SetHeight (height) menuButton:SetPoint ("top", frame1, "top", 0, temp) temp = temp + ( height * -1) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index bc332c33..a9e414b1 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 183 +local dversion = 184 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) diff --git a/boot.lua b/boot.lua index 64ed2f5d..6c400565 100644 --- a/boot.lua +++ b/boot.lua @@ -8,7 +8,7 @@ _detalhes.alpha_build_counter = 7334 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.3.0" _detalhes.userversion = "v8.3.0." .. _detalhes.build_counter - _detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below) + _detalhes.realversion = 141 --core version, this is used to check API version for scripts and plugins (see alias below) _detalhes.APIVersion = _detalhes.realversion --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players @@ -19,7 +19,7 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> initialization stuff -do +do --local f = CreateFrame("frame") --f:SetSize(300, 300) diff --git a/classes/classe_damage.lua b/classes/classe_damage.lua index f7c5036d..c159f73f 100644 --- a/classes/classe_damage.lua +++ b/classes/classe_damage.lua @@ -2895,7 +2895,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) --> TOP HABILIDADES --get variables - local ActorDamage = self.total_without_pet --mostrando os pets no tooltip + --local ActorDamage = self.total_without_pet --mostrando os pets no tooltip local ActorDamage = self.total local ActorDamageWithPet = self.total if (ActorDamage == 0) then @@ -2903,6 +2903,8 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end local ActorSkillsContainer = self.spells._ActorTable local ActorSkillsSortTable = {} + + local reflectionSpells = {} --get time type local meu_tempo @@ -2911,11 +2913,15 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) elseif (_detalhes.time_type == 2) then meu_tempo = instancia.showing:GetCombatTime() end - + --add actor spells for _spellid, _skill in _pairs (ActorSkillsContainer) do ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo} + if (_skill.isReflection) then + reflectionSpells[#reflectionSpells+1] = _skill + end end + --add actor pets for petIndex, petName in _ipairs (self:Pets()) do local petActor = instancia.showing[class_type]:PegarCombatente (nil, petName) @@ -2941,9 +2947,6 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) --tooltip stuff local tooltip_max_abilities = _detalhes.tooltip.tooltip_max_abilities - if (instancia.sub_atributo == 2) then - tooltip_max_abilities = 6 - end local is_maximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then @@ -2991,17 +2994,42 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) GameCooltip:AddLine (nome_magia, FormatTooltipNumber (_, _math_floor (totalDPS)) .." (".._cstr("%.1f", totalDamage/ActorDamage*100).."%)") end - GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W + 4, icon_size.H + 4, icon_border.L, icon_border.R, icon_border.T, icon_border.B) _detalhes:AddTooltipBackgroundStatusbar (false, totalDamage/topAbility*100) end else GameCooltip:AddLine (Loc ["STRING_NO_SPELL"]) end - + + --> spell reflected + if (#reflectionSpells > 0) then + --small blank space + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space + _detalhes:AddTooltipSpellHeaderText ("Spells Reflected", headerColor, 1, select(3, _GetSpellInfo(reflectionSpells[1].id)), 0.1, 0.9, 0.1, 0.9) --localize-me + _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + + for i = 1, #reflectionSpells do + local _spell = reflectionSpells[i] + local extraInfo = _spell.extra + for spellId, damageDone in pairs(extraInfo) do + local spellName, _, spellIcon = _GetSpellInfo(spellId) + + if (spellName) then + GameCooltip:AddLine (spellName, FormatTooltipNumber (_, damageDone) .. " (" .. _math_floor (damageDone / self.total * 100) .. "%)") + _detalhes:AddTooltipBackgroundStatusbar (false, damageDone / self.total * 100) + GameCooltip:AddIcon (spellIcon, 1, 1, icon_size.W, icon_size.H, 0.1, 0.9, 0.1, 0.9) + end + end + end + end + --> MOSTRA INIMIGOS local topEnemy = ActorTargetsSortTable [1] and ActorTargetsSortTable [1][2] or 0 if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then + --small blank space + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #ActorTargetsSortTable, [[Interface\Addons\Details\images\icons]], 0, 0.03125, 0.126953125, 0.15625) local max_targets = _detalhes.tooltip.tooltip_max_targets @@ -3038,6 +3066,9 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) local alvos = {} --> armazena os alvos local totais = {} --> armazena o dano total de cada objeto + --small blank space + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) + for index, nome in _ipairs (meus_pets) do if (not quantidade [nome]) then quantidade [nome] = 1 @@ -3134,10 +3165,10 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) if (bossInfo and phasesInfo) then if (#phasesInfo > 1) then - --_detalhes:AddTooltipSpellHeaderText ("Phases", headerColor, 1, [[Interface\Garrison\MobileAppIcons]], 2*130/1024, 3*130/1024, 5*130/1024, 6*130/1024) - --_detalhes:AddTooltipSpellHeaderText ("Phases", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic10]], 0, 1, 0, 1) + --small blank space + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) + _detalhes:AddTooltipSpellHeaderText ("Damage by Encounter Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local playerPhases = {} @@ -3174,7 +3205,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end end end - + return true end @@ -3649,7 +3680,7 @@ end --------------------------------------------- // JANELA DETALHES // --------------------------------------------- ----------> DETALHES BIFURCA��O +---------> DETALHES BIFURCA��O ~detalhes ~detailswindow function atributo_damage:MontaInfo() if (info.sub_atributo == 1 or info.sub_atributo == 2 or info.sub_atributo == 6) then --> damage done & dps return self:MontaInfoDamageDone() @@ -4239,12 +4270,12 @@ function atributo_damage:MontaInfoDamageDone() if (barra.mouse_over) then --> atualizar o tooltip if (barra.isAlvo) then - GameTooltip:Hide() - GameTooltip:SetOwner (barra, "ANCHOR_TOPRIGHT") + --GameTooltip:Hide() + --GameTooltip:SetOwner (barra, "ANCHOR_TOPRIGHT") if (not barra.minha_tabela:MontaTooltipAlvos (barra, index, instancia)) then return end - GameTooltip:Show() + --GameTooltip:Show() end end @@ -4895,34 +4926,48 @@ function atributo_damage:MontaTooltipDamageTaken (esta_barra, index) end -local targets_tooltips_table = {} - function atributo_damage:MontaTooltipAlvos (esta_barra, index, instancia) local inimigo = esta_barra.nome_inimigo - local habilidades = targets_tooltips_table - - for i = 1, #habilidades do - local t = habilidades [i] - t[1], t[2], t[3] = "", 0, "" --name, total, icon - end - + local habilidades = {} local total = self.total - local i = 1 + _detalhes:FormatCooltipForSpells() + GameCooltip:SetOwner(esta_barra, "bottom", "top", 4, -2) + GameCooltip:SetOption ("MinWidth", _math_max (230, esta_barra:GetWidth()*0.98)) + for spellid, spell in _pairs (self.spells._ActorTable) do - for target_name, amount in _pairs (spell.targets) do - if (target_name == inimigo) then - local nome, _, icone = _GetSpellInfo (spellid) - - local t = habilidades [i] - if (not t) then - habilidades [i] = {} - t = habilidades [i] + if (spell.isReflection) then + for target_name, amount in _pairs (spell.targets) do + if (target_name == inimigo) then + for reflectedSpellId, amount in _pairs (spell.extra) do + local spellName, _, spellIcon = _GetSpellInfo(reflectedSpellId) + local t = habilidades [i] + if (not t) then + habilidades [i] = {} + t = habilidades [i] + end + + t[1], t[2], t[3] = spellName .. " (|cFFCCBBBBreflected|r)", amount, spellIcon + i = i + 1 + end + end + end + else + for target_name, amount in _pairs (spell.targets) do + if (target_name == inimigo) then + local nome, _, icone = _GetSpellInfo (spellid) + + local t = habilidades [i] + if (not t) then + habilidades [i] = {} + t = habilidades [i] + end + + t[1], t[2], t[3] = nome, amount, icone + i = i + 1 end - t[1], t[2], t[3] = nome, amount, icone - i = i + 1 end end end @@ -4967,35 +5012,39 @@ function atributo_damage:MontaTooltipAlvos (esta_barra, index, instancia) local is_dps = info.instancia.sub_atributo == 2 if (is_dps) then - GameTooltip:AddLine (index..". "..inimigo) - GameTooltip:AddLine (Loc ["STRING_DAMAGE_DPS_IN"] .. ":") - GameTooltip:AddLine (" ") + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_DPS_IN"] .. ":", {1, 0.9, 0.0, 1}, 1, _detalhes.tooltip_spell_icon.file, unpack (_detalhes.tooltip_spell_icon.coords)) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 1) + else - GameTooltip:AddLine (index..". "..inimigo) - GameTooltip:AddLine (Loc ["STRING_DAMAGE_FROM"] .. ":") - GameTooltip:AddLine (" ") + _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"] .. ":", {1, 0.9, 0.0, 1}, 1, _detalhes.tooltip_spell_icon.file, unpack (_detalhes.tooltip_spell_icon.coords)) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 1) end - - for index, tabela in _ipairs (habilidades) do - - if (tabela [2] < 1) then - break - end - - if (index < 8) then - if (is_dps) then - GameTooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t "..tabela[1], _detalhes:comma_value ( _math_floor (tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) - else - GameTooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t " .. tabela[1], SelectedToKFunction (_, tabela[2]) .. " (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + + local icon_size = _detalhes.tooltip.icon_size + local icon_border = _detalhes.tooltip.icon_border_texcoord + + local topSpellDamage = habilidades[1] and habilidades[1][2] + + if (topSpellDamage) then + for index, tabela in _ipairs (habilidades) do + if (tabela [2] < 1) then + break end - else + if (is_dps) then - GameTooltip:AddDoubleLine (index..". "..tabela[1], _detalhes:comma_value ( _math_floor (tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65) + --GameCooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t "..tabela[1], _detalhes:comma_value ( _math_floor (tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine (tabela[1], _detalhes:comma_value ( _math_floor (tabela[2] / meu_tempo) ).." (".._cstr("%.1f", tabela[2]/total*100).."%)") else - GameTooltip:AddDoubleLine (index..". "..tabela[1], SelectedToKFunction (_, tabela[2]).." (".._cstr("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65) + --GameCooltip:AddDoubleLine (index..". |T"..tabela[3]..":0|t " .. tabela[1], SelectedToKFunction (_, tabela[2]) .. " (".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1) + GameCooltip:AddLine (tabela[1], SelectedToKFunction (_, tabela[2]) .. " (".._cstr("%.1f", tabela[2]/total*100).."%)") end + + GameCooltip:AddIcon (tabela[3], nil, nil, icon_size.W + 4, icon_size.H + 4, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + _detalhes:AddTooltipBackgroundStatusbar (false, tabela[2] / topSpellDamage * 100) end end + + GameCooltip:Show() return true @@ -5107,14 +5156,21 @@ end for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) - --> refresh e soma os valores dos alvos + + --> create the target value for target_name, amount in _pairs (habilidade.targets) do - --> cria e soma o valor do total if (not habilidade_shadow.targets [target_name]) then habilidade_shadow.targets [target_name] = 0 end end + --> create the extra value + for spellId, amount in _pairs (habilidade.extra) do + if (not habilidade_shadow.extra [spellId]) then + habilidade_shadow.extra [spellId] = 0 + end + end + end --> copia o container de friendly fire (captura de dados) @@ -5224,10 +5280,17 @@ end for spellid, habilidade in _pairs (actor.spells._ActorTable) do --> cria e soma o valor local habilidade_shadow = shadow.spells:PegaHabilidade (spellid, true, nil, true) + --> refresh e soma os valores dos alvos for target_name, amount in _pairs (habilidade.targets) do habilidade_shadow.targets [target_name] = (habilidade_shadow.targets [target_name] or 0) + amount end + + --> refresh and add extra values + for spellId, amount in _pairs (habilidade.extra) do + habilidade_shadow.extra [spellId] = (habilidade_shadow.extra [spellId] or 0) + amount + end + --> soma todos os demais valores for key, value in _pairs (habilidade) do if (_type (value) == "number") then @@ -5322,10 +5385,17 @@ atributo_damage.__add = function (tabela1, tabela2) for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do --> pega a habilidade no primeiro ator local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) + --> soma os alvos for target_name, amount in _pairs (habilidade.targets) do habilidade_tabela1.targets = (habilidade_tabela1.targets [target_name] or 0) + amount end + + --> soma os extras + for spellId, amount in _pairs (habilidade.extra) do + habilidade_tabela1.extra = (habilidade_tabela1.extra [spellId] or 0) + amount + end + --> soma os valores da habilidade for key, value in _pairs (habilidade) do if (_type (value) == "number") then @@ -5401,15 +5471,25 @@ atributo_damage.__sub = function (tabela1, tabela2) --> reduz o container de habilidades for spellid, habilidade in _pairs (tabela2.spells._ActorTable) do - --> pega a habilidade no primeiro ator + --> get the spell from the first actor local habilidade_tabela1 = tabela1.spells:PegaHabilidade (spellid, true, "SPELL_DAMAGE", false) - --> soma os alvos - for target_name, amount in _pairs (habilidade.targets._ActorTable) do + + --> subtract targets + for target_name, amount in _pairs (habilidade.targets) do local alvo_tabela1 = habilidade_tabela1.targets [target_name] if (alvo_tabela1) then habilidade_tabela1.targets [target_name] = habilidade_tabela1.targets [target_name] - amount end end + + --> subtract extra table + for spellId, amount in _pairs (habilidade.extra) do + local extra_tabela1 = habilidade_tabela1.extra [spellId] + if (extra_tabela1) then + habilidade_tabela1.extra [spellId] = habilidade_tabela1.extra [spellId] - amount + end + end + --> subtrai os valores da habilidade for key, value in _pairs (habilidade) do if (_type (value) == "number") then diff --git a/classes/classe_damage_habilidade.lua b/classes/classe_damage_habilidade.lua index 414f45b2..40b31323 100644 --- a/classes/classe_damage_habilidade.lua +++ b/classes/classe_damage_habilidade.lua @@ -32,7 +32,7 @@ id = id, --spellid successful_casted = 0, --successful casted times (only for enemies) - --> multistrike + --> multistrike (deprecated) m_amt = 0, m_dmg = 0, m_crit = 0, @@ -68,7 +68,8 @@ a_amt = 0, a_dmg = 0, - targets = {} + targets = {}, + extra = {} } if (token == "SPELL_PERIODIC_DAMAGE") then @@ -85,66 +86,60 @@ self.targets [nome] = self.targets [nome] or 0 end - function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, isoffhand) + function habilidade_dano:Add (serial, nome, flag, amount, who_nome, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected) self.total = self.total + amount + --if is reflected add the spellId into the extra table + --this is too show which spells has been reflected + if (isreflected) then + self.extra [isreflected] = (self.extra [isreflected] or 0) + amount + end + self.targets [nome] = (self.targets [nome] or 0) + amount - if (multistrike) then + self.counter = self.counter + 1 + + if (resisted and resisted > 0) then + self.r_dmg = self.r_dmg+amount --> tabela.total � o total de dano + self.r_amt = self.r_amt+1 --> tabela.total � o total de dano + end - self.m_amt = self.m_amt + 1 - self.m_dmg = self.m_dmg + amount - - if (critical) then - self.m_crit = self.m_crit + 1 + if (blocked and blocked > 0) then + self.b_dmg = self.b_dmg+amount --> amount � o total de dano + self.b_amt = self.b_amt+1 --> amount � o total de dano + end + + if (absorbed and absorbed > 0) then + self.a_dmg = self.a_dmg+amount --> amount � o total de dano + self.a_amt = self.a_amt+1 --> amount � o total de dano + end + + if (glacing) then + self.g_dmg = self.g_dmg+amount --> amount � o total de dano + self.g_amt = self.g_amt+1 --> amount � o total de dano + + elseif (critical) then + self.c_dmg = self.c_dmg+amount --> amount � o total de dano + self.c_amt = self.c_amt+1 --> amount � o total de dano + if (amount > self.c_max) then + self.c_max = amount + end + if (self.c_min > amount or self.c_min == 0) then + self.c_min = amount end else - - self.counter = self.counter + 1 - - if (resisted and resisted > 0) then - self.r_dmg = self.r_dmg+amount --> tabela.total � o total de dano - self.r_amt = self.r_amt+1 --> tabela.total � o total de dano + self.n_dmg = self.n_dmg+amount + self.n_amt = self.n_amt+1 + if (amount > self.n_max) then + self.n_max = amount end - - if (blocked and blocked > 0) then - self.b_dmg = self.b_dmg+amount --> amount � o total de dano - self.b_amt = self.b_amt+1 --> amount � o total de dano + if (self.n_min > amount or self.n_min == 0) then + self.n_min = amount end - - if (absorbed and absorbed > 0) then - self.a_dmg = self.a_dmg+amount --> amount � o total de dano - self.a_amt = self.a_amt+1 --> amount � o total de dano - end - - if (glacing) then - self.g_dmg = self.g_dmg+amount --> amount � o total de dano - self.g_amt = self.g_amt+1 --> amount � o total de dano - - elseif (critical) then - self.c_dmg = self.c_dmg+amount --> amount � o total de dano - self.c_amt = self.c_amt+1 --> amount � o total de dano - if (amount > self.c_max) then - self.c_max = amount - end - if (self.c_min > amount or self.c_min == 0) then - self.c_min = amount - end - - else - self.n_dmg = self.n_dmg+amount - self.n_amt = self.n_amt+1 - if (amount > self.n_max) then - self.n_max = amount - end - if (self.n_min > amount or self.n_min == 0) then - self.n_min = amount - end - end - end + if (_recording_ability_with_buffs) then if (who_nome == _detalhes.playername) then --aqui ele vai detalhar tudo sobre a magia usada diff --git a/classes/classe_heal.lua b/classes/classe_heal.lua index 7ea0d92e..f394f121 100644 --- a/classes/classe_heal.lua +++ b/classes/classe_heal.lua @@ -1390,7 +1390,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) end - GameCooltip:AddIcon (ActorHealingTable[i][4][3], nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) + GameCooltip:AddIcon (ActorHealingTable[i][4][3], nil, nil, icon_size.W+4, icon_size.H+4, icon_border.L, icon_border.R, icon_border.T, icon_border.B) _detalhes:AddTooltipBackgroundStatusbar (false, ActorHealingTable[i][2] / topAbility * 100) end @@ -1407,7 +1407,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) local topTarget = ActorHealingTargets [1] and ActorHealingTargets [1][2] or 0 if (instancia.sub_atributo == 1) then -- 1 or 2 -> healing done or hps - + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_TARGETS"], headerColor, #ActorHealingTargets, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) local ismaximized = false @@ -1504,6 +1504,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) if (not added_logo) then added_logo = true + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) if (ismaximized) then @@ -1540,11 +1541,8 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) local phasesInfo = segment:GetPhases() if (bossInfo and phasesInfo) then if (#phasesInfo > 1) then - - --_detalhes:AddTooltipSpellHeaderText ("Phases", headerColor, 1, [[Interface\Garrison\MobileAppIcons]], 2*130/1024, 3*130/1024, 5*130/1024, 6*130/1024) - --_detalhes:AddTooltipSpellHeaderText ("Phases", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic10]], 0, 1, 0, 1) + _detalhes:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space _detalhes:AddTooltipSpellHeaderText ("Healing by Encounter Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) - --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local playerPhases = {} diff --git a/core/control.lua b/core/control.lua index 5933849b..f9f0d874 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1578,7 +1578,14 @@ -- /run local a,b=_detalhes.tooltip.header_statusbar,0.3;a[1]=b;a[2]=b;a[3]=b;a[4]=0.8; - function _detalhes:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B) + function _detalhes:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B, separator) + + if (separator and separator == true) then + GameCooltip:AddLine ("", "", nil, nil, 1, 1, 1, 1, 8) + + return + end + if (_detalhes.tooltip.show_amount) then GameCooltip:AddLine (headerText, "x" .. amount .. "", nil, headerColor, 1, 1, 1, .4, _detalhes.tooltip.fontsize_title) else @@ -1592,13 +1599,12 @@ local bgColor, borderColor = {0, 0, 0, 0.8}, {0, 0, 0, 0} --{0.37, 0.37, 0.37, .75}, {.30, .30, .30, .3} - function _detalhes:BuildInstanceBarTooltip (frame) + function _detalhes:FormatCooltipForSpells() local GameCooltip = GameCooltip - + GameCooltip:Reset() GameCooltip:SetType ("tooltip") - GameCooltip:SetOption ("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98)) GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background]]) GameCooltip:SetOption ("TextSize", _detalhes.tooltip.fontsize) @@ -1607,16 +1613,22 @@ GameCooltip:SetOption ("TextColorRight", _detalhes.tooltip.fontcolor_right) GameCooltip:SetOption ("TextShadow", _detalhes.tooltip.fontshadow and "OUTLINE") - GameCooltip:SetOption ("LeftBorderSize", -4) - GameCooltip:SetOption ("RightBorderSize", 4) + GameCooltip:SetOption ("LeftBorderSize", -5) + GameCooltip:SetOption ("RightBorderSize", 5) GameCooltip:SetOption ("RightTextMargin", 0) - GameCooltip:SetOption ("VerticalOffset", 8) + GameCooltip:SetOption ("VerticalOffset", 9) GameCooltip:SetOption ("AlignAsBlizzTooltip", true) GameCooltip:SetOption ("AlignAsBlizzTooltipFrameHeightOffset", -8) GameCooltip:SetOption ("LineHeightSizeOffset", 4) GameCooltip:SetOption ("VerticalPadding", -4) GameCooltip:SetBackdrop (1, _detalhes.cooltip_preset2_backdrop, bgColor, borderColor) + end + + function _detalhes:BuildInstanceBarTooltip (frame) + local GameCooltip = GameCooltip + _detalhes:FormatCooltipForSpells() + GameCooltip:SetOption ("MinWidth", _math_max (230, self.baseframe:GetWidth()*0.98)) local myPoint = _detalhes.tooltip.anchor_point local anchorPoint = _detalhes.tooltip.anchor_relative diff --git a/core/parser.lua b/core/parser.lua index 1c13bbfa..62e277e7 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -466,7 +466,7 @@ --]=] - function parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand) + function parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amount, overkill, school, resisted, blocked, absorbed, critical, glacing, crushing, isoffhand, isreflected) ------------------------------------------------------------------------------------------------ --> early checks and fixes @@ -502,7 +502,8 @@ ------------------------------------------------------------------------------------------------ --> spell reflection - if (who_serial == alvo_serial and not reflection_ignore[spellid]) then + if (who_serial == alvo_serial and not reflection_ignore[spellid]) then --~reflect + --> this spell could've been reflected, check it if (reflection_events[who_serial] and reflection_events[who_serial][spellid] and time-reflection_events[who_serial][spellid].time > 3.5 and (not reflection_debuffs[who_serial] or (reflection_debuffs[who_serial] and not reflection_debuffs[who_serial][spellid]))) then --> here we check if we have to filter old reflection data @@ -518,23 +519,27 @@ reflection_events[who_serial] = nil end end + local reflection = reflection_events[who_serial] and reflection_events[who_serial][spellid] if (reflection) then --> if we still have the reflection data then we conclude it was reflected + + --extend the duration of the timer to catch the rare channelling spells reflection_events[who_serial][spellid].time = time - --> extend the duration of the timer to catch the rare channelling spells + --crediting the source of the reflection aura who_serial = reflection.who_serial who_name = reflection.who_name who_flags = reflection.who_flags - -- crediting the source of the reflection aura - spellid = reflection.spellid + --data of the aura that caused the reflection + print("2", spellid, GetSpellInfo(spellid)) + isreflected = spellid --which spell was reflected + spellid = reflection.spellid --which spell made the reflection spellname = reflection.spellname spelltype = reflection.spelltype - --> data of the aura that caused the reflection - - return parser:spell_dmg(token,time,who_serial,who_name,who_flags,alvo_serial,alvo_name,alvo_flags,alvo_flags2,spellid,spellname,spelltype,amount,-1,nil,nil,nil,nil,false,false,false,false) + + return parser:spell_dmg(token,time,who_serial,who_name,who_flags,alvo_serial,alvo_name,alvo_flags,alvo_flags2,spellid,spellname,0x400,amount,-1,nil,nil,nil,nil,false,false,false,false, isreflected) else --> saving information about this damage because it may occurred before a reflect event reflection_damage[who_serial] = reflection_damage[who_serial] or {} @@ -1080,6 +1085,10 @@ if (_current_combat.is_boss and who_flags and _bit_band (who_flags, OBJECT_TYPE_ENEMY) ~= 0) then _detalhes.spell_school_cache [spellname] = spelltype or school end + + if (isreflected) then + spell.isReflection = true + end end if (_is_storing_cleu) then @@ -1087,7 +1096,7 @@ _current_combat_cleu_events.n = _current_combat_cleu_events.n + 1 end - return spell_damage_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, resisted, blocked, absorbed, critical, glacing, token, isoffhand) + return spell_damage_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, resisted, blocked, absorbed, critical, glacing, token, isoffhand, isreflected) end @@ -1443,6 +1452,7 @@ local este_jogador = damage_cache [who_serial] if (not este_jogador) then --este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (nil, who_name) + local meu_dono este_jogador, meu_dono, who_name = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true) if (not este_jogador) then return --> just return if actor doen't exist yet @@ -1517,7 +1527,7 @@ ------------------------------------------------------------------------------------------------ --> spell reflection - elseif (missType == "REFLECT" and reflection_auras[alvo_serial]) then + elseif (missType == "REFLECT" and reflection_auras[alvo_serial]) then --~reflect --> a reflect event and we have the reflecting aura data if (reflection_damage[who_serial] and reflection_damage[who_serial][spellid] and time-reflection_damage[who_serial][spellid].time > 3.5 and (not reflection_debuffs[who_serial] or (reflection_debuffs[who_serial] and not reflection_debuffs[who_serial][spellid]))) then --> here we check if we have to filter old damage data @@ -1537,8 +1547,10 @@ local reflection = reflection_auras[alvo_serial] if (damage) then --> damage ocurred first, so we have its data - amount = reflection_damage[who_serial][spellid].amount + local amount = reflection_damage[who_serial][spellid].amount + print("1", spellid, GetSpellInfo(spellid)) + local isreflected = spellid --which spell was reflected alvo_serial = reflection.who_serial alvo_name = reflection.who_name alvo_flags = reflection.who_flags @@ -1553,7 +1565,8 @@ --> this is so bad at clearing, there should be a better way of handling this reflection_damage[who_serial] = nil end - return parser:spell_dmg(token,time,alvo_serial,alvo_name,alvo_flags,who_serial,who_name,who_flags,nil,spellid,spellname,spelltype,amount,-1,nil,nil,nil,nil,false,false,false,false) + + return parser:spell_dmg(token,time,alvo_serial,alvo_name,alvo_flags,who_serial,who_name,who_flags,nil,spellid,spellname,spelltype,amount,-1,nil,nil,nil,nil,false,false,false,false, isreflected) else --> saving information about this reflect because it occurred before the damage event reflection_events[who_serial] = reflection_events[who_serial] or {} @@ -2090,7 +2103,7 @@ ------------------------------------------------------------------------------------------------ --> spell reflection - if (reflection_spellid[spellid]) then + if (reflection_spellid[spellid]) then --~reflect --> this is a spell reflect aura --> we save the info on who received this aura and from whom --> this will be used to credit this spell as the one doing the damage diff --git a/functions/profiles.lua b/functions/profiles.lua index 32d0c618..af45587f 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1134,7 +1134,7 @@ local default_profile = { border_color = {0, 0, 0, 1}, border_size = 14, - tooltip_max_abilities = 8, + tooltip_max_abilities = 7, tooltip_max_targets = 2, tooltip_max_pets = 2, diff --git a/functions/spells.lua b/functions/spells.lua index 27b0fa38..f583c9a5 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -3360,6 +3360,7 @@ do [124] = {name = STRING_SCHOOL_CHROMATIC, formated = "|cFFC0C0C0" .. STRING_SCHOOL_CHROMATIC .. "|r", hex = "FFC0C0C0", rgb = {192, 192, 192}, decimals = {0.7529, 0.7529, 0.7529}}, [126] = {name = STRING_SCHOOL_MAGIC , formated = "|cFF1111FF" .. STRING_SCHOOL_MAGIC .. "|r", hex = "FF1111FF", rgb = {17, 255, 255}, decimals = {0.0667, 0.0667, 1.0000}}, [127] = {name = STRING_SCHOOL_CHAOS, formated = "|cFFFF1111" .. STRING_SCHOOL_CHAOS .. "|r", hex = "FFFF1111", rgb = {255, 17, 17}, decimals = {1.0000, 0.0667, 0.0667}}, + --[[custom]] [1024] = {name = "Reflection", formated = "|cFFFFFFFF" .. "Reflection" .. "|r", hex = "FFFFFFFF", rgb = {255, 255, 255}, decimals = {1, 1, 1}}, } _detalhes.OverrideSpellSchool = { diff --git a/gumps/janela_info.lua b/gumps/janela_info.lua index 1fde1e16..b97af4ae 100644 --- a/gumps/janela_info.lua +++ b/gumps/janela_info.lua @@ -5327,14 +5327,15 @@ local row_on_enter = function (self) if (not self.minha_tabela or not self.minha_tabela:MontaTooltipDamageTaken (self, self._index, info.instancia)) then -- > poderia ser aprimerado para uma tailcall return end - elseif (not self.minha_tabela or not self.minha_tabela:MontaTooltipAlvos (self, self._index, info.instancia)) then -- > poderia ser aprimerado para uma tailcall + GameTooltip:Show() + self:SetHeight (CONST_TARGET_HEIGHT + 1) return end - - self:SetHeight (CONST_TARGET_HEIGHT + 1) - - GameTooltip:Show() - + + if (not self.minha_tabela or not self.minha_tabela:MontaTooltipAlvos (self, self._index, info.instancia)) then -- > poderia ser aprimerado para uma tailcall + return + end + elseif (self.isMain) then if (IsShiftKeyDown()) then @@ -5573,17 +5574,22 @@ local target_on_enter = function (self) local ActorTargetsSortTable = {} local ActorTargetsContainer + local total = 0 - local attribute, sub_attribute = info.instancia:GetDisplay() - if (attribute == 1 or attribute == 3) then - ActorTargetsContainer = spell.targets + if (spell.isReflection) then + ActorTargetsContainer = spell.extra else - if (sub_attribute == 3) then --overheal - ActorTargetsContainer = spell.targets_overheal - elseif (sub_attribute == 6) then --absorbs - ActorTargetsContainer = spell.targets_absorbs - else + local attribute, sub_attribute = info.instancia:GetDisplay() + if (attribute == 1 or attribute == 3) then ActorTargetsContainer = spell.targets + else + if (sub_attribute == 3) then --overheal + ActorTargetsContainer = spell.targets_overheal + elseif (sub_attribute == 6) then --absorbs + ActorTargetsContainer = spell.targets_absorbs + else + ActorTargetsContainer = spell.targets + end end end @@ -5591,6 +5597,7 @@ local target_on_enter = function (self) for target_name, amount in _pairs (ActorTargetsContainer) do --print (target_name, amount) ActorTargetsSortTable [#ActorTargetsSortTable+1] = {target_name, amount or 0} + total = total + (amount or 0) end table.sort (ActorTargetsSortTable, _detalhes.Sort2) @@ -5611,21 +5618,52 @@ local target_on_enter = function (self) local SelectedToKFunction = _detalhes.ToKFunctions [_detalhes.ps_abbreviation] - for index, target in ipairs (ActorTargetsSortTable) do - if (target [2] > 0) then - local class = _detalhes:GetClass (target [1]) - if (class and _detalhes.class_coords [class]) then - local cords = _detalhes.class_coords [class] - if (info.target_persecond) then - GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], _detalhes:comma_value ( _math_floor (target [2] / meu_tempo) ), 1, 1, 1, 1, 1, 1) + if (spell.isReflection) then + _detalhes:FormatCooltipForSpells() + GameCooltip:SetOwner(self, "bottomright", "top", 4, -2) + + _detalhes:AddTooltipSpellHeaderText ("Spells Reflected", {1, 0.9, 0.0, 1}, 1, select(3, _GetSpellInfo(spell.id)), 0.1, 0.9, 0.1, 0.9) --localize-me + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.4) + + GameCooltip:AddIcon(select(3, _GetSpellInfo(spell.id)), 1, 1, 16, 16, .1, .9, .1, .9) + _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + + local topDamage = ActorTargetsSortTable[1] and ActorTargetsSortTable[1][2] + + for index, target in ipairs (ActorTargetsSortTable) do + if (target [2] > 0) then + local spellId = target[1] + local damageDone = target[2] + local spellName, _, spellIcon = _GetSpellInfo(spellId) + GameCooltip:AddLine(spellName, SelectedToKFunction (_, damageDone) .. " (" .. floor(damageDone / topDamage * 100) .. "%)") + GameCooltip:AddIcon(spellIcon, 1, 1, 16, 16, .1, .9, .1, .9) + _detalhes:AddTooltipBackgroundStatusbar (false, damageDone / topDamage * 100) + end + end + + GameCooltip:Show() + + self.texture:SetAlpha (1) + self:SetAlpha (1) + barra:GetScript("OnEnter")(barra) + return + else + for index, target in ipairs (ActorTargetsSortTable) do + if (target [2] > 0) then + local class = _detalhes:GetClass (target [1]) + if (class and _detalhes.class_coords [class]) then + local cords = _detalhes.class_coords [class] + if (info.target_persecond) then + GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], _detalhes:comma_value ( _math_floor (target [2] / meu_tempo) ), 1, 1, 1, 1, 1, 1) + else + GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) + end else - GameTooltip:AddDoubleLine (index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) - end - else - if (info.target_persecond) then - GameTooltip:AddDoubleLine (index .. ". " .. target [1], _detalhes:comma_value ( _math_floor (target [2] / meu_tempo)), 1, 1, 1, 1, 1, 1) - else - GameTooltip:AddDoubleLine (index .. ". " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) + if (info.target_persecond) then + GameTooltip:AddDoubleLine (index .. ". " .. target [1], _detalhes:comma_value ( _math_floor (target [2] / meu_tempo)), 1, 1, 1, 1, 1, 1) + else + GameTooltip:AddDoubleLine (index .. ". " .. target [1], SelectedToKFunction (_, target [2]), 1, 1, 1, 1, 1, 1) + end end end end @@ -5656,6 +5694,7 @@ end local target_on_leave = function (self) GameTooltip:Hide() + GameCooltip:Hide() self:GetParent():GetParent():GetScript("OnLeave")(self:GetParent():GetParent()) self.texture:SetAlpha (.7) self:SetAlpha (.7) diff --git a/startup.lua b/startup.lua index 76a639ac..08a8f617 100644 --- a/startup.lua +++ b/startup.lua @@ -1739,7 +1739,7 @@ function _G._detalhes:Start() end --enforce to show 6 abilities on the tooltip - _detalhes.tooltip.tooltip_max_abilities = 6 + --_detalhes.tooltip.tooltip_max_abilities = 6 freeeeeedooommmmm --enforce to use the new animation code if (_detalhes.streamer_config) then