Greasy Fork

Greasy Fork is available in English.

MooMoo.io Anti-Insta, Quad Spike/Trap, Enemy Trap Indicator

Anti-insta, auto-heal, quad spike/trap, and enemy trap line indicator.

当前为 2025-01-29 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         MooMoo.io Anti-Insta, Quad Spike/Trap, Enemy Trap Indicator
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Anti-insta, auto-heal, quad spike/trap, and enemy trap line indicator.
// @author       II
// @match        *://moomoo.io/*
// @grant        none
// @license      ALL RIGHTS RESERVED
// ==/UserScript==

(function() {
    'use strict';

    console.log("🔥 MooMoo.io Mod by II Loaded!");

    // Keybinds
    const KEY_TANK_GEAR = 'F';
    const KEY_SOLDIER_GEAR = 'G';
    const KEY_QUAD_SPIKE = 'T';
    const KEY_QUAD_TRAP = 'Y';
    const KEY_TOGGLE_AUTO_HEAL = 'B';
    const KEY_TOGGLE_ANTI_TRAP = 'V';

    const AUTO_HEAL_THRESHOLD = 60;
    let autoHealEnabled = true;
    let antiTrapEnabled = true;

    let lastTrapTime = 0;
    const TRAP_DELAY = 2000;

    let player = { x: 0, y: 0 };
    let enemies = {};
    let spikes = [];

    // Create a canvas for the enemy trap indicator
    let canvas = document.createElement("canvas");
    document.body.appendChild(canvas);
    canvas.style.position = "absolute";
    canvas.style.top = "0";
    canvas.style.left = "0";
    canvas.style.pointerEvents = "none";
    let ctx = canvas.getContext("2d");

    function resizeCanvas() {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
    }
    window.addEventListener("resize", resizeCanvas);
    resizeCanvas();

    // Intercept WebSocket messages
    const oldSend = WebSocket.prototype.send;
    WebSocket.prototype.send = function(data) {
        try {
            let msg = new Uint8Array(data);

            // Auto-Heal & Anti-Insta
            if (msg.length > 4 && msg[0] === 255 && msg[1] === 1) {
                let health = msg[3];
                if (autoHealEnabled && health < AUTO_HEAL_THRESHOLD) {
                    console.log("⚕️ Auto Healing...");
                    oldSend.call(this, new Uint8Array([255, 3, 0]));
                }
                if (health < 30) {
                    console.log("🛡️ Auto-Switching to Soldier Gear!");
                    selectHat(15);
                }
            }

            // Anti-Trap Mode
            if (msg.length > 4 && msg[0] === 255 && msg[1] === 3 && antiTrapEnabled) {
                let trapType = msg[2]; 
                if (trapType === 6) { 
                    let now = Date.now();
                    if (now - lastTrapTime > TRAP_DELAY) {
                        console.log("🚨 Anti-Trap Mode: Placing traps behind!");
                        placeTrapBehind();
                        lastTrapTime = now;
                    }
                }
            }

            // Enemy Trap Indicator
            if (msg.length > 4 && msg[0] === 255 && msg[1] === 3) {
                let enemyID = msg[2];
                let trapX = msg[3];
                let trapY = msg[4];

                if (enemies[enemyID]) {
                    let enemyPos = enemies[enemyID];
                    let closestSpike = getNearestSpike(enemyPos.x, enemyPos.y);
                    if (closestSpike) {
                        drawLethalLine(player.x, player.y, enemyPos.x, enemyPos.y, closestSpike.x, closestSpike.y);
                    }
                }
            }

        } catch (error) {
            console.error("Error processing WebSocket data:", error);
        }
        return oldSend.apply(this, arguments);
    };

    // Key events
    document.addEventListener("keydown", function(event) {
        let key = event.key.toUpperCase();

        if (key === KEY_TANK_GEAR) {
            console.log("💥 Switching to Tank Gear...");
            selectHat(7);
        }
        if (key === KEY_SOLDIER_GEAR) {
            console.log("🛡️ Switching to Soldier Gear...");
            selectHat(15);
        }
        if (key === KEY_QUAD_SPIKE) {
            console.log("💥 Placing Quad Spikes...");
            placeQuadSpikes();
        }
        if (key === KEY_QUAD_TRAP) {
            console.log("🚨 Placing Quad Traps...");
            placeQuadTraps();
        }
    });

    // Draw Enemy Trap Indicator
    function drawLethalLine(px, py, ex, ey, sx, sy) {
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        ctx.beginPath();
        ctx.moveTo(px, py);
        ctx.lineTo(ex, ey);
        ctx.lineTo(sx, sy);

        let isAligned = Math.abs(px - sx) < 10 || Math.abs(py - sy) < 10;
        ctx.strokeStyle = isAligned ? "green" : "red";
        ctx.lineWidth = 3;
        ctx.stroke();

        setTimeout(() => {
            ctx.clearRect(0, 0, canvas.width, canvas.height);
        }, 3000);
    }

    // Place 2 traps behind
    function placeTrapBehind() {
        for (let i = 0; i < 2; i++) {
            window.gameSocket.send(new Uint8Array([255, 3, 6]));
        }
    }

    // Place 4 spikes
    function placeQuadSpikes() {
        for (let i = 0; i < 4; i++) {
            window.gameSocket.send(new Uint8Array([255, 3, 0]));
        }
    }

    // Place 4 traps
    function placeQuadTraps() {
        for (let i = 0; i < 4; i++) {
            window.gameSocket.send(new Uint8Array([255, 3, 6]));
        }
    }

    // Select a hat
    function selectHat(hatID) {
        window.gameSocket.send(new Uint8Array([255, 6, hatID]));
    }

})();