Paper.io Enhanced Hacked Menu with Anti-Ban

Improved hack menu for Paper.io with optimized performance and anti-ban features.

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

// ==UserScript==
// @name         Paper.io Enhanced Hacked Menu with Anti-Ban
// @namespace    http://tampermonkey.net/
// @version      5.0
// @description  Improved hack menu for Paper.io with optimized performance and anti-ban features.
// @author       AA034
// @match        https://paper-io.com/*
// @grant        none
// ==/UserScript==

(() => {
    const overlayHTML = `
    <div id="hackMenu" style="display: none;">
        <div class="menuContent">
            <p style="color:white;">PaperHack</p>
            <section><label>Zoom [Scroll]</label></section>
            <section><label>Speed Boost [Hold Mouse]</label></section>
            <section><label>Pause [P]</label></section>
            <section><button class="button" id="unlockSkins">Unlock Skins</button></section>
            <section>
                <label><input type="checkbox" id="invinCheck"> Invincible</label>
            </section>
            <section>
                <label><input type="checkbox" id="radiCheck"> Auto Kill</label>
            </section>
            <p>Press "M" to toggle menu</p>
        </div>
    </div>
    <style>
        #hackMenu {
            position: absolute;
            top: 10%;
            left: 10px;
            z-index: 9999;
            padding: 10px;
            background-color: #363c3d;
            color: white;
            font-family: Arial, sans-serif;
            border-radius: 8px;
            font-size: 14px;
            display: none; /* Start hidden */
        }
        .menuContent {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        .button {
            padding: 8px;
            background-color: #242829;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .button:hover {
            background-color: #a10000;
        }
        input[type="checkbox"] {
            margin-right: 5px;
        }
    </style>
    `;

    const createOverlay = () => {
        const overlay = document.createElement('div');
        overlay.innerHTML = overlayHTML;
        document.body.appendChild(overlay);

        // Add functionality for buttons and checkboxes
        document.getElementById('unlockSkins').addEventListener('click', unlockAllSkins);

        // Toggle menu visibility with "M"
        document.addEventListener('keydown', (e) => {
            if (e.key === 'm') {
                const menu = document.getElementById('hackMenu');
                menu.style.display = menu.style.display === 'none' ? 'block' : 'none';
            }
        });
    };

    const unlockAllSkins = () => {
        if (window.paper2 && window.paper2.skins) {
            window.paper2.skins.forEach(skin => unlockSkin(skin.name));
            console.log('All skins unlocked!');
        }
    };

    const optimizeSpeedHack = () => {
        let isMouseHeld = false;

        const movePlayer = () => {
            const { player } = window.paper2.game;
            const { x: playerX, y: playerY } = player.position;
            const { x: targetX, y: targetY } = player.target;

            const distance = Math.hypot(targetX - playerX, targetY - playerY);
            const stepSize = distance > 50 ? 10 : 5; // Dynamic speed adjustment

            if (distance > stepSize) {
                const angle = Math.atan2(targetY - playerY, targetX - playerX);
                player.position.x += stepSize * Math.cos(angle);
                player.position.y += stepSize * Math.sin(angle);
            } else {
                clearInterval(speedInterval);
            }
        };

        let speedInterval;
        document.addEventListener('mousedown', (e) => {
            if (e.button === 0 && !isMouseHeld) {
                isMouseHeld = true;
                speedInterval = setInterval(movePlayer, 16); // Smooth updates
            }
        });

        document.addEventListener('mouseup', (e) => {
            if (e.button === 0) {
                isMouseHeld = false;
                clearInterval(speedInterval);
            }
        });
    };

    const antiBanFeatures = () => {
        // Randomize interval times to mimic human behavior
        const randomizeInterval = (callback, baseTime = 1000) => {
            return setInterval(callback, baseTime + Math.random() * 500);
        };

        // Hide menu visibility from anti-cheat scanners
        document.addEventListener('visibilitychange', () => {
            if (document.hidden) {
                const menu = document.getElementById('hackMenu');
                if (menu) menu.style.display = 'none';
            }
        });

        // Restore patched functions (if needed)
        const safeFunctionCall = (func, fallback) => {
            try {
                return func();
            } catch (err) {
                console.error('Anti-ban fallback triggered:', err);
                return fallback();
            }
        };

        console.log('Anti-ban features activated!');
    };

    const initializeHacks = () => {
        optimizeSpeedHack();
        antiBanFeatures();
        console.log('Hacks and anti-ban initialized');
    };

    const waitForGameStart = () => {
        const playButton = document.querySelector("#pre_game > div.grow > div.button.play");
        if (playButton) {
            playButton.addEventListener('click', () => {
                setTimeout(initializeHacks, 500);
            });
        }
    };

    // Inject overlay and setup hacks
    createOverlay();
    waitForGameStart();
})();