From e3161ff29cfac47337b14d7a25c0b47104d7a955 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 26 Nov 2022 10:21:54 -0300 Subject: [PATCH] small fixes --- boot.lua | 4 +- classes/class_damage.lua | 168 ++++++++++++++++++++--------------- classes/container_spells.lua | 4 + core/parser.lua | 15 +++- frames/window_all_in_one.lua | 22 ++++- 5 files changed, 133 insertions(+), 80 deletions(-) diff --git a/boot.lua b/boot.lua index 7b04e8bb..203d2741 100644 --- a/boot.lua +++ b/boot.lua @@ -6,8 +6,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - _detalhes.build_counter = 10288 - _detalhes.alpha_build_counter = 10288 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 10289 + _detalhes.alpha_build_counter = 10289 --if this is higher than the regular counter, use it instead _detalhes.dont_open_news = true _detalhes.game_version = version _detalhes.userversion = version .. " " .. _detalhes.build_counter diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 12eb11eb..bc316a60 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -234,6 +234,24 @@ function Details:GetSpellList() --[[ exported]] return self.spells._ActorTable end + +function Details:GetTimeInCombat(petOwner) --[[exported]] + if (petOwner) then + if (Details.time_type == 1 or not petOwner.grupo) then + return self:Tempo() + elseif (Details.time_type == 2) then + return self:GetCombatTime() + end + else + if (Details.time_type == 1) then + return self:Tempo() + elseif (Details.time_type == 2) then + return self:GetCombatTime() + end + end +end + + --enemies(sort function) local sortEnemies = function(t1, t2) local a = bitBand(t1.flag_original, 0x00000060) @@ -3332,103 +3350,99 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end --PETS - local meus_pets = self.pets - if (#meus_pets > 0) then --teve ajudantes + local instance = instancia + local combatObject = instance:GetShowingCombat() - 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 + local myPets = self.pets + if (#myPets > 0) then --teve ajudantes + local petAmountWithSameName = {} --armazena a quantidade de pets iguais + local petDamageTable = {} --armazena o dano total de cada objeto --small blank space - Details:AddTooltipSpellHeaderText ("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) + Details: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 + for index, petName in ipairs(myPets) do + if (not petAmountWithSameName[petName]) then + petAmountWithSameName[petName] = 1 + local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) + local petActorObject = damageContainer:GetActor(petName) - local my_self = instancia.showing[class_type]:PegarCombatente (nil, nome) - if (my_self) then - local meu_total = my_self.total_without_pet - local tabela = my_self.spells._ActorTable - local meus_danos = {} + if (petActorObject) then + local petDamageDone = petActorObject.total_without_pet + local petSpells = petActorObject:GetSpellList() + local petSpellsSorted = {} - --totais [nome] = my_self.total_without_pet - local meu_tempo + --local timeInCombat = petActorObject:GetTimeInCombat(self) + local timeInCombat = 0 if (Details.time_type == 1 or not self.grupo) then - meu_tempo = my_self:Tempo() + timeInCombat = petActorObject:Tempo() elseif (Details.time_type == 2) then - meu_tempo = my_self:GetCombatTime() + timeInCombat = petActorObject: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) - tinsert(meus_danos, {spellid, tabela.total, tabela.total/meu_total*100, {nome, rank, icone}}) - end - _table_sort(meus_danos, Details.Sort2) - danos [nome] = meus_danos + petDamageTable[#petDamageTable+1] = {petName, petActorObject.total_without_pet, petActorObject.total_without_pet / timeInCombat} - local meus_inimigos = {} - tabela = my_self.targets - for target_name, amount in pairs(tabela) do - tinsert(meus_inimigos, {target_name, amount, amount/meu_total*100}) + for spellId, spellTable in pairs(petSpells) do + local spellName, rank, spellIcon = _GetSpellInfo(spellId) + tinsert(petSpellsSorted, {spellId, spellTable.total, spellTable.total / petDamageDone * 100, {spellName, rank, spellIcon}}) end - _table_sort(meus_inimigos,Details.Sort2) - alvos [nome] = meus_inimigos + + table.sort(petSpellsSorted, Details.Sort2) + + local petTargets = {} + petSpells = petActorObject.targets + for targetName, spellDamageDone in pairs(petSpells) do + tinsert(petTargets, {targetName, spellDamageDone, spellDamageDone / petDamageDone * 100}) + end + table.sort(petTargets,Details.Sort2) end - else - quantidade [nome] = quantidade [nome]+1 + petAmountWithSameName[petName] = petAmountWithSameName[petName] + 1 end end - --GameTooltip:AddLine(" ") - --GameCooltip:AddLine(" ") + local petHeaderAdded = false - local _quantidade = 0 - local added_logo = false - - _table_sort(totais, Details.Sort2) + table.sort(petDamageTable, Details.Sort2) local ismaximized = false if (keydown == "alt" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 5) then ismaximized = true end - local topPet = totais [1] and totais [1][2] or 0 - for index, _table in ipairs(totais) do + local topPetDamageDone = petDamageTable[1] and petDamageTable[1][2] or 0 - if (_table [2] > 0 and (index <= Details.tooltip.tooltip_max_pets or ismaximized)) then - - if (not added_logo) then - added_logo = true - - Details:AddTooltipSpellHeaderText (Loc ["STRING_PETS"], headerColor, #totais, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) + for index, damageTable in ipairs(petDamageTable) do + if (damageTable [2] > 0 and (index <= Details.tooltip.tooltip_max_pets or ismaximized)) then + if (not petHeaderAdded) then + petHeaderAdded = true + Details:AddTooltipSpellHeaderText(Loc ["STRING_PETS"], headerColor, #petDamageTable, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875) if (ismaximized) then GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - Details:AddTooltipHeaderStatusbar (r, g, b, 1) + Details:AddTooltipHeaderStatusbar(r, g, b, 1) else GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) end - end - local n = _table [1]:gsub(("%s%<.*"), "") + local petName = damageTable[1] + local petDamageDone = damageTable[2] + local petDPS = damageTable[3] + + petName = damageTable[1]:gsub(("%s%<.*"), "") if (instancia.sub_atributo == 1) then - GameCooltip:AddLine(n, FormatTooltipNumber (_, _table [2]) .. " (" .. _math_floor(_table [2]/self.total*100) .. "%)") + GameCooltip:AddLine(petName, FormatTooltipNumber(_, petDamageDone) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)") else - GameCooltip:AddLine(n, FormatTooltipNumber (_, _math_floor(_table [3])) .. " (" .. _math_floor(_table [2]/self.total*100) .. "%)") + GameCooltip:AddLine(petName, FormatTooltipNumber(_, math.floor(petDPS)) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)") end - Details:AddTooltipBackgroundStatusbar (false, _table [2] / topPet * 100) + Details:AddTooltipBackgroundStatusbar(false, petDamageDone / topPetDamageDone * 100) - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, icon_size.W, icon_size.H, 0.25, 0.49609375, 0.75, 1) + GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, icon_size.W, icon_size.H, 0.25/2, 0.49609375/2, 0.75/2, 1/2) end end - end --~Phases @@ -4287,27 +4301,29 @@ end ------ Damage Done & Dps function atributo_damage:MontaInfoDamageDone() + local actorObject = self + local allLines = info.barras1 local instance = info.instancia - local totalDamageWithoutPet = self.total_without_pet --total de dano aplicado por este jogador - local actorTotalDamage = self.total - local actorSkillsSortTable = {} - local actorSkillsContainer = self.spells._ActorTable + local totalDamageWithoutPet = actorObject.total_without_pet + local actorTotalDamage = actorObject.total + + local actorSpellsSorted = {} + local actorSpells = actorObject:GetSpellList() --get time type local actorCombatTime if (Details.time_type == 1 or not self.grupo) then actorCombatTime = self:Tempo() - elseif (Details.time_type == 2) then actorCombatTime = info.instancia.showing:GetCombatTime() end - for spellId, spellTable in pairs(actorSkillsContainer) do --da foreach em cada spellid do container - local nome, _, icone = _GetSpellInfo(spellId) - if (nome) then - tinsert(actorSkillsSortTable, {spellId, spellTable.total, spellTable.total/actorTotalDamage*100, nome, icone, nil, spellTable.spellschool}) + for spellId, spellTable in pairs(actorSpells) do + local spellName, _, spellIcon = _GetSpellInfo(spellId) + if (spellName) then + tinsert(actorSpellsSorted, {spellId, spellTable.total, spellTable.total / actorTotalDamage * 100, spellName, spellIcon, nil, spellTable.spellschool}) end end @@ -4336,6 +4352,9 @@ function atributo_damage:MontaInfoDamageDone() info:SetStatusbarText() end + --show damage percentille within item level bracket + + --add pets local ActorPets = self.pets --local class_color = RAID_CLASS_COLORS [self.classe] and RAID_CLASS_COLORS [self.classe].colorStr @@ -4349,17 +4368,17 @@ function atributo_damage:MontaInfoDamageDone() local nome, _, icone = _GetSpellInfo(_spellid) --tinsert(ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " |TInterface\\AddOns\\Details\\images\\classes_small_alpha:12:12:0:0:128:128:33:64:96:128|t|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r", icone, PetActor, _skill.spellschool}) if (nome) then - tinsert(actorSkillsSortTable, {_spellid, _skill.total, _skill.total/actorTotalDamage*100, nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor, _skill.spellschool}) + tinsert(actorSpellsSorted, {_spellid, _skill.total, _skill.total/actorTotalDamage*100, nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor, _skill.spellschool}) end end end end - _table_sort(actorSkillsSortTable, Details.Sort2) + _table_sort(actorSpellsSorted, Details.Sort2) - gump:JI_AtualizaContainerBarras (#actorSkillsSortTable + 1) + gump:JI_AtualizaContainerBarras (#actorSpellsSorted + 1) - local max_ = actorSkillsSortTable[1] and actorSkillsSortTable[1][2] or 0 --dano que a primeiro magia vez + local max_ = actorSpellsSorted[1] and actorSpellsSorted[1][2] or 0 --dano que a primeiro magia vez local barra @@ -4374,7 +4393,7 @@ function atributo_damage:MontaInfoDamageDone() end --spell bars - for index, tabela in ipairs(actorSkillsSortTable) do + for index, tabela in ipairs(actorSpellsSorted) do --index = index + 1 --with the aura bar index = index @@ -5040,7 +5059,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) t3[9] = "MISS" .. ": " .. misses end - --empowered + --~empowered if (esta_magia.e_total) then local empowerLevelSum = esta_magia.e_total --total sum of empower levels local empowerAmount = esta_magia.e_amt --amount of casts with empower @@ -5138,9 +5157,9 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) if (not thatRectangle66.bloodLustIndicators) then thatRectangle66.bloodLustIndicators = {} - for i = 1, 2 do + for i = 1, 5 do local thisIndicator = thatRectangle66:CreateTexture(nil, "artwork", nil, 4) - thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) + thisIndicator:SetColorTexture(0.0980392, 0.0980392, 0.439216) thatRectangle66.bloodLustIndicators[#thatRectangle66.bloodLustIndicators+1] = thisIndicator end end @@ -5241,6 +5260,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) local bloodlustDuration = 40 for i = 1, #combatObject.bloodlust do thatRectangle66.bloodLustIndicators[i]:Show() + thatRectangle66.bloodLustIndicators[i]:SetAlpha(0.46) thatRectangle66.bloodLustIndicators[i]:SetSize(bloodlustDuration / combatTime * width, height - 2) thatRectangle66.bloodLustIndicators[i]:SetPoint("bottomleft", thatRectangle66, "bottomleft", 0, 0) end diff --git a/classes/container_spells.lua b/classes/container_spells.lua index dc4e74cb..847be125 100644 --- a/classes/container_spells.lua +++ b/classes/container_spells.lua @@ -60,6 +60,10 @@ local addonName, Details222 = ... return pairs(self._ActorTable) end + function container_habilidades:ListActors() + return pairs(self._ActorTable) + end + function container_habilidades:GetOrCreateSpell(id, shouldCreate, token) return self:PegaHabilidade (id, shouldCreate, token) end diff --git a/core/parser.lua b/core/parser.lua index 8ee20152..ef0b4c4a 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5158,6 +5158,17 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:Msg("(debug) |cFFFFFF00ENCOUNTER_START|r event triggered.") end + if (not isWOTLK) then + C_Timer.After(1, function() + if (Details.show_warning_id1) then + if (Details.show_warning_id1_amount < 10) then + Details.show_warning_id1_amount = Details.show_warning_id1_amount + 1 + Details:Msg("|cFFFFFF00you might find differences on damage done, this is due to a bug in the game client, nothing related to Details! itself (" .. Details.show_warning_id1_amount .. " / 10).") + end + end + end) + end + _detalhes.latest_ENCOUNTER_END = _detalhes.latest_ENCOUNTER_END or 0 if (_detalhes.latest_ENCOUNTER_END + 10 > GetTime()) then return @@ -5265,9 +5276,9 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (not isWOTLK) then C_Timer.After(1, function() if (Details.show_warning_id1) then - if (Details.show_warning_id1_amount < 5) then + if (Details.show_warning_id1_amount < 10) then Details.show_warning_id1_amount = Details.show_warning_id1_amount + 1 - Details:Msg("you may find differences on damage done, this is due to a bug in the game client (" .. Details.show_warning_id1_amount .. " / 5).") + Details:Msg("|cFFFFFF00you may find differences on damage done, this is due to a bug in the game client, nothing related to Details! itself (" .. Details.show_warning_id1_amount .. " / 10).") end end end) diff --git a/frames/window_all_in_one.lua b/frames/window_all_in_one.lua index 6b5d8c92..d610a90e 100644 --- a/frames/window_all_in_one.lua +++ b/frames/window_all_in_one.lua @@ -44,9 +44,12 @@ --namespace DetailsPrivite.AllInOneWindow = {} local attributeCodes = { - + } + DetailsPrivite.WindowTooltip = {} + + local textureCoords = { show_mainmenu = {0/256, 32/256, 0, 1}, show_segments = {32/256, 64/256, 0, 1}, @@ -650,7 +653,22 @@ end - +------------------------------------------------------------------------------------------------------------------------ + +function DetailsPrivite.WindowTooltip.CreateTooltipFrame() + local damageDoneTooltipFrame = CreateFrame("frame", "DetailsWindowTooltipFrame", UIParent, "BackdropTemplate") + DetailsFramework:ApplyStandardBackdrop(damageDoneTooltipFrame) + + --create header + + --create 4 scroll frames + + --create 4 separators + + --import data from the regular tooltip functions on each attribute file + + +end