Clean up the modules a little
This commit is contained in:
2
Meta
2
Meta
Submodule Meta updated: 859955aa36...ba3bf263d6
@@ -1,10 +1,9 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "AchievementSniffer"
|
local ModuleName = "AchievementSniffer"
|
||||||
|
|
||||||
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
-- local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
||||||
local TextureRoot = HeimdallRoot .. "Texture\\"
|
-- local TextureRoot = HeimdallRoot .. "Texture\\"
|
||||||
|
|
||||||
local Achievements = {
|
local Achievements = {
|
||||||
15,
|
15,
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "AgentTracker"
|
local ModuleName = "AgentTracker"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
@@ -37,7 +36,7 @@ function shared.AgentTracker.Init()
|
|||||||
|
|
||||||
local newAgents = 0
|
local newAgents = 0
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
local name = GetChannelRosterInfo(index, i)
|
name = GetChannelRosterInfo(index, i)
|
||||||
if name then
|
if name then
|
||||||
local isNewAgent = not Heimdall_Data.config.agents[name]
|
local isNewAgent = not Heimdall_Data.config.agents[name]
|
||||||
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "BonkDetector"
|
local ModuleName = "BonkDetector"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
@@ -30,14 +29,23 @@ function shared.BonkDetector.Init()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local source, err = CLEUParser.GetSourceName(...)
|
---@type string|nil, string, string, string, string
|
||||||
|
local err, source, sourceGUID, destination, destinationGUID
|
||||||
|
|
||||||
|
source, err = CLEUParser.GetSourceName(...)
|
||||||
if err then
|
if err then
|
||||||
if Heimdall_Data.config.bonkDetector.debug then
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
print(string.format("[%s] Error getting source name: %s", ModuleName, err))
|
print(string.format("[%s] Error getting source name: %s", ModuleName, err))
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local sourceGUID = CLEUParser.GetSourceGUID(...)
|
sourceGUID, err = CLEUParser.GetSourceGUID(...)
|
||||||
|
if err then
|
||||||
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
|
print(string.format("[%s] Error getting source GUID: %s", ModuleName, err))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
if not string.find(sourceGUID, "Player") then
|
if not string.find(sourceGUID, "Player") then
|
||||||
if Heimdall_Data.config.bonkDetector.debug then
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
print(string.format("[%s] Source %s is not a player, nothing to do", ModuleName, source))
|
print(string.format("[%s] Source %s is not a player, nothing to do", ModuleName, source))
|
||||||
@@ -45,14 +53,20 @@ function shared.BonkDetector.Init()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local destination, err = CLEUParser.GetDestName(...)
|
destination, err = CLEUParser.GetDestName(...)
|
||||||
if err then
|
if err then
|
||||||
if Heimdall_Data.config.bonkDetector.debug then
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
print(string.format("[%s] Error getting destination name: %s", ModuleName, err))
|
print(string.format("[%s] Error getting destination name: %s", ModuleName, err))
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local destinationGUID = CLEUParser.GetDestGUID(...)
|
destinationGUID, err = CLEUParser.GetDestGUID(...)
|
||||||
|
if err then
|
||||||
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
|
print(string.format("[%s] Error getting destination GUID: %s", ModuleName, err))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
if not string.find(destinationGUID, "Player") then
|
if not string.find(destinationGUID, "Player") then
|
||||||
if Heimdall_Data.config.bonkDetector.debug then
|
if Heimdall_Data.config.bonkDetector.debug then
|
||||||
print(string.format("[%s] Destination %s is not a player, nothing to do", ModuleName, destination))
|
print(string.format("[%s] Destination %s is not a player, nothing to do", ModuleName, destination))
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "Bully"
|
local ModuleName = "Bully"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "CombatAlerter"
|
local ModuleName = "CombatAlerter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
@@ -20,7 +19,10 @@ function shared.CombatAlerter.Init()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local destination, err = CLEUParser.GetDestName(...)
|
---@type string|nil, string, string
|
||||||
|
local err, source, destination
|
||||||
|
|
||||||
|
destination, err = CLEUParser.GetDestName(...)
|
||||||
if err then
|
if err then
|
||||||
if Heimdall_Data.config.combatAlerter.debug then
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
print(string.format("[%s] Error getting destination: %s", ModuleName, err))
|
print(string.format("[%s] Error getting destination: %s", ModuleName, err))
|
||||||
@@ -39,7 +41,7 @@ function shared.CombatAlerter.Init()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local source, err = CLEUParser.GetSourceName(...)
|
source, err = CLEUParser.GetSourceName(...)
|
||||||
if err then
|
if err then
|
||||||
if Heimdall_Data.config.combatAlerter.debug then
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
print(string.format("[%s] Error getting source, using 'unknown': %s", ModuleName, err))
|
print(string.format("[%s] Error getting source, using 'unknown': %s", ModuleName, err))
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "Commander"
|
local ModuleName = "Commander"
|
||||||
|
|
||||||
local helpMessages = {
|
local helpMessages = {
|
||||||
@@ -78,6 +77,7 @@ function shared.Commander.Init()
|
|||||||
local function CountPartitioned(arr)
|
local function CountPartitioned(arr)
|
||||||
local count = Count(arr)
|
local count = Count(arr)
|
||||||
local text = {}
|
local text = {}
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||||
for _, line in pairs(Partition(strjoin(", ", unpack(count)), 200)) do
|
for _, line in pairs(Partition(strjoin(", ", unpack(count)), 200)) do
|
||||||
text[#text + 1] = line
|
text[#text + 1] = line
|
||||||
end
|
end
|
||||||
@@ -108,6 +108,7 @@ function shared.Commander.Init()
|
|||||||
local function WhoPartitioned(arr)
|
local function WhoPartitioned(arr)
|
||||||
local who = Who(arr)
|
local who = Who(arr)
|
||||||
local text = {}
|
local text = {}
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||||
for _, line in pairs(Partition(strjoin(", ", unpack(who)), 200)) do
|
for _, line in pairs(Partition(strjoin(", ", unpack(who)), 200)) do
|
||||||
text[#text + 1] = "who: " .. line
|
text[#text + 1] = "who: " .. line
|
||||||
end
|
end
|
||||||
@@ -134,6 +135,7 @@ function shared.Commander.Init()
|
|||||||
local function CountClassPartitioned(arr)
|
local function CountClassPartitioned(arr)
|
||||||
local countClass = CountClass(arr)
|
local countClass = CountClass(arr)
|
||||||
local text = {}
|
local text = {}
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||||
for _, line in pairs(Partition(strjoin(", ", unpack(countClass)), 200)) do
|
for _, line in pairs(Partition(strjoin(", ", unpack(countClass)), 200)) do
|
||||||
text[#text + 1] = line
|
text[#text + 1] = line
|
||||||
end
|
end
|
||||||
@@ -212,6 +214,7 @@ function shared.Commander.Init()
|
|||||||
---@param args string[]
|
---@param args string[]
|
||||||
local function MacroTarget(args)
|
local function MacroTarget(args)
|
||||||
if Heimdall_Data.config.commander.debug then
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||||
print(string.format("[%s] Macroing: %s", ModuleName, strjoin(" ", unpack(args))))
|
print(string.format("[%s] Macroing: %s", ModuleName, strjoin(" ", unpack(args))))
|
||||||
end
|
end
|
||||||
if #args < 2 or #args % 2 ~= 0 then
|
if #args < 2 or #args % 2 ~= 0 then
|
||||||
@@ -313,13 +316,15 @@ function shared.Commander.Init()
|
|||||||
)
|
)
|
||||||
then
|
then
|
||||||
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
|
||||||
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
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
|
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
|
||||||
end
|
end
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local returnmsg = {
|
||||||
channel = "C",
|
channel = "C",
|
||||||
data = channelname,
|
data = channelname,
|
||||||
message = message,
|
message = message,
|
||||||
@@ -329,7 +334,7 @@ function shared.Commander.Init()
|
|||||||
shared.dumpTable(msg)
|
shared.dumpTable(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, returnmsg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -66,16 +66,16 @@ local function MapFromString(str, deliminer, terminator)
|
|||||||
end
|
end
|
||||||
return map
|
return map
|
||||||
end
|
end
|
||||||
---@param map table<any, any>
|
-- ---@param map table<any, any>
|
||||||
---@param deliminer string
|
-- ---@param deliminer string
|
||||||
---@return string
|
-- ---@return string
|
||||||
local function MapValueToString(map, deliminer)
|
-- local function MapValueToString(map, deliminer)
|
||||||
local str = ""
|
-- local str = ""
|
||||||
for _, v in pairs(map) do
|
-- for _, v in pairs(map) do
|
||||||
str = str .. tostring(v) .. deliminer
|
-- str = str .. tostring(v) .. deliminer
|
||||||
end
|
-- end
|
||||||
return str
|
-- return str
|
||||||
end
|
-- end
|
||||||
|
|
||||||
---@class GridFrame:Frame
|
---@class GridFrame:Frame
|
||||||
---@field name string
|
---@field name string
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "Emoter"
|
local ModuleName = "Emoter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
|
Reference in New Issue
Block a user