Balance check fix

This commit is contained in:
Abhorrent_Anger 2025-03-10 14:42:24 +02:00
parent f285265faa
commit 43b0f92332

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Skinrave Reward Ticket Handler
// @namespace http://tampermonkey.net/
// @version 2025-03-05
// @version 2025-03-07
// @description Claims tickets and tries to join minutely roulettes with the minimum bet
// @author Abhorrent_Anger
// @match https://skinrave.gg/en/reward-tickets
@ -12,7 +12,7 @@
// @run-at document-end
// ==/UserScript==
const REJOIN_TIMER = 35000;
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)";
@ -21,17 +21,23 @@ const MIN_SELECTOR = "body > div.flex.overflow-y-auto.overflow-x-hidden > div.w-
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')";
var lastBalance;
function clickClaimButton() {
$(CLAIM_BUTTON_SELECTOR).click();
}
function clickJoinButton() {
if ($(TICKET_BALANCE_SELECTOR).text() == '0.00' || $(MINUTE_SELECTOR).length == 0) {
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...');
$(MIN_SELECTOR).click();
$(JOIN_GAME_SELECTOR).click();
console.log('Attempted to Join the Game');
lastBalance = balance;
}
function runRoutines() {
@ -42,4 +48,4 @@ function runRoutines() {
waitForKeyElements(MAIN_WINDOW_SELECTOR, () => {
setTimeout(runRoutines, INITIAL_TIMER);
});
});