TrueBonus Auto Attack + Refresh

Auto login, auto attack at max energy and refresh every minute

当前为 2025-12-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         TrueBonus Auto Attack + Refresh
// @namespace    https://truebonus.ru/
// @version      1.1
// @description  Auto login, auto attack at max energy and refresh every minute
// @author       Rubystance
// @license      MIT
// @match        https://truebonus.ru/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const EMAIL = "YOUR_EMAIL_HERE";
    const MAX_ENERGY_TEXT = "Attack (20)";
    const REFRESH_TIME = 60000; // 1 minute

    function waitFor(selector, callback, interval = 300) {
        const timer = setInterval(() => {
            const el = document.querySelector(selector);
            if (el) {
                clearInterval(timer);
                callback(el);
            }
        }, interval);
    }

    function autoRefresh() {
        setTimeout(() => {
            location.reload();
        }, REFRESH_TIME);
    }

    // Login / Register page
    if (location.pathname === "/" || location.pathname === "/index.php") {
        waitFor('input[name="email"]', (input) => {
            const form = input.closest('form');
            const button = form?.querySelector('button[type="submit"]');

            input.focus();
            input.value = EMAIL;
            input.dispatchEvent(new Event('input', { bubbles: true }));
            input.dispatchEvent(new Event('change', { bubbles: true }));

            if (button) {
                setTimeout(() => button.click(), 500);
            }
        });
    }

    // Dashboard
    if (location.pathname === "/dashboard") {

        waitFor('#attack-btn', (attackBtn) => {

            const tryAttack = () => {
                if (
                    attackBtn.innerText.includes(MAX_ENERGY_TEXT) &&
                    !attackBtn.disabled
                ) {
                    attackBtn.click();
                }
            };

            // Initial attempt
            tryAttack();

            // Real-time observer
            const observer = new MutationObserver(tryAttack);
            observer.observe(attackBtn, {
                childList: true,
                subtree: true,
                characterData: true,
                attributes: true
            });

            // Force refresh every minute
            autoRefresh();
        });
    }

})();