From 55790fb0ffe0b153a580eb10783c09bec2d8acbd Mon Sep 17 00:00:00 2001 From: Tercioo Date: Fri, 15 Mar 2019 20:03:38 -0300 Subject: [PATCH] - Tagging deprecated functions as 'deprecated' and small cleanups. - Adding more prints to chat on the overall merge. --- Details.toc | 2 +- boot.lua | 2 +- classes/container_historico.lua | 20 ++--- core/control.lua | 19 ++--- core/parser.lua | 146 +++++++++++++++----------------- startup.lua | 20 +++-- 6 files changed, 106 insertions(+), 103 deletions(-) diff --git a/Details.toc b/Details.toc index bfbe0416..08c02703 100644 --- a/Details.toc +++ b/Details.toc @@ -1,6 +1,6 @@ ## Interface: 80100 ## Title: Details! Damage Meter -## Notes: Computes detailed infos about combats. +## Notes: Essential tool to impress that chick in your raid. ## SavedVariables: _detalhes_global ## SavedVariablesPerCharacter: _detalhes_database ## OptionalDeps: Ace3, LibSharedMedia-3.0, LibWindow-1.1, LibDBIcon-1.0, NickTag-1.0, LibDataBroker-1.1, LibItemUpgradeInfo-1.0, LibGroupInSpecT-1.1, LibCompress, LibGraph-2.0 diff --git a/boot.lua b/boot.lua index 15c37e32..e37914c9 100644 --- a/boot.lua +++ b/boot.lua @@ -5,7 +5,7 @@ _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") _detalhes.build_counter = 6923 - _detalhes.alpha_build_counter = 6992 --if this is higher than the regular counter, use it instead + _detalhes.alpha_build_counter = 7002 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v8.1.0" _detalhes.userversion = "v8.1.0." .. _detalhes.build_counter _detalhes.realversion = 136 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/classes/container_historico.lua b/classes/container_historico.lua index 53483cdd..8b0317c9 100644 --- a/classes/container_historico.lua +++ b/classes/container_historico.lua @@ -146,7 +146,7 @@ function historico:adicionar_overall (tabela) end -function _detalhes:ScheduleAddCombatToOverall (combat) +function _detalhes:ScheduleAddCombatToOverall (combat) --deprecated (15/03/2019) local canAdd = _detalhes:CanAddCombatToOverall (combat) if (canAdd) then _detalhes.schedule_add_to_overall = _detalhes.schedule_add_to_overall or {} @@ -162,7 +162,7 @@ function _detalhes:CanAddCombatToOverall (tabela) end --> already scheduled to add - if (_detalhes.schedule_add_to_overall) then + if (_detalhes.schedule_add_to_overall) then --deprecated for _, combat in ipairs (_detalhes.schedule_add_to_overall) do if (combat == tabela) then return false @@ -425,10 +425,10 @@ function _detalhes:OverallOptions (reset_new_boss, reset_new_challenge, reset_on end function historico:resetar_overall() - if (InCombatLockdown()) then - _detalhes:Msg (Loc ["STRING_ERASE_IN_COMBAT"]) - _detalhes.schedule_remove_overall = true - else + --if (InCombatLockdown()) then + -- _detalhes:Msg (Loc ["STRING_ERASE_IN_COMBAT"]) + -- _detalhes.schedule_remove_overall = true + --else --> fecha a janela de informa��es do jogador _detalhes:FechaJanelaInfo() @@ -441,10 +441,10 @@ function historico:resetar_overall() end end - if (_detalhes.schedule_add_to_overall) then + if (_detalhes.schedule_add_to_overall) then --deprecated wipe (_detalhes.schedule_add_to_overall) end - end + --end --> stop bar testing if any _detalhes:StopTestBarUpdate() @@ -475,7 +475,7 @@ function historico:resetar() --> clear other schedules _detalhes.schedule_flag_boss_components = nil _detalhes.schedule_store_boss_encounter = nil - _detalhes.schedule_remove_overall = nil + --_detalhes.schedule_remove_overall = nil --> fecha a janela de informa��es do jogador _detalhes:FechaJanelaInfo() @@ -490,7 +490,7 @@ function historico:resetar() _table_wipe (_detalhes.tabela_overall) _table_wipe (_detalhes.spellcache) - if (_detalhes.schedule_add_to_overall) then + if (_detalhes.schedule_add_to_overall) then --deprecated wipe (_detalhes.schedule_add_to_overall) end diff --git a/core/control.lua b/core/control.lua index 68583051..9c0573ab 100644 --- a/core/control.lua +++ b/core/control.lua @@ -478,13 +478,14 @@ _detalhes.leaving_combat = true _detalhes.last_combat_time = _tempo - if (_detalhes.schedule_remove_overall and not from_encounter_end and not InCombatLockdown()) then - if (_detalhes.debug) then - _detalhes:Msg ("(debug) found schedule overall data deletion.") - end - _detalhes.schedule_remove_overall = false - _detalhes.tabela_historico:resetar_overall() - end + --deprecated (combat are now added immediatelly since there's no script run too long) + --if (_detalhes.schedule_remove_overall and not from_encounter_end and not InCombatLockdown()) then + -- if (_detalhes.debug) then + -- _detalhes:Msg ("(debug) found schedule overall data deletion.") + -- end + -- _detalhes.schedule_remove_overall = false + -- _detalhes.tabela_historico:resetar_overall() + --end _detalhes:CatchRaidBuffUptime ("BUFF_UPTIME_OUT") _detalhes:CatchRaidDebuffUptime ("DEBUFF_UPTIME_OUT") @@ -706,13 +707,11 @@ local bossFunction, bossFunctionType = _detalhes:GetBossFunction (_detalhes.tabela_vigente.is_boss.mapid or 0, _detalhes.tabela_vigente.is_boss.index or 0) if (bossFunction) then if (_bit_band (bossFunctionType, 0x2) ~= 0) then --end of combat - if (not InCombatLockdown() and not UnitAffectingCombat ("player") and not _detalhes.logoff_saving_data) then + if (not _detalhes.logoff_saving_data) then local successful, errortext = pcall (bossFunction, _detalhes.tabela_vigente) if (not successful) then _detalhes:Msg ("error occurred on Encounter Boss Function:", errortext) end - else - _detalhes.schedule_boss_function_run = bossFunction end end end diff --git a/core/parser.lua b/core/parser.lua index fdc5069e..dda5c3e8 100644 --- a/core/parser.lua +++ b/core/parser.lua @@ -4196,7 +4196,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --store the encounter time inside the encounter table for the encounter plugin _detalhes.encounter_table ["start"] = _GetTime() _detalhes.encounter_table ["end"] = nil - +-- local encounterID = Details.encounter_table.id _detalhes.encounter_table.id = encounterID _detalhes.encounter_table.name = encounterName _detalhes.encounter_table.diff = difficultyID @@ -4374,60 +4374,13 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:Msg ("(debug) running scheduled events after combat end.") end - --> add segments to overall data if any scheduled - if (_detalhes.schedule_add_to_overall and #_detalhes.schedule_add_to_overall > 0) then - if (_detalhes.debug) then - _detalhes:Msg ("(debug) adding ", #_detalhes.schedule_add_to_overall, "combats in queue to overall data.") - end - - for i = #_detalhes.schedule_add_to_overall, 1, -1 do - local CombatToAdd = tremove (_detalhes.schedule_add_to_overall, i) - if (CombatToAdd) then - _detalhes.historico:adicionar_overall (CombatToAdd) - end - end - end - - if (_detalhes.schedule_mythicdungeon_trash_merge) then - _detalhes.schedule_mythicdungeon_trash_merge = nil - DetailsMythicPlusFrame.MergeTrashCleanup (true) - end - - if (_detalhes.schedule_mythicdungeon_endtrash_merge) then - _detalhes.schedule_mythicdungeon_endtrash_merge = nil - DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() - end - - if (_detalhes.schedule_mythicdungeon_overallrun_merge) then - _detalhes.schedule_mythicdungeon_overallrun_merge = nil - DetailsMythicPlusFrame.MergeSegmentsOnEnd() - end - - --> aqui, tentativa de fazer o timer da janela do Solo funcionar corretamente: - if (_detalhes.solo and _detalhes.PluginCount.SOLO > 0) then - if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].Stop) then - _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].Stop() - end - end - + --when the user requested data from the storage but is in combat lockdown if (_detalhes.schedule_storage_load) then _detalhes.schedule_storage_load = nil _detalhes.ScheduleLoadStorage() end - if (_detalhes.schedule_flag_boss_components) then - _detalhes.schedule_flag_boss_components = false - _detalhes:FlagActorsOnBossFight() - end - - if (_detalhes.schedule_remove_overall) then - if (_detalhes.debug) then - _detalhes:Msg ("(debug) found schedule overall data clean up.") - end - _detalhes.schedule_remove_overall = false - _detalhes.tabela_historico:resetar_overall() - end - + --store a boss encounter when out of combat since it might need to load the storage if (_detalhes.schedule_store_boss_encounter) then if (not _detalhes.logoff_saving_data) then --_detalhes.StoreEncounter() @@ -4439,16 +4392,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes.schedule_store_boss_encounter = nil end - if (_detalhes.schedule_boss_function_run) then - if (not _detalhes.logoff_saving_data) then - local successful, errortext = pcall (_detalhes.schedule_boss_function_run, _detalhes.tabela_vigente) - if (not successful) then - _detalhes:Msg ("error occurred on Encounter Boss Function:", errortext) - end - end - _detalhes.schedule_boss_function_run = nil - end - + --when a large amount of data has been removed and the player is in combat, schedule to run the hard garbage collector (the blizzard one, not the details! internal) if (_detalhes.schedule_hard_garbage_collect) then if (_detalhes.debug) then _detalhes:Msg ("(debug) found schedule collectgarbage().") @@ -4463,27 +4407,77 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end - if (_detalhes.wipe_called and false) then --disabled - _detalhes.wipe_called = nil - _detalhes:CaptureSet (nil, "damage", true) - _detalhes:CaptureSet (nil, "energy", true) - _detalhes:CaptureSet (nil, "aura", true) - _detalhes:CaptureSet (nil, "energy", true) - _detalhes:CaptureSet (nil, "spellcast", true) - - _detalhes:CaptureSet (false, "damage", false, 10) - _detalhes:CaptureSet (false, "energy", false, 10) - _detalhes:CaptureSet (false, "aura", false, 10) - _detalhes:CaptureSet (false, "energy", false, 10) - _detalhes:CaptureSet (false, "spellcast", false, 10) - end - if (not OnRegenEnabled) then _table_wipe (bitfield_swap_cache) _table_wipe (ignore_actors) - _detalhes:DispatchAutoRunCode ("on_leavecombat") end + + if (_detalhes.solo and _detalhes.PluginCount.SOLO > 0) then --code too old and I don't have documentation for it + if (_detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].Stop) then + _detalhes.SoloTables.Plugins [_detalhes.SoloTables.Mode].Stop() + end + end + + --deprecated shcedules + do + if (_detalhes.schedule_add_to_overall and #_detalhes.schedule_add_to_overall > 0) then --deprecated (combat are now added immediatelly since there's no script run too long) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) adding ", #_detalhes.schedule_add_to_overall, "combats in queue to overall data.") + end + + for i = #_detalhes.schedule_add_to_overall, 1, -1 do + local CombatToAdd = tremove (_detalhes.schedule_add_to_overall, i) + if (CombatToAdd) then + _detalhes.historico:adicionar_overall (CombatToAdd) + end + end + end + + if (_detalhes.schedule_mythicdungeon_trash_merge) then --deprecated (combat are now added immediatelly since there's no script run too long) + _detalhes.schedule_mythicdungeon_trash_merge = nil + DetailsMythicPlusFrame.MergeTrashCleanup (true) + end + + if (_detalhes.schedule_mythicdungeon_endtrash_merge) then --deprecated (combat are now added immediatelly since there's no script run too long) + _detalhes.schedule_mythicdungeon_endtrash_merge = nil + DetailsMythicPlusFrame.MergeRemainingTrashAfterAllBossesDone() + end + + if (_detalhes.schedule_mythicdungeon_overallrun_merge) then --deprecated (combat are now added immediatelly since there's no script run too long) + _detalhes.schedule_mythicdungeon_overallrun_merge = nil + DetailsMythicPlusFrame.MergeSegmentsOnEnd() + end + + if (_detalhes.schedule_flag_boss_components) then --deprecated (combat are now added immediatelly since there's no script run too long) + _detalhes.schedule_flag_boss_components = false + _detalhes:FlagActorsOnBossFight() + end + + if (_detalhes.schedule_remove_overall) then --deprecated (combat are now added immediatelly since there's no script run too long) + if (_detalhes.debug) then + _detalhes:Msg ("(debug) found schedule overall data clean up.") + end + _detalhes.schedule_remove_overall = false + _detalhes.tabela_historico:resetar_overall() + end + + if (_detalhes.wipe_called and false) then --disabled + _detalhes.wipe_called = nil + _detalhes:CaptureSet (nil, "damage", true) + _detalhes:CaptureSet (nil, "energy", true) + _detalhes:CaptureSet (nil, "aura", true) + _detalhes:CaptureSet (nil, "energy", true) + _detalhes:CaptureSet (nil, "spellcast", true) + + _detalhes:CaptureSet (false, "damage", false, 10) + _detalhes:CaptureSet (false, "energy", false, 10) + _detalhes:CaptureSet (false, "aura", false, 10) + _detalhes:CaptureSet (false, "energy", false, 10) + _detalhes:CaptureSet (false, "spellcast", false, 10) + end + end + end diff --git a/startup.lua b/startup.lua index d34f109c..7ef7a5ff 100644 --- a/startup.lua +++ b/startup.lua @@ -594,7 +594,7 @@ function _G._detalhes:Start() local lastSegment --> add segments - for _, pastCombat in ipairs (segmentsToMerge) do + for i, pastCombat in ipairs (segmentsToMerge) do overallCombat = overallCombat + pastCombat if (newFrame.DevelopmentDebug) then print ("MergeRemainingTrashAfterAllBossesDone() > segment added") @@ -609,6 +609,8 @@ function _G._detalhes:Start() endDate = whenEnded end lastSegment = pastCombat + + Details:Msg ("segment " .. i .. " merged.") end --> set the segment time / using a sum of combat times, this combat time is reliable @@ -635,14 +637,21 @@ function _G._detalhes:Start() end --> should delete the trash segments after the merge? + Details:Msg ("merge finished, starting clean up of merged segments.") + if (_detalhes.mythic_plus.delete_trash_after_merge) then local segmentHistory = self:GetCombatSegments() for _, pastCombat in ipairs (segmentsToMerge) do for i = #segmentHistory, 1, -1 do local segment = segmentHistory [i] - if (segment == pastCombat and _detalhes.tabela_vigente ~= segment) then - --> remove the segment - tremove (segmentHistory, i) + if (segment == pastCombat) then + if (_detalhes.tabela_vigente ~= segment) then + --> remove the segment + tremove (segmentHistory, i) + Details:Msg ("segment " .. i .. " removed.") + else + Details:Msg ("error removing segment " .. i .. ", reason: the segment is the current segment.") + end break end end @@ -655,7 +664,6 @@ function _G._detalhes:Start() --> clear the segments to merge table for i = #segmentsToMerge, 1, -1 do tremove (segmentsToMerge, i) - --> notify plugins about a segment deleted self:SendEvent ("DETAILS_DATA_SEGMENTREMOVED") end @@ -849,6 +857,7 @@ function _G._detalhes:Start() local pastCombat = segmentHistory [i] if (pastCombat and pastCombat.is_mythic_dungeon and pastCombat.is_mythic_dungeon.SegmentID == "trashoverall") then latestTrashOverall = pastCombat + Details:Msg ("found last trash overall on segment " .. i .. ", starting the merge.") break end end @@ -863,6 +872,7 @@ function _G._detalhes:Start() if (newFrame.DevelopmentDebug) then print ("Details!", "MythicDungeonFinished() > not in combat, merging last pack of trash now") end + newFrame.MergeRemainingTrashAfterAllBossesDone() --else -- if (newFrame.DevelopmentDebug) then