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