Implement canceling death reports for duels

This commit is contained in:
2024-12-12 17:13:39 +01:00
parent 1f4d51a6cc
commit ff6dad0c7b

View File

@@ -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