Implement class listing in whoer
This commit is contained in:
@@ -383,6 +383,20 @@ function shared.Whoer.Init()
|
||||
end
|
||||
return ret
|
||||
end
|
||||
---@return string[]
|
||||
local function CountClass()
|
||||
local ret = {}
|
||||
for _, player in pairs(HeimdallStinkies) do
|
||||
if Heimdall_Data.config.who.zoneNotifyFor[player.zone] then
|
||||
ret[player.class] = (ret[player.class] or 0) + 1
|
||||
end
|
||||
end
|
||||
local text = {}
|
||||
for class, count in pairs(ret) do
|
||||
text[#text + 1] = string.format("%s: %d", class, count)
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
local whoQueryWhisperFrame = CreateFrame("Frame")
|
||||
whoQueryWhisperFrame:RegisterEvent("CHAT_MSG_WHISPER")
|
||||
@@ -406,6 +420,15 @@ function shared.Whoer.Init()
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
if msg == "classes" then
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "WHISPER",
|
||||
data = sender,
|
||||
message = strjoin(", ", unpack(CountClass()))
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
end)
|
||||
|
||||
local whoQueryChannelFrame = CreateFrame("Frame")
|
||||
@@ -446,6 +469,15 @@ function shared.Whoer.Init()
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
if msg == "classes" then
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "CHANNEL",
|
||||
data = channelname,
|
||||
message = strjoin(", ", unpack(CountClass()))
|
||||
}
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
end)
|
||||
|
||||
print("Heimdall - Whoer loaded")
|
||||
|
||||
Reference in New Issue
Block a user