Dn.io

Bot circulo perfecto

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.sleazyfork.org/scripts/579613/1833833/Dnio.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Dn.io
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Bot circulo perfecto
// @author       You
// @match        https://wormax.io/
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    let botOn       = false;
    let botInterval = null;
    let isDragging  = false;
    let dragOffX = 0, dragOffY = 0;

    // Estado de angulo para el circulo (global, siempre avanza)
    let circleAngle = 0;
    let zigDir = 1, zigPos = 0;
    let randTimer = 0, randTargetX = 0, randTargetY = 0;
    let randCurrX = 0, randCurrY = 0;

    // =========================
    // MENU HTML
    // =========================
    const menu = document.createElement('div');
    menu.id = 'bot-menu';
    menu.innerHTML = `
        <div id="bot-header">
            <span>🤖 BOT MENU</span>
            <button id="bot-min-btn" title="Minimizar">—</button>
        </div>
        <div id="bot-body">
            <div class="bot-row" id="bot-row-main">
                <div class="bot-info">
                    <span class="bot-icon">🐍</span>
                    <span class="bot-label">Auto Movimiento</span>
                </div>
                <div class="bot-right">
                    <label class="bot-switch">
                        <input type="checkbox" id="chk-bot">
                        <span class="bot-slider"></span>
                    </label>
                    <span class="bot-status" id="bot-status-txt">OFF</span>
                </div>
            </div>
            <div class="sep"></div>
            <div class="bot-mode-label">Modo:</div>
            <div class="bot-modes">
                <label class="mode-opt"><input type="radio" name="botMode" value="circle" checked> 🔵 Círculo</label>
                <label class="mode-opt"><input type="radio" name="botMode" value="zigzag"> ↔ Zigzag</label>
                <label class="mode-opt"><input type="radio" name="botMode" value="random"> 🎲 Aleatorio</label>
            </div>
            <div class="sep"></div>
            <div class="bot-speed-row">
                <span class="bot-mode-label">Velocidad:</span>
                <input type="range" id="speed-slider" min="1" max="10" value="5" step="1">
                <span id="speed-val">5</span>
            </div>
            <div class="sep"></div>
            <div class="bot-hint">Numpad 1 → Toggle Bot</div>
        </div>
    `;
    document.body.appendChild(menu);

    // =========================
    // ESTILOS
    // =========================
    const style = document.createElement('style');
    style.innerHTML = `
        #bot-menu {
            position: fixed; top: 80px; right: 30px; width: 240px;
            background: #0d0d0d; border: 1.5px solid #00ff88; border-radius: 14px;
            z-index: 999999; box-shadow: 0 0 22px rgba(0,255,136,0.3);
            font-family: Arial, sans-serif; user-select: none; overflow: hidden;
        }
        #bot-header {
            display: flex; align-items: center; justify-content: space-between;
            background: #111; padding: 9px 13px; cursor: grab;
            border-bottom: 1px solid #1e1e1e;
            color: #00ff88; font-size: 12px; font-weight: bold; letter-spacing: 1.5px;
        }
        #bot-header:active { cursor: grabbing; }
        #bot-min-btn {
            background: none; border: 1px solid #333; color: #888; border-radius: 5px;
            width: 22px; height: 22px; cursor: pointer; font-size: 14px;
            display: flex; align-items: center; justify-content: center; padding: 0; transition: 0.15s;
        }
        #bot-min-btn:hover { border-color: #00ff88; color: #00ff88; }
        #bot-body {
            padding: 12px 14px;
            transition: max-height 0.25s ease, padding 0.25s, opacity 0.2s;
            max-height: 400px; opacity: 1; overflow: hidden;
        }
        #bot-body.hidden { max-height: 0; padding: 0 14px; opacity: 0; }
        .bot-row {
            display: flex; align-items: center; justify-content: space-between;
            background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 10px;
            padding: 9px 11px; transition: border-color 0.2s, box-shadow 0.2s;
        }
        .bot-row.active { border-color: #00ff88; box-shadow: 0 0 10px rgba(0,255,136,0.15); }
        .bot-info { display: flex; align-items: center; gap: 9px; }
        .bot-icon { font-size: 18px; }
        .bot-label { color: #aaa; font-size: 12px; }
        .bot-right { display: flex; align-items: center; gap: 7px; }
        .bot-switch { position: relative; display: inline-block; width: 42px; height: 22px; }
        .bot-switch input { opacity: 0; width: 0; height: 0; }
        .bot-slider {
            position: absolute; cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background: #2e2e2e; border-radius: 22px; border: 1px solid #444; transition: 0.25s;
        }
        .bot-slider::before {
            content: ""; position: absolute;
            height: 16px; width: 16px; left: 3px; bottom: 2px;
            background: #777; border-radius: 50%; transition: 0.25s;
        }
        .bot-switch input:checked + .bot-slider { background: #00cc6a; border-color: #00ff88; box-shadow: 0 0 8px rgba(0,255,136,0.4); }
        .bot-switch input:checked + .bot-slider::before { transform: translateX(18px); background: #fff; }
        .bot-status { font-size: 11px; font-weight: bold; color: #444; min-width: 22px; transition: color 0.2s; }
        .bot-row.active .bot-status { color: #00ff88; }
        .sep { height: 1px; background: #1e1e1e; margin: 10px 0; }
        .bot-mode-label { font-size: 11px; color: #666; margin-bottom: 7px; }
        .bot-modes { display: flex; flex-direction: column; gap: 5px; }
        .mode-opt { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #aaa; cursor: pointer; }
        .mode-opt input[type=radio] { accent-color: #00ff88; cursor: pointer; }
        .bot-speed-row { display: flex; align-items: center; gap: 8px; }
        .bot-speed-row .bot-mode-label { margin-bottom: 0; white-space: nowrap; }
        #speed-slider { flex: 1; accent-color: #00ff88; }
        #speed-val { font-size: 12px; font-weight: bold; color: #00ff88; min-width: 14px; text-align: right; }
        .bot-hint { font-size: 10px; color: #333; text-align: center; }
    `;
    document.head.appendChild(style);

    // =========================
    // DRAGGABLE
    // =========================
    const header = document.getElementById('bot-header');
    header.addEventListener('mousedown', e => {
        if (e.target.id === 'bot-min-btn') return;
        isDragging = true;
        const r = menu.getBoundingClientRect();
        dragOffX = e.clientX - r.left;
        dragOffY = e.clientY - r.top;
        e.preventDefault();
    });
    document.addEventListener('mousemove', e => {
        if (!isDragging) return;
        let nx = Math.max(0, Math.min(window.innerWidth  - menu.offsetWidth,  e.clientX - dragOffX));
        let ny = Math.max(0, Math.min(window.innerHeight - menu.offsetHeight, e.clientY - dragOffY));
        menu.style.left = nx + 'px';
        menu.style.top  = ny + 'px';
        menu.style.right = 'auto';
    });
    document.addEventListener('mouseup', () => { isDragging = false; });

    // =========================
    // MINIMIZAR
    // =========================
    const body   = document.getElementById('bot-body');
    const minBtn = document.getElementById('bot-min-btn');
    let minimized = false;
    minBtn.addEventListener('click', () => {
        minimized = !minimized;
        body.classList.toggle('hidden', minimized);
        minBtn.textContent = minimized ? '+' : '—';
    });

    // =========================
    // VELOCIDAD
    // =========================
    const speedSlider = document.getElementById('speed-slider');
    const speedValEl  = document.getElementById('speed-val');
    speedSlider.addEventListener('input', () => {
        speedValEl.textContent = speedSlider.value;
        if (botOn) { stopBot(); startBot(); }
    });

    function getMode() {
        return document.querySelector('input[name="botMode"]:checked')?.value || 'circle';
    }

    // =========================
    // DISPARAR EVENTO AL CANVAS
    // =========================
    function sendMouse(x, y) {
        const canvas = document.querySelector('canvas');
        if (!canvas) return;
        canvas.dispatchEvent(new MouseEvent('mousemove', {
            clientX: x, clientY: y,
            bubbles: true, cancelable: true
        }));
    }

    // =========================
    // MODO CIRCULO
    // El angulo avanza de forma constante cada tick
    // Radio fijo = 180px alrededor del centro de pantalla
    // =========================
    const CIRCLE_RADIUS = 180;
    // Cuanto avanza el angulo por tick segun velocidad
    function getAngleStep() {
        const v = parseInt(speedSlider.value); // 1-10
        // velocidad 1 → 0.008 rad/tick, velocidad 10 → 0.06 rad/tick
        return 0.008 + (v - 1) * (0.06 - 0.008) / 9;
    }

    function tickCircle() {
        circleAngle += getAngleStep();
        if (circleAngle > Math.PI * 2) circleAngle -= Math.PI * 2;
        const cx = window.innerWidth  / 2;
        const cy = window.innerHeight / 2;
        sendMouse(
            cx + Math.cos(circleAngle) * CIRCLE_RADIUS,
            cy + Math.sin(circleAngle) * CIRCLE_RADIUS
        );
    }

    // =========================
    // MODO ZIGZAG
    // =========================
    function tickZigzag() {
        const v = parseInt(speedSlider.value);
        const speed = 2 + v * 0.8;
        zigPos += speed * zigDir;
        if (zigPos >  220 || zigPos < -220) zigDir *= -1;
        sendMouse(
            window.innerWidth  / 2 + zigPos,
            window.innerHeight / 2 + Math.sin(zigPos * 0.03) * 100
        );
    }

    // =========================
    // MODO ALEATORIO (suave, interpola hacia el target)
    // =========================
    function tickRandom() {
        randTimer--;
        if (randTimer <= 0) {
            randTimer = 40 + Math.floor(Math.random() * 80);
            randTargetX = window.innerWidth  * 0.15 + Math.random() * window.innerWidth  * 0.7;
            randTargetY = window.innerHeight * 0.15 + Math.random() * window.innerHeight * 0.7;
            if (randCurrX === 0) { randCurrX = window.innerWidth / 2; randCurrY = window.innerHeight / 2; }
        }
        // Interpolacion suave hacia el objetivo
        randCurrX += (randTargetX - randCurrX) * 0.08;
        randCurrY += (randTargetY - randCurrY) * 0.08;
        sendMouse(randCurrX, randCurrY);
    }

    // =========================
    // INICIAR / PARAR
    // El intervalo siempre es 16ms (60fps) para que el circulo sea fluido.
    // La velocidad controla el ANGULO que avanza, no el intervalo.
    // =========================
    function startBot() {
        const mode = getMode();
        botInterval = setInterval(() => {
            if      (mode === 'circle') tickCircle();
            else if (mode === 'zigzag') tickZigzag();
            else                        tickRandom();
        }, 16); // siempre 60fps para movimiento suave
    }

    function stopBot() {
        if (botInterval) { clearInterval(botInterval); botInterval = null; }
    }

    // =========================
    // TOGGLE
    // =========================
    const chkBot    = document.getElementById('chk-bot');
    const rowMain   = document.getElementById('bot-row-main');
    const statusTxt = document.getElementById('bot-status-txt');

    function activateBot(state) {
        botOn = state;
        chkBot.checked = state;
        if (state) {
            // Reiniciar angulo desde la posicion actual del mouse
            circleAngle = 0; zigPos = 0; zigDir = 1; randTimer = 0;
            startBot();
            rowMain.classList.add('active');
            statusTxt.textContent = 'ON';
        } else {
            stopBot();
            rowMain.classList.remove('active');
            statusTxt.textContent = 'OFF';
        }
    }

    chkBot.addEventListener('change', () => activateBot(chkBot.checked));

    document.querySelectorAll('input[name="botMode"]').forEach(r => {
        r.addEventListener('change', () => {
            if (botOn) { stopBot(); startBot(); }
        });
    });

    // =========================
    // HOTKEY Numpad 1
    // =========================
    window.addEventListener('keydown', e => {
        if (e.code === 'Numpad1') {
            e.preventDefault();
            activateBot(!botOn);
        }
    }, true);

})();