From 6527146c5d22542ab6894745b27f50580ff67029 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Fri, 12 May 2023 15:17:11 -0300 Subject: [PATCH] Added friendly fire and healing taken into the new breakdown --- Definitions.lua | 12 +++++- classes/class_damage.lua | 53 +++++++++++++++++++++++- classes/class_heal.lua | 46 ++++++++++++++++++++ classes/class_resources.lua | 2 + frames/window_playerbreakdown.lua | 3 +- frames/window_playerbreakdown_spells.lua | 5 ++- 6 files changed, 114 insertions(+), 7 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 9d354bdb..9eb638fd 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -362,6 +362,10 @@ ---@field ListSpells fun(container: spellcontainer) : any, any usage: for spellId, spelltable in container:ListActors() do ---@field _ActorTable table +---@class friendlyfiretable : table +---@field total number total amount of friendly fire caused by the actor +---@field spells table spellId = total + ---@class spelltable : table ---@field uptime number ---@field total number @@ -423,8 +427,6 @@ ---@field total number ---@field pets table ---@field targets targettable ----@field damage_taken number amount of damage the actor took durent the segment ----@field damage_from table store the name of the actors which damaged the actor, format: [actorName] = true ---@field GetSpellContainer fun(actor: actor, containerType: "debuff"|"buff"|"spell"|"cooldowns") : spellcontainer ---@field Class fun(actor: actor) : string get the ingame class of the actor ---@field Spec fun(actor: actor) : string get the ingame spec of the actor @@ -433,6 +435,12 @@ ---@field GetPets fun(actor: actor) : table get a table with all pet names that belong to the player ---@field GetSpellList fun(actor: actor) : table +---@class actordamage : actor +---@field friendlyfire_total number +---@field friendlyfire friendlyfiretable +---@field damage_taken number amount of damage the actor took durent the segment +---@field damage_from table store the name of the actors which damaged the actor, format: [actorName] = true + ---@class segmentid : number ---@class instanceid : number ---@class attributeid : number diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 50c6714c..ec3b2bf6 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3591,6 +3591,13 @@ local ENEMIES_format_name = function(player) if (player == 0) then return false local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. " (" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end function damageClass:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags) + + --can open the breakdown window now + + + + if (true) then return end + if (ShiftKeyDown) then local inimigo = actor.nome local custom_name = inimigo .. " -" .. Loc ["STRING_CUSTOM_ENEMY_DT"] @@ -4077,7 +4084,49 @@ end ------ Friendly Fire -function damageClass:MontaInfoFriendlyFire() +local friendlyFireHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true} +function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff + ---@type actordamage + local actorObject = self + ---@type instance + local instance = info.instancia + ---@type combat + local combatObject = instance:GetCombat() + ---@type string + local actorName = actorObject:Name() + + ---@type number + local friendlyFireTotal = actorObject.friendlyfire_total + ---@type table + local damagedPlayers = actorObject.friendlyfire --players which got hit by this actor + ---@type actorcontainer + local damageContainer = combatObject:GetContainer(class_type) + + local resultTable = {} + + for targetName, friendlyFireTable in pairs(damagedPlayers) do + local amountOfFriendlyFire = friendlyFireTable.total + if (amountOfFriendlyFire > 0) then + local targetActorObject = damageContainer:GetActor(targetName) + if (targetActorObject) then + ---@type texturetable + local iconTable = Details:GetActorIcon(targetActorObject) + + ---@type {name: string, amount: number, icon: texturetable} + local ffTable = {name = targetName, total = amountOfFriendlyFire, icon = iconTable} + + resultTable[#resultTable+1] = ffTable + end + end + end + + resultTable.totalValue = friendlyFireTotal + resultTable.combatTime = combatObject:GetCombatTime() + resultTable.headersAllowed = friendlyFireHeadersAllowed + + Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance) + + if true then return end local instancia = info.instancia local combat = instancia:GetShowingCombat() @@ -4263,7 +4312,7 @@ function damageClass:MontaInfoDamageTaken() Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance) - if 1 then return end + if true then return end local barras = info.barras1 local meus_agressores = {} diff --git a/classes/class_heal.lua b/classes/class_heal.lua index 2f93b84d..b3e8a12f 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -1666,7 +1666,53 @@ function atributo_heal:MontaInfo() end end +local healingTakenHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true} function atributo_heal:MontaInfoHealTaken() + ---@type actor + local actorObject = self + ---@type instance + local instance = info.instancia + ---@type combat + local combatObject = instance:GetCombat() + ---@type string + local actorName = actorObject:Name() + + ---@type number + local healTakenTotal = actorObject.healing_taken + ---@type table + local healTakenFrom = actorObject.healing_from + ---@type actorcontainer + local healContainer = combatObject:GetContainer(class_type) + + local resultTable = {} + + ---@type string + for healerName in pairs(healTakenFrom) do + local sourceActorObject = healContainer:GetActor(healerName) + if (sourceActorObject) then + ---@type table + local targets = sourceActorObject:GetTargets() + ---@type number|nil + local amountOfHeal = targets[actorName] + if (amountOfHeal) then + ---@type texturetable + local iconTable = Details:GetActorIcon(sourceActorObject) + + ---@type {name: string, amount: number, icon: texturetable} + local healTakenTable = {name = healerName, total = amountOfHeal, icon = iconTable} + + resultTable[#resultTable+1] = healTakenTable + end + end + end + + resultTable.totalValue = healTakenTotal + resultTable.combatTime = combatObject:GetCombatTime() + resultTable.headersAllowed = healingTakenHeadersAllowed + + Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance) + + if true then return end local healing_taken = self.healing_taken local curandeiros = self.healing_from diff --git a/classes/class_resources.lua b/classes/class_resources.lua index 2acbcf1d..95627c16 100644 --- a/classes/class_resources.lua +++ b/classes/class_resources.lua @@ -1060,6 +1060,8 @@ end function atributo_energy:MontaInfoRegenRecebido() + if true then return end + reset_tooltips_table() local barras = info.barras1 diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index e88b5465..edb89670 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -111,7 +111,8 @@ function Details:OpenBreakdownWindow(instanceObject, actorObject, bFromAttribute Details:CloseBreakdownWindow() return end - return Details.row_singleclick_overwrite[mainAttribute][subAttribute](_, actorObject, instanceObject, bIsShiftKeyDown, bIsControlKeyDown) + Details.row_singleclick_overwrite[mainAttribute][subAttribute](_, actorObject, instanceObject, bIsShiftKeyDown, bIsControlKeyDown) + return end if (instanceObject:GetMode() == DETAILS_MODE_RAID) then diff --git a/frames/window_playerbreakdown_spells.lua b/frames/window_playerbreakdown_spells.lua index d17d6849..08d1ef1a 100644 --- a/frames/window_playerbreakdown_spells.lua +++ b/frames/window_playerbreakdown_spells.lua @@ -1535,7 +1535,8 @@ local refreshGenericFunc = function(scrollFrame, scrollData, offset, totalLines) ---@type fontstring local fontString = genericBar.InLineTexts[textIndex] genericBar:AddFrameToHeaderAlignment(fontString) - fontString:SetText(dataTable.name) + local nameWithoutRealm = DF:RemoveRealmName(dataTable.name) + fontString:SetText(nameWithoutRealm or dataTable.name) textIndex = textIndex + 1 end @@ -2177,7 +2178,7 @@ function spellsTab.CreateTargetContainer(tabFrame) --~create ~target ~createtarg targetScrollFrame:CreateLine(spellsTab.CreateTargetBar) end - tabFrame.targets = tabFrame:CreateFontString(nil, "overlay", "QuestFont_Large") + tabFrame.targets = targetScrollFrame:CreateFontString(nil, "overlay", "QuestFont_Large") tabFrame.targets:SetPoint("bottomleft", container, "topleft", 2, 2) tabFrame.targets:SetText(Loc ["STRING_TARGETS"] .. ":")