Files
wow-weakauras/Complete Projects/Legion/JanaPullTimer.lua
2024-08-24 22:43:07 +02:00

47 lines
1.4 KiB
Lua

--CHAT_MSG_ADDON
function(e, ...)
local msg = select(2, ...)
if msg:match("Pull") and msg:match("%d+") then
local pull = msg:match("%d+")
print(pull)
end
end
function(allstates, e, msg, sender)
if e == "CHAT_MSG_SAY" or e == "CHAT_MSG_PARTY" or e == "CHAT_MSG_PARTY_LEADER" or e == "CHAT_MSG_ADDON" then
if e ~= "CHAT_MSG_ADDON" then
if (sender == "Angellianna" or sender == "Piinkiepiie" or sender == "Smolpotato") and msg:match("%d+") and select(1, msg:find("%d+")) == 1 and select(2, msg:find(".+")) <= 3 then
aura_env.pullTime = tonumber(msg:match("%d+"))
else
if sender:match("Pull") then
aura_env.pullTime = tonumber(sender:match("%d+"))
end
end
if aura_env.timer then
aura_env.timer:Cancel()
end
aura_env.timer = C_Timer.NewTimer(aura_env.pullTime, function() WeakAuras.ScanEvents("HIDE_PULL") end)
allstates[1] = {
show = true,
changed = true,
progressType = "timed",
expirationTime = GetTime() + aura_env.pullTime,
duration = aura_env.pullTime,
}
return true
elseif e == "HIDE_PULL" then
allstates[1].show = false
allstates[1].changed = true
return true
elseif e == "PLAYER_REGEN_DISABLED" then
if allstates[1] then
allstates[1].show = false
allstates[1].changed = true
end
return true
end
end