8 Commits

26 changed files with 197 additions and 73 deletions

1
.gitignore vendored
View File

@@ -0,0 +1 @@
*.zip

View File

@@ -2,7 +2,7 @@ local addonname, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
---@cast addonname string ---@cast addonname string
local VERSION = "3.11.0" local VERSION = "3.12.0"
shared.VERSION = VERSION shared.VERSION = VERSION
local function init() local function init()
@@ -26,7 +26,7 @@ local function init()
---@field _L fun(key: string, locale: string): string ---@field _L fun(key: string, locale: string): string
---@field _Locale Localization ---@field _Locale Localization
---@field VERSION string ---@field VERSION string
---@field dumpTable fun(table: any, depth?: number): nil ---@field dump fun(table: any, depth?: number): nil
---@field utf8len fun(input: string): number ---@field utf8len fun(input: string): number
---@field padString fun(input: string, targetLength: number, left?: boolean): string ---@field padString fun(input: string, targetLength: number, left?: boolean): string
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any ---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
@@ -59,6 +59,7 @@ local function init()
---@field StinkyCache InitTable ---@field StinkyCache InitTable
---@field Configurator InitTable ---@field Configurator InitTable
---@field AchievementSniffer InitTable ---@field AchievementSniffer InitTable
---@field ChatSniffer InitTable
--- Config --- --- Config ---
---@class HeimdallConfig ---@class HeimdallConfig
@@ -737,6 +738,7 @@ local function init()
shared.Configurator.Init() shared.Configurator.Init()
shared.StinkyCache.Init() shared.StinkyCache.Init()
shared.AchievementSniffer.Init() shared.AchievementSniffer.Init()
shared.ChatSniffer.Init()
print("Heimdall loaded!") print("Heimdall loaded!")
end end
@@ -745,3 +747,69 @@ loadedFrame:RegisterEvent("ADDON_LOADED")
loadedFrame:SetScript("OnEvent", function(self, event, addonName) loadedFrame:SetScript("OnEvent", function(self, event, addonName)
if addonName == addonname then init() end if addonName == addonname then init() end
end) end)
-- Create the import/export frame
local ccpFrame = CreateFrame("Frame", "CCPFrame", UIParent)
ccpFrame:SetSize(512 * 1.5, 512 * 1.5)
ccpFrame:SetPoint("CENTER")
ccpFrame:SetFrameStrata("HIGH")
ccpFrame:EnableMouse(true)
ccpFrame:SetMovable(true)
ccpFrame:SetResizable(false)
ccpFrame:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true,
tileSize = 4,
edgeSize = 4,
insets = {
left = 4,
right = 4,
top = 4,
bottom = 4,
},
})
ccpFrame:SetBackdropColor(0, 0, 0, 0.8)
ccpFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
ccpFrame:SetMovable(true)
ccpFrame:EnableMouse(true)
ccpFrame:RegisterForDrag("LeftButton")
ccpFrame:SetScript("OnDragStart", function(self) self:StartMoving() end)
ccpFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
ccpFrame:SetScript("OnShow", function(self) self:SetScale(1) end)
ccpFrame:Hide()
-- Create scroll frame
local scrollFrame = CreateFrame("ScrollFrame", "CCPFrameScrollFrame", ccpFrame, "UIPanelScrollFrameTemplate")
scrollFrame:SetPoint("TOPLEFT", ccpFrame, "TOPLEFT", 10, -10)
scrollFrame:SetPoint("BOTTOMRIGHT", ccpFrame, "BOTTOMRIGHT", -30, 10)
-- Create the text box
local ccpFrameTextBox = CreateFrame("EditBox", "CCPFrameTextBox", scrollFrame)
ccpFrameTextBox:SetSize(512 * 1.5 - 40, 512 * 1.5 - 20)
ccpFrameTextBox:SetPoint("TOPLEFT", scrollFrame, "TOPLEFT", 0, 0)
ccpFrameTextBox:SetFont("Fonts\\FRIZQT__.ttf", 12)
ccpFrameTextBox:SetTextColor(1, 1, 1, 1)
ccpFrameTextBox:SetTextInsets(10, 10, 10, 10)
ccpFrameTextBox:SetMultiLine(true)
ccpFrameTextBox:SetAutoFocus(true)
ccpFrameTextBox:SetMaxLetters(1000000)
ccpFrameTextBox:SetScript("OnEscapePressed", function(self) ccpFrame:Hide() end)
-- Set the scroll frame's scroll child
scrollFrame:SetScrollChild(ccpFrameTextBox)
CCP = function(window)
window = window or 1
local charFrame = _G["ChatFrame" .. window]
local maxLines = charFrame:GetNumMessages() or 0
local chat = {}
for i = 1, maxLines do
local currentMsg = charFrame:GetMessageInfo(i)
chat[#chat + 1] = currentMsg
end
ccpFrameTextBox:SetText(table.concat(chat, "\n"))
ccpFrame:Show()
ccpFrameTextBox:SetFocus()
end

View File

@@ -1,9 +1,9 @@
## Interface: 70300 ## Interface: 70300
## Title: Heimdall ## Title: Heimdall
## Version: 3.11.0 ## Version: 3.12.0
## Notes: Watches over areas and alerts when hostiles spotted ## Notes: Watches over areas and alerts when hostiles spotted
## Author: Cyka ## Author: Cyka
## SavedVariables: Heimdall_Data, Heimdall_Achievements ## SavedVariables: Heimdall_Data, Heimdall_Achievements, Heimdall_Chat
_L.lua _L.lua
Modules/CLEUParser.lua Modules/CLEUParser.lua
@@ -33,4 +33,5 @@ Modules/NetworkMessenger.lua
Modules/StinkyCache.lua Modules/StinkyCache.lua
Modules/Configurator.lua Modules/Configurator.lua
Modules/AchievementSniffer.lua Modules/AchievementSniffer.lua
Modules/ChatSniffer.lua
Heimdall.lua Heimdall.lua

BIN
Heimdall.zip (Stored with Git LFS)

Binary file not shown.

2
Meta

Submodule Meta updated: e045572f60...eee043a846

View File

@@ -89,7 +89,7 @@ function shared.AgentTracker.Init()
end end
if Heimdall_Data.config.agentTracker.debug then if Heimdall_Data.config.agentTracker.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.agentTracker) shared.dump(Heimdall_Data.config.agentTracker)
end end
sender = string.match(sender, "^[^-]+") sender = string.match(sender, "^[^-]+")

View File

@@ -124,7 +124,7 @@ function shared.BonkDetector.Init()
} }
if Heimdall_Data.config.bonkDetector.debug then if Heimdall_Data.config.bonkDetector.debug then
print(string.format("[%s] Queuing bonk detector message", ModuleName)) print(string.format("[%s] Queuing bonk detector message", ModuleName))
shared.dumpTable(message) shared.dump(message)
end end
table.insert(shared.messenger.queue, message) table.insert(shared.messenger.queue, message)
end end

40
Modules/ChatSniffer.lua Normal file
View File

@@ -0,0 +1,40 @@
local _, shared = ...
---@cast shared HeimdallShared
local ModuleName = "ChatSniffer"
---@diagnostic disable-next-line: missing-fields
shared.ChatSniffer = {}
function shared.ChatSniffer.Init()
Heimdall_Chat = Heimdall_Chat or {}
local frame = CreateFrame("Frame")
frame:RegisterEvent("CHAT_MSG_SAY")
frame:RegisterEvent("CHAT_MSG_YELL")
frame:RegisterEvent("CHAT_MSG_CHANNEL")
frame:RegisterEvent("CHAT_MSG_WHISPER")
frame:RegisterEvent("CHAT_MSG_CHANNEL_JOIN")
frame:RegisterEvent("CHAT_MSG_CHANNEL_LEAVE")
frame:RegisterEvent("CHAT_MSG_EMOTE")
frame:RegisterEvent("CHAT_MSG_PARTY")
frame:RegisterEvent("CHAT_MSG_PARTY_LEADER")
frame:RegisterEvent("CHAT_MSG_RAID")
frame:RegisterEvent("CHAT_MSG_RAID_LEADER")
frame:RegisterEvent("CHAT_MSG_RAID_WARNING")
frame:RegisterEvent("CHAT_MSG_SYSTEM")
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
frame:RegisterEvent("CHAT_MSG_YELL")
frame:SetScript("OnEvent", function(self, event, msg, sender, language, channel)
local timestamp = date("%Y-%m-%d %H:%M:%S")
local log = string.format(
"%s|%s|%s|%s|%s|%s",
tostring(timestamp),
tostring(event),
tostring(sender),
tostring(msg),
tostring(language),
tostring(channel)
)
Heimdall_Chat[#Heimdall_Chat + 1] = log
end)
print("[Heimdall] ChatSniffer loaded")
end

View File

@@ -106,7 +106,7 @@ function shared.CombatAlerter.Init()
} }
if Heimdall_Data.config.combatAlerter.debug then if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Queuing alert message", ModuleName)) print(string.format("[%s] Queuing alert message", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.messenger.queue, msg) table.insert(shared.messenger.queue, msg)
end end

View File

@@ -152,7 +152,7 @@ function shared.Commander.Init()
local function WhoPartitionedStinkies() local function WhoPartitionedStinkies()
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName)) print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName))
shared.dumpTable(HeimdallStinkies) shared.dump(HeimdallStinkies)
end end
local res = WhoPartitioned(HeimdallStinkies) local res = WhoPartitioned(HeimdallStinkies)
if #res == 0 then return { "No stinkies found" } end if #res == 0 then return { "No stinkies found" } end
@@ -266,7 +266,7 @@ function shared.Commander.Init()
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...) commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
--if Heimdall_Data.config.commander.debug then --if Heimdall_Data.config.commander.debug then
-- print(string.format("[%s] Event received", ModuleName)) -- print(string.format("[%s] Event received", ModuleName))
-- shared.dumpTable(Heimdall_Data.config.commander) -- shared.dump(Heimdall_Data.config.commander)
--end --end
if not Heimdall_Data.config.commander.enabled then if not Heimdall_Data.config.commander.enabled then
--if Heimdall_Data.config.commander.debug then --if Heimdall_Data.config.commander.debug then
@@ -300,7 +300,7 @@ function shared.Commander.Init()
sender = string.match(sender, "^[^-]+") sender = string.match(sender, "^[^-]+")
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Message from: %s", ModuleName, sender)) print(string.format("[%s] Message from: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.commander) shared.dump(Heimdall_Data.config.commander)
end end
for _, command in ipairs(commands) do for _, command in ipairs(commands) do
@@ -331,7 +331,7 @@ function shared.Commander.Init()
} }
if Heimdall_Data.config.commander.debug then if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Queuing message", ModuleName)) print(string.format("[%s] Queuing message", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
--table.insert(shared.messenger.queue, msg) --table.insert(shared.messenger.queue, msg)
table.insert(shared.networkMessenger.queue, returnmsg) table.insert(shared.networkMessenger.queue, returnmsg)

View File

@@ -706,7 +706,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.spotter.channels = StringToArray(text, ",") Heimdall_Data.config.spotter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.spotter.channels) shared.dump(Heimdall_Data.config.spotter.channels)
end end
) )
spotterConfigFrame:Add(channels, 2, 4) spotterConfigFrame:Add(channels, 2, 4)
@@ -806,7 +806,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.who.channels = StringToArray(text, ",") Heimdall_Data.config.who.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.who.channels) shared.dump(Heimdall_Data.config.who.channels)
end end
) )
whoerConfigFrame:Add(channels, 2, 3) whoerConfigFrame:Add(channels, 2, 3)
@@ -1018,7 +1018,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.deathReporter.channels = StringToArray(text, ",") Heimdall_Data.config.deathReporter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.deathReporter.channels) shared.dump(Heimdall_Data.config.deathReporter.channels)
end end
) )
deathReporterConfigFrame:Add(channels, 2, 6) deathReporterConfigFrame:Add(channels, 2, 6)
@@ -1143,7 +1143,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.inviter.channels = StringToArray(text, ",") Heimdall_Data.config.inviter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.inviter.channels) shared.dump(Heimdall_Data.config.inviter.channels)
end end
) )
inviterConfigFrame:Add(channels, 2, 6) inviterConfigFrame:Add(channels, 2, 6)
@@ -1298,7 +1298,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.agentTracker.channels = StringToArray(text, ",") Heimdall_Data.config.agentTracker.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.agentTracker.channels) shared.dump(Heimdall_Data.config.agentTracker.channels)
end end
) )
agentTrackerConfigFrame:Add(channels, 2, 6) agentTrackerConfigFrame:Add(channels, 2, 6)
@@ -1351,7 +1351,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.stinkyTracker.channels = StringToArray(text, ",") Heimdall_Data.config.stinkyTracker.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.stinkyTracker.channels) shared.dump(Heimdall_Data.config.stinkyTracker.channels)
end end
) )
stinkyTrackerConfigFrame:Add(channels, 2, 6) stinkyTrackerConfigFrame:Add(channels, 2, 6)
@@ -1404,7 +1404,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.emoter.channels = StringToArray(text, ",") Heimdall_Data.config.emoter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.emoter.channels) shared.dump(Heimdall_Data.config.emoter.channels)
end end
) )
emoterConfigFrame:Add(channels, 2, 6) emoterConfigFrame:Add(channels, 2, 6)
@@ -1475,7 +1475,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.echoer.channels = StringToArray(text, ",") Heimdall_Data.config.echoer.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.echoer.channels) shared.dump(Heimdall_Data.config.echoer.channels)
end end
) )
echoerConfigFrame:Add(channels, 2, 6) echoerConfigFrame:Add(channels, 2, 6)
@@ -1546,7 +1546,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.commander.channels = StringToArray(text, ",") Heimdall_Data.config.commander.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.commander.channels) shared.dump(Heimdall_Data.config.commander.channels)
end end
) )
commanderConfigFrame:Add(channels, 2, 6) commanderConfigFrame:Add(channels, 2, 6)
@@ -1680,7 +1680,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.combatAlerter.channels = StringToArray(text, ",") Heimdall_Data.config.combatAlerter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.combatAlerter.channels) shared.dump(Heimdall_Data.config.combatAlerter.channels)
end end
) )
combatAlerterConfigFrame:Add(channels, 2, 6) combatAlerterConfigFrame:Add(channels, 2, 6)
@@ -1745,7 +1745,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.sniffer.channels = StringToArray(text, ",") Heimdall_Data.config.sniffer.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.sniffer.channels) shared.dump(Heimdall_Data.config.sniffer.channels)
end end
) )
snifferConfigFrame:Add(channels, 2, 6) snifferConfigFrame:Add(channels, 2, 6)
@@ -1835,7 +1835,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.bonkDetector.channels = StringToArray(text, ",") Heimdall_Data.config.bonkDetector.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.bonkDetector.channels) shared.dump(Heimdall_Data.config.bonkDetector.channels)
end end
) )
bonkDetectorConfigFrame:Add(channels, 2, 6) bonkDetectorConfigFrame:Add(channels, 2, 6)
@@ -1906,7 +1906,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.minimapTagger.channels = StringToArray(text, ",") Heimdall_Data.config.minimapTagger.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.minimapTagger.channels) shared.dump(Heimdall_Data.config.minimapTagger.channels)
end end
) )
minimapTaggerConfigFrame:Add(channels, 2, 3) minimapTaggerConfigFrame:Add(channels, 2, 3)
@@ -2275,7 +2275,7 @@ function shared.Config.Init()
local text = self:GetText() local text = self:GetText()
Heimdall_Data.config.noter.channels = StringToArray(text, ",") Heimdall_Data.config.noter.channels = StringToArray(text, ",")
print("Channels set to") print("Channels set to")
shared.dumpTable(Heimdall_Data.config.noter.channels) shared.dump(Heimdall_Data.config.noter.channels)
end end
) )
noterConfigFrame:Add(channels, 2, 6) noterConfigFrame:Add(channels, 2, 6)

View File

@@ -168,7 +168,7 @@ function shared.DeathReporter.Init()
} }
if Heimdall_Data.config.deathReporter.debug then if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Queuing death report message", ModuleName)) print(string.format("[%s] Queuing death report message", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.messenger.queue, msg) table.insert(shared.messenger.queue, msg)
end end

View File

@@ -1,25 +1,29 @@
local _, shared = ... local _, shared = ...
---@cast shared HeimdallShared ---@cast shared HeimdallShared
if not shared.dumpTable then if not shared.dump then
---@param table table ---@param value any
---@param depth number? ---@param depth number?
shared.dumpTable = function(table, depth) shared.dump = function(value, depth)
if not table then if not value then
print(tostring(table)) print(tostring(value))
return
end
if type(value) ~= "table" then
print(tostring(value))
return return
end end
if depth == nil then depth = 0 end if depth == nil then depth = 0 end
if depth > 200 then if depth > 200 then
print("Error: Depth > 200 in dumpTable()") print("Error: Depth > 200 in dump()")
return return
end end
for k, v in pairs(table) do for k, v in pairs(value) do
if type(v) == "table" then if type(v) == "table" then
print(string.rep(" ", depth) .. k .. ":") print(string.rep(" ", depth) .. tostring(k) .. ":")
shared.dumpTable(v, depth + 1) shared.dump(v, depth + 1)
else else
print(string.rep(" ", depth) .. k .. ": ", v) print(string.rep(" ", depth) .. tostring(k) .. ": " .. tostring(v))
end end
end end
end end

View File

@@ -36,7 +36,7 @@ function shared.Echoer.Init()
end end
if Heimdall_Data.config.echoer.debug then if Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.echoer) shared.dump(Heimdall_Data.config.echoer)
end end
if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then

View File

@@ -37,7 +37,7 @@ function shared.Emoter.Init()
if Heimdall_Data.config.emoter.debug then if Heimdall_Data.config.emoter.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.emoter) shared.dump(Heimdall_Data.config.emoter)
end end
if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then

View File

@@ -205,7 +205,7 @@ function shared.Inviter.Init()
inviterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...) inviterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
--if Heimdall_Data.config.inviter.debug then --if Heimdall_Data.config.inviter.debug then
-- print(string.format("[%s] Chat message received: %s", ModuleName, msg)) -- print(string.format("[%s] Chat message received: %s", ModuleName, msg))
-- shared.dumpTable(Heimdall_Data.config.inviter) -- shared.dump(Heimdall_Data.config.inviter)
--end --end
if not Heimdall_Data.config.inviter.enabled then return end if not Heimdall_Data.config.inviter.enabled then return end
local channelId = select(6, ...) local channelId = select(6, ...)

View File

@@ -68,7 +68,7 @@ function shared.Macroer.Init()
if Heimdall_Data.config.macroer.debug then if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Sorted stinkies: %d", ModuleName, #sortedStinkies)) print(string.format("[%s] Sorted stinkies: %d", ModuleName, #sortedStinkies))
shared.dumpTable(sortedStinkies) shared.dump(sortedStinkies)
end end
local lines = { "/targetenemy" } local lines = { "/targetenemy" }
for _, stinky in pairs(sortedStinkies) do for _, stinky in pairs(sortedStinkies) do

View File

@@ -445,7 +445,7 @@ function shared.MinimapTagger.Init()
end end
if Heimdall_Data.config.minimapTagger.debug then if Heimdall_Data.config.minimapTagger.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.minimapTagger) shared.dump(Heimdall_Data.config.minimapTagger)
end end
local doTag = true local doTag = true

View File

@@ -50,7 +50,7 @@ function shared.Network.Init()
end end
if Heimdall_Data.config.network.debug then if Heimdall_Data.config.network.debug then
print(string.format("[%s] Network nodes:", ModuleName)) print(string.format("[%s] Network nodes:", ModuleName))
shared.dumpTable(shared.networkNodes) shared.dump(shared.networkNodes)
end end
end end

View File

@@ -131,7 +131,7 @@ function shared.NetworkMessenger.Init()
local parts = shared.Split(message, "|") local parts = shared.Split(message, "|")
if Heimdall_Data.config.networkMessenger.debug then if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Received message parts:", ModuleName)) print(string.format("[%s] Received message parts:", ModuleName))
shared.dumpTable(parts) shared.dump(parts)
end end
local command = strtrim(parts[1]) local command = strtrim(parts[1])
if command == "message" then if command == "message" then

View File

@@ -61,7 +61,7 @@ function shared.Noter.Init()
local indices = shared.Split(range, "..") local indices = shared.Split(range, "..")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Indices for range deletion: %s", ModuleName, table.concat(indices, ", "))) print(string.format("[%s] Indices for range deletion: %s", ModuleName, table.concat(indices, ", ")))
shared.dumpTable(indices) shared.dump(indices)
end end
local start = tonumber(indices[1]) local start = tonumber(indices[1])
local finish = tonumber(indices[2]) local finish = tonumber(indices[2])
@@ -90,7 +90,7 @@ function shared.Noter.Init()
else else
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Deleting note %s at index %s", ModuleName, name, i)) print(string.format("[%s] Deleting note %s at index %s", ModuleName, name, i))
shared.dumpTable(Heimdall_Data.config.notes[name][i]) shared.dump(Heimdall_Data.config.notes[name][i])
end end
Heimdall_Data.config.notes[name][i] = nil Heimdall_Data.config.notes[name][i] = nil
end end
@@ -151,7 +151,7 @@ function shared.Noter.Init()
local indices = shared.Split(range, "..") local indices = shared.Split(range, "..")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Indices for range printing: %s", ModuleName, table.concat(indices, ", "))) print(string.format("[%s] Indices for range printing: %s", ModuleName, table.concat(indices, ", ")))
shared.dumpTable(indices) shared.dump(indices)
end end
local start = tonumber(indices[1]) local start = tonumber(indices[1])
local finish = tonumber(indices[2]) local finish = tonumber(indices[2])
@@ -177,7 +177,7 @@ function shared.Noter.Init()
else else
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i)) print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i))
shared.dumpTable(Heimdall_Data.config.notes[name][i]) shared.dump(Heimdall_Data.config.notes[name][i])
end end
PrintNote(channel, i, Heimdall_Data.config.notes[name][i]) PrintNote(channel, i, Heimdall_Data.config.notes[name][i])
end end
@@ -192,7 +192,7 @@ function shared.Noter.Init()
if not Heimdall_Data.config.notes[name] then Heimdall_Data.config.notes[name] = {} end if not Heimdall_Data.config.notes[name] then Heimdall_Data.config.notes[name] = {} end
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Adding note for: %s from: %s", ModuleName, name, sender)) print(string.format("[%s] Adding note for: %s from: %s", ModuleName, name, sender))
shared.dumpTable(args) shared.dump(args)
end end
local msgparts = {} local msgparts = {}
for i = 3, #args do for i = 3, #args do
@@ -213,7 +213,7 @@ function shared.Noter.Init()
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Adding note", ModuleName)) print(string.format("[%s] Adding note", ModuleName))
shared.dumpTable(note) shared.dump(note)
end end
table.insert(Heimdall_Data.config.notes[name], note) table.insert(Heimdall_Data.config.notes[name], note)
end end
@@ -231,7 +231,7 @@ function shared.Noter.Init()
noterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...) noterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
--if Heimdall_Data.config.noter.debug then --if Heimdall_Data.config.noter.debug then
-- print(string.format("[%s] Event received", ModuleName)) -- print(string.format("[%s] Event received", ModuleName))
-- shared.dumpTable(Heimdall_Data.config.noter) -- shared.dump(Heimdall_Data.config.noter)
--end --end
if not Heimdall_Data.config.noter.enabled then if not Heimdall_Data.config.noter.enabled then
--if Heimdall_Data.config.noter.debug then --if Heimdall_Data.config.noter.debug then
@@ -258,7 +258,7 @@ function shared.Noter.Init()
sender = string.match(sender, "^[^-]+") sender = string.match(sender, "^[^-]+")
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Message from: %s", ModuleName, sender)) print(string.format("[%s] Message from: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.noter) shared.dump(Heimdall_Data.config.noter)
end end
if not msg or msg == "" then if not msg or msg == "" then
@@ -271,7 +271,7 @@ function shared.Noter.Init()
local args = { strsplit(" ", msg) } local args = { strsplit(" ", msg) }
if Heimdall_Data.config.noter.debug then if Heimdall_Data.config.noter.debug then
print(string.format("[%s] Arguments received: %s", ModuleName, table.concat(args, ", "))) print(string.format("[%s] Arguments received: %s", ModuleName, table.concat(args, ", ")))
shared.dumpTable(args) shared.dump(args)
end end
local command = args[1] local command = args[1]
if command == "note" then if command == "note" then

View File

@@ -483,7 +483,7 @@ local function Init()
-- S local clbk = test:onChange(function(value) -- S local clbk = test:onChange(function(value)
-- S invocations = invocations + 1 -- S invocations = invocations + 1
-- S print("test changed to") -- S print("test changed to")
-- S dumpTable(value, 0) -- S dump(value, 0)
-- S end) -- S end)
-- S test:set({1, 2, 3, 4}) -- S test:set({1, 2, 3, 4})
-- S assert(invocations == 1) -- S assert(invocations == 1)
@@ -516,7 +516,7 @@ local function Init()
-- S test:once(function(value) -- S test:once(function(value)
-- S invocations = invocations + 1 -- S invocations = invocations + 1
-- S print("test changed to") -- S print("test changed to")
-- S dumpTable(value, 0) -- S dump(value, 0)
-- S end) -- S end)
-- S test:set({3, 2, 1}) -- S test:set({3, 2, 1})
-- S assert(invocations == 1) -- S assert(invocations == 1)
@@ -527,7 +527,7 @@ local function Init()
-- S test:onChange(function(value) -- S test:onChange(function(value)
-- S invocations = invocations + 1 -- S invocations = invocations + 1
-- S print("test changed to") -- S print("test changed to")
-- S dumpTable(value, 0) -- S dump(value, 0)
-- S end) -- S end)
-- S test:onAnyFieldChange(function(field, value) -- S test:onAnyFieldChange(function(field, value)
-- S invocations = invocations + 1 -- S invocations = invocations + 1

View File

@@ -10,7 +10,7 @@ function shared.Sniffer.Init()
local SmellStinky = function(stinky) local SmellStinky = function(stinky)
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
print(string.format("%s: SmellStinky", ModuleName)) print(string.format("%s: SmellStinky", ModuleName))
shared.dumpTable(Heimdall_Data.config.sniffer) shared.dump(Heimdall_Data.config.sniffer)
end end
if not Heimdall_Data.config.sniffer.enabled then return end if not Heimdall_Data.config.sniffer.enabled then return end
if Heimdall_Data.config.sniffer.stinky and not shared.IsStinky(stinky) then if Heimdall_Data.config.sniffer.stinky and not shared.IsStinky(stinky) then
@@ -19,11 +19,13 @@ function shared.Sniffer.Init()
end end
return return
end end
if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttleTime then local now = GetTime()
local throttle = smellThrottle[stinky] or 0
if now - throttle < Heimdall_Data.config.sniffer.throttle then
if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end
return return
end end
smellThrottle[stinky] = GetTime() smellThrottle[stinky] = now
for _, channel in pairs(Heimdall_Data.config.sniffer.channels) do for _, channel in pairs(Heimdall_Data.config.sniffer.channels) do
local locale = shared.GetLocaleForChannel(channel) local locale = shared.GetLocaleForChannel(channel)
@@ -36,7 +38,7 @@ function shared.Sniffer.Init()
} }
if Heimdall_Data.config.sniffer.debug then if Heimdall_Data.config.sniffer.debug then
print(string.format("[%s] Queuing sniffer message", ModuleName)) print(string.format("[%s] Queuing sniffer message", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.messenger.queue, msg) table.insert(shared.messenger.queue, msg)
end end

View File

@@ -188,7 +188,7 @@ function shared.Spotter.Init()
} }
if Heimdall_Data.config.spotter.debug then if Heimdall_Data.config.spotter.debug then
print(string.format("[%s] Queuing spotter message", ModuleName)) print(string.format("[%s] Queuing spotter message", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.messenger.queue, msg) table.insert(shared.messenger.queue, msg)
end end

View File

@@ -34,7 +34,7 @@ function shared.StinkyTracker.Init()
date("%H:%M:%S", time()) date("%H:%M:%S", time())
) )
) )
shared.dumpTable(stinkies) shared.dump(stinkies)
end end
end end
return stinkies return stinkies
@@ -73,7 +73,7 @@ function shared.StinkyTracker.Init()
date("%H:%M:%S", time()) date("%H:%M:%S", time())
) )
) )
shared.dumpTable(stinkies) shared.dump(stinkies)
end end
return stinkies return stinkies
end end
@@ -106,7 +106,7 @@ function shared.StinkyTracker.Init()
stinkies[name] = stinky stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("%s: Found stinky in arrived: %s/%s", ModuleName, name, class)) print(string.format("%s: Found stinky in arrived: %s/%s", ModuleName, name, class))
shared.dumpTable(stinkies) shared.dump(stinkies)
end end
return stinkies return stinkies
end end
@@ -140,7 +140,7 @@ function shared.StinkyTracker.Init()
end end
if Heimdall_Data.config.stinkyTracker.debug then if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender)) print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
shared.dumpTable(Heimdall_Data.config.stinkyTracker) shared.dump(Heimdall_Data.config.stinkyTracker)
end end
if string.find(msg, "^who:") then if string.find(msg, "^who:") then

View File

@@ -8,6 +8,8 @@ function shared.Whoer.Init()
if not Heimdall_Data.who then Heimdall_Data.who = {} end if not Heimdall_Data.who then Heimdall_Data.who = {} end
if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end
local whoWaiting = false
---@type table<string, Player> ---@type table<string, Player>
HeimdallStinkies = {} HeimdallStinkies = {}
@@ -161,7 +163,7 @@ function shared.Whoer.Init()
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] WHO query: %s with %d filters", ModuleName, queryParts[1], #filters)) print(string.format("[%s] WHO query: %s with %d filters", ModuleName, queryParts[1], #filters))
end end
shared.dumpTable(filters) shared.dump(filters)
return WHOQuery.new(queryParts[1], filters) return WHOQuery.new(queryParts[1], filters)
end, end,
---@param queryStr string ---@param queryStr string
@@ -295,7 +297,7 @@ function shared.Whoer.Init()
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.networkMessenger.queue, msg) table.insert(shared.networkMessenger.queue, msg)
end end
@@ -354,7 +356,7 @@ function shared.Whoer.Init()
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
table.insert(shared.networkMessenger.queue, msg) table.insert(shared.networkMessenger.queue, msg)
end end
@@ -405,7 +407,7 @@ function shared.Whoer.Init()
} }
if Heimdall_Data.config.who.debug then if Heimdall_Data.config.who.debug then
print(string.format("[%s] Queuing channel notification", ModuleName)) print(string.format("[%s] Queuing channel notification", ModuleName))
shared.dumpTable(msg) shared.dump(msg)
end end
--table.insert(shared.messenger.queue, msg) --table.insert(shared.messenger.queue, msg)
table.insert(shared.networkMessenger.queue, msg) table.insert(shared.networkMessenger.queue, msg)
@@ -583,7 +585,8 @@ function shared.Whoer.Init()
end end
-- Turns out WA cannot do this ( -- Turns out WA cannot do this (
-- aura_env.UpdateMacro() -- aura_env.UpdateMacro()
_G["FriendsFrameCloseButton"]:Click() -- We MAY not need this
-- _G["FriendsFrameCloseButton"]:Click()
end) end)
do do
@@ -635,13 +638,21 @@ function shared.Whoer.Init()
lastQuery = query lastQuery = query
---@diagnostic disable-next-line: param-type-mismatch ---@diagnostic disable-next-line: param-type-mismatch
SetWhoToUI(1) SetWhoToUI(1)
SetWhoToUI(1)
SendWho(query.query) SendWho(query.query)
whoWaiting = true
end end
local function Tick() local function Tick()
DoQuery() DoQuery()
C_Timer.NewTimer(1, Tick, 1) C_Timer.NewTimer(1, Tick, 1)
end end
Tick() Tick()
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
local function my_FriendsFrame_OnEvent(event)
if not (event == "WHO_LIST_UPDATE" and whoWaiting) then original_FriendsFrame_OnEvent() end
end
FriendsFrame_OnEvent = my_FriendsFrame_OnEvent
end end
print("[Heimdall] Whoer loaded") print("[Heimdall] Whoer loaded")