diff --git a/FreshShit/StinkyDetector/event.lua b/FreshShit/StinkyDetector/event.lua index abf32e0..d66f096 100644 --- a/FreshShit/StinkyDetector/event.lua +++ b/FreshShit/StinkyDetector/event.lua @@ -1,6 +1,8 @@ -- COMBAT_LOG_EVENT_UNFILTERED ---@param e string function(e, ...) + -- /run RegisterAddonMessagePrefix("STINKY_DETECTOR") + -- RegisterAddonMessagePrefix(aura_env.addonprefix) local detected = false local stinky = "" diff --git a/FreshShit/StinkyDetector/event2.lua b/FreshShit/StinkyDetector/event2.lua index ab3bf14..ea4c274 100644 --- a/FreshShit/StinkyDetector/event2.lua +++ b/FreshShit/StinkyDetector/event2.lua @@ -7,6 +7,7 @@ function() table.remove(aura_env.messageQueue, 1) if aura_env.config.debug then print(string.format("Processing message; %d in queue", #aura_env.messageQueue)) + DevTools_Dump(message) end if message.addon then diff --git a/FreshShit/StinkyDetector/event3.lua b/FreshShit/StinkyDetector/event3.lua index fc7df69..88f756a 100644 --- a/FreshShit/StinkyDetector/event3.lua +++ b/FreshShit/StinkyDetector/event3.lua @@ -86,7 +86,12 @@ function(allstates, e, prefix, msg, ...) end local stinky = aura_env.stinkies[name] - if not stinky then return false end + if not stinky then + if aura_env.config.debug then + print(string.format("Could not find stinky for %s", name)) + end + return false + end if not allstates[name] then PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua index 0af3cb5..febd77c 100644 --- a/FreshShit/StinkyDetector/init.lua +++ b/FreshShit/StinkyDetector/init.lua @@ -1,6 +1,3 @@ --- TODO: Add zone detection and all that shit so we're not always in orgrimmar --- see GetSubZoneText() and GetZoneText() - ---@type Message[] aura_env.messageQueue = {} aura_env.separator = "ΕΎ" @@ -9,31 +6,24 @@ RegisterAddonMessagePrefix(aura_env.addonprefix) ---@param string string ---@param deliminer string ----@return string[] +---@return string[], string|nil local function StrSplit(input, deliminer) + if not deliminer then return {}, "deliminer is nil" end + if not input then return {}, "input is nil" end local parts = {} for part in string.gmatch(input, "([^" .. deliminer .. "]+)") do table.insert(parts, strtrim(part)) end - return parts + return parts, nil end ---@type string[] -local toNotify = StrSplit(msg, ",") +local toNotify = StrSplit(aura_env.config.notify, ",") for i, part in ipairs(toNotify) do toNotify[i] = strtrim(part) end --- local toNotify = { "Deathleta" } - ---@type Stinky[] aura_env.stinkies = {} -local stinkies = StrSplit(msg, ",") -for i, part in ipairs(stinkies) do - local datum = StrSplit(part, ":") - local name = strtrim(datum[1]) - local threat = tonumber(strtrim(datum[2] or "0")) - aura_env.stinkies[name] = Stinky.new(name, threat) -end ---@class Message @@ -212,6 +202,14 @@ aura_env.GetZone = function() return string.format("%s (%s)", GetZoneText(), GetSubZoneText()) end +local stinkies = StrSplit(aura_env.config.stinkies, ",") +for i, part in ipairs(stinkies) do + local datum = StrSplit(part, ":") + local name = strtrim(datum[1]) + local threat = tonumber(strtrim(datum[2] or "0")) + aura_env.stinkies[name] = Stinky.new(name, threat) +end + local killSpamTime = 30 local recentlyKilled = {} aura_env.RegisterKill = function(source, destination, spellName, overkill) @@ -237,6 +235,7 @@ aura_env.localStinkies = {} ---@param name string aura_env.StinkyDetected = function(name) + if aura_env.config.debug then print(string.format("StinkyDetected (%s)", name)) end if not aura_env.localStinkies[name] or aura_env.localStinkies[name] < GetTime() - aura_env.config.messageThrottle then local stinky = aura_env.stinkies[name]