diff --git a/FreshShit/StinkyDetector/event.lua b/FreshShit/StinkyDetector/event.lua new file mode 100644 index 0000000..3517b4c --- /dev/null +++ b/FreshShit/StinkyDetector/event.lua @@ -0,0 +1,72 @@ +-- COMBAT_LOG_EVENT_UNFILTERED TICKER_1000 +---@param allstates allstates +---@param e string +function(allstates, e, ...) + if e == "TICKER_1000" then + local ttl = 120 + for _, state in pairs(allstates) do + if state.progress then + local elapsedTime = GetTime() - state.index + if elapsedTime > ttl then + state.show = false + state.changed = true + else + local prettyTime = "" + + local minutes = 0 + while elapsedTime > 60 do + elapsedTime = elapsedTime - 60 + minutes = minutes + 1 + end + if minutes > 0 then + prettyTime = string.format("%s%dm", prettyTime, minutes) + end + if elapsedTime > 0 then + prettyTime = string.format("%s %ds", prettyTime, elapsedTime) + end + + state.progress = string.format("%20s", prettyTime) + state.changed = true + end + end + end + return true + end + + + local detected = false + local stinky = "" + + local source, err = CLEUParser.GetSourceName(...) + if not err then + if aura_env.stinkies[source] then + stinky = source + detected = true + end + end + if not detected then + local destination, err = CLEUParser.GetDestName(...) + if not err then + if aura_env.stinkies[destination] then + stinky = destination + detected = true + end + end + end + + if detected then + aura_env.StinkyDetected(stinky) + allstates[stinky] = { + show = true, + changed = true, + name = string.format("%30s", stinky), + progressType = "timed", + duration = 60, + expirationTime = GetTime() + 60, + autohide = true, + index = GetTime(), + progress = string.format("%20s", "0s"), + } + end + return true +end \ No newline at end of file diff --git a/FreshShit/StinkyDetector/init.lua b/FreshShit/StinkyDetector/init.lua new file mode 100644 index 0000000..cc39fcb --- /dev/null +++ b/FreshShit/StinkyDetector/init.lua @@ -0,0 +1,12 @@ +if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end +if not WeakAurasSaved.Cyka.Stinkies then WeakAurasSaved.Cyka.Stinkies = {} end + +aura_env.stinkies = WeakAurasSaved.Cyka.Stinkies +aura_env.stinkies[UnitName("player")] = true +aura_env.localStinkies = {} + +---@param name string +aura_env.StinkyDetected = function(name) + aura_env.localStinkies[name] = GetTime() + DevTools_Dump(aura_env.localStinkies) +end \ No newline at end of file