Make duel detection maybe a bit better
This commit is contained in:
@@ -12,6 +12,8 @@ function data.DeathReporter.Init()
|
||||
---@type table<string, number>
|
||||
local recentDeaths = {}
|
||||
---@type table<string, number>
|
||||
local recentDuels = {}
|
||||
---@type table<string, number>
|
||||
local notifyTimers = {}
|
||||
|
||||
---@param source string
|
||||
@@ -23,8 +25,20 @@ function data.DeathReporter.Init()
|
||||
and GetTime() - recentDeaths[destination] < data.config.deathReporter.throttle then
|
||||
return
|
||||
end
|
||||
|
||||
if recentDuels[destination]
|
||||
and GetTime() - recentDuels[destination] < data.config.deathReporter.duelThrottle then
|
||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
||||
return
|
||||
end
|
||||
if recentDuels[source]
|
||||
and GetTime() - recentDuels[source] < data.config.deathReporter.duelThrottle then
|
||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
||||
return
|
||||
end
|
||||
|
||||
recentDeaths[destination] = GetTime()
|
||||
local timer = C_Timer.NewTimer(1, function()
|
||||
local timer = C_Timer.NewTimer(3, function()
|
||||
local zone = data.config.deathReporter.zoneOverride
|
||||
if not zone then
|
||||
zone = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
||||
@@ -86,6 +100,9 @@ function data.DeathReporter.Init()
|
||||
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
|
||||
local now = GetTime()
|
||||
recentDuels[source] = now
|
||||
recentDuels[destination] = now
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user