diff --git a/classes/class_utility.lua b/classes/class_utility.lua index d0e0b10b..3bf6ebe4 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -161,14 +161,6 @@ function Details:GetSpellCastAmount(combat, actorName, spellId) --[[exported]] return 0 end ---[[exported]] function Details:GetSpellTableFromContainer(spellContainerName, spellId) - local spellContainer = self[spellContainerName] - if (spellContainer) then - local spellTable = spellContainer._ActorTable[spellId] - return spellTable - end -end - function atributo_misc:NovaTabela(serial, nome, link) local newUtilityActor = { last_event = 0, @@ -675,107 +667,120 @@ function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, insta end -function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, exportar, refresh_needed) +function atributo_misc:RefreshWindow(instance, combatObject, bIsForceRefresh, bIsExport) + ---@type actorcontainer + local utilityActorContainer = combatObject[class_type] - local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable - - if (#showing._ActorTable < 1) then --n�o h� barras para mostrar - return _detalhes:EsconderBarrasNaoUsadas (instancia, showing), "", 0, 0 + if (#utilityActorContainer._ActorTable < 1) then --n�o h� barras para mostrar + return _detalhes:EsconderBarrasNaoUsadas (instance, utilityActorContainer), "", 0, 0 end local total = 0 - instancia.top = 0 + instance.top = 0 - local sub_atributo = instancia.sub_atributo --o que esta sendo mostrado nesta inst�ncia - local conteudo = showing._ActorTable + --the main attribute is utility, the sub attribute is the type of utility (cc break, ress, etc) + local subAttribute = instance.sub_atributo + local conteudo = utilityActorContainer._ActorTable local amount = #conteudo - local modo = instancia.modo + local modo = instance.modo - if (exportar) then - if (type(exportar) == "boolean") then - if (sub_atributo == 1) then --CC BREAKS + if (bIsExport) then + if (type(bIsExport) == "boolean") then + if (subAttribute == 1) then --CC BREAKS keyName = "cc_break" - elseif (sub_atributo == 2) then --RESS + elseif (subAttribute == 2) then --RESS keyName = "ress" - elseif (sub_atributo == 3) then --INTERRUPT + elseif (subAttribute == 3) then --INTERRUPT keyName = "interrupt" - elseif (sub_atributo == 4) then --DISPELLS + elseif (subAttribute == 4) then --DISPELLS keyName = "dispell" - elseif (sub_atributo == 5) then --DEATHS + elseif (subAttribute == 5) then --DEATHS keyName = "dead" - elseif (sub_atributo == 6) then --DEFENSIVE COOLDOWNS + elseif (subAttribute == 6) then --DEFENSIVE COOLDOWNS keyName = "cooldowns_defensive" - elseif (sub_atributo == 7) then --BUFF UPTIME + elseif (subAttribute == 7) then --BUFF UPTIME keyName = "buff_uptime" - elseif (sub_atributo == 8) then --DEBUFF UPTIME + elseif (subAttribute == 8) then --DEBUFF UPTIME keyName = "debuff_uptime" end else - keyName = exportar.key - modo = exportar.modo + keyName = bIsExport.key + modo = bIsExport.modo end - elseif (instancia.atributo == 5) then --custom + elseif (instance.atributo == 5) then --custom keyName = "custom" - total = tabela_do_combate.totals [instancia.customName] + total = combatObject.totals [instance.customName] else --pega qual a sub key que ser� usada - if (sub_atributo == 1) then --CC BREAKS + if (subAttribute == 1) then --CC BREAKS keyName = "cc_break" - elseif (sub_atributo == 2) then --RESS + elseif (subAttribute == 2) then --RESS keyName = "ress" - elseif (sub_atributo == 3) then --INTERRUPT + elseif (subAttribute == 3) then --INTERRUPT keyName = "interrupt" - elseif (sub_atributo == 4) then --DISPELLS + elseif (subAttribute == 4) then --DISPELLS keyName = "dispell" - elseif (sub_atributo == 5) then --DEATHS + elseif (subAttribute == 5) then --DEATHS keyName = "dead" - elseif (sub_atributo == 6) then --DEFENSIVE COOLDOWNS + elseif (subAttribute == 6) then --DEFENSIVE COOLDOWNS keyName = "cooldowns_defensive" - elseif (sub_atributo == 7) then --BUFF UPTIME + elseif (subAttribute == 7) then --BUFF UPTIME keyName = "buff_uptime" - elseif (sub_atributo == 8) then --DEBUFF UPTIME + elseif (subAttribute == 8) then --DEBUFF UPTIME keyName = "debuff_uptime" end - end if (keyName == "dead") then - local mortes = tabela_do_combate.last_events_tables - instancia.top = 1 - total = #mortes + local allDeathsInTheCombat = combatObject.last_events_tables + instance.top = 1 + total = #allDeathsInTheCombat - if (exportar) then - return mortes + if (bIsExport) then + return allDeathsInTheCombat end if (total < 1) then - instancia:EsconderScrollBar() - return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --retorna a tabela que precisa ganhar o refresh + instance:EsconderScrollBar() + return _detalhes:EndRefresh(instance, total, combatObject, utilityActorContainer) end - --estra mostrando ALL ent�o posso seguir o padr�o correto? primeiro, atualiza a scroll bar... - instancia:RefreshScrollBar (total) + instance:RefreshScrollBar(total) - --depois faz a atualiza��o normal dele atrav�s dos_ iterators local whichRowLine = 1 - local barras_container = instancia.barras - local percentage_type = instancia.row_info.percent_type + local bIsReverse = true - for i = instancia.barraS[1], instancia.barraS[2], 1 do --vai atualizar s� o range que esta sendo mostrado - if (mortes[i]) then --corre��o para um raro e desconhecido problema onde mortes[i] � nil - atributo_misc:DeadAtualizarBarra (mortes[i], whichRowLine, i, instancia) - whichRowLine = whichRowLine+1 + --if this is reverse, need to invert the values in the table which holds the deaths in the combat + if (bIsReverse) then + local tempTable = {} + for i = #allDeathsInTheCombat, 1, -1 do + tempTable[#tempTable+1] = allDeathsInTheCombat[i] + end + + --update only the lines shown + for i = instance.barraS[1], instance.barraS[2], 1 do + if (tempTable[i]) then + atributo_misc:DeadAtualizarBarra(tempTable[i], whichRowLine, i, instance) + whichRowLine = whichRowLine+1 + end + end + else + --update only the lines shown + for i = instance.barraS[1], instance.barraS[2], 1 do + if (allDeathsInTheCombat[i]) then + atributo_misc:DeadAtualizarBarra(allDeathsInTheCombat[i], whichRowLine, i, instance) + whichRowLine = whichRowLine+1 + end end end - return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --retorna a tabela que precisa ganhar o refresh - + return _detalhes:EndRefresh(instance, total, combatObject, utilityActorContainer) else - if (instancia.atributo == 5) then --custom + if (instance.atributo == 5) then --custom --faz o sort da categoria e retorna o amount corrigido table.sort (conteudo, _detalhes.SortIfHaveKey) @@ -789,10 +794,10 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end --pega o total ja aplicado na tabela do combate - total = tabela_do_combate.totals [class_type] [keyName] + total = combatObject.totals [class_type] [keyName] --grava o total - instancia.top = conteudo[1][keyName] + instance.top = conteudo[1][keyName] elseif (modo == modo_ALL) then --mostrando ALL @@ -808,10 +813,10 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end --pega o total ja aplicado na tabela do combate - total = tabela_do_combate.totals [class_type] [keyName] + total = combatObject.totals [class_type] [keyName] --grava o total - instancia.top = conteudo[1][keyName] + instance.top = conteudo[1][keyName] elseif (modo == modo_GROUP) then --mostrando GROUP @@ -824,7 +829,7 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo amount = index - 1 break elseif (index == 1) then --esse IF aqui, precisa mesmo ser aqui? n�o daria pra pega-lo com uma chave [1] nad grupo == true? - instancia.top = conteudo[1][keyName] + instance.top = conteudo[1][keyName] end total = total + player[keyName] @@ -838,46 +843,46 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end --refaz o mapa do container - showing:remapear() + utilityActorContainer:remapear() - if (exportar) then - return total, keyName, instancia.top, amount + if (bIsExport) then + return total, keyName, instance.top, amount end if (amount < 1) then --n�o h� barras para mostrar - instancia:EsconderScrollBar() --precisaria esconder a scroll bar - return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --retorna a tabela que precisa ganhar o refresh + instance:EsconderScrollBar() --precisaria esconder a scroll bar + return _detalhes:EndRefresh (instance, total, combatObject, utilityActorContainer) --retorna a tabela que precisa ganhar o refresh end --estra mostrando ALL ent�o posso seguir o padr�o correto? primeiro, atualiza a scroll bar... - instancia:RefreshScrollBar (amount) + instance:RefreshScrollBar (amount) --depois faz a atualiza��o normal dele atrav�s dos_ iterators local whichRowLine = 1 - local barras_container = instancia.barras - local percentage_type = instancia.row_info.percent_type - local bars_show_data = instancia.row_info.textR_show_data - local bars_brackets = instancia:GetBarBracket() - local bars_separator = instancia:GetBarSeparator() - local use_animations = _detalhes.is_using_row_animations and (not instancia.baseframe.isStretching and not forcar) + local barras_container = instance.barras + local percentage_type = instance.row_info.percent_type + local bars_show_data = instance.row_info.textR_show_data + local bars_brackets = instance:GetBarBracket() + local bars_separator = instance:GetBarSeparator() + local use_animations = _detalhes.is_using_row_animations and (not instance.baseframe.isStretching and not bIsForceRefresh) if (total == 0) then total = 0.00000001 end - UsingCustomLeftText = instancia.row_info.textL_enable_custom_text - UsingCustomRightText = instancia.row_info.textR_enable_custom_text + UsingCustomLeftText = instance.row_info.textL_enable_custom_text + UsingCustomRightText = instance.row_info.textR_enable_custom_text - if (instancia.bars_sort_direction == 1) then --top to bottom - for i = instancia.barraS[1], instancia.barraS[2], 1 do --vai atualizar s� o range que esta sendo mostrado - conteudo[i]:RefreshLine(instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) + if (instance.bars_sort_direction == 1) then --top to bottom + for i = instance.barraS[1], instance.barraS[2], 1 do --vai atualizar s� o range que esta sendo mostrado + conteudo[i]:RefreshLine(instance, barras_container, whichRowLine, i, total, subAttribute, bIsForceRefresh, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end - elseif (instancia.bars_sort_direction == 2) then --bottom to top - for i = instancia.barraS[2], instancia.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado + elseif (instance.bars_sort_direction == 2) then --bottom to top + for i = instance.barraS[2], instance.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado if (conteudo[i]) then - conteudo[i]:RefreshLine(instancia, barras_container, whichRowLine, i, total, sub_atributo, forcar, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) + conteudo[i]:RefreshLine(instance, barras_container, whichRowLine, i, total, subAttribute, bIsForceRefresh, keyName, nil, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end end @@ -885,10 +890,10 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end if (use_animations) then - instancia:PerformAnimations (whichRowLine-1) + instance:PerformAnimations (whichRowLine-1) end - if (instancia.atributo == 5) then --custom + if (instance.atributo == 5) then --custom --zerar o .custom dos_ Actors for index, player in ipairs(conteudo) do if (player.custom > 0) then @@ -900,15 +905,15 @@ function atributo_misc:RefreshWindow (instancia, tabela_do_combate, forcar, expo end --beta, hidar barras n�o usadas durante um refresh for�ado - if (forcar) then - if (instancia.modo == 2) then --group - for i = whichRowLine, instancia.rows_fit_in_window do - Details.FadeHandler.Fader(instancia.barras [i], "in", Details.fade_speed) + if (bIsForceRefresh) then + if (instance.modo == 2) then --group + for i = whichRowLine, instance.rows_fit_in_window do + Details.FadeHandler.Fader(instance.barras [i], "in", Details.fade_speed) end end end - return _detalhes:EndRefresh (instancia, total, tabela_do_combate, showing) --retorna a tabela que precisa ganhar o refresh + return _detalhes:EndRefresh (instance, total, combatObject, utilityActorContainer) --retorna a tabela que precisa ganhar o refresh end diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 7fb81434..189c3f58 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -45,15 +45,15 @@ function segmentClass:NovoHistorico() return esta_tabela end -function segmentClass:adicionar_overall (tabela) +function segmentClass:adicionar_overall (combatObject) local zoneName, zoneType = GetInstanceInfo() - if (zoneType ~= "none" and tabela:GetCombatTime() <= Details.minimum_overall_combat_time) then + if (zoneType ~= "none" and combatObject:GetCombatTime() <= Details.minimum_overall_combat_time) then return end if (Details.overall_clear_newboss) then --only for raids - if (tabela.instance_type == "raid" and tabela.is_boss) then + if (combatObject.instance_type == "raid" and combatObject.is_boss) then if (Details.last_encounter ~= Details.last_encounter2) then if (Details.debug) then Details:Msg("(debug) new boss detected 'overall_clear_newboss' is true, cleaning overall data.") @@ -66,12 +66,12 @@ function segmentClass:adicionar_overall (tabela) end end - if (tabela.overall_added) then + if (combatObject.overall_added) then Details:Msg("error > attempt to add a segment already added > func historico:adicionar_overall()") return end - local mythicInfo = tabela.is_mythic_dungeon + local mythicInfo = combatObject.is_mythic_dungeon if (mythicInfo) then --do not add overall mythic+ dungeon segments if (mythicInfo.TrashOverallSegment) then @@ -85,11 +85,11 @@ function segmentClass:adicionar_overall (tabela) --store the segments added to the overall data Details.tabela_overall.segments_added = Details.tabela_overall.segments_added or {} - local this_clock = tabela.data_inicio + local this_clock = combatObject.data_inicio - local combatName = tabela:GetCombatName(true) - local combatTime = tabela:GetCombatTime() - local combatType = tabela:GetCombatType() + local combatName = combatObject:GetCombatName(true) + local combatTime = combatObject:GetCombatTime() + local combatType = combatObject:GetCombatType() tinsert(Details.tabela_overall.segments_added, 1, {name = combatName, elapsed = combatTime, clock = this_clock, type = combatType}) @@ -98,26 +98,26 @@ function segmentClass:adicionar_overall (tabela) end if (Details.debug) then - Details:Msg("(debug) adding the segment to overall data: " .. (tabela:GetCombatName(true) or "no name") .. " with time of: " .. (tabela:GetCombatTime() or "no time")) + Details:Msg("(debug) adding the segment to overall data: " .. (combatObject:GetCombatName(true) or "no name") .. " with time of: " .. (combatObject:GetCombatTime() or "no time")) end - Details.tabela_overall = Details.tabela_overall + tabela - tabela.overall_added = true + Details.tabela_overall = Details.tabela_overall + combatObject + combatObject.overall_added = true if (not Details.tabela_overall.overall_enemy_name) then - Details.tabela_overall.overall_enemy_name = tabela.is_boss and tabela.is_boss.name or tabela.enemy + Details.tabela_overall.overall_enemy_name = combatObject.is_boss and combatObject.is_boss.name or combatObject.enemy else - if (Details.tabela_overall.overall_enemy_name ~= (tabela.is_boss and tabela.is_boss.name or tabela.enemy)) then + if (Details.tabela_overall.overall_enemy_name ~= (combatObject.is_boss and combatObject.is_boss.name or combatObject.enemy)) then Details.tabela_overall.overall_enemy_name = "-- x -- x --" end end if (Details.tabela_overall.start_time == 0) then - Details.tabela_overall:SetStartTime (tabela.start_time) - Details.tabela_overall:SetEndTime (tabela.end_time) + Details.tabela_overall:SetStartTime (combatObject.start_time) + Details.tabela_overall:SetEndTime (combatObject.end_time) else - Details.tabela_overall:SetStartTime (tabela.start_time - Details.tabela_overall:GetCombatTime()) - Details.tabela_overall:SetEndTime (tabela.end_time) + Details.tabela_overall:SetStartTime (combatObject.start_time - Details.tabela_overall:GetCombatTime()) + Details.tabela_overall:SetEndTime (combatObject.end_time) end if (Details.tabela_overall.data_inicio == 0) then @@ -215,7 +215,7 @@ function Details:CanAddCombatToOverall (tabela) end --sai do combate, chamou adicionar a tabela ao hist�rico -function segmentClass:adicionar (tabela) +function segmentClass:adicionar(tabela) local tamanho = #self.tabelas @@ -259,7 +259,7 @@ function segmentClass:adicionar (tabela) end --see if can add the encounter to overall data - local canAddToOverall = Details:CanAddCombatToOverall (tabela) + local canAddToOverall = Details:CanAddCombatToOverall(tabela) if (canAddToOverall) then --if (InCombatLockdown()) then diff --git a/core/parser.lua b/core/parser.lua index 2e2f52bf..2688fa65 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -4090,6 +4090,13 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 return end + local bIsMythicRun = false + --check if this is a mythic+ run for overall deaths + local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() --classic wow doesn't not have C_ChallengeMode API + if (mythicLevel and type(mythicLevel) == "number" and mythicLevel >= 2) then --several checks to be future proof + bIsMythicRun = true + end + _current_misc_container.need_refresh = true --combat totals @@ -4255,9 +4262,6 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 eventsBeforePlayerDeath[#eventsBeforePlayerDeath+1] = eventTable end - local combatElapsedTime = GetTime() - _current_combat:GetStartTime() - local minutes, seconds = floor(combatElapsedTime / 60), floor(combatElapsedTime % 60) - local maxHealth if (thisPlayer.arena_enemy) then --this is an arena enemy, get the heal with the unit Id @@ -4276,34 +4280,29 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 maxHealth = UnitHealthMax(thisPlayer.nome) end - local playerDeathTable = { - eventsBeforePlayerDeath, --table - time, --number unix time - thisPlayer.nome, --string player name - thisPlayer.classe, --string player class - maxHealth, --number max health - minutes .. "m " .. seconds .. "s", --time of death as string + local playerDeathTable + local combatElapsedTime = GetTime() - _current_combat:GetStartTime() - ["dead"] = true, - ["last_cooldown"] = thisPlayer.last_cooldown, - ["dead_at"] = combatElapsedTime, - } + do + local minutes, seconds = floor(combatElapsedTime / 60), floor(combatElapsedTime % 60) + + playerDeathTable = { + eventsBeforePlayerDeath, --table + time, --number unix time + thisPlayer.nome, --string player name + thisPlayer.classe, --string player class + maxHealth, --number max health + minutes .. "m " .. seconds .. "s", --time of death as string + ["dead"] = true, + ["last_cooldown"] = thisPlayer.last_cooldown, + ["dead_at"] = combatElapsedTime, + } + end tinsert(_current_combat.last_events_tables, #_current_combat.last_events_tables+1, playerDeathTable) - if (_hook_deaths) then - --send event to registred functions - for _, func in ipairs(_hook_deaths_container) do - local successful, errortext = pcall(func, nil, token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, playerDeathTable, thisPlayer.last_cooldown, combatElapsedTime, maxHealth) - if (not successful) then - _detalhes:Msg("error occurred on a death hook function:", errortext) - end - end - end - --check if this is a mythic+ run for overall deaths - local mythicLevel = C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() --classic wow doesn't not have C_ChallengeMode API - if (mythicLevel and type(mythicLevel) == "number" and mythicLevel >= 2) then --several checks to be future proof + if (bIsMythicRun) then --more checks for integrity if (_detalhes.tabela_overall and _detalhes.tabela_overall.last_events_tables) then --this is a mythic dungeon run, add the death to overall data @@ -4312,16 +4311,31 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 local overallDeathTable = DetailsFramework.table.copy({}, playerDeathTable) --get the elapsed time - local timeElapsed = GetTime() - _detalhes.tabela_overall:GetStartTime() - local minutes, seconds = floor(timeElapsed/60), floor(timeElapsed % 60) + local mythicPlusElapsedTime = GetTime() - _detalhes.tabela_overall:GetStartTime() + local minutes, seconds = floor(mythicPlusElapsedTime/60), floor(mythicPlusElapsedTime % 60) - overallDeathTable [6] = minutes .. "m " .. seconds .. "s" - overallDeathTable.dead_at = timeElapsed + overallDeathTable[6] = minutes .. "m " .. seconds .. "s" + overallDeathTable.dead_at = mythicPlusElapsedTime + + --save data about the mythic run in the deathTable which goes in the regular segment + playerDeathTable["mythic_plus"] = true + playerDeathTable["mythic_plus_dead_at"] = mythicPlusElapsedTime + playerDeathTable["mythic_plus_dead_at_string"] = overallDeathTable[6] tinsert(_detalhes.tabela_overall.last_events_tables, #_detalhes.tabela_overall.last_events_tables + 1, overallDeathTable) end end + if (_hook_deaths) then + --send event to registred functions + for _, func in ipairs(_hook_deaths_container) do + local successful, errortext = pcall(func, nil, token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, playerDeathTable, thisPlayer.last_cooldown, combatElapsedTime, maxHealth, playerDeathTable["mythic_plus_dead_at"] or 0) + if (not successful) then + _detalhes:Msg("error occurred on a death hook function:", errortext) + end + end + end + --remove the player death events from the cache last_events_cache[targetName] = nil end diff --git a/functions/mixin.lua b/functions/mixin.lua index 3964f416..ebf43b46 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -6,19 +6,37 @@ local addonName, Details222 = ... Details222.Mixins.ActorMixin = { - GetSpellContainer = function(self, containerType) + ---return a spellContainer from an actor + ---@param actor actor + ---@param containerType string + ---@return spellcontainer|nil + GetSpellContainer = function(actor, containerType) if (containerType == "debuff") then - return self.debuff_uptime_spells + return actor.debuff_uptime_spells elseif (containerType == "buff") then - return self.buff_uptime_spells + return actor.buff_uptime_spells elseif (containerType == "spell") then - return self.spells + return actor.spells elseif (containerType == "cooldowns") then - return self.cooldowns_defensive_spells + return actor.cooldowns_defensive_spells end + end, + ---return a spellTable from a spellContainer + ---@param actor actor + ---@param spellContainerName string + ---@param spellId number + ---@return spelltable|nil + GetSpellTableFromContainer = function(actor, spellContainerName, spellId) + ---@type spellcontainer + local spellContainer = actor[spellContainerName] + if (spellContainer) then + ---@type spelltable + local spellTable = spellContainer._ActorTable[spellId] + return spellTable + end end, } \ No newline at end of file diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index 0a136da2..05ad260d 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -60,7 +60,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() Details222.MythicPlus.LogStep("MergeSegmentsOnEnd started | creating the overall segment at the end of the run.") --create a new combat to be the overall for the mythic run - Details:EntrarEmCombate() + Details:StartCombat() --get the current combat just created and the table with all past segments local newCombat = Details:GetCurrentCombat() @@ -72,30 +72,32 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() local totalSegments = 0 --add all boss segments from this run to this new segment - for i = 1, 25 do --from the newer combat to the oldest - local pastCombat = segmentHistory [i] - if (pastCombat and pastCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then + for i = 1, 40 do --from the newer combat to the oldest + local thisCombat = segmentHistory[i] + if (thisCombat and thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then local canAddThisSegment = true if (_detalhes.mythic_plus.make_overall_boss_only) then - if (not pastCombat.is_boss) then + if (not thisCombat.is_boss) then canAddThisSegment = false end end if (canAddThisSegment) then - newCombat = newCombat + pastCombat - totalTime = totalTime + pastCombat:GetCombatTime() + newCombat = newCombat + thisCombat + newCombat:CopyDeathsFrom(thisCombat, true) + + totalTime = totalTime + thisCombat:GetCombatTime() totalSegments = totalSegments + 1 if (DetailsMythicPlusFrame.DevelopmentDebug) then - print("MergeSegmentsOnEnd() > adding time:", pastCombat:GetCombatTime(), pastCombat.is_boss and pastCombat.is_boss.name) + print("MergeSegmentsOnEnd() > adding time:", thisCombat:GetCombatTime(), thisCombat.is_boss and thisCombat.is_boss.name) end if (endDate == "") then - local _, whenEnded = pastCombat:GetDate() + local _, whenEnded = thisCombat:GetDate() endDate =whenEnded end - lastSegment = pastCombat + lastSegment = thisCombat end end end @@ -187,6 +189,8 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule) newCombat = newCombat + pastCombat totalTime = totalTime + pastCombat:GetCombatTime() + newCombat:CopyDeathsFrom(pastCombat, true) + --tag this combat as already added to a boss trash overall pastCombat._trashoverallalreadyadded = true