From 72bd44b973b6ffd71fa92bb7f607d735aef962f3 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Tue, 14 Jun 2022 13:48:14 -0300 Subject: [PATCH] Added Details:GetTop5Actors(attributeId) and Details:GetActorByRank(attributeId, rankIndex) --- classes/class_instance.lua | 42 ++++++++++++++++++++++++++++++++++++++ core/gears.lua | 6 +++--- frames/window_main.lua | 6 ++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/classes/class_instance.lua b/classes/class_instance.lua index c69aceda..8119aa31 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -314,6 +314,48 @@ function Details:GetNumLinesShown() --alis of _detalhes:GetNumRows() return self.rows_fit_in_window end +--@attributeId: DETAILS_ATTRIBUTE_DAMAGE, DETAILS_ATTRIBUTE_HEAL +function Details:GetTop5Actors(attributeId) + local combatObject = self.showing + if (combatObject) then + local container = combatObject:GetContainer(attributeId) + if (container) then + local actorTable = container._ActorTable + return actorTable[1], actorTable[2], actorTable[3], actorTable[4], actorTable[5] + end + end +end + +--@attributeId: DETAILS_ATTRIBUTE_DAMAGE, DETAILS_ATTRIBUTE_HEAL +--@rankIndex: the rank id of the actor shown in the window +function Details:GetActorByRank(attributeId, rankIndex) + local combatObject = self.showing + if (combatObject) then + local container = combatObject:GetContainer(attributeId) + if (container) then + return container._ActorTable[rankIndex] + end + end + + --[=[ + local firstRow = window1:GetLine(1) + if (firstRow and firstRow:IsShown()) then + local actor = firstRow:GetActor() + if (actor) then + local total = actor.total + local combatTime = Details:GetCurrentCombat():GetCombatTime() + print("dps:", total/combatTime) + end + end + + local actorTable = container._ActorTable + for i = 1, #actorTable do + local actor = actorTable[rankIndex] + return actor + end + --]=] +end + ------------------------------------------------------------------------------------------------------------------------ --> retorna se a inst�ncia esta ou n�o ativa diff --git a/core/gears.lua b/core/gears.lua index 7f5ae681..a12c6946 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -2691,9 +2691,9 @@ if (DetailsFramework.IsTBCWow()) then ShamanEnhancement = 263, ShamanRestoration = 264, - WarlockCurses = 265, - WarlockDestruction = 266, - WarlockSummoning = 267, + WarlockCurses = 265, --affliction + WarlockSummoning = 266, --demo + WarlockDestruction = 267, --destruction --WarriorArm = 71, WarriorArms = 71, diff --git a/frames/window_main.lua b/frames/window_main.lua index 6d4d63ad..e3d8d283 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -4053,6 +4053,10 @@ end _detalhes.barras_criadas = 0 +local getActor = function(self) + return self.minha_tabela +end + --> search key: ~row ~barra ~newbar ~createbar ~createrow function gump:CreateNewLine (instancia, index) @@ -4067,6 +4071,8 @@ function gump:CreateNewLine (instancia, index) newLine.instance_id = instancia.meu_id newLine.animacao_fim = 0 newLine.animacao_fim2 = 0 + + newLine.GetActor = getActor --> set point, almost irrelevant here, it recalc this on SetBarGrowDirection() local y = instancia.row_height * (index-1)