Files
wow-weakauras/FreshShit/BattlePassTimer/BattlePassAccountWideTimer/init.lua

28 lines
929 B
Lua

if WeakAurasSaved.Cyka == nil then WeakAurasSaved.Cyka = {} end
if WeakAurasSaved.Cyka.LoginInfo == nil then WeakAurasSaved.Cyka.LoginInfo = {} end
Today = date("%Y-%m-%d")
if WeakAurasSaved.Cyka.LoginInfo[UnitName("player")] == nil then WeakAurasSaved.Cyka.LoginInfo[UnitName("player")] = {} end
if WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][Today] == nil then
WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][Today] = {
isClaimed = false,
timeLeft = 120,
}
end
---@param unit string
---@return number
aura_env.GetTimeLeft = function(unit)
local timeLeft = WeakAurasSaved.Cyka.LoginInfo[unit][Today].timeLeft
if timeLeft == nil then return 120 end
return timeLeft
end
---@return string
aura_env.GetAllTimeLeft = function()
local out = ""
for unit, _ in pairs(WeakAurasSaved.Cyka.LoginInfo) do
local timeLeft = aura_env.GetTimeLeft(unit)
out = out .. unit .. ": " .. timeLeft .. "\n"
end
return out
end