diff --git a/GetDropFreeCaseClaimer.user.js b/GetDropFreeCaseClaimer.user.js index 9dfe06b..8518c05 100644 --- a/GetDropFreeCaseClaimer.user.js +++ b/GetDropFreeCaseClaimer.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Get Drop Free Case Claimer // @namespace https://pube.tk -// @version 2025-09-20 +// @version 2025-09-21 // @description Claims free cases // @author Abhorrent_Anger // @match https://getdrop.org/case/free* @@ -14,8 +14,10 @@ const INITIAL_TIMER = 2000; const RECHECK_TIMER = 60 * 1000; +const RELOAD_TIMER = 30 * 60 * 1000; const MAIN_WINDOW_SELECTOR = "main"; const FREE_CASE_BUTTON = '.free-open.btn-opencase span'; +const MINUTE_SELECTOR = '.number.min.m'; function clickFreeCase() { $(FREE_CASE_BUTTON).click(); @@ -27,6 +29,24 @@ function runRoutines() { setTimeout(runRoutines, RECHECK_TIMER); } +function setupReload() { + let reload_timer = Math.max(RELOAD_TIMER, getCooldown()); + console.log('Sleeping for '+reload_timer+' seconds...'); + setTimeout(reload, reload_timer); +} + +function getCooldown() { + let time = 0; + time += ($(MINUTE_SELECTOR).text() * 60 * 1000) + 60 * 1000; + return time; +} + +function reload() { + console.log('Reloading...'); + location.reload(); +} + waitForKeyElements(MAIN_WINDOW_SELECTOR, () => { setTimeout(runRoutines, INITIAL_TIMER); + setTimeout(setupReload, RECHECK_TIMER); }); \ No newline at end of file