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)
|
||||
|
||||
|
||||
@@ -70,6 +70,7 @@ local function init()
|
||||
---@field doWhisper boolean
|
||||
---@field notifyChannel string
|
||||
---@field zoneOverride string?
|
||||
---@field duelThrottle number
|
||||
|
||||
--- Data ---
|
||||
---@class HeimdallMessengerData
|
||||
@@ -147,6 +148,7 @@ local function init()
|
||||
doWhisper = data.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "doWhisper" }, true),
|
||||
notifyChannel = data.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "notifyChannel" }, "Agent"),
|
||||
zoneOverride = data.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "zoneOverride" }, nil),
|
||||
duelThrottle = data.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "duelThrottle" }, 2),
|
||||
},
|
||||
whisperNotify = data.GetOrDefault(Heimdall_Data, { "config", "whisperNotify" }, {
|
||||
"Extazyk",
|
||||
|
||||
Reference in New Issue
Block a user