YoHoHo.io OpenSource

inf kills, inf score, inf gold, inf wins and more

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YoHoHo.io OpenSource
// @namespace    http://tampermonkey.net/
// @version      4.0
// @description  inf kills, inf score, inf gold, inf wins and more
// @author       YourName
// @match        https://yohoho.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', () => {
        // Create main container
        const panel = document.createElement('div');
        panel.id = 'yh-custom-panel';
        panel.style.position = 'fixed';
        panel.style.top = '50px';
        panel.style.right = '50px';
        panel.style.zIndex = '100000';
        panel.style.backgroundColor = '#111827';
        panel.style.color = '#f3f4f6';
        panel.style.borderRadius = '12px';
        panel.style.fontFamily = '"Segoe UI", system-ui, sans-serif';
        panel.style.boxShadow = '0 20px 25px -5px rgba(0,0,0,0.5), 0 10px 10px -5px rgba(0,0,0,0.5)';
        panel.style.width = '240px';
        panel.style.userSelect = 'none';
        panel.style.border = '1px solid #374151';

        // Add Header Container
        const header = document.createElement('div');
        header.style.padding = '12px';
        header.style.background = '#1f2937';
        header.style.borderTopLeftRadius = '11px';
        header.style.borderTopRightRadius = '11px';
        header.style.borderBottom = '1px solid #374151';
        header.style.cursor = 'move';
        header.style.fontWeight = 'bold';
        header.style.color = '#f59e0b';
        header.style.fontSize = '14px';
        header.style.display = 'flex';
        header.style.justifyContent = 'space-between';
        header.style.alignItems = 'center';

        // Title text inside header
        const titleText = document.createElement('span');
        titleText.innerHTML = '🏴‍☠️ OpenSource 🏴‍';
        header.appendChild(titleText);

        // Collapse Button (+ / -)
        const toggleBtn = document.createElement('span');
        toggleBtn.innerText = '−'; // Starts open (minus sign)
        toggleBtn.style.cursor = 'pointer';
        toggleBtn.style.padding = '0 5px';
        toggleBtn.style.fontSize = '16px';
        toggleBtn.style.color = '#9ca3af';
        toggleBtn.style.fontWeight = 'bold';
        header.appendChild(toggleBtn);

        panel.appendChild(header);

        // Add Vertical Body
        const body = document.createElement('div');
        body.style.padding = '15px';
        body.style.display = 'flex';
        body.style.flexDirection = 'column';
        body.style.gap = '10px';
        panel.appendChild(body);

        // List of all accessible profile variables
        const variables = [
            { key: 'coinsOwned', label: 'Coins' },
            { key: 'playerXP', label: 'Player XP' },
            { key: 'abBotSkillLevel', label: 'Bot Level' },
            { key: 'totalWins', label: 'Wins' },
            { key: 'totalKills', label: 'Total Kills' },
            { key: 'bestKills', label: 'Best Kills' },
            { key: 'bestScore', label: 'Best Score' },
            { key: 'gamesStarted', label: 'Matches' }
        ];

        // Dynamically build vertical forms (stacked one under the other)
        variables.forEach(item => {
            const row = document.createElement('div');

            const label = document.createElement('label');
            label.style.display = 'block';
            label.style.fontSize = '11px';
            label.style.color = '#9ca3af';
            label.style.marginBottom = '4px';
            label.style.fontWeight = '500';
            label.innerText = item.label;

            const input = document.createElement('input');
            input.type = 'number';
            input.className = 'yh-input';
            input.dataset.key = item.key;
            input.value = localStorage.getItem(item.key) || '0';
            input.style.width = '100%';
            input.style.padding = '6px 8px';
            input.style.boxSizing = 'border-box';
            input.style.backgroundColor = '#1f2937';
            input.style.border = '1px solid #4b5563';
            input.style.borderRadius = '6px';
            input.style.color = '#fff';
            input.style.fontSize = '13px';

            row.appendChild(label);
            row.appendChild(input);
            body.appendChild(row);
        });

        // Add Action Button
        const saveBtn = document.createElement('button');
        saveBtn.innerText = 'Save & Sync';
        saveBtn.style.width = '100%';
        saveBtn.style.padding = '8px';
        saveBtn.style.marginTop = '4px';
        saveBtn.style.backgroundColor = '#d97706';
        saveBtn.style.color = '#fff';
        saveBtn.style.border = 'none';
        saveBtn.style.borderRadius = '6px';
        saveBtn.style.cursor = 'pointer';
        saveBtn.style.fontWeight = 'bold';
        saveBtn.style.fontSize = '13px';
        saveBtn.style.transition = 'background 0.2s';

        saveBtn.onmouseover = () => saveBtn.style.backgroundColor = '#b45309';
        saveBtn.onmouseout = () => saveBtn.style.backgroundColor = '#d97706';

        body.appendChild(saveBtn);
        document.body.appendChild(panel);

        // Collapse/Expand Functionality
        toggleBtn.addEventListener('click', (e) => {
            e.stopPropagation(); // Prevent drag triggers on click
            if (body.style.display === 'none') {
                body.style.display = 'flex';
                toggleBtn.innerText = '−'; // Unicode minus sign
                panel.style.borderBottomRightRadius = '12px';
                panel.style.borderBottomLeftRadius = '12px';
            } else {
                body.style.display = 'none';
                toggleBtn.innerText = '+'; // Plus sign
                panel.style.borderBottomRightRadius = '0px';
                panel.style.borderBottomLeftRadius = '0px';
            }
        });

        // Save Functionality
        saveBtn.addEventListener('click', () => {
            const inputs = body.querySelectorAll('.yh-input');
            inputs.forEach(input => {
                localStorage.setItem(input.dataset.key, input.value);
            });
            window.location.reload();
        });

        // Make the Panel Draggable via Header
        let isDragging = false;
        let offsetX, offsetY;

        header.addEventListener('mousedown', (e) => {
            if (e.target === toggleBtn) return; // Don't drag if clicking the +/- button
            isDragging = true;
            offsetX = e.clientX - panel.getBoundingClientRect().left;
            offsetY = e.clientY - panel.getBoundingClientRect().top;
            header.style.cursor = 'grabbing';
        });

        document.addEventListener('mousemove', (e) => {
            if (!isDragging) return;
            panel.style.left = `${e.clientX - offsetX}px`;
            panel.style.top = `${e.clientY - offsetY}px`;
            panel.style.right = 'auto';
        });

        document.addEventListener('mouseup', () => {
            isDragging = false;
            header.style.cursor = 'move';
        });
    });
})();