Add debug options
Add debug buttons Add combatalerter debug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
local addonname, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
local ModuleName = "AgentTracker"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.AgentTracker = {}
|
||||
@@ -9,29 +10,78 @@ function shared.AgentTracker.Init()
|
||||
local channelRosterFrame = CreateFrame("Frame")
|
||||
channelRosterFrame:RegisterEvent("CHANNEL_ROSTER_UPDATE")
|
||||
channelRosterFrame:SetScript("OnEvent", function(self, event, index)
|
||||
if not Heimdall_Data.config.agentTracker.enabled then return end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||
shared.dumpTable(Heimdall_Data.config.agentTracker)
|
||||
end
|
||||
if not Heimdall_Data.config.agentTracker.enabled then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: AgentTracker disabled", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
local name = GetChannelDisplayInfo(index)
|
||||
if name ~= Heimdall_Data.config.agentTracker.masterChannel then return end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Processing channel: %s", ModuleName, name))
|
||||
end
|
||||
if name ~= Heimdall_Data.config.agentTracker.masterChannel then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Channel is not master channel: %s", ModuleName, name))
|
||||
end
|
||||
return
|
||||
end
|
||||
local count = select(5, GetChannelDisplayInfo(index))
|
||||
for i = 1, count do
|
||||
local name = GetChannelRosterInfo(index, i)
|
||||
if name then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Tracking agent in channel: %s", ModuleName, name))
|
||||
end
|
||||
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||
end
|
||||
end
|
||||
--shared.dumpTable(Heimdall_Data.config.agents)
|
||||
end)
|
||||
|
||||
|
||||
local agentTrackerChannelSniffer = CreateFrame("Frame")
|
||||
agentTrackerChannelSniffer:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
agentTrackerChannelSniffer:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
if not Heimdall_Data.config.agentTracker.enabled then return end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||
shared.dumpTable(Heimdall_Data.config.agentTracker)
|
||||
end
|
||||
if not Heimdall_Data.config.agentTracker.enabled then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: AgentTracker disabled", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
local channelId = select(6, ...)
|
||||
local channelname = GetChannelName(channelId)
|
||||
if not channelname then return end
|
||||
if channelname ~= Heimdall_Data.config.who.notifyChannel then return end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Processing message from: %s", ModuleName, sender))
|
||||
end
|
||||
if not channelname then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: No channel name found", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
if channelname ~= Heimdall_Data.config.who.notifyChannel then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Message not in notify channel: %s", ModuleName, channelname))
|
||||
end
|
||||
return
|
||||
end
|
||||
local agentName = sender
|
||||
if not agentName then return end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: Tracking agent from message: %s", ModuleName, agentName))
|
||||
end
|
||||
if not agentName then
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("%s: No agent name found", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
Heimdall_Data.config.agents[agentName] = date("%Y-%m-%dT%H:%M:%S")
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user