Refactor Commander and StinkyTracker modules for improved clarity and consistency in type annotations
This commit is contained in:
@@ -360,10 +360,8 @@ shared.Commander = {
|
|||||||
if msg:match(command.keywordRe) then
|
if msg:match(command.keywordRe) then
|
||||||
---@diagnostic disable-next-line: redundant-parameter Currently luals does not support variadic functions as a @field
|
---@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) })
|
||||||
local messages = command.callback({ strsplit(",", msg) })
|
if Heimdall_Data.config.commander.debug then
|
||||||
if Heimdall_Data.config.commander.debug then
|
print(string.format("[%s] Messages to send: %s", ModuleName))
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
|
||||||
print(
|
|
||||||
shared.dumpTable(messages)
|
shared.dumpTable(messages)
|
||||||
end
|
end
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
|
@@ -99,7 +99,7 @@ shared.StinkyTracker = {
|
|||||||
|
|
||||||
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseWho(msg)
|
local function ParseWho(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
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))
|
||||||
@@ -130,7 +130,7 @@ shared.StinkyTracker = {
|
|||||||
|
|
||||||
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseSee(msg)
|
local function ParseSee(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
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))
|
||||||
@@ -169,7 +169,7 @@ shared.StinkyTracker = {
|
|||||||
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
|
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
|
||||||
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
|
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseArrived(msg)
|
local function ParseArrived(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
|
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))
|
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
|
||||||
end
|
end
|
||||||
|
|
||||||
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
shared.StinkyTracker.ForEach(function(name, stinky)
|
||||||
if shared.AgentTracker.IsAgent(name) then
|
if shared.AgentTracker.IsAgent(name) then
|
||||||
shared.stinkyTracker.stinkies[name] = nil
|
shared.stinkyTracker.stinkies[name] = nil
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local targetFrame = CreateFrame("Frame")
|
local targetFrame = CreateFrame("Frame")
|
||||||
|
Reference in New Issue
Block a user