SkinraveRewardTicketHandler/SkinraveRewardTicketHandler.user.js
2025-06-03 10:24:00 +03:00

52 lines
2.0 KiB
JavaScript

// ==UserScript==
// @name Skinrave Reward Ticket Handler
// @namespace https://pube.tk
// @version 2025-06-03
// @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 = 70000;
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 AMOUNT_SELECTOR = "#searchParam";
const MIN_AMOUNT = "0.01";
const JOIN_GAME_SELECTOR = "div.w-full.max-w-full button.max-w-full:not(:disabled)";
const MINUTE_SELECTOR = "body > div:contains('minute')";
var lastBalance;
function clickClaimButton() {
$(CLAIM_BUTTON_SELECTOR).click();
}
function clickJoinButton() {
let balance = $(TICKET_BALANCE_SELECTOR).text();
let isEmptyBalance = (balance == '0.00' && (lastBalance == '0.01' || lastBalance == null));
if (isEmptyBalance || $(MINUTE_SELECTOR).length == 0) {
console.log('Not joining the game due to insufficient tickets!');
return false;
}
console.log('Attempting to join the game...');
$(AMOUNT_SELECTOR).val(MIN_AMOUNT);
$(JOIN_GAME_SELECTOR).click();
lastBalance = balance;
}
function runRoutines() {
clickClaimButton();
clickJoinButton();
setTimeout(runRoutines, REJOIN_TIMER);
}
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
setTimeout(runRoutines, INITIAL_TIMER);
});