diff --git a/Modules/Whoer.lua b/Modules/Whoer.lua index d53eff6..7c26c87 100644 --- a/Modules/Whoer.lua +++ b/Modules/Whoer.lua @@ -367,6 +367,17 @@ function shared.Whoer.Init() Tick() end + ---@return table + local function Count() + local ret = {} + for _, player in pairs(HeimdallStinkies) do + if Heimdall_Data.config.who.zoneNotifyFor[player.zone] then + ret[player.zone] = (ret[player.zone] or 0) + 1 + end + end + return ret + end + local whoQueryWhisperFrame = CreateFrame("Frame") whoQueryWhisperFrame:RegisterEvent("CHAT_MSG_WHISPER") whoQueryWhisperFrame:SetScript("OnEvent", function(self, event, msg, sender) @@ -383,6 +394,21 @@ function shared.Whoer.Init() table.insert(shared.messenger.queue, msg) end end + if msg == "howmany" then + local count = Count() + local text = "" + for zone, count in pairs(count) do + text = text .. string.format("%s: %d, ", zone, count) + end + text = text:sub(1, string.len(text) - 2) + ---@type Message + local msg = { + channel = "WHISPER", + data = sender, + message = text + } + table.insert(shared.messenger.queue, msg) + end end) local whoQueryChannelFrame = CreateFrame("Frame") @@ -417,6 +443,21 @@ function shared.Whoer.Init() table.insert(shared.messenger.queue, msg) end end + if msg == "howmany" then + local count = Count() + local text = "" + for zone, count in pairs(count) do + text = text .. string.format("%s: %d, ", zone, count) + end + text = text:sub(1, string.len(text) - 2) + ---@type Message + local msg = { + channel = "CHANNEL", + data = channelname, + message = text + } + table.insert(shared.messenger.queue, msg) + end end) print("Heimdall - Whoer loaded")