Add zone changed messages
This commit is contained in:
@@ -7,6 +7,7 @@ end
|
||||
|
||||
aura_env.ttl = 12
|
||||
aura_env.ignored = {"Maritza", "Goodbones"}
|
||||
local channelId = nil
|
||||
|
||||
---@class aura_env
|
||||
---@field raceMap table<string, string>
|
||||
@@ -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)
|
||||
|
Reference in New Issue
Block a user