Florr.io Auto-Evade Script

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

  1. // ==UserScript==
  2. // @name Florr.io Auto-Evade Script
  3. // @namespace http://florr.io/dev-tools/
  4. // @version 1.0
  5. // @description Script para esquivar automáticamente entidades dañinas en Florr.io con fines de desarrollo y pruebas internas.
  6. // @author Desarrollador del Juego
  7. // @match https://florr.io/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. 'use strict';
  13.  
  14. const EVASION_DISTANCE = 150; // Distancia mínima para esquivar entidades peligrosas.
  15. const CHECK_INTERVAL = 50; // Tiempo en ms entre cada chequeo de entidades.
  16.  
  17. /**
  18. * Función principal para detectar y esquivar entidades dañinas.
  19. */
  20. function autoEvade() {
  21. const player = getPlayer();
  22. const entities = getEntities();
  23.  
  24. if (!player) {
  25. console.warn('No se detectó al jugador.');
  26. return;
  27. }
  28.  
  29. if (entities.length === 0) {
  30. console.log('No hay entidades cercanas.');
  31. return;
  32. }
  33.  
  34. entities.forEach(entity => {
  35. if (isDangerous(entity) && getDistance(player, entity) < EVASION_DISTANCE) {
  36. console.log(`Esquivando entidad peligrosa en (${entity.x}, ${entity.y})`);
  37. evadeEntity(player, entity);
  38. }
  39. });
  40. }
  41.  
  42. /**
  43. * Obtiene la posición del jugador.
  44. */
  45. function getPlayer() {
  46. return window.gameState?.player || null; // Ajustar según la estructura real del juego.
  47. }
  48.  
  49. /**
  50. * Obtiene todas las entidades presentes en el mapa.
  51. */
  52. function getEntities() {
  53. return window.gameState?.entities || []; // Ajustar según la estructura real del juego.
  54. }
  55.  
  56. /**
  57. * Determina si una entidad es peligrosa.
  58. */
  59. function isDangerous(entity) {
  60. return entity.type === 'enemy'; // Ajustar según los tipos reales de entidades.
  61. }
  62.  
  63. /**
  64. * Calcula la distancia entre el jugador y una entidad.
  65. */
  66. function getDistance(a, b) {
  67. return Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);
  68. }
  69.  
  70. /**
  71. * Lógica para esquivar una entidad peligrosa.
  72. */
  73. function evadeEntity(player, entity) {
  74. const dx = player.x - entity.x;
  75. const dy = player.y - entity.y;
  76.  
  77. const angle = Math.atan2(dy, dx);
  78. const newX = player.x + Math.cos(angle) * EVASION_DISTANCE;
  79. const newY = player.y + Math.sin(angle) * EVASION_DISTANCE;
  80.  
  81. movePlayer(newX, newY);
  82. }
  83.  
  84. /**
  85. * Mueve al jugador a una nueva posición.
  86. */
  87. function movePlayer(x, y) {
  88. if (window.sendInput) {
  89. window.sendInput('move', { x, y });
  90. } else {
  91. console.error('La función de movimiento no está disponible.');
  92. }
  93. }
  94.  
  95. // Ejecuta la función autoEvade en intervalos definidos.
  96. setInterval(autoEvade, CHECK_INTERVAL);
  97. })();