diff --git a/Modules/Network.lua b/Modules/Network.lua index 3ebd0dd..4ceceac 100644 --- a/Modules/Network.lua +++ b/Modules/Network.lua @@ -14,7 +14,7 @@ function shared.Network.Init() ---@type table 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 diff --git a/Modules/NetworkMessenger.lua b/Modules/NetworkMessenger.lua index 551d169..2b36106 100644 --- a/Modules/NetworkMessenger.lua +++ b/Modules/NetworkMessenger.lua @@ -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) diff --git a/Modules/Noter.lua b/Modules/Noter.lua index 4096825..3d3ecc6 100644 --- a/Modules/Noter.lua +++ b/Modules/Noter.lua @@ -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) diff --git a/Modules/Sniffer.lua b/Modules/Sniffer.lua index 501e743..5477a55 100644 --- a/Modules/Sniffer.lua +++ b/Modules/Sniffer.lua @@ -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 diff --git a/Modules/Spotter.lua b/Modules/Spotter.lua index ef5e01b..ed0f3f5 100644 --- a/Modules/Spotter.lua +++ b/Modules/Spotter.lua @@ -1,6 +1,5 @@ -local addonname, shared = ... +local shared = ... ---@cast shared HeimdallShared ----@cast addonname string local ModuleName = "Spotter" ---@diagnostic disable-next-line: missing-fields diff --git a/Modules/StinkyCache.lua b/Modules/StinkyCache.lua index f2d50a7..ddc175d 100644 --- a/Modules/StinkyCache.lua +++ b/Modules/StinkyCache.lua @@ -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 diff --git a/Modules/StinkyTracker.lua b/Modules/StinkyTracker.lua index 92e9572..b3abefc 100644 --- a/Modules/StinkyTracker.lua +++ b/Modules/StinkyTracker.lua @@ -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 diff --git a/Modules/Whoer.lua b/Modules/Whoer.lua index 0b35951..5e1f142 100644 --- a/Modules/Whoer.lua +++ b/Modules/Whoer.lua @@ -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,8 +541,8 @@ function shared.Whoer.Init() end player.stinky = true --PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") - else - --PlaySoundFile("Interface\\Sounds\\Cloak.ogg", "Master") + -- else + -- PlaySoundFile("Interface\\Sounds\\Cloak.ogg", "Master") end local err = Notify(player)