Greasy Fork 支持简体中文。

Custom Mod with Auto Heal and Key Binds

A custom mod with auto healing and key bindings to switch hats and place traps.

// ==UserScript==
// @name         Custom Mod with Auto Heal and Key Binds
// @version      1.0
// @author       II
// @match        *://moomoo.io/*
// @grant        none
// @namespace    https://greasyfork.org/users/805514
// @description  A custom mod with auto healing and key bindings to switch hats and place traps.
// ==/UserScript==

let autoHealSpeed = 100; // Speed of auto healing
let trapCount = 4; // Number of traps to place
let tankHats = [1, 2]; // Example IDs for tank hats
let soldierHats = [3, 4]; // Example IDs for soldier hats
let currentHatType = 'soldier'; // Starting with soldier hats

// Function to add styles
function addStyle(styleItem) {
    if (typeof GM_addStyle != "undefined") {
        GM_addStyle(styleItem);
    } else {
        var node = document.createElement("style");
        node.type = "text/css";
        node.appendChild(document.createTextNode(styleItem));
        var heads = document.getElementsByTagName("head");
        if (heads.length > 0) {
            heads[0].appendChild(node);
        } else {
            document.documentElement.appendChild(node);
        }
    }
}

// Auto Heal Function
function autoHeal() {
    let myHealth = player.health; // Assuming player object exists
    let myMaxHealth = player.maxHealth;
    if (myHealth < myMaxHealth) {
        player.health += Math.min(autoHealSpeed, myMaxHealth - myHealth); // Heal quickly
    }
}

// Key Binding to Switch Hats
document.addEventListener('keydown', function(event) {
    if (event.key === 't') {
        currentHatType = currentHatType === 'soldier' ? 'tank' : 'soldier';
        let newHat = (currentHatType === 'tank') ? tankHats[Math.floor(Math.random() * tankHats.length)] : soldierHats[Math.floor(Math.random() * soldierHats.length)];
        player.skinIndex = newHat; // Update player's hat
    }
});

// Key Binding to Place Traps
document.addEventListener('keydown', function(event) {
    if (event.key === 'y') {
        placeTraps(); // Call function to place traps
    }
});

// Function to Place Traps Around Player
function placeTraps() {
    for (let i = 0; i < trapCount; i++) {
        let angle = (i * (Math.PI / 2)); // Distributing traps in a square
        let trapX = player.x + Math.cos(angle) * 50; // Adjust distance as needed
        let trapY = player.y + Math.sin(angle) * 50; // Adjust distance as needed
        if (canPlaceTrap(trapX, trapY)) { // Check if we can place a trap
            placeTrap(trapX, trapY); // Assuming placeTrap is a function that places a trap at the specified coordinates
        }
    }
}

// Bypass Captcha Placeholder
function bypassCaptcha() {
    // Implement captcha bypass logic here
}

// Main function to keep everything running
(function() {
    let styleItem = `
        /* Add custom styles here */
    `;

    addStyle(styleItem);
    
    setInterval(() => {
        autoHeal(); // Call auto heal function periodically
        bypassCaptcha(); // Call captcha bypass function
    }, 1000); // Adjust interval as needed
})();