From 775f6ae0765072876bcfa5f4462601721ce4bbd3 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Thu, 28 Nov 2024 16:35:25 +0100 Subject: [PATCH] Implement replying to "who" on channel --- FreshShit/WhoSniffer/event6.lua | 22 ++++++++++++++++++++++ FreshShit/WhoSniffer/init.lua | 7 ++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 FreshShit/WhoSniffer/event6.lua diff --git a/FreshShit/WhoSniffer/event6.lua b/FreshShit/WhoSniffer/event6.lua new file mode 100644 index 0000000..4507d1f --- /dev/null +++ b/FreshShit/WhoSniffer/event6.lua @@ -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 diff --git a/FreshShit/WhoSniffer/init.lua b/FreshShit/WhoSniffer/init.lua index 5862d69..ea25a37 100644 --- a/FreshShit/WhoSniffer/init.lua +++ b/FreshShit/WhoSniffer/init.lua @@ -299,6 +299,7 @@ if not channelId then JoinPermanentChannel(channel) end channelId = GetChannelId(channel) +aura_env.channelId = channelId print(string.format("channel %s resolved to id %d", channel, channelId)) ---@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, player.zone) NotifyChannel(msg) -end - -local foo = Player.new("foo", "bar", "Human", "Warrior", "Orgrimmar") -aura_env.NotifyChannel(foo) - +end \ No newline at end of file