From 8be102a6be727af3485699935b51b237332264cc Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 14 Oct 2024 15:57:13 +0200 Subject: [PATCH] Implement threat threshold validation --- FreshShit/StinkyDetector/init.lua | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index e833222..1573f60 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -38,6 +38,14 @@ 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 @@ -46,6 +54,14 @@ 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 @@ -58,6 +74,14 @@ 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 @@ -66,6 +90,14 @@ 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 @@ -82,7 +114,8 @@ Message = { QueueNotifyKilledAddonGuild = function(faction, source, destination, spellName) if not aura_env.config.killNotifyAddonGuild then return end if aura_env.config.debug then print("Queueing notify addon guild:") end - local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, aura_env.separator, spellName) + local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, + aura_env.separator, spellName) local message = Message.new(text, nil, "GUILD", true) if aura_env.config.debug then DevTools_Dump(message) end table.insert(aura_env.messageQueue, message) @@ -94,7 +127,8 @@ Message = { QueueNotifyKilledAddonWhisper = function(faction, source, destination, spellName) if not aura_env.config.killNotifyAddonWhisper then return end if aura_env.config.debug then print("Queueing notify addon whisper:") end - local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, aura_env.separator, spellName) + local text = string.format("%s%s%s%s%s%s%s", faction, aura_env.separator, source, aura_env.separator, destination, + aura_env.separator, spellName) for _, to in ipairs(toNotify) do local message = Message.new(text, to, "WHISPER", true) if aura_env.config.debug then DevTools_Dump(message) end