Nexus Optimizer Pro

Maximiza FPS, reduce ping y optimiza el rendimiento en resurviv.biz y survev.io

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Advertisement:

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

Advertisement:

// ==UserScript==
// @name         Nexus Optimizer Pro
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Maximiza FPS, reduce ping y optimiza el rendimiento en resurviv.biz y survev.io
// @author       ! System
// @icon         https://i.ibb.co/35RDsjMg/Chat-GPT-Image-12-jul-2026-13-15-49.png
// @match        *://survev.io/*
// @match        *://*.survev.io/*
// @match        *://resurviv.biz/*
// @match        *://*.resurviv.biz/*
// @license      MIT
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // ---------- CONFIGURACIÓN DE OPTIMIZACIONES ----------
    const OPT = {
        fpsUncap: true,
        disableInterpolation: true,
        disableHighResTex: true,
        disableScreenShake: true,
        reducePingInterval: true,
        webSocketBinary: true,
        hideMainMenuElements: true
    };

    const applied = {
        fpsUncap: false,
        interpolation: false,
        highResTex: false,
        screenShake: false,
        pingInterval: false,
        webSocketBinary: false,
        menuElementsHidden: false
    };

    const monitor = {
        fps: 0,
        ping: 0,
        players: 0,
        menuVisible: true
    };

    let fpsFrameCount = 0;
    let fpsLastTime = performance.now();

    // ---------- FUNCIONES DE BÚSQUEDA ----------
    function findConfig() {
        const paths = [
            () => window.config,
            () => window.ConfigManager?.config,
            () => window.game?.config,
            () => window.game?.m_config,
            () => window.g?.config,
            () => window.app?.config,
            () => window._config,
            () => window.surviv_config,
            () => window.resurviv_config
        ];
        for (let fn of paths) {
            try { const cfg = fn(); if (cfg && typeof cfg === 'object') return cfg; } catch(e) {}
        }
        return null;
    }

    function findGame() {
        const paths = [
            () => window.game,
            () => window.Game,
            () => window.g,
            () => window._game,
            () => window.app?.game,
            () => window.app
        ];
        for (let fn of paths) {
            try { const g = fn(); if (g && typeof g === 'object') return g; } catch(e) {}
        }
        return null;
    }

    function applyAllOptimizations() {
        const config = findConfig();
        const game = findGame();
        let anyApplied = false;

        // FPS Uncap
        if (OPT.fpsUncap) {
            try {
                if (game?.maxFps !== undefined && game.maxFps < 999) { game.maxFps = 999; applied.fpsUncap = true; anyApplied = true; }
                else if (game?.fpsMax !== undefined && game.fpsMax < 999) { game.fpsMax = 999; applied.fpsUncap = true; anyApplied = true; }
                else if (config?.maxFps !== undefined && config.maxFps < 999) { config.maxFps = 999; applied.fpsUncap = true; anyApplied = true; }
                else if (config?.fpsMax !== undefined && config.fpsMax < 999) { config.fpsMax = 999; applied.fpsUncap = true; anyApplied = true; }
            } catch(e) {}
        }

        // Interpolación
        if (OPT.disableInterpolation) {
            try {
                if (config?.interpolation !== undefined && config.interpolation !== false) { config.interpolation = false; applied.interpolation = true; anyApplied = true; }
                else if (typeof config?.set === 'function') { config.set('interpolation', false); applied.interpolation = true; anyApplied = true; }
            } catch(e) {}
        }

        // Texturas HD
        if (OPT.disableHighResTex) {
            try {
                if (config?.highResTex !== undefined && config.highResTex !== false) { config.highResTex = false; applied.highResTex = true; anyApplied = true; }
                else if (typeof config?.set === 'function') { config.set('highResTex', false); applied.highResTex = true; anyApplied = true; }
            } catch(e) {}
        }

        // Screen Shake
        if (OPT.disableScreenShake) {
            try {
                if (config?.screenShake !== undefined && config.screenShake !== false) { config.screenShake = false; applied.screenShake = true; anyApplied = true; }
                else if (typeof config?.set === 'function') { config.set('screenShake', false); applied.screenShake = true; anyApplied = true; }
            } catch(e) {}
        }

        // Ping Interval
        if (OPT.reducePingInterval) {
            const target = 100;
            try {
                if (config?.pingInterval !== undefined && config.pingInterval > target) { config.pingInterval = target; applied.pingInterval = true; anyApplied = true; }
                else if (typeof config?.set === 'function') { config.set('pingInterval', target); applied.pingInterval = true; anyApplied = true; }
            } catch(e) {}
        }

        // Ocultar elementos del menú principal
        if (OPT.hideMainMenuElements && !applied.menuElementsHidden) {
            try {
                const selectors = ['.main-menu-background','.menu-background-animation','.ad-container','.main-menu-video','#main-menu-ad'];
                let c = 0;
                selectors.forEach(sel => document.querySelectorAll(sel).forEach(el => { el.style.display = 'none'; c++; }));
                if (c > 0) { applied.menuElementsHidden = true; anyApplied = true; }
            } catch(e) {}
        }

        return anyApplied;
    }

    function updateFPS() {
        fpsFrameCount++;
        const now = performance.now();
        if (now - fpsLastTime >= 1000) {
            monitor.fps = Math.round((fpsFrameCount * 1000) / (now - fpsLastTime));
            fpsFrameCount = 0;
            fpsLastTime = now;
        }
        requestAnimationFrame(updateFPS);
    }

    function updatePlayers() {
        try {
            const el = document.querySelector('.js-ui-players-alive');
            if (el) {
                const n = parseInt(el.textContent.trim(), 10);
                if (!isNaN(n)) monitor.players = n;
            }
        } catch(e) {}
    }

    function setupPingDetection() {
        const OrigWebSocket = window.WebSocket;
        window.WebSocket = function(url, protocols) {
            const ws = new OrigWebSocket(url, protocols);
            if (typeof url === 'string' && (url.includes('ptc') || url.includes('gameId'))) {
                if (OPT.webSocketBinary) {
                    ws.binaryType = 'arraybuffer';
                    applied.webSocketBinary = true;
                }
                let lastSend = 0;
                const origSend = ws.send;
                ws.send = function(data) {
                    if (data instanceof ArrayBuffer && data.byteLength === 1) lastSend = performance.now();
                    return origSend.call(this, data);
                };
                ws.addEventListener('message', function(e) {
                    if (e.data instanceof ArrayBuffer && e.data.byteLength === 1 && lastSend > 0) {
                        monitor.ping = Math.round(performance.now() - lastSend);
                        lastSend = 0;
                    }
                });
            }
            return ws;
        };
    }

    function createMenu() {
        const menu = document.createElement('div');
        menu.id = 'nx-optimizer-menu';
        menu.innerHTML = `
            <div id="nx-opt-header">
                <span class="nx-opt-title">
                    <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                        <polygon points="12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2"/>
                        <line x1="12" y1="22" x2="12" y2="15.5"/>
                        <polyline points="22 8.5 12 15.5 2 8.5"/>
                    </svg>
                    Nexus Optimizer
                </span>
                <button id="nx-opt-close">
                    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                        <line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
                    </svg>
                </button>
            </div>
            <div id="nx-opt-body">
                <div class="nx-opt-row">
                    <span class="nx-opt-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 20V10M18 20V4M6 20v-6"/></svg> FPS</span>
                    <span class="nx-opt-value" id="nx-fps">0</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="6" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg> Ping</span>
                    <span class="nx-opt-value" id="nx-ping">0 ms</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/></svg> Players</span>
                    <span class="nx-opt-value" id="nx-players">0</span>
                </div>
                <hr>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">FPS Uncap</span>
                    <span class="nx-opt-status" id="nx-uncap">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">Interpolation</span>
                    <span class="nx-opt-status" id="nx-interp">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">HighRes Tex</span>
                    <span class="nx-opt-status" id="nx-hires">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">Screen Shake</span>
                    <span class="nx-opt-status" id="nx-shake">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">Ping Interval</span>
                    <span class="nx-opt-status" id="nx-pingint">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">WebSocket Bin</span>
                    <span class="nx-opt-status" id="nx-wsbin">✗</span>
                </div>
                <div class="nx-opt-row">
                    <span class="nx-opt-label">Menu Clean</span>
                    <span class="nx-opt-status" id="nx-hidemen">✗</span>
                </div>
            </div>
        `;

        const style = document.createElement('style');
        style.textContent = `
            #nx-optimizer-menu {
                position: fixed;
                top: 20px;
                right: 20px;
                width: 260px;
                background: rgba(18, 18, 24, 0.92);
                backdrop-filter: blur(14px);
                -webkit-backdrop-filter: blur(14px);
                border: 1px solid rgba(255,255,255,0.08);
                border-radius: 16px;
                color: #f0f0f0;
                font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
                font-size: 13px;
                z-index: 99999;
                box-shadow: 0 8px 32px rgba(0,0,0,0.6);
                display: flex;
                flex-direction: column;
                overflow: hidden;
                animation: nxSlideIn 0.3s ease-out;
            }
            @keyframes nxSlideIn {
                from { opacity: 0; transform: translateY(-10px); }
                to { opacity: 1; transform: translateY(0); }
            }
            #nx-opt-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 8px 12px;
                background: rgba(10, 10, 14, 0.95);
                border-bottom: 1px solid rgba(255,255,255,0.08);
                font-weight: 600;
                font-size: 14px;
            }
            .nx-opt-title {
                display: flex;
                align-items: center;
                gap: 8px;
                color: #ccc;
            }
            .nx-opt-title svg {
                color: #ff4444;
            }
            #nx-opt-close {
                background: none;
                border: none;
                color: #888;
                cursor: pointer;
                padding: 2px;
                display: flex;
                align-items: center;
                transition: color 0.2s;
            }
            #nx-opt-close:hover { color: #fff; }
            #nx-opt-body {
                padding: 12px 14px;
            }
            .nx-opt-row {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 8px;
            }
            .nx-opt-label {
                display: flex;
                align-items: center;
                gap: 6px;
                color: #aaa;
            }
            .nx-opt-label svg {
                color: #888;
            }
            .nx-opt-value {
                font-weight: 600;
                color: #fff;
            }
            .nx-opt-status {
                font-weight: 600;
                font-size: 14px;
            }
            .nx-opt-status:contains('✓') { color: #4caf50; }
            hr {
                border: 0.5px solid rgba(255,255,255,0.08);
                margin: 8px 0;
            }
        `;
        document.head.appendChild(style);
        document.body.appendChild(menu);

        // Eventos
        document.getElementById('nx-opt-close').addEventListener('click', () => {
            menu.style.display = 'none';
            monitor.menuVisible = false;
        });

        document.addEventListener('keydown', (e) => {
            if (e.key === 'p' || e.key === 'P') {
                monitor.menuVisible = !monitor.menuVisible;
                menu.style.display = monitor.menuVisible ? 'flex' : 'none';
            }
        });

        // Actualizar cada segundo
        setInterval(() => {
            document.getElementById('nx-fps').textContent = monitor.fps;
            document.getElementById('nx-ping').textContent = monitor.ping + ' ms';
            document.getElementById('nx-players').textContent = monitor.players;

            document.getElementById('nx-uncap').textContent = applied.fpsUncap ? '✓' : '✗';
            document.getElementById('nx-uncap').style.color = applied.fpsUncap ? '#4caf50' : '#ff4444';
            document.getElementById('nx-interp').textContent = applied.interpolation ? '✓' : '✗';
            document.getElementById('nx-interp').style.color = applied.interpolation ? '#4caf50' : '#ff4444';
            document.getElementById('nx-hires').textContent = applied.highResTex ? '✓' : '✗';
            document.getElementById('nx-hires').style.color = applied.highResTex ? '#4caf50' : '#ff4444';
            document.getElementById('nx-shake').textContent = applied.screenShake ? '✓' : '✗';
            document.getElementById('nx-shake').style.color = applied.screenShake ? '#4caf50' : '#ff4444';
            document.getElementById('nx-pingint').textContent = applied.pingInterval ? '✓' : '✗';
            document.getElementById('nx-pingint').style.color = applied.pingInterval ? '#4caf50' : '#ff4444';
            document.getElementById('nx-wsbin').textContent = applied.webSocketBinary ? '✓' : '✗';
            document.getElementById('nx-wsbin').style.color = applied.webSocketBinary ? '#4caf50' : '#ff4444';
            document.getElementById('nx-hidemen').textContent = applied.menuElementsHidden ? '✓' : '✗';
            document.getElementById('nx-hidemen').style.color = applied.menuElementsHidden ? '#4caf50' : '#ff4444';

            updatePlayers();
        }, 1000);
    }

    function tryApply() {
        const ok = applyAllOptimizations();
        if (!ok) {
            setTimeout(tryApply, 3000);
        } else {
            setTimeout(tryApply, 10000);
        }
    }

    function init() {
        console.log('[Nexus Optimizer] Starting...');
        setupPingDetection();
        updateFPS();
        createMenu();
        setTimeout(tryApply, 2000);
    }

    if (document.readyState === 'complete' || document.readyState === 'interactive') {
        init();
    } else {
        window.addEventListener('DOMContentLoaded', init);
    }
})();