This commit is contained in:
2025-05-05 00:02:38 +02:00
parent f897183920
commit a1301abdb2
8 changed files with 49 additions and 50 deletions

View File

@@ -14,7 +14,7 @@ function shared.Network.Init()
---@type table<string, boolean>
local friends = {}
for i = 1, GetNumFriends() do
local name, level, class, area, connected, status, note, RAF = GetFriendInfo(i)
local name, _, _, _, connected, _, _, _ = GetFriendInfo(i)
if name then
friends[name] = connected
if Heimdall_Data.config.network.debug then
@@ -38,7 +38,8 @@ function shared.Network.Init()
friends[UnitName("player")] = true
shared.networkNodes = {}
if false then shared.networkNodes[#shared.networkNodes + 1] = UnitName("player") end
-- Why are we skipping this again...?
-- if false then shared.networkNodes[#shared.networkNodes + 1] = UnitName("player") end
for _, player in ipairs(Heimdall_Data.config.network.members) do
if friends[player] then
shared.networkNodes[#shared.networkNodes + 1] = player

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "NetworkMessenger"
---@diagnostic disable-next-line: missing-fields
@@ -136,16 +135,18 @@ function shared.NetworkMessenger.Init()
end
local command = strtrim(parts[1])
if command == "message" then
local message = strtrim(tostring(parts[2]))
local channel = strtrim(tostring(parts[3]))
local content = strtrim(tostring(parts[2]))
local targetchannel = strtrim(tostring(parts[3]))
local target = strtrim(tostring(parts[4]))
if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Received message command: %s %s %s", ModuleName, message, channel, target))
print(
string.format("[%s] Received message command: %s %s %s", ModuleName, content, targetchannel, target)
)
end
---@type Message
local msg = {
channel = channel,
message = message,
channel = targetchannel,
message = content,
data = target,
}
table.insert(shared.messenger.queue, msg)
@@ -154,15 +155,15 @@ function shared.NetworkMessenger.Init()
print(string.format("[%s] Received dmessage command", ModuleName))
end
parts[1] = "message"
local message = table.concat(parts, "|")
local content = table.concat(parts, "|")
if nextIdx > #shared.networkNodes then nextIdx = 1 end
local recipient = shared.networkNodes[nextIdx]
nextIdx = nextIdx + 1
if Heimdall_Data.config.networkMessenger.debug then
print(string.format("[%s] Sending message %s to %s", ModuleName, message, recipient))
print(string.format("[%s] Sending message %s to %s", ModuleName, content, recipient))
end
SendAddonMessage(Heimdall_Data.config.addonPrefix, message, "WHISPER", recipient)
SendAddonMessage(Heimdall_Data.config.addonPrefix, content, "WHISPER", recipient)
end
end)

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Noter"
---@class Note
@@ -12,32 +11,32 @@ local ModuleName = "Noter"
---@diagnostic disable-next-line: missing-fields
shared.Noter = {}
function shared.Noter.Init()
---Hopefully this will not be necessary
---@param text string
---@param size number
---@return string[]
local function Partition(text, size)
local words = {}
for word in text:gmatch("[^,]+") do
words[#words + 1] = word
end
-- ---Hopefully this will not be necessary
-- ---@param text string
-- ---@param size number
-- ---@return string[]
-- local function Partition(text, size)
-- local words = {}
-- for word in text:gmatch("[^,]+") do
-- words[#words + 1] = word
-- end
local ret = {}
local currentChunk = ""
-- local ret = {}
-- local currentChunk = ""
for _, word in ipairs(words) do
if #currentChunk + #word + 1 <= size then
currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
else
if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
currentChunk = word
end
end
-- for _, word in ipairs(words) do
-- if #currentChunk + #word + 1 <= size then
-- currentChunk = currentChunk .. (currentChunk == "" and word or " " .. word)
-- else
-- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
-- currentChunk = word
-- end
-- end
if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
-- if #currentChunk > 0 then ret[#ret + 1] = currentChunk end
return ret
end
-- return ret
-- end
---@param array any[]
---@return any[]
local function Compact(array)

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Sniffer"
---@diagnostic disable-next-line: missing-fields
@@ -55,7 +54,8 @@ function shared.Sniffer.Init()
end
return
end
local source, err = CLEUParser.GetSourceName(...)
local source, destination, err
source, err = CLEUParser.GetSourceName(...)
if Heimdall_Data.config.sniffer.debug then
print(string.format("[%s] Processing source: %s", ModuleName, source))
end
@@ -66,7 +66,7 @@ function shared.Sniffer.Init()
return
end
SmellStinky(source)
local destination, err = CLEUParser.GetDestName(...)
destination, err = CLEUParser.GetDestName(...)
if Heimdall_Data.config.sniffer.debug then
print(string.format("[%s] Processing destination: %s", ModuleName, destination))
end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Spotter"
---@diagnostic disable-next-line: missing-fields

View File

@@ -47,7 +47,8 @@ function shared.StinkyCache.Init()
)
)
end
local name, value = { strsplit("|", msg) }
local parts = { strsplit("|", msg) }
local name, value = parts[1], parts[2]
shared.stinkyCache.stinkies[name] = { value = value, timestamp = time() }
else
if Heimdall_Data.config.stinkyCache.debug then

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "StinkyTracker"
---@diagnostic disable-next-line: missing-fields
@@ -229,7 +228,7 @@ function shared.StinkyTracker.Init()
if Heimdall_Data.config.stinkyTracker.debug then
print(string.format("[%s] Event received: %s for unit: %s", ModuleName, event, unit or "target"))
end
local unit = "target"
unit = "target"
if not Heimdall_Data.config.stinkyTracker.enabled then
if Heimdall_Data.config.stinkyTracker.debug then

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Whoer"
---@diagnostic disable-next-line: missing-fields
@@ -542,7 +541,7 @@ function shared.Whoer.Init()
end
player.stinky = true
--PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
else
-- else
-- PlaySoundFile("Interface\\Sounds\\Cloak.ogg", "Master")
end