DSC.GG/143X ULTIMATE MOD MENU - NEWEST UPDATE SIMPLIFIED MENU

DSC.GG/143X MOD MENU

目前为 2025-05-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         DSC.GG/143X ULTIMATE MOD MENU - NEWEST UPDATE SIMPLIFIED MENU
// @namespace    http://tampermonkey.net/
// @version      9.8
// @description  DSC.GG/143X MOD MENU
// @author       GITHUB.COM/DXXTHLY - HTTPS://DSC.GG/143X dxxthly. | waynesg
// @match        http://slither.io/
// @match        https://slither.io/
// @match        http://slither.com/io
// @match        https://slither.com/io
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // === CONFIG ===
    const config = {
        menuPosition: 'right',
        defaultCircleRadius: 150,
        circleRadiusStep: 20,
        minCircleRadius: 50,
        maxCircleRadius: 300,
        deathSoundURL: 'https://www.myinstants.com/media/sounds/minecraft-death-sound.mp3',
        godModeVideoURL: 'https://youtu.be/ghAap5IWu1Y',
        defaultMenuName: 'DSC.GG/143X',
        defaultMenuColor: '#4CAF50'
    };

    // === STATE ===
    const state = {
        features: {
            circleRestriction: false,
            autoCircle: false,
            performanceMode: 1,
            deathSound: true,
            fpsDisplay: false,
            autoBoost: false,
            showServer: false,
        },
        menuVisible: true,
        zoomFactor: 1.0,
        circleRadius: config.defaultCircleRadius,
        fps: 0,
        fpsFrames: 0,
        fpsLastCheck: Date.now(),
        deathSound: new Audio(config.deathSoundURL),
        isInGame: false,
        boosting: false,
        autoCircleAngle: 0,
        ping: 0,
        server: '',
        leaderboard: [],
        lastSnakeAlive: true,
        boostingInterval: null,
        menuName: localStorage.getItem('modMenuName') || config.defaultMenuName,
        menuColor: localStorage.getItem('modMenuColor') || config.defaultMenuColor,
        showCustomization: sessionStorage.getItem('showCustomization') === 'false' ? false : true,
        simplified: sessionStorage.getItem('modMenuSimplified') === 'true'
    };

    let autoCircleRAF = null;

    // === Helper: Hex to RGBA ===
    function hexToRgba(hex, alpha = 1) {
        let c = hex.replace('#', '');
        if (c.length === 3) c = c[0]+c[0]+c[1]+c[1]+c[2]+c[2];
        const num = parseInt(c, 16);
        return `rgba(${(num>>16)&255},${(num>>8)&255},${num&255},${alpha})`;
    }

    // === MENU CREATION ===
    const menu = document.createElement('div');
    menu.id = 'mod-menu';
    menu.style.position = 'fixed';
    menu.style.top = '50px';
    menu.style.background = 'rgba(17, 17, 17, 0.92)';
    menu.style.border = `2px solid ${state.menuColor}`;
    menu.style.borderRadius = '10px';
    menu.style.padding = '20px';
    menu.style.zIndex = '9999';
    menu.style.color = '#fff';
    menu.style.fontFamily = 'Arial, sans-serif';
    menu.style.fontSize = '14px';
    menu.style.width = '460px';
    menu.style.boxShadow = '0 0 15px rgba(0,0,0,0.7)';
    menu.style.backdropFilter = 'blur(5px)';
    menu.style.transition = 'all 0.3s ease';
    menu.style.userSelect = "text";
    if (config.menuPosition === 'left') {
        menu.style.left = '50px';
    } else if (config.menuPosition === 'center') {
        menu.style.left = '50%';
        menu.style.transform = 'translateX(-50%)';
    } else {
        menu.style.right = '50px';
    }
    document.body.appendChild(menu);

    // FPS display
    const fpsDisplay = document.createElement('div');
    fpsDisplay.id = 'fps-display';
    fpsDisplay.style.position = 'fixed';
    fpsDisplay.style.bottom = '10px';
    fpsDisplay.style.right = '10px';
    fpsDisplay.style.color = '#fff';
    fpsDisplay.style.fontFamily = 'Arial, sans-serif';
    fpsDisplay.style.fontSize = '14px';
    fpsDisplay.style.zIndex = '9999';
    fpsDisplay.style.display = 'none';
    fpsDisplay.style.background = 'rgba(0,0,0,0.5)';
    fpsDisplay.style.padding = '5px 10px';
    fpsDisplay.style.borderRadius = '5px';
    document.body.appendChild(fpsDisplay);

    // Ping display
    const pingDisplay = document.createElement('div');
    pingDisplay.id = 'ping-display';
    pingDisplay.style.position = 'fixed';
    pingDisplay.style.bottom = '35px';
    pingDisplay.style.right = '10px';
    pingDisplay.style.color = '#fff';
    pingDisplay.style.fontFamily = 'Arial, sans-serif';
    pingDisplay.style.fontSize = '14px';
    pingDisplay.style.zIndex = '9999';
    pingDisplay.style.display = 'block';
    pingDisplay.style.background = 'rgba(0,0,0,0.5)';
    pingDisplay.style.padding = '5px 10px';
    pingDisplay.style.borderRadius = '5px';
    document.body.appendChild(pingDisplay);

    // Circle restriction visual
    const circleVisual = document.createElement('div');
    circleVisual.id = 'circle-visual';
    circleVisual.style.position = 'fixed';
    circleVisual.style.border = `2px dashed ${hexToRgba(state.menuColor, 0.7)}`;
    circleVisual.style.borderRadius = '50%';
    circleVisual.style.pointerEvents = 'none';
    circleVisual.style.transform = 'translate(-50%, -50%)';
    circleVisual.style.zIndex = '9998';
    circleVisual.style.display = 'none';
    circleVisual.style.transition = 'all 0.2s ease';
    document.body.appendChild(circleVisual);

    // === MENU CONTENT ===
    function updateMenu() {
        menu.style.border = `2px solid ${state.menuColor}`;
        const color = state.menuColor;
        circleVisual.style.border = `2px dashed ${hexToRgba(state.menuColor, 0.7)}`;
        const arrow = state.showCustomization ? '▼' : '▶';

        if (state.simplified) {
            menu.style.width = '320px';
            menu.innerHTML = `
                <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px">
                    <h2 id="mod-menu-title" style="margin:0;color:${color};font-size:1.3em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;">${state.menuName}</h2>
                    <div style="display:flex;flex-direction:column;align-items:flex-end;">
                        <div style="color:#aaa;font-size:12px">v9.8</div>
                        <button id="default-menu-btn" title="Expand menu" style="margin-top:2px;background:${color};color:#fff;border:none;border-radius:4px;padding:3px 10px;cursor:pointer;font-size:12px;">Default</button>
                    </div>
                </div>
                <div style="background:${hexToRgba(state.menuColor,0.09)};padding:10px 5px 5px 5px;border-radius:7px;margin-bottom:15px;">
                    <div style="font-size:14px;margin-bottom:3px;color:${color};font-weight:bold;text-align:center;">Status</div>
                    <div style="font-size:13px;line-height:1.7;">
                        <b>Zoom:</b> ${Math.round(100 / state.zoomFactor)}%<br>
                        <b>Ping:</b> ${state.ping} ms<br>
                        <b>FPS:</b> ${state.fps}<br>
                        <b>Server:</b> ${state.features.showServer ? (state.server || 'N/A') : 'Hidden'}
                    </div>
                </div>
                <div style="text-align:center;font-size:12px;color:#aaa;border-top:1px solid #444;padding-top:10px">
                    <b>DSC.GG/143X</b> | <span style="color:#aaa;">Made by: <b>dxxthly.</b> & <b>waynesg</b> on Discord</span>
                </div>
            `;
            setTimeout(() => {
                const btn = document.getElementById('default-menu-btn');
                if (btn) {
                    btn.onclick = () => {
                        state.simplified = false;
                        sessionStorage.setItem('modMenuSimplified', 'false');
                        menu.style.width = '460px';
                        updateMenu();
                    };
                }
            }, 0);
            return;
        }

        menu.style.width = '460px';
        menu.innerHTML = `
            <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px">
                <h2 id="mod-menu-title" style="margin:0;color:${color};">${state.menuName}</h2>
                <div style="display:flex;align-items:center;gap:7px;">
                    <div style="color:#aaa;font-size:12px">v9.8</div>
                    <button id="simplify-menu-btn" title="Simplify menu" style="background:${color};color:#fff;border:none;border-radius:4px;padding:3px 10px;cursor:pointer;font-size:12px;">Simplify</button>
                </div>
            </div>
            <div style="margin-bottom:10px;">
                <span id="customization-toggle" style="cursor:pointer;user-select:none;color:${color};font-weight:bold;">
                    ${arrow} Menu Customization
                </span>
                <div id="customization-section" style="display:${state.showCustomization ? 'flex' : 'none'};gap:10px;margin-top:8px;align-items:center;">
                    <input id="mod-menu-name-input" type="text" placeholder="Menu Name..." value="${state.menuName.replace(/"/g,'&quot;')}" style="flex:1 1 0;max-width:180px;padding:2px 6px;border-radius:4px;border:1px solid #222;background:#222;color:#fff;">
                    <button id="mod-menu-name-btn" style="background:${color};color:#fff;border:none;border-radius:4px;padding:3px 10px;cursor:pointer;font-size:13px;">Set Name</button>
                    <input id="mod-menu-color-input" type="color" value="${state.menuColor}" style="width:32px;height:32px;border:none;outline:2px solid ${color};border-radius:4px;cursor:pointer;">
                    <label for="mod-menu-color-input" style="color:${color};font-size:13px;cursor:pointer;margin-left:4px;">Color</label>
                </div>
            </div>
            <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom:15px">
                <div>
                    <h3 style="color:${color};border-bottom:1px solid #444;padding-bottom:5px;margin-top:0">MOVEMENT</h3>
                    <p><strong>K: Circle Restriction:</strong> <span style="color:${state.features.circleRestriction ? 'lime' : 'red'}">${state.features.circleRestriction ? 'ON' : 'OFF'}</span></p>
                    <p><strong>J/L: Circle Size:</strong> ${state.circleRadius}px</p>
                    <p><strong>A: Auto Circle (left):</strong> <span style="color:${state.features.autoCircle ? 'lime' : 'red'}">${state.features.autoCircle ? 'ON' : 'OFF'}</span></p>
                    <p><strong>B: Auto Boost:</strong> <span style="color:${state.features.autoBoost ? 'lime' : 'red'}">${state.features.autoBoost ? 'ON' : 'OFF'}</span></p>
                    <h3 style="color:${color};border-bottom:1px solid #444;padding-bottom:5px;margin-top:15px">ZOOM</h3>
                    <p><strong>Z: Zoom In</strong></p>
                    <p><strong>X: Zoom Out</strong></p>
                    <p><strong>C: Reset Zoom</strong></p>
                </div>
                <div>
                    <h3 style="color:${color};border-bottom:1px solid #444;padding-bottom:5px;margin-top:0">VISUALS</h3>
                    <p><strong>1-3: Performance Mode</strong> <span style="color:${['lime','cyan','orange'][state.features.performanceMode-1] || '#aaa'}">${['Low: Minimal','Medium: Balanced','High: Quality'][state.features.performanceMode-1] || 'Off'}</span></p>
                    <p><strong>F: FPS Display:</strong> <span style="color:${state.features.fpsDisplay ? 'lime' : 'red'}">${state.features.fpsDisplay ? 'ON' : 'OFF'}</span></p>
                    <p><strong>V: Death Sound:</strong> <span style="color:${state.features.deathSound ? 'lime' : 'red'}">${state.features.deathSound ? 'ON' : 'OFF'}</span></p>
                    <p><strong>T: Show Server IP:</strong> <span style="color:${state.features.showServer ? 'lime' : 'red'}">${state.features.showServer ? 'ON' : 'OFF'}</span></p>
                    <h3 style="color:${color};border-bottom:1px solid #444;padding-bottom:5px;margin-top:15px">LINKS</h3>
                    <p><strong>G: GitHub</strong></p>
                    <p><strong>D: Discord</strong></p>
                    <p><strong>Y: GodMode</strong></p>
                </div>
            </div>
            <div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;background:${hexToRgba(state.menuColor,0.1)};padding:10px;border-radius:5px;margin-bottom:15px">
                <div>
                    <h3 style="color:${color};margin-top:0;margin-bottom:10px">STATUS</h3>
                    <p><strong>Game State:</strong> ${state.isInGame ? 'In Game' : 'Menu'}</p>
                    <p><strong>Zoom:</strong> ${Math.round(100 / state.zoomFactor)}%</p>
                    <p><strong>Ping:</strong> <span id="ping-value">${state.ping} ms</span></p>
                    <p><strong>FPS:</strong> ${state.fps}</p>
                </div>
                <div>
                    <h3 style="color:${color};margin-top:0;margin-bottom:10px">EXTRA</h3>
                    <p><strong>Server:</strong> ${state.features.showServer ? (state.server || 'N/A') : 'Hidden'}</p>
                    <p><strong>Leaderboard:</strong><br>
                        ${state.leaderboard.length ? state.leaderboard.map((x,i)=>`${i+1}. ${x}`).join('<br>') : 'N/A'}
                    </p>
                </div>
            </div>
            <div style="text-align:center;font-size:12px;color:#aaa;border-top:1px solid #444;padding-top:10px">
                Press <strong>M</strong> to hide/show menu | <b>DSC.GG/143X</b> | <strong>P</strong> Screenshot<br>
                <span style="color:#aaa;">Made by: <b>dxxthly.</b> & <b>waynesg</b> on Discord</span>
            </div>
        `;

        setTimeout(() => {
            const simplifyBtn = document.getElementById('simplify-menu-btn');
            if (simplifyBtn) {
                simplifyBtn.onclick = () => {
                    state.simplified = true;
                    sessionStorage.setItem('modMenuSimplified', 'true');
                    updateMenu();
                };
            }
            const toggle = document.getElementById('customization-toggle');
            if (toggle) {
                toggle.onclick = () => {
                    state.showCustomization = !state.showCustomization;
                    sessionStorage.setItem('showCustomization', state.showCustomization);
                    updateMenu();
                };
            }
            const nameInput = document.getElementById('mod-menu-name-input');
            const nameBtn = document.getElementById('mod-menu-name-btn');
            const colorInput = document.getElementById('mod-menu-color-input');
            if (nameBtn && nameInput) {
                nameBtn.onclick = () => {
                    const val = nameInput.value.trim();
                    if (val.length > 0) {
                        state.menuName = val;
                        localStorage.setItem('modMenuName', val);
                        updateMenu();
                    }
                };
                nameInput.onkeydown = (e) => {
                    if (e.key === 'Enter') nameBtn.click();
                };
            }
            if (colorInput) {
                colorInput.oninput = (e) => {
                    state.menuColor = colorInput.value;
                    localStorage.setItem('modMenuColor', colorInput.value);
                    updateMenu();
                };
            }
        }, 0);
    }
    updateMenu();

    // === GAME STATE DETECTION ===
    function checkGameState() {
        const gameCanvas = document.querySelector('canvas');
        const loginForm = document.getElementById('login');
        state.isInGame = !!(gameCanvas && gameCanvas.style.display !== 'none' && (!loginForm || loginForm.style.display === 'none'));
        setTimeout(checkGameState, 1000);
    }
    checkGameState();

    // === CIRCLE RESTRICTION VISUAL ===
    function drawCircleRestriction() {
        if (state.features.circleRestriction && state.isInGame) {
            const centerX = window.innerWidth / 2;
            const centerY = window.innerHeight / 2;
            circleVisual.style.left = `${centerX}px`;
            circleVisual.style.top = `${centerY}px`;
            circleVisual.style.width = `${state.circleRadius * 2}px`;
            circleVisual.style.height = `${state.circleRadius * 2}px`;
            circleVisual.style.display = 'block';
        } else {
            circleVisual.style.display = 'none';
        }
        requestAnimationFrame(drawCircleRestriction);
    }
    drawCircleRestriction();

    // === KEYBINDS ===
    document.addEventListener('keydown', function (e) {
        if (document.activeElement && (
                document.activeElement.tagName === 'INPUT' ||
                document.activeElement.tagName === 'TEXTAREA' ||
                document.activeElement.isContentEditable
            )) return;

        switch (e.key.toLowerCase()) {
            case 'm':
                state.menuVisible = !state.menuVisible;
                menu.style.display = state.menuVisible ? 'block' : 'none';
                break;
            case 'k':
                state.features.circleRestriction = !state.features.circleRestriction;
                updateMenu();
                break;
            case 'j':
                state.circleRadius = Math.max(config.minCircleRadius, state.circleRadius - config.circleRadiusStep);
                updateMenu();
                break;
            case 'l':
                state.circleRadius = Math.min(config.maxCircleRadius, state.circleRadius + config.circleRadiusStep);
                updateMenu();
                break;
            case 'a':
                state.features.autoCircle = !state.features.autoCircle;
                if (state.features.autoCircle) {
                    autoCircleRAF = requestAnimationFrame(autoCircle);
                } else if (autoCircleRAF) {
                    cancelAnimationFrame(autoCircleRAF);
                    autoCircleRAF = null;
                }
                updateMenu();
                break;
            case 'b':
                state.features.autoBoost = !state.features.autoBoost;
                updateMenu();
                break;
            case 'f':
                state.features.fpsDisplay = !state.features.fpsDisplay;
                fpsDisplay.style.display = state.features.fpsDisplay ? 'block' : 'none';
                updateMenu();
                break;
            case 'v':
                state.features.deathSound = !state.features.deathSound;
                updateMenu();
                break;
            case 't':
                state.features.showServer = !state.features.showServer;
                updateMenu();
                break;
            case 'z':
                state.zoomFactor = Math.max(0.1, state.zoomFactor - 0.1);
                updateMenu();
                break;
            case 'x':
                state.zoomFactor = Math.min(2, state.zoomFactor + 0.1);
                updateMenu();
                break;
            case 'c':
                state.zoomFactor = 1.0;
                updateMenu();
                break;
            case '1':
                state.features.performanceMode = 1;
                applyPerformanceMode();
                break;
            case '2':
                state.features.performanceMode = 2;
                applyPerformanceMode();
                break;
            case '3':
                state.features.performanceMode = 3;
                applyPerformanceMode();
                break;
            case 'g':
                window.open('https://github.com/dxxthly', '_blank');
                break;
            case 'd':
                window.open('https://dsc.gg/143x', '_blank');
                break;
            case 'y':
                window.open(config.godModeVideoURL, '_blank');
                break;
        }
    });

    // === AUTO CIRCLE ===
    function autoCircle() {
        if (!state.features.autoCircle || !state.isInGame) return;
        state.autoCircleAngle += 0.04;
        const centerX = window.innerWidth / 2;
        const centerY = window.innerHeight / 2;
        const radius = state.circleRadius * 0.8;
        const moveX = centerX + Math.cos(state.autoCircleAngle) * radius;
        const moveY = centerY + Math.sin(state.autoCircleAngle) * radius;
        const canvas = document.querySelector('canvas');
        if (canvas) {
            const event = new MouseEvent('mousemove', {
                clientX: moveX,
                clientY: moveY,
                bubbles: true
            });
            canvas.dispatchEvent(event);
        }
        autoCircleRAF = requestAnimationFrame(autoCircle);
    }

    // === AUTO BOOST ===
    function autoBoost() {
        if (!state.features.autoBoost || !state.isInGame) {
            if (state.boosting) {
                state.boosting = false;
                if (typeof window.setAcceleration === 'function') window.setAcceleration(0);
                document.dispatchEvent(new KeyboardEvent('keyup', { key: ' ' }));
            }
            return;
        }
        if (!state.boosting) {
            state.boosting = true;
            if (typeof window.setAcceleration === 'function') window.setAcceleration(1);
            document.dispatchEvent(new KeyboardEvent('keydown', { key: ' ' }));
        }
    }
    function autoBoostLoop() {
        autoBoost();
        setTimeout(autoBoostLoop, 100);
    }
    autoBoostLoop();

    // === FPS COUNTER ===
    function fpsCounter() {
        state.fpsFrames++;
        const now = Date.now();
        if (now - state.fpsLastCheck >= 1000) {
            state.fps = state.fpsFrames;
            state.fpsFrames = 0;
            state.fpsLastCheck = now;
            if (state.features.fpsDisplay) {
                fpsDisplay.textContent = `FPS: ${state.fps}`;
            }
        }
        requestAnimationFrame(fpsCounter);
    }
    fpsCounter();

    // === DEATH SOUND ===
    function deathSoundObserver() {
        let lastState = true;
        setInterval(() => {
            if (!state.features.deathSound) return;
            if (window.snake && lastState && !window.snake.alive) {
                state.deathSound.pause();
                state.deathSound.currentTime = 0;
                state.deathSound.play();
            }
            const died = document.getElementById('died');
            if (died && died.style.display !== 'none' && lastState) {
                state.deathSound.pause();
                state.deathSound.currentTime = 0;
                state.deathSound.play();
            }
            lastState = window.snake ? window.snake.alive : false;
        }, 100);
    }
    state.deathSound.preload = 'auto';
    state.deathSound.load();
    state.deathSound.addEventListener('ended', () => {
        state.deathSound.currentTime = 0;
    });
    deathSoundObserver();

    // === PERFORMANCE MODES ===
    function applyPerformanceMode() {
        if (typeof window !== "undefined") {
            switch (state.features.performanceMode) {
                case 1:
                    window.want_quality = 0;
                    window.high_quality = false;
                    window.render_mode = 1;
                    break;
                case 2:
                    window.want_quality = 1;
                    window.high_quality = false;
                    window.render_mode = 2;
                    break;
                case 3:
                    window.want_quality = 2;
                    window.high_quality = true;
                    window.render_mode = 2;
                    break;
                default:
                    break;
            }
        }
        updateMenu();
    }
    applyPerformanceMode();

    // === ZOOM LOCK ===
    function zoomLockLoop() {
        if (typeof window.gsc !== 'undefined') {
            window.gsc = state.zoomFactor;
        }
        requestAnimationFrame(zoomLockLoop);
    }
    zoomLockLoop();

    // === PING DISPLAY ===
    function pingLoop() {
        let ping = 0;
        if (window.lagging && typeof window.lagging === "number") {
            ping = Math.round(window.lagging);
        } else if (window.lag && typeof window.lag === "number") {
            ping = Math.round(window.lag);
        }
        state.ping = ping;
        pingDisplay.textContent = `Ping: ${ping} ms`;
        const pingValue = document.getElementById("ping-value");
        if (pingValue) pingValue.textContent = `${ping} ms`;
        setTimeout(pingLoop, 500);
    }
    pingLoop();

    // === SCREENSHOT BUTTON (P) ===
    document.addEventListener('keydown', function (e) {
        if (e.key.toLowerCase() === 'p' && state.isInGame) {
            try {
                const canvas = document.querySelector('canvas');
                if (canvas) {
                    const dataURL = canvas.toDataURL();
                    const link = document.createElement('a');
                    link.href = dataURL;
                    link.download = `slither_screenshot_${Date.now()}.png`;
                    document.body.appendChild(link);
                    link.click();
                    document.body.removeChild(link);
                }
            } catch (err) {
                alert('Screenshot failed: ' + err);
            }
        }
    });

    // === SERVER & LEADERBOARD UPDATES ===
    function updateServerAndLeaderboard() {
        if (window.bso && window.bso && window.bso.ip) {
            state.server = window.bso.ip;
        }
        if (window.lb && Array.isArray(window.lb)) {
            state.leaderboard = window.lb.map(x => x ? (x.nk || x.name || 'Unknown') : 'Unknown');
        }
        setTimeout(updateServerAndLeaderboard, 1000);
    }
    updateServerAndLeaderboard();

    // === INITIAL MENU VISIBILITY ===
    menu.style.display = state.menuVisible ? 'block' : 'none';

    // === INITIAL FPS DISPLAY ===
    fpsDisplay.style.display = state.features.fpsDisplay ? 'block' : 'none';

    // === INITIAL PING DISPLAY ===
    pingDisplay.style.display = 'block';

    // === INITIAL CIRCLE VISUAL COLOR ===
    circleVisual.style.border = `2px dashed ${hexToRgba(state.menuColor, 0.7)}`;

})();

QingJ © 2025

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