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 aura_env.BattlePass = { Hide = function() uDailyRewFrame:Hide() end, ---@param day number ---@return Frame, string|nil GetDayCard = function(day) local frame = _G[string.format("card%d", day)] if frame == nil then return UIParent, string.format("card%d is nil", day) end return frame, nil end, ---@return {day: number, text: Frame, button: Frame}, string|nil GetActiveDayInfo = function() for i = 1, 7 do local dayCard, err = aura_env.BattlePass.GetDayCard(i) if err ~= nil then return { day = i, text = nil, button = nil }, err end local textFrame = dayCard.text_w if textFrame ~= nil then if textFrame:GetText() ~= nil then return { day = i, text = textFrame, button = nil }, nil end else print(string.format("card%d.text_w is nil", i)) end local button = _G[string.format("uDRWbutton_get%d", i)] if button ~= nil then return { day = i, text = nil, button = button }, nil end end return { day = 0, text = nil, button = nil }, "No active days found" end, GetRemainingTime = function() local activeDayInfo, err = aura_env.BattlePass.GetActiveDayInfo() if err ~= nil then return 0, err end if activeDayInfo.text == nil then return 0, "No time text found" end local minutes = tonumber(activeDayInfo.text:GetText():match("(%d+) minutes")) if minutes == nil then return 0, "No time text found" end return minutes, nil end } local aura_env = aura_env aura_env.Tick = function() -- TODO: If cannot find time text try find claim button -- If claim button then click claim button and set isClaimed to true -- OR better yet change the click handler to one that updates isClaimed to true -- And THEN click the button -- idk if that works though -- uDRWbutton_get is the button local remainingTime = aura_env.BattlePass.GetRemainingTime() if remainingTime == 0 then local activeDayInfo, err = aura_env.BattlePass.GetActiveDayInfo() if activeDayInfo.button ~= nil then activeDayInfo.button:Click() WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][Today].isClaimed = true end end WeakAurasSaved.Cyka.LoginInfo[UnitName("player")][Today].timeLeft = remainingTime aura_env.BattlePass.Hide() C_Timer.After(0.1, function() aura_env.BattlePass.Hide() end) end