From ff6dad0c7b61953639e435cf1f7a460213a3b052 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Thu, 12 Dec 2024 17:13:39 +0100 Subject: [PATCH] Implement canceling death reports for duels --- DeathReporter.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/DeathReporter.lua b/DeathReporter.lua index 9a52df5..4bcce53 100644 --- a/DeathReporter.lua +++ b/DeathReporter.lua @@ -20,7 +20,7 @@ function data.DeathReporter.Init() return end recentDeaths[destination] = GetTime() - local timer = C_Timer.After(1, function() + local timer = C_Timer.NewTimer(1, function() local zone = data.config.deathReporter.zoneOverride if not zone then zone = string.format("%s (%s)", GetZoneText(), GetSubZoneText()) @@ -73,4 +73,15 @@ function data.DeathReporter.Init() RegisterDeath(source, destination, spellName, overkill) end end) + + local systemMessageFrame = CreateFrame("Frame") + systemMessageFrame:RegisterEvent("CHAT_MSG_SYSTEM") + systemMessageFrame:SetScript("OnEvent", function(self, event, msg) + local source, destination = string.match(msg, "(.+) has defeated (.+) in a duel") + if source and destination then + print(string.format("Cancelling death reports for %s and %s", source, destination)) + if notifyTimers[source] then notifyTimers[source]:Cancel() end + if notifyTimers[destination] then notifyTimers[destination]:Cancel() end + end + end) end