Add debug options

Add debug buttons

Add combatalerter debug
This commit is contained in:
2025-01-08 15:10:52 +01:00
parent 8b085009a9
commit fca49c6302
14 changed files with 584 additions and 95 deletions

View File

@@ -1,6 +1,7 @@
local addonname, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "DeathReporter"
---@diagnostic disable-next-line: missing-fields
shared.DeathReporter = {}
@@ -14,20 +15,31 @@ function shared.DeathReporter.Init()
---@param destination string
---@param spellName string
local function RegisterDeath(source, destination, spellName)
if Heimdall_Data.config.deathReporter.debug then
print(string.format("%s: RegisterDeath", ModuleName))
shared.dumpTable(Heimdall_Data.config.deathReporter)
end
if not Heimdall_Data.config.deathReporter.enabled then return end
if recentDeaths[destination]
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle then
if Heimdall_Data.config.deathReporter.debug then
print(string.format("%s: Throttled death report for %s", ModuleName, destination))
end
return
end
if recentDuels[destination]
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
if Heimdall_Data.config.deathReporter.debug then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
end
return
end
if recentDuels[source]
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
if Heimdall_Data.config.deathReporter.debug then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
end
return
end
@@ -35,12 +47,18 @@ function shared.DeathReporter.Init()
C_Timer.NewTimer(3, function()
if recentDuels[destination]
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
if Heimdall_Data.config.deathReporter.debug then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source,
destination))
end
return
end
if recentDuels[source]
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
if Heimdall_Data.config.deathReporter.debug then
print(string.format("Cancelling death reports for %s and %s because of recent duel", source,
destination))
end
return
end
@@ -48,12 +66,18 @@ function shared.DeathReporter.Init()
if zone == nil or zone == "" then
zone = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
end
if Heimdall_Data.config.deathReporter.debug then
print(string.format("%s: zone = %s", ModuleName, zone))
end
local text = string.format("%s killed %s with %s in %s",
tostring(source),
tostring(destination),
tostring(spellName),
tostring(zone))
if Heimdall_Data.config.deathReporter.debug then
print(string.format("%s: text = %s", ModuleName, text))
end
---@type Message
local msg = {
@@ -61,6 +85,10 @@ function shared.DeathReporter.Init()
data = Heimdall_Data.config.deathReporter.notifyChannel,
message = text,
}
if Heimdall_Data.config.deathReporter.debug then
print(string.format("%s: msg =", ModuleName))
shared.dumpTable(msg)
end
table.insert(shared.messenger.queue, msg)
if Heimdall_Data.config.deathReporter.doWhisper then