SkinraveRewardTicketHandler/SkinraveRewardTicketHandler.user.js

46 lines
1.9 KiB
JavaScript

// ==UserScript==
// @name Skinrave Reward Ticket Handler
// @namespace http://tampermonkey.net/
// @version 2025-03-05
// @description Claims tickets and tries to join minutely roulettes with the minimum bet
// @author Abhorrent_Anger
// @match https://skinrave.gg/en/reward-tickets
// @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 REJOIN_TIMER = 35000;
const INITIAL_TIMER = 2000;
const CLAIM_BUTTON_SELECTOR = "div.flex.justify-end.items-center.gap-2.h-full button:not(:disabled)";
const TICKET_BALANCE_SELECTOR = "div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > span:nth-child(2) > span:nth-child(1)";
const MAIN_WINDOW_SELECTOR = "div.flex.overflow-y-auto.overflow-x-hidden";
const MIN_SELECTOR = "body > div.flex.overflow-y-auto.overflow-x-hidden > div.w-full.flex > div.w-full.max-w-full > main > main > div button:nth-child(8)";
const JOIN_GAME_SELECTOR = "body > div.flex.overflow-y-auto.overflow-x-hidden > div.w-full.flex > div.w-full.max-w-full > main > main > div button.max-w-full:not(:disabled)";
const MINUTE_SELECTOR = "body > div:contains('minute')";
function clickClaimButton() {
$(CLAIM_BUTTON_SELECTOR).click();
}
function clickJoinButton() {
if ($(TICKET_BALANCE_SELECTOR).text() == '0.00' || $(MINUTE_SELECTOR).length == 0) {
return false;
}
$(MIN_SELECTOR).click();
$(JOIN_GAME_SELECTOR).click();
console.log('Attempted to Join the Game');
}
function runRoutines() {
clickClaimButton();
clickJoinButton();
setTimeout(runRoutines, REJOIN_TIMER);
}
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
setTimeout(runRoutines, INITIAL_TIMER);
});