From 5c6b37731d47e339429a92451c13f37ccb0a2961 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 20 Oct 2024 17:06:02 +0200 Subject: [PATCH] Fix up sound notifications in stinky detector --- FreshShit/StinkyDetector/event3.lua | 3 ++- FreshShit/StinkyDetector/init.lua | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/FreshShit/StinkyDetector/event3.lua b/FreshShit/StinkyDetector/event3.lua index 88f756a..546ccf7 100644 --- a/FreshShit/StinkyDetector/event3.lua +++ b/FreshShit/StinkyDetector/event3.lua @@ -93,8 +93,9 @@ function(allstates, e, prefix, msg, ...) return false end - if not allstates[name] then + if not aura_env.soundNotifyTimer[name] or aura_env.soundNotifyTimer[name] < GetTime() then PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") + aura_env.soundNotifyTimer[name] = GetTime() + aura_env.config.alertThrottle end allstates[name] = { diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index c661e9d..9a3bb73 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -1,4 +1,17 @@ ----@type Message[] +---@class aura_env +---@field messageQueue Message[] +---@field separator string +---@field addonprefix string +---@field config table +---@field stinkies Stinky[] +---@field raceFactions table +---@field localStinkies table +---@field soundNotifyTimer table +---@field GetZone fun(): string +---@field RegisterKill fun(source: string, destination: string, spellName: string, overkill: number) +---@field StinkyDetected fun(name: string) + +aura_env.soundNotifyTimer = {} aura_env.messageQueue = {} aura_env.separator = "ΕΎ" aura_env.addonprefix = "STINKY_DETECTOR" @@ -22,7 +35,6 @@ local toNotify = StrSplit(aura_env.config.notify, ",") for i, part in ipairs(toNotify) do toNotify[i] = strtrim(part) end ----@type Stinky[] aura_env.stinkies = {}