diff --git a/FreshShit/WhoSniffer/event.lua b/FreshShit/WhoSniffer/event.lua index a616650..30bb01e 100644 --- a/FreshShit/WhoSniffer/event.lua +++ b/FreshShit/WhoSniffer/event.lua @@ -48,6 +48,9 @@ function() WeakAurasSaved.Cyka.WhoSniffer[name] = player end player.lastSeenInternal = GetTime() + if player.zone ~= zone then + aura_env.NotifyZoneChanged(player, zone) + end player.zone = zone player.lastSeen = timestamp aura_env.stinkies[name] = player diff --git a/FreshShit/WhoSniffer/init.lua b/FreshShit/WhoSniffer/init.lua index 9afec8b..229e2b5 100644 --- a/FreshShit/WhoSniffer/init.lua +++ b/FreshShit/WhoSniffer/init.lua @@ -7,6 +7,7 @@ end aura_env.ttl = 12 aura_env.ignored = {"Maritza", "Goodbones"} +local channelId = nil ---@class aura_env ---@field raceMap table @@ -257,6 +258,20 @@ local NotifyAll = function(msg) table.insert(aura_env.messageQueue, message) end end +---@param msg string +local NotifyChannel = function(msg) + if not channelId then + print("cannot notify channel, channelId is nil") + return + end + local message = { + channel = "CHANNEL", + data = channelId, + message = msg + } + table.insert(aura_env.messageQueue, message) +end + ---@param player Player ---@return nil aura_env.Notify = function(player) @@ -268,6 +283,19 @@ aura_env.Notify = function(player) aura_env.NotifyChannel(player) end +---@param player Player +---@param newzone string +---@return nil +aura_env.NotifyZoneChanged = function(player, newzone) + if not notifyFor[newzone] then + return + end + local msg = string.format("%s of class %s and guild %s moved to %s", player.name, player.class, player.guild, + newzone) + NotifyAll(msg) + NotifyChannel(msg) +end + ---@param player Player ---@return nil aura_env.NotifyGone = function(player) @@ -283,7 +311,6 @@ end -- CHANNEL fuckery local channel = aura_env.config.channelName or "foobar" local password = aura_env.config.channelPassword -local channelId = nil local function GetChannelId(channelName) local channels = {GetChannelList()} @@ -309,19 +336,6 @@ channelId = GetChannelId(channel) aura_env.channelId = channelId print(string.format("channel %s resolved to id %d", channel, channelId)) ----@param msg string -local NotifyChannel = function(msg) - if not channelId then - print("cannot notify channel, channelId is nil") - return - end - local message = { - channel = "CHANNEL", - data = channelId, - message = msg - } - table.insert(aura_env.messageQueue, message) -end ---@param player Player ---@return nil aura_env.NotifyChannel = function(player)