Files
wow-weakauras/FreshShit/StinkyDetector/event2.lua

45 lines
1.1 KiB
Lua

-- TICKER_1000
---@param allstates allstates
---@param e string
---@param prefix string
---@param msg string
function(allstates, e, prefix, msg, ...)
for i = 1, 40 do
if UnitIsPlayer("nameplate" .. i) then
local name = UnitName("nameplate" .. i)
if aura_env.stinkies[name] then
aura_env.StinkyDetected(name)
end
end
end
local ttl = aura_env.config.ttl or 10
for stinky, data in pairs(aura_env.detectedStinkies) do
local elapsed = GetTime() - data.seen
if allstates[stinky] then
if elapsed > ttl then
allstates[stinky].show = false
allstates[stinky].changed = true
aura_env.detectedStinkies[stinky] = nil
else
allstates[stinky].progress = string.format("%20ss", string.format("%.1f", elapsed))
allstates[stinky].changed = true
end
else
allstates[stinky] = {
show = true,
changed = true,
name = string.format("%-20s", stinky),
progressType = "timed",
duration = ttl,
expirationTime = GetTime() + ttl,
autohide = true,
index = GetTime(),
progress = string.format("%20ss", string.format("%.1f", elapsed))
}
end
end
return true
end