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 = "CombatAlerter"
---@diagnostic disable-next-line: missing-fields
shared.CombatAlerter = {}
@@ -9,17 +10,33 @@ function shared.CombatAlerter.Init()
local combatAlerterFrame = CreateFrame("Frame")
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
combatAlerterFrame:SetScript("OnEvent", function(self, event, ...)
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Received event: %s", ModuleName, event))
shared.dumpTable(Heimdall_Data.config.combatAlerter)
end
if not Heimdall_Data.config.combatAlerter.enabled then return end
local destination, err = CLEUParser.GetDestName(...)
if err then return end
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Destination: %s", ModuleName, destination))
end
if destination ~= UnitName("player") then return end
local source, err = CLEUParser.GetSourceName(...)
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Source: %s", ModuleName, source))
end
if err then source = "unknown" end
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Alerted status for %s: %s", ModuleName, source, alerted[source]))
end
if alerted[source] then return end
alerted[source] = true
local x, y = GetPlayerMapPosition("player")
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Player position: %2.2f,%2.2f", ModuleName, x, y))
end
---@type Message
local msg = {
channel = "CHANNEL",
@@ -30,6 +47,10 @@ function shared.CombatAlerter.Init()
x * 100, y * 100
),
}
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Message:", ModuleName))
shared.dumpTable(msg)
end
table.insert(shared.messenger.queue, msg)
end
end)
@@ -37,11 +58,11 @@ function shared.CombatAlerter.Init()
local combatTriggerFrame = CreateFrame("Frame")
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
-- We want to only alert once per target per combat encounter
-- Even a small throttle would probably spam too much here
-- ....but maybe we can call it a 120 second throttle or something?
-- We will see
combatTriggerFrame:SetScript("OnEvent", function(self, event, ...)
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("%s: Received event: %s", ModuleName, event))
shared.dumpTable(Heimdall_Data.config.combatAlerter)
end
alerted = {}
end)