Fix up the log messages a lil
Unbutcher inviter
This commit is contained in:
@@ -15,7 +15,7 @@ function shared.StinkyTracker.Init()
|
||||
---@return table<string, stinky>
|
||||
local function ParseWho(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Parsing who message: %s", ModuleName, msg))
|
||||
print(string.format("[%s] Parsing WHO message: '%s'", ModuleName, msg))
|
||||
end
|
||||
local stinkies = {}
|
||||
for name, class in string.gmatch(msg, whoRegex) do
|
||||
@@ -26,7 +26,7 @@ function shared.StinkyTracker.Init()
|
||||
hostile = true
|
||||
}
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Found stinky in who: %s/%s", ModuleName, name, class))
|
||||
print(string.format("[%s] Found hostile player: %s (%s) at %s", ModuleName, name, class, date("%H:%M:%S", time())))
|
||||
end
|
||||
end
|
||||
return stinkies
|
||||
@@ -37,13 +37,13 @@ function shared.StinkyTracker.Init()
|
||||
---@return table<string, stinky>
|
||||
local function ParseSee(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Parsing see message: %s", ModuleName, msg))
|
||||
print(string.format("[%s] Parsing SEE message: '%s'", ModuleName, msg))
|
||||
end
|
||||
local stinkies = {}
|
||||
local aggression, name, class = string.match(msg, seeRegex)
|
||||
if not name or not class then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: No valid stinky found in see message", ModuleName))
|
||||
print(string.format("[%s] Error: Invalid SEE message format", ModuleName))
|
||||
end
|
||||
return stinkies
|
||||
end
|
||||
@@ -55,7 +55,7 @@ function shared.StinkyTracker.Init()
|
||||
}
|
||||
stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Found stinky in see: %s/%s (%s)", ModuleName, name, class, aggression))
|
||||
print(string.format("[%s] Found stinky in SEE: %s (%s) - %s at %s", ModuleName, name, class, aggression, date("%H:%M:%S", time())))
|
||||
end
|
||||
return stinkies
|
||||
end
|
||||
@@ -96,11 +96,11 @@ function shared.StinkyTracker.Init()
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||
print(string.format("[%s] Event received: %s from %s", ModuleName, event, sender))
|
||||
end
|
||||
if not Heimdall_Data.config.stinkyTracker.enabled then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: StinkyTracker disabled", ModuleName))
|
||||
print(string.format("[%s] Module disabled, ignoring event", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -108,66 +108,87 @@ function shared.StinkyTracker.Init()
|
||||
local _, channelname = GetChannelName(channelId)
|
||||
if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Message not in master channel: %s", ModuleName, channelname))
|
||||
print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if string.find(msg, "^who:") then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Processing who message", ModuleName))
|
||||
print(string.format("[%s] Processing WHO message from %s", ModuleName, sender))
|
||||
end
|
||||
local whoStinkies = ParseWho(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found %d stinkies in WHO message", ModuleName, #whoStinkies))
|
||||
end
|
||||
for name, stinky in pairs(whoStinkies) do
|
||||
if stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Added stinky from who: %s", ModuleName, name))
|
||||
print(string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky.class))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if string.find(msg, "^I see") then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Processing see message", ModuleName))
|
||||
print(string.format("[%s] Processing SEE message from %s", ModuleName, sender))
|
||||
end
|
||||
local seeStinkies = ParseSee(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found %d stinkies in SEE message", ModuleName, #seeStinkies))
|
||||
end
|
||||
for name, stinky in pairs(seeStinkies) do
|
||||
if stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Added stinky from see: %s", ModuleName, name))
|
||||
print(string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky.class))
|
||||
end
|
||||
end
|
||||
if not stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = nil
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Removed stinky from see: %s", ModuleName, name))
|
||||
print(string.format("[%s] Removed non-hostile stinky from SEE: %s", ModuleName, name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if string.find(msg, " and guild ") then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Processing arrived message", ModuleName))
|
||||
print(string.format("[%s] Processing ARRIVED message from %s", ModuleName, sender))
|
||||
end
|
||||
local arrivedStinkies = ParseArrived(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found %d stinkies in ARRIVED message", ModuleName, #arrivedStinkies))
|
||||
end
|
||||
for name, stinky in pairs(arrivedStinkies) do
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Added stinky from arrived: %s", ModuleName, name))
|
||||
print(string.format("[%s] Added stinky from ARRIVED: %s (%s)", ModuleName, name, stinky.class))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Log total stinky count after processing
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
local count = 0
|
||||
for _ in pairs(shared.stinkyTracker.stinkies) do count = count + 1 end
|
||||
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
|
||||
end
|
||||
|
||||
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
||||
if Heimdall_Data.config.agents[name] then
|
||||
shared.stinkyTracker.stinkies[name] = nil
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Removed agent stinky: %s", ModuleName, name))
|
||||
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
print("Heimdall - StinkyTracker loaded")
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end
|
||||
print("[Heimdall] StinkyTracker loaded")
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user