Bonk.io Ultimate Script

Add rainbow styles, auto-join games, UI tweaks, hotkeys, and more to Bonk.io. Activated via commands.

目前为 2024-12-17 提交的版本。查看 最新版本

// ==UserScript==
// @name         Bonk.io Ultimate Script
// @namespace    http://tampermonkey.net/
// @version      17.8.9
// @description  Add rainbow styles, auto-join games, UI tweaks, hotkeys, and more to Bonk.io. Activated via commands.
// @author       YourName
// @match        https://bonk.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let isRainbowActive = false;
    let isAutoJoinActive = false;
    let isChatBoostActive = false;
    let isAutoPlayActive = false;
    let customSkin = null;
    let hotkeys = {};

    let hue = 0;

    function setupCommandListener() {
        document.addEventListener('keydown', (e) => {
            if (e.key === 'Enter') {
                setTimeout(() => {
                    const chatInput = document.querySelector('#chatinput');
                    if (!chatInput) return;

                    const command = chatInput.value.trim().toLowerCase();
                    chatInput.value = ''; // Clear input

                    // Handle commands
                    switch (command) {
                        case '/rainbowstyle':
                            isRainbowActive = !isRainbowActive;
                            console.log(`Rainbow Style: ${isRainbowActive ? 'Enabled' : 'Disabled'}`);
                            break;
                        case '/autojoin':
                            isAutoJoinActive = !isAutoJoinActive;
                            console.log(`Auto-Join: ${isAutoJoinActive ? 'Enabled' : 'Disabled'}`);
                            break;
                        case '/customizeui':
                            customizeUI();
                            break;
                        case '/sethotkeys':
                            setHotkeys();
                            break;
                        case '/chatboost':
                            isChatBoostActive = !isChatBoostActive;
                            console.log(`Chat Boost: ${isChatBoostActive ? 'Enabled' : 'Disabled'}`);
                            break;
                        case '/setskin':
                            setCustomSkin();
                            break;
                        case '/autoplay':
                            isAutoPlayActive = !isAutoPlayActive;
                            console.log(`Auto-Play: ${isAutoPlayActive ? 'Enabled' : 'Disabled'}`);
                            break;
                        default:
                            console.log(`Unknown command: ${command}`);
                    }
                }, 0);
            }
        });
    }

    function applyRainbowEffect() {
        setInterval(() => {
            if (!isRainbowActive) return;

            hue = (hue + 5) % 360;
            const rectangleColor = `hsl(${hue}, 100%, 50%)`;
            const oppositeColor = `hsl(${(hue + 180) % 360}, 100%, 50%)`;

            try {
                if (window.bonkHost && window.bonkHost.p) {
                    window.bonkHost.p.color = rectangleColor;
                    window.bonkHost.p.outline = rectangleColor;
                }

                const playerName = document.querySelector('.playerName');
                const levelText = document.querySelector('.levelText');
                if (playerName) playerName.style.color = oppositeColor;
                if (levelText) levelText.style.color = oppositeColor;

            } catch (e) {
                console.error('Error applying rainbow effect:', e);
            }
        }, 100);
    }

    function autoJoinGames() {
        setInterval(() => {
            if (!isAutoJoinActive) return;

            try {
                const joinButton = document.querySelector('.joinGameButton');
                if (joinButton) {
                    joinButton.click();
                    console.log('Auto-Joined a game!');
                }
            } catch (e) {
                console.error('Error with Auto-Join:', e);
            }
        }, 1000);
    }

    function customizeUI() {
        alert('UI customization activated! (This is a placeholder — add customization logic here.)');
    }

    function setHotkeys() {
        alert('Hotkey configuration activated! (This is a placeholder — add hotkey logic here.)');
    }

    function chatBoost() {
        if (!isChatBoostActive) return;

        const chatLog = document.querySelector('.chatLog');
        if (chatLog) {
            // Example: Automatically highlight certain messages
            chatLog.querySelectorAll('.chatMessage').forEach((msg) => {
                if (msg.textContent.includes('!')) {
                    msg.style.color = 'red';
                }
            });
        }
    }

    function setCustomSkin() {
        customSkin = prompt('Enter a hex color for your custom skin:');
        if (customSkin && window.bonkHost && window.bonkHost.p) {
            window.bonkHost.p.color = customSkin;
            window.bonkHost.p.outline = customSkin;
            console.log(`Custom skin set to: ${customSkin}`);
        }
    }

    function autoPlay() {
        setInterval(() => {
            if (!isAutoPlayActive) return;

            try {
                if (window.bonkHost && window.bonkHost.p) {
                    // Example: Automatically jump every second
                    window.bonkHost.p.jump();
                    console.log('Auto-Jumping!');
                }
            } catch (e) {
                console.error('Error with Auto-Play:', e);
            }
        }, 1000);
    }

    const waitForGame = setInterval(() => {
        if (typeof window.bonkHost !== 'undefined' && window.bonkHost.p !== undefined) {
            clearInterval(waitForGame);
            setupCommandListener();
            applyRainbowEffect();
            autoJoinGames();
            setInterval(chatBoost, 500); // Enhance chat functionality
            autoPlay();
        }
    }, 100);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址