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 = "Macroer"
---@diagnostic disable-next-line: missing-fields
shared.Macroer = {}
@@ -11,22 +12,37 @@ function shared.Macroer.Init()
---@field seenAt number
---@field hostile boolean
---@type table<string, stinky>
local recentStinkies = {}
local function FindOrCreateMacro(macroName)
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: FindOrCreateMacro", ModuleName))
shared.dumpTable(Heimdall_Data.config.macroer)
end
local idx = GetMacroIndexByName(macroName)
if idx == 0 then
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: Creating macro", ModuleName))
end
CreateMacro(macroName, "INV_Misc_QuestionMark", "")
end
idx = GetMacroIndexByName(macroName)
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: idx = %s", ModuleName, idx))
end
return idx
end
---@param stinkies table<string, stinky>
local function FixMacro(stinkies)
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: FixMacro", ModuleName))
shared.dumpTable(Heimdall_Data.config.macroer)
end
if not Heimdall_Data.config.macroer.enabled then return end
if InCombatLockdown() then return end
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: InCombatLockdown", ModuleName))
shared.dumpTable(Heimdall_Data.config.macroer)
end
local priorityMap = {}
for priority, className in ipairs(Heimdall_Data.config.macroer.priority) do
priorityMap[className] = priority
@@ -60,6 +76,10 @@ function shared.Macroer.Init()
end
shared.stinkyTracker.stinkies:onChange(function(value)
if Heimdall_Data.config.macroer.debug then
print(string.format("%s: onChange", ModuleName))
shared.dumpTable(Heimdall_Data.config.macroer)
end
FixMacro(value)
end)