Add zone changed messages
This commit is contained in:
@@ -48,6 +48,9 @@ function()
|
|||||||
WeakAurasSaved.Cyka.WhoSniffer[name] = player
|
WeakAurasSaved.Cyka.WhoSniffer[name] = player
|
||||||
end
|
end
|
||||||
player.lastSeenInternal = GetTime()
|
player.lastSeenInternal = GetTime()
|
||||||
|
if player.zone ~= zone then
|
||||||
|
aura_env.NotifyZoneChanged(player, zone)
|
||||||
|
end
|
||||||
player.zone = zone
|
player.zone = zone
|
||||||
player.lastSeen = timestamp
|
player.lastSeen = timestamp
|
||||||
aura_env.stinkies[name] = player
|
aura_env.stinkies[name] = player
|
||||||
|
@@ -7,6 +7,7 @@ end
|
|||||||
|
|
||||||
aura_env.ttl = 12
|
aura_env.ttl = 12
|
||||||
aura_env.ignored = {"Maritza", "Goodbones"}
|
aura_env.ignored = {"Maritza", "Goodbones"}
|
||||||
|
local channelId = nil
|
||||||
|
|
||||||
---@class aura_env
|
---@class aura_env
|
||||||
---@field raceMap table<string, string>
|
---@field raceMap table<string, string>
|
||||||
@@ -257,6 +258,20 @@ local NotifyAll = function(msg)
|
|||||||
table.insert(aura_env.messageQueue, message)
|
table.insert(aura_env.messageQueue, message)
|
||||||
end
|
end
|
||||||
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
|
---@param player Player
|
||||||
---@return nil
|
---@return nil
|
||||||
aura_env.Notify = function(player)
|
aura_env.Notify = function(player)
|
||||||
@@ -268,6 +283,19 @@ aura_env.Notify = function(player)
|
|||||||
aura_env.NotifyChannel(player)
|
aura_env.NotifyChannel(player)
|
||||||
end
|
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
|
---@param player Player
|
||||||
---@return nil
|
---@return nil
|
||||||
aura_env.NotifyGone = function(player)
|
aura_env.NotifyGone = function(player)
|
||||||
@@ -283,7 +311,6 @@ end
|
|||||||
-- CHANNEL fuckery
|
-- CHANNEL fuckery
|
||||||
local channel = aura_env.config.channelName or "foobar"
|
local channel = aura_env.config.channelName or "foobar"
|
||||||
local password = aura_env.config.channelPassword
|
local password = aura_env.config.channelPassword
|
||||||
local channelId = nil
|
|
||||||
|
|
||||||
local function GetChannelId(channelName)
|
local function GetChannelId(channelName)
|
||||||
local channels = {GetChannelList()}
|
local channels = {GetChannelList()}
|
||||||
@@ -309,19 +336,6 @@ channelId = GetChannelId(channel)
|
|||||||
aura_env.channelId = channelId
|
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
|
|
||||||
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
|
---@param player Player
|
||||||
---@return nil
|
---@return nil
|
||||||
aura_env.NotifyChannel = function(player)
|
aura_env.NotifyChannel = function(player)
|
||||||
|
Reference in New Issue
Block a user