Code format

This commit is contained in:
2025-01-09 10:55:32 +01:00
parent 2e44a1ef31
commit be81a31302
15 changed files with 274 additions and 231 deletions

View File

@@ -26,12 +26,13 @@ function shared.StinkyTracker.Init()
hostile = true
}
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Found hostile player: %s (%s) at %s", ModuleName, name, class, date("%H:%M:%S", time())))
print(string.format("[%s] Found hostile player: %s (%s) at %s", ModuleName, name, class,
date("%H:%M:%S", time())))
end
end
return stinkies
end
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
---@param msg string
---@return table<string, stinky>
@@ -55,11 +56,12 @@ 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 at %s", ModuleName, name, class, aggression, date("%H:%M:%S", time())))
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
local arrivedRegex = "([^ -/]+)-?%w* of class (%w+)"
local arrivedRegexAlt = "([^ -/]+)-?%w* %(!!!!%) of class (%w+)"
---@param msg string
@@ -95,22 +97,22 @@ function shared.StinkyTracker.Init()
local frame = CreateFrame("Frame")
frame:RegisterEvent("CHAT_MSG_CHANNEL")
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
-- if Heimdall_Data.config.stinkyTracker.debug then
-- 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] Module disabled, ignoring event", ModuleName))
-- end
return
-- if Heimdall_Data.config.stinkyTracker.debug then
-- 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] Module disabled, ignoring event", ModuleName))
-- end
return
end
local channelId = select(6, ...)
local _, channelname = GetChannelName(channelId)
if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then
-- if Heimdall_Data.config.stinkyTracker.debug then
-- print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname))
-- end
return
if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then
-- if Heimdall_Data.config.stinkyTracker.debug then
-- print(string.format("[%s] Ignoring message from non-master channel: %s", ModuleName, channelname))
-- end
return
end
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
@@ -129,7 +131,8 @@ function shared.StinkyTracker.Init()
if stinky.hostile then
shared.stinkyTracker.stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky.class))
print(string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky
.class))
end
end
end
@@ -146,7 +149,8 @@ function shared.StinkyTracker.Init()
if stinky.hostile then
shared.stinkyTracker.stinkies[name] = stinky
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky.class))
print(string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky
.class))
end
end
if not stinky.hostile then