Rework battle pass timer into multiple weakauras
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user