From 5c8b4526afa4985257e85880f215954ebb28a591 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sat, 8 Jul 2023 11:18:15 -0300 Subject: [PATCH] When DBM/BW send a callback, check if the current combat in details is valid --- functions/bossmods.lua | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/functions/bossmods.lua b/functions/bossmods.lua index 346e1443..3e50e92d 100644 --- a/functions/bossmods.lua +++ b/functions/bossmods.lua @@ -145,12 +145,14 @@ function Details:CreateCallbackListeners() if (_G.DBM) then local dbm_timer_callback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) local currentCombat = Details:GetCurrentCombat() - table.insert(currentCombat.bossTimers, {"dbm", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid}) - --print("dbm event", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) + if (not currentCombat.__destroyed) then --async events, need to check for combat destruction + table.insert(currentCombat.bossTimers, {"dbm", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid}) + --print("dbm event", bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) - local spell = tostring(spellId) - if (spell and not current_table_dbm [spell]) then - current_table_dbm [spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid} + local spell = tostring(spellId) + if (spell and not current_table_dbm [spell]) then + current_table_dbm [spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid} + end end end DBM:RegisterCallback ("DBM_TimerStart", dbm_timer_callback) @@ -162,12 +164,14 @@ function Details:CreateCallbackListeners() if (BigWigsLoader) then function Details:BigWigs_StartBar (event, module, spellid, bar_text, time, icon, ...) local currentCombat = Details:GetCurrentCombat() - table.insert(currentCombat.bossTimers, {"bw", event, spellid, bar_text, time, icon}) - --print("bw event", event, spellid, bar_text, time, icon) + if (not currentCombat.__destroyed) then --async events, need to check for combat destruction + table.insert(currentCombat.bossTimers, {"bw", event, spellid, bar_text, time, icon}) + --print("bw event", event, spellid, bar_text, time, icon) - spellid = tostring(spellid) - if (not current_table_bigwigs [spellid]) then - current_table_bigwigs [spellid] = {(type(module) == "string" and module) or (module and module.moduleName) or "", spellid or "", bar_text or "", time or 0, icon or ""} + spellid = tostring(spellid) + if (not current_table_bigwigs [spellid]) then + current_table_bigwigs [spellid] = {(type(module) == "string" and module) or (module and module.moduleName) or "", spellid or "", bar_text or "", time or 0, icon or ""} + end end end if (BigWigsLoader.RegisterMessage) then