Move notification and validation to event3
This commit is contained in:
@@ -52,15 +52,25 @@ function(allstates, e, prefix, msg, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not prefix or prefix ~= aura_env.addonprefix then return end
|
if not prefix or prefix ~= aura_env.addonprefix then return end
|
||||||
local data = string.split(msg, aura_env.separator)
|
local name, threat, note = string.split(aura_env.separator, msg)
|
||||||
local name = data[1]
|
if not name then
|
||||||
local threat = data[2]
|
if aura_env.config.debug then
|
||||||
local note = data[3]
|
print("Could not get name for " .. msg)
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
allstates[stinky] = {
|
if threat < aura_env.config.threatThreshold then
|
||||||
|
if aura_env.config.debug then
|
||||||
|
print(string.format("Skipping notify due to low threat (%d < %d)", threat, aura_env.config.threatThreshold))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
allstates[name] = {
|
||||||
show = true,
|
show = true,
|
||||||
changed = true,
|
changed = true,
|
||||||
name = string.format("%-30s", stinky),
|
name = string.format("%-30s", name),
|
||||||
progressType = "timed",
|
progressType = "timed",
|
||||||
duration = 60,
|
duration = 60,
|
||||||
expirationTime = GetTime() + 60,
|
expirationTime = GetTime() + 60,
|
||||||
@@ -68,6 +78,7 @@ function(allstates, e, prefix, msg, ...)
|
|||||||
index = GetTime(),
|
index = GetTime(),
|
||||||
progress = string.format("%20s", "0s"),
|
progress = string.format("%20s", "0s"),
|
||||||
}
|
}
|
||||||
|
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
---@type Message[]
|
---@type Message[]
|
||||||
aura_env.messageQueue = {}
|
aura_env.messageQueue = {}
|
||||||
aura_env.separator = "\\"
|
aura_env.separator = "ž"
|
||||||
aura_env.addonprefix = "STINKY_DETECTOR"
|
aura_env.addonprefix = "STINKY_DETECTOR"
|
||||||
RegisterAddonMessagePrefix(aura_env.addonprefix)
|
RegisterAddonMessagePrefix(aura_env.addonprefix)
|
||||||
|
|
||||||
@@ -38,14 +38,6 @@ Message = {
|
|||||||
---@param stinky Stinky
|
---@param stinky Stinky
|
||||||
QueueNotifyGuild = function(stinky)
|
QueueNotifyGuild = function(stinky)
|
||||||
if not aura_env.config.stinkyNotifyGuild then return end
|
if not aura_env.config.stinkyNotifyGuild then return end
|
||||||
if stinky.threat < aura_env.config.threatThreshold then
|
|
||||||
if aura_env.config.debug then
|
|
||||||
print(string.format("Skipping notify guild due to low threat (%d < %d)",
|
|
||||||
stinky.threat, aura_env.config.threatThreshold))
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if aura_env.config.debug then print("Queueing notify guild:") end
|
if aura_env.config.debug then print("Queueing notify guild:") end
|
||||||
local message = Message.new(stinky:FormMessage(), nil, "GUILD")
|
local message = Message.new(stinky:FormMessage(), nil, "GUILD")
|
||||||
if aura_env.config.debug then DevTools_Dump(message) end
|
if aura_env.config.debug then DevTools_Dump(message) end
|
||||||
@@ -54,14 +46,6 @@ Message = {
|
|||||||
---@param stinky Stinky
|
---@param stinky Stinky
|
||||||
QueueNotifyWhisper = function(stinky)
|
QueueNotifyWhisper = function(stinky)
|
||||||
if not aura_env.config.stinkyNotifyWhisper then return end
|
if not aura_env.config.stinkyNotifyWhisper then return end
|
||||||
if stinky.threat < aura_env.config.threatThreshold then
|
|
||||||
if aura_env.config.debug then
|
|
||||||
print(string.format("Skipping notify whisper due to low threat (%d < %d)",
|
|
||||||
stinky.threat, aura_env.config.threatThreshold))
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if aura_env.config.debug then print("Queueing notify whisper:") end
|
if aura_env.config.debug then print("Queueing notify whisper:") end
|
||||||
local text = stinky:FormMessage()
|
local text = stinky:FormMessage()
|
||||||
for _, to in ipairs(toNotify) do
|
for _, to in ipairs(toNotify) do
|
||||||
@@ -74,14 +58,6 @@ Message = {
|
|||||||
---@param stinky Stinky
|
---@param stinky Stinky
|
||||||
QueueNotifyAddonGuild = function(stinky)
|
QueueNotifyAddonGuild = function(stinky)
|
||||||
if not aura_env.config.stinkyNotifyAddonGuild then return end
|
if not aura_env.config.stinkyNotifyAddonGuild then return end
|
||||||
if stinky.threat < aura_env.config.threatThreshold then
|
|
||||||
if aura_env.config.debug then
|
|
||||||
print(string.format("Skipping notify addon guild due to low threat (%d < %d)",
|
|
||||||
stinky.threat, aura_env.config.threatThreshold))
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if aura_env.config.debug then print("Queueing notify addon guild:") end
|
if aura_env.config.debug then print("Queueing notify addon guild:") end
|
||||||
local message = Message.new(stinky:FormAddonMessage(), nil, "GUILD", true)
|
local message = Message.new(stinky:FormAddonMessage(), nil, "GUILD", true)
|
||||||
if aura_env.config.debug then DevTools_Dump(message) end
|
if aura_env.config.debug then DevTools_Dump(message) end
|
||||||
@@ -90,14 +66,6 @@ Message = {
|
|||||||
---@param stinky Stinky
|
---@param stinky Stinky
|
||||||
QueueNotifyAddonWhisper = function(stinky)
|
QueueNotifyAddonWhisper = function(stinky)
|
||||||
if not aura_env.config.stinkyNotifyAddonWhisper then return end
|
if not aura_env.config.stinkyNotifyAddonWhisper then return end
|
||||||
if stinky.threat < aura_env.config.threatThreshold then
|
|
||||||
if aura_env.config.debug then
|
|
||||||
print(string.format("Skipping notify addon whisper due to low threat (%d < %d)",
|
|
||||||
stinky.threat, aura_env.config.threatThreshold))
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if aura_env.config.debug then print("Queueing notify addon whisper:") end
|
if aura_env.config.debug then print("Queueing notify addon whisper:") end
|
||||||
local text = stinky:FormMessage()
|
local text = stinky:FormMessage()
|
||||||
for _, to in ipairs(toNotify) do
|
for _, to in ipairs(toNotify) do
|
||||||
@@ -285,7 +253,6 @@ aura_env.StinkyDetected = function(name)
|
|||||||
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
if not aura_env.localStinkies[name] or aura_env.localStinkies[name] <
|
||||||
GetTime() - 60 then
|
GetTime() - 60 then
|
||||||
local stinky = aura_env.stinkies[name]
|
local stinky = aura_env.stinkies[name]
|
||||||
PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master")
|
|
||||||
Message.QueueNotifyGuild(stinky)
|
Message.QueueNotifyGuild(stinky)
|
||||||
Message.QueueNotifyWhisper(stinky)
|
Message.QueueNotifyWhisper(stinky)
|
||||||
Message.QueueNotifyAddonGuild(stinky)
|
Message.QueueNotifyAddonGuild(stinky)
|
||||||
|
|||||||
Reference in New Issue
Block a user