Implement replying to "who" on channel

This commit is contained in:
2024-11-28 16:35:25 +01:00
parent cfa3228ca5
commit 775f6ae076
2 changed files with 24 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
-- CHAT_MSG_CHANNEL
---@type event string
---@type msg string
---@type sender string
function(event, msg, sender, ...)
local channelId = select(6, ...)
if channelId ~= aura_env.channelId then
return
end
if msg == "who" then
for _, player in pairs(aura_env.stinkies) do
local msg = aura_env.MakeNotifyMessage(player)
local message = {
channel = "CHANNEL",
data = channelId,
message = msg
}
table.insert(aura_env.messageQueue, message)
end
end
end

View File

@@ -299,6 +299,7 @@ if not channelId then
JoinPermanentChannel(channel) JoinPermanentChannel(channel)
end end
channelId = GetChannelId(channel) channelId = GetChannelId(channel)
aura_env.channelId = channelId
print(string.format("channel %s resolved to id %d", channel, channelId)) print(string.format("channel %s resolved to id %d", channel, channelId))
---@param msg string ---@param msg string
@@ -327,8 +328,4 @@ aura_env.NotifyChannelGone = function(player)
local msg = string.format("%s of class %s and guild %s left %s", player.name, player.class, player.guild, local msg = string.format("%s of class %s and guild %s left %s", player.name, player.class, player.guild,
player.zone) player.zone)
NotifyChannel(msg) NotifyChannel(msg)
end end
local foo = Player.new("foo", "bar", "Human", "Warrior", "Orgrimmar")
aura_env.NotifyChannel(foo)