From 6274f291a104b67dbd64967cf75f37ec62198fa5 Mon Sep 17 00:00:00 2001
From: Abhorrent_Anger <abhorrentanger@cock.li>
Date: Thu, 30 Jan 2025 21:41:13 +0200
Subject: [PATCH] Initial commit

---
 LICENSE                         | 11 ++++++++++
 README.md                       | 11 ++++++++++
 SkinraveDailyCaseOpener.user.js | 37 +++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+)
 create mode 100644 LICENSE
 create mode 100644 README.md
 create mode 100644 SkinraveDailyCaseOpener.user.js

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7a3094a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,11 @@
+DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+Version 2, December 2004
+
+Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
+
+DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. You just DO WHAT THE FUCK YOU WANT TO.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..941b076
--- /dev/null
+++ b/README.md
@@ -0,0 +1,11 @@
+# SkinraveDailyCaseOpener
+
+## Requirements
+* [Tampermonkey](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en) (Chrome)
+* [Greasemonkey](https://addons.mozilla.org/en-us/firefox/addon/greasemonkey/) (Firefox)
+
+## Installation
+1. Ensure that you have either Tampermonkey or Greasemonkey installed.
+2. Download the script [`SkinraveDailyCaseOpener.user.js`](SkinraveDailyCaseOpener.user.js?raw=true).
+3. Confirm that you want to install the script.
+4. The script should now be installed and ready to use. Open the [Reward Ticket](https://skinrave.gg/en/cs2/case-opening/daily-case) page.
\ No newline at end of file
diff --git a/SkinraveDailyCaseOpener.user.js b/SkinraveDailyCaseOpener.user.js
new file mode 100644
index 0000000..5bfc6ee
--- /dev/null
+++ b/SkinraveDailyCaseOpener.user.js
@@ -0,0 +1,37 @@
+// ==UserScript==
+// @name         Skinrave Daily Case Opener
+// @namespace    http://tampermonkey.net/
+// @version      2025-01-30
+// @description  Opens daily cases
+// @author       You
+// @match        https://skinrave.gg/en/cs2/case-opening/daily-case
+// @icon         https://www.google.com/s2/favicons?sz=64&domain=skinrave.gg
+// @grant        none
+// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
+// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js
+// @run-at document-end
+// ==/UserScript==
+
+const RECHECK_TIMER = 60000;
+const INITIAL_TIMER = 2000;
+const MAIN_WINDOW_SELECTOR = "div.flex.overflow-y-auto.overflow-x-hidden";
+const OPEN_BUTTON_SELECTOR = 'body > div.flex.overflow-y-auto.overflow-x-hidden >  div.w-full.flex div.relative.w-fit.items-center.justify-center.gap-1.flex button:not(:disabled)';
+
+function openDailyCase() {
+    let openButton = $(OPEN_BUTTON_SELECTOR);
+    if (openButton.length == 0) {
+        console.log('No daily cases to open');
+        return false;
+    }
+    openButton.click();
+    console.log('Attempted to open a daily case');
+}
+
+function runRoutines() {
+    openDailyCase();
+    setTimeout(runRoutines, RECHECK_TIMER);
+}
+
+waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
+    setTimeout(runRoutines, INITIAL_TIMER);
+});
\ No newline at end of file