Cartel Empire - Quick Refills/Resets

Adds buttons to pages to allow you to quick use point refills and resets without being on the donator page

目前為 2025-04-04 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Cartel Empire - Quick Refills/Resets
// @namespace    baccy.ce
// @version      0.1
// @description  Adds buttons to pages to allow you to quick use point refills and resets without being on the donator page
// @author       Baccy
// @match        https://cartelempire.online/*
// @icon         https://cartelempire.online/images/icon-white.png
// @grant        none
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';

    let title = null;
    let url;
    let header = 1;

    switch (location.pathname) {
        case '/PetShop':
            title = 'Reset Pets';
            url = 'https://cartelempire.online/Donator/ResetPetShop';
            break;
        case '/Town/Club':
            title = 'Reset Sicarios';
            url = 'https://cartelempire.online/Donator/ResetClubRecruitment';
            break;
        case '/Casino/Blackjack':
            title = 'Refill Tokens';
            url = 'https://cartelempire.online/Donator/ResetTokens';
            break;
        case '/Casino/Spinner':
            title = 'Refill Tokens';
            url = 'https://cartelempire.online/Donator/ResetTokens';
            break;
        case '/Casino/Slots':
            title = 'Refill Tokens';
            url = 'https://cartelempire.online/Donator/ResetTokens';
            break;
        case '/Casino/Lottery':
            title = 'Refill Tokens';
            url = 'https://cartelempire.online/Donator/ResetTokens';
            header = 3;
            break;
        case '/Gym':
            title = 'Refill Energy';
            url = 'https://cartelempire.online/Donator/Refill/Energy';
            header = 0;
            break;
        case '/University':
            title = 'Refill Energy';
            url = 'https://cartelempire.online/Donator/Refill/Energy';
            header = 0;
            break;
        case '/Hospital':
            title = 'Refill Life';
            url = 'https://cartelempire.online/Donator/Refill/Life';
            header = 0;
            break;
        default:
            break;
    }

    if (title !== null) {
        const headers = document.querySelectorAll('.header-section');
        if (headers[header]) {
            headers[header].style.cssText = 'display: flex; justify-content: space-between;';
            const button = document.createElement('button');
            button.textContent = title;
            button.style.cssText = 'background: #1e1e1e; color: #fff; border: 1px solid #555; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-size: 14px;';
            button.addEventListener('click', async () => {
                const response = await fetch(url, { method: 'POST' });
                if (response.ok) window.location.reload();
            });
            headers[header].appendChild(button);
        }
    }
})();