Refactor Commander and StinkyTracker modules for improved clarity and consistency in type annotations

This commit is contained in:
2025-05-18 12:48:26 +02:00
parent 03597d1b5e
commit ce92e8e12c
2 changed files with 8 additions and 10 deletions

View File

@@ -360,10 +360,8 @@ shared.Commander = {
if msg:match(command.keywordRe) then
---@diagnostic disable-next-line: redundant-parameter Currently luals does not support variadic functions as a @field
local messages = command.callback({ strsplit(",", msg) })
local messages = command.callback({ strsplit(",", msg) })
if Heimdall_Data.config.commander.debug then
---@diagnostic disable-next-line: param-type-mismatch
print(
if Heimdall_Data.config.commander.debug then
print(string.format("[%s] Messages to send: %s", ModuleName))
shared.dumpTable(messages)
end
for _, message in ipairs(messages) do

View File

@@ -99,7 +99,7 @@ shared.StinkyTracker = {
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
---@param msg string
---@return table<string, stinky>
---@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))
@@ -130,7 +130,7 @@ shared.StinkyTracker = {
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
---@param msg string
---@return table<string, stinky>
---@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))
@@ -169,7 +169,7 @@ shared.StinkyTracker = {
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
---@param msg string
---@return table<string, stinky>
---@return table<string, Stinky>
local function ParseArrived(msg)
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
@@ -295,14 +295,14 @@ shared.StinkyTracker = {
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
end
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
shared.StinkyTracker.ForEach(function(name, stinky)
if shared.AgentTracker.IsAgent(name) then
shared.stinkyTracker.stinkies[name] = nil
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
end
end
end
end)
end)
local targetFrame = CreateFrame("Frame")