From 396f8e09d01547b7e234dc9f98480ff66b4677d7 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 19 Mar 2023 20:10:45 -0300 Subject: [PATCH] Reverse Deaths for Mythic plus updates --- frames/window_cdtracker.lua | 11 +++ frames/window_options2_sections.lua | 12 +-- functions/mythicdungeon.lua | 144 ++++++++++++++-------------- functions/profiles.lua | 21 ++-- 4 files changed, 94 insertions(+), 94 deletions(-) diff --git a/frames/window_cdtracker.lua b/frames/window_cdtracker.lua index 9a4e33df5..240eb7e0 100644 --- a/frames/window_cdtracker.lua +++ b/frames/window_cdtracker.lua @@ -675,6 +675,17 @@ end desc = "Example: Invisibility Potion.", }, + {--filter: crowd control + type = "toggle", + get = function() return Details.ocd_tracker.filters["crowdcontrol"] end, + set = function(self, fixedparam, value) + Details.ocd_tracker.filters["crowdcontrol"] = value + Details222.CooldownTracking.RefreshAllCooldownFrames() + end, + name = "Crowd Control", + desc = "Example: Incapacitaion Roar.", + }, + {type = "breakline"}, {--bar width diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 7a7e3dde..950b6b40 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -6922,7 +6922,7 @@ do set = function(self, fixedparam, value) Details.mythic_plus.boss_dedicated_segment = value end, - name = "Boss Dedicated Segment", + name = "New Combat on Boss Pull", desc = "If a boss is pulled while in combat, Details! close the combat and start a new one for the boss.", }, @@ -6946,15 +6946,7 @@ do desc = "Merge Trash", }, - {--delete merged trash - type = "toggle", - get = function() return Details.mythic_plus.delete_trash_after_merge end, - set = function(self, fixedparam, value) - Details.mythic_plus.delete_trash_after_merge = value - end, - name = "Delete Merged Trash Segments", - desc = "After have the segment merged, if this option is enabled it'll delete those merged segments.", - }, + {type = "blank"}, {--show chart popup type = "toggle", diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index 682f91bc..fdd9e4d2 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -71,6 +71,24 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() local lastSegment local totalSegments = 0 + if (Details.mythic_plus.reverse_death_log) then + for i = 1, 40 do --copy the deaths from the first segment to the last one + local thisCombat = segmentHistory[i] + if (thisCombat and thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then + newCombat:CopyDeathsFrom(thisCombat, true) + end + end + else + for i = 40, 1, -1 do --copy the deaths from the last segment to the new segment + local thisCombat = segmentHistory[i] + if (thisCombat) then + if (thisCombat.is_mythic_dungeon_run_id == Details.mythic_dungeon_id) then + newCombat:CopyDeathsFrom(thisCombat, true) + end + end + end + end + --add all boss segments from this run to this new segment for i = 1, 40 do --from the newer combat to the oldest local thisCombat = segmentHistory[i] @@ -79,7 +97,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() if (canAddThisSegment) then newCombat = newCombat + thisCombat - newCombat:CopyDeathsFrom(thisCombat, true) + --newCombat:CopyDeathsFrom(thisCombat, true) totalTime = totalTime + thisCombat:GetCombatTime() totalSegments = totalSegments + 1 @@ -231,34 +249,22 @@ function DetailsMythicPlusFrame.MergeTrashCleanup (isFromSchedule) print("Details!", "MergeTrashCleanup() > finished merging trash segments.", _detalhes.tabela_vigente, _detalhes.tabela_vigente.is_boss) end - --should delete the trash segments after the merge? - if (_detalhes.mythic_plus.delete_trash_after_merge) then - local segmentHistory = Details:GetCombatSegments() - for i = #segmentHistory, 1, -1 do - local segment = segmentHistory [i] - if (segment and segment._trashoverallalreadyadded) then - tremove(segmentHistory, i) - end + --delete all segments that were merged + local segmentHistory = Details:GetCombatSegments() + for segmentId = #segmentHistory, 1, -1 do + local segment = segmentHistory[segmentId] + if (segment and segment._trashoverallalreadyadded) then + tremove(segmentHistory, segmentId) end - - for i = #segmentsToMerge, 1, -1 do - tremove(segmentsToMerge, i) - end - - Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") - else - --clear the segments to merge table - for i = #segmentsToMerge, 1, -1 do - tremove(segmentsToMerge, i) - --notify plugins about a segment deleted - Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") - end - - --clear encounter name and id - segmentsToMerge.EncounterID = nil - segmentsToMerge.EncounterName = nil end + for i = #segmentsToMerge, 1, -1 do + tremove(segmentsToMerge, i) + end + + --call the segment removed event to notify third party addons + Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") + --update all windows Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") Details:InstanciaCallFunction(Details.AtualizaSegmentos) @@ -311,6 +317,7 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() if (DetailsMythicPlusFrame.DevelopmentDebug) then print("MergeRemainingTrashAfterAllBossesDone() > total combat time:", totalTime) end + --set the segment date local startDate = overallCombat:GetDate() overallCombat:SetDate (startDate, endDate) @@ -328,58 +335,49 @@ function DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() print("MergeRemainingTrashAfterAllBossesDone() > elapsed time after:", mythicDungeonInfo.EndedAt - mythicDungeonInfo.StartedAt) end - --should delete the trash segments after the merge? - if (_detalhes.mythic_plus.delete_trash_after_merge) then - local removedCurrentSegment = false - local segmentHistory = Details:GetCombatSegments() - for _, pastCombat in ipairs(segmentsToMerge) do - for i = #segmentHistory, 1, -1 do - local segment = segmentHistory [i] - if (segment == pastCombat) then - --remove the segment - if (_detalhes.tabela_vigente == segment) then - removedCurrentSegment = true - end - tremove(segmentHistory, i) - break + --remove trash segments from the segment history after the merge + local removedCurrentSegment = false + local segmentHistory = Details:GetCombatSegments() + for _, pastCombat in ipairs(segmentsToMerge) do + for i = #segmentHistory, 1, -1 do + local segment = segmentHistory [i] + if (segment == pastCombat) then + --remove the segment + if (_detalhes.tabela_vigente == segment) then + removedCurrentSegment = true end + tremove(segmentHistory, i) + break end end - - for i = #segmentsToMerge, 1, -1 do - tremove(segmentsToMerge, i) - end - - if (removedCurrentSegment) then - --find another current segment - local segmentHistory = Details:GetCombatSegments() - _detalhes.tabela_vigente = segmentHistory [1] - - if (not _detalhes.tabela_vigente) then - --assuming there's no segment from the dungeon run - Details:EntrarEmCombate() - Details:SairDoCombate() - end - - --update all windows - Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") - Details:InstanciaCallFunction(Details.AtualizaSegmentos) - Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) - Details:InstanciaCallFunction(Details.ResetaGump) - Details:RefreshMainWindow(-1, true) - end - - Details222.MythicPlus.LogStep("delete_trash_after_merge | concluded") - Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") - else - --clear the segments to merge table - for i = #segmentsToMerge, 1, -1 do - tremove(segmentsToMerge, i) - --notify plugins about a segment deleted - Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") - end end + for i = #segmentsToMerge, 1, -1 do + tremove(segmentsToMerge, i) + end + + if (removedCurrentSegment) then + --find another current segment + local segmentHistory = Details:GetCombatSegments() + _detalhes.tabela_vigente = segmentHistory [1] + + if (not _detalhes.tabela_vigente) then + --assuming there's no segment from the dungeon run + Details:EntrarEmCombate() + Details:SairDoCombate() + end + + --update all windows + Details:InstanciaCallFunction(Details.FadeHandler.Fader, "IN", nil, "barras") + Details:InstanciaCallFunction(Details.AtualizaSegmentos) + Details:InstanciaCallFunction(Details.AtualizaSoloMode_AfertReset) + Details:InstanciaCallFunction(Details.ResetaGump) + Details:RefreshMainWindow(-1, true) + end + + Details222.MythicPlus.LogStep("delete_trash_after_merge | concluded") + Details:SendEvent("DETAILS_DATA_SEGMENTREMOVED") + DetailsMythicPlusFrame.TrashMergeScheduled2 = nil DetailsMythicPlusFrame.TrashMergeScheduled2_OverallCombat = nil diff --git a/functions/profiles.lua b/functions/profiles.lua index fa684630..bdff055a 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1197,6 +1197,7 @@ local default_player_data = { ["itemheal"] = false, ["itempower"] = false, ["itemutil"] = false, + ["crowdcontrol"] = false, }, --when creating a filter, add it here and also add to 'own_frame' own_frame = { @@ -1492,13 +1493,14 @@ local default_global_data = { --mythic plus config mythic_plus = { - merge_boss_trash = true, -- - delete_trash_after_merge = true, -- - --merge_boss_with_trash = false, --this won't be used - boss_dedicated_segment = true, -- - make_overall_when_done = true, -- + merge_boss_trash = true, + boss_dedicated_segment = true, + make_overall_when_done = true, show_damage_graphic = true, - delay_to_show_graphic = 5, + + reverse_death_log = false, + + delay_to_show_graphic = 10, last_mythicrun_chart = {}, mythicrun_chart_frame = {}, mythicrun_chart_frame_minimized = {}, @@ -1702,9 +1704,6 @@ function _detalhes:RestoreState_CurrentMythicDungeonRun() end - - - -------------------------------------------------------------------------------------------------------------------------------------------- --~export ~ import ~profile @@ -1891,11 +1890,11 @@ function Details:ImportProfile (profileString, newProfileName, bImportAutoRunCod --profile imported, set mythic dungeon to default settings local mythicPlusSettings = Details.mythic_plus mythicPlusSettings.merge_boss_trash = true - mythicPlusSettings.delete_trash_after_merge = true mythicPlusSettings.boss_dedicated_segment = true mythicPlusSettings.make_overall_when_done = true mythicPlusSettings.show_damage_graphic = true - mythicPlusSettings.delay_to_show_graphic = 5 + mythicPlusSettings.reverse_death_log = false + mythicPlusSettings.delay_to_show_graphic = 10 mythicPlusSettings.last_mythicrun_chart = {} mythicPlusSettings.mythicrun_chart_frame = {} mythicPlusSettings.mythicrun_chart_frame_minimized = {}