Florr.io Auto-Evade Script

Script para esquivar automáticamente entidades dañinas en Florr.io con fines de desarrollo y pruebas internas.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Florr.io Auto-Evade Script
// @namespace    http://florr.io/dev-tools/
// @version      1.0
// @description  Script para esquivar automáticamente entidades dañinas en Florr.io con fines de desarrollo y pruebas internas.
// @author       Desarrollador del Juego
// @match        https://florr.io/
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const EVASION_DISTANCE = 150; // Distancia mínima para esquivar entidades peligrosas.
    const CHECK_INTERVAL = 50; // Tiempo en ms entre cada chequeo de entidades.

    /**
     * Función principal para detectar y esquivar entidades dañinas.
     */
    function autoEvade() {
        const player = getPlayer();
        const entities = getEntities();

        if (!player) {
            console.warn('No se detectó al jugador.');
            return;
        }

        if (entities.length === 0) {
            console.log('No hay entidades cercanas.');
            return;
        }

        entities.forEach(entity => {
            if (isDangerous(entity) && getDistance(player, entity) < EVASION_DISTANCE) {
                console.log(`Esquivando entidad peligrosa en (${entity.x}, ${entity.y})`);
                evadeEntity(player, entity);
            }
        });
    }

    /**
     * Obtiene la posición del jugador.
     */
    function getPlayer() {
        return window.gameState?.player || null; // Ajustar según la estructura real del juego.
    }

    /**
     * Obtiene todas las entidades presentes en el mapa.
     */
    function getEntities() {
        return window.gameState?.entities || []; // Ajustar según la estructura real del juego.
    }

    /**
     * Determina si una entidad es peligrosa.
     */
    function isDangerous(entity) {
        return entity.type === 'enemy'; // Ajustar según los tipos reales de entidades.
    }

    /**
     * Calcula la distancia entre el jugador y una entidad.
     */
    function getDistance(a, b) {
        return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);
    }

    /**
     * Lógica para esquivar una entidad peligrosa.
     */
    function evadeEntity(player, entity) {
        const dx = player.x - entity.x;
        const dy = player.y - entity.y;

        const angle = Math.atan2(dy, dx);
        const newX = player.x + Math.cos(angle) * EVASION_DISTANCE;
        const newY = player.y + Math.sin(angle) * EVASION_DISTANCE;

        movePlayer(newX, newY);
    }

    /**
     * Mueve al jugador a una nueva posición.
     */
    function movePlayer(x, y) {
        if (window.sendInput) {
            window.sendInput('move', { x, y });
        } else {
            console.error('La función de movimiento no está disponible.');
        }
    }

    // Ejecuta la función autoEvade en intervalos definidos.
    setInterval(autoEvade, CHECK_INTERVAL);
})();