Add toggle for whispering

This commit is contained in:
2024-12-12 14:51:38 +01:00
parent 71894a2613
commit f3542d6e94
2 changed files with 37 additions and 25 deletions

View File

@@ -41,8 +41,9 @@ if not Heimdall_Data then Heimdall_Data = {} end
---@field enabled boolean
---@field ignored table<string, boolean>
---@field notifyChannel string
---@field zoneNotifyFor table<string, boolean>
---@field ttl number
---@field doWhisper boolean
---@field zoneNotifyFor table<string, boolean>
---@class HeimdallMessengerConfig
---@field enabled boolean
@@ -60,6 +61,9 @@ if not Heimdall_Data then Heimdall_Data = {} end
data.messenger = {
queue = {}
}
data.who = {
ignored = {},
}
data.config = {
spotter = {
@@ -77,6 +81,7 @@ data.config = {
ignored = {},
notifyChannel = "Foobar",
ttl = 10,
doWhisper = true,
zoneNotifyFor = {
["Orgrimmar"] = true,
["Thunder Bluff"] = true,

View File

@@ -135,14 +135,16 @@ local function Notify(player)
}
table.insert(data.messenger.queue, msg)
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
if data.config.who.doWhisper then
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
end
end
return nil
@@ -170,14 +172,16 @@ local function NotifyZoneChanged(player, zone)
}
table.insert(data.messenger.queue, msg)
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
if data.config.who.doWhisper then
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
end
end
return nil
@@ -199,14 +203,16 @@ local function NotifyGone(player)
}
table.insert(data.messenger.queue, msg)
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
if data.config.who.doWhisper then
for _, name in pairs(data.config.whisperNotify) do
---@type Message
local msg = {
channel = "WHISPER",
data = name,
message = text
}
table.insert(data.messenger.queue, msg)
end
end
return nil
@@ -309,6 +315,7 @@ if not data.who.whoTicker then
whoQueryIdx = 1
end
lastQuery = query
print("Running who query: " .. tostring(query.query))
SendWho(query.query)
end)
end