MooMoo.js anticheat calculator

Sort of calculating kick level

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         MooMoo.js anticheat calculator
// @namespace    http://tampermonkey.net/
// @version      0.1.54
// @description  Sort of calculating kick level
// @require      https://greasyfork.org/scripts/456235-moomoo-js/code/MooMoojs.js?version=1159501
// @author       Lovou#4725
// @match        *://*.moomoo.io/*
// @grant        none
// ==/UserScript==

const MooMoo = (function MooMooJS_beta() {})[69]

let kickCount = 0;
let intervalStarted = false;
const resetInterval = 60000; // 1 minute in milliseconds
let resetTime = Date.now() + resetInterval;

const resetKickCount = () => {
    kickCount = 0;
    resetTime = Date.now() + resetInterval;
};

MooMoo.addEventListener("packet", () => {
    if (!intervalStarted) {
        intervalStarted = true;
        setInterval(() => {
            const currentTime = Date.now();
            if (currentTime >= resetTime) {
                resetKickCount();
            }
        }, 100);
    }
});

const incrementKickCount = () => {
    kickCount++;
};

const calculateKickPercentage = (kicks, goal) => (kicks / goal) * 100;

const setStyles = element => {
    const styles = {
        position: "absolute",
        top: "0px",
        left: "0px",
        color: "white",
        fontFamily: "monospace",
        fontSize: "25px"
    };

    Object.entries(styles).forEach(([key, value]) => {
        element.style[key] = value;
    });
};

const displayGameInfo = () => {
    const gameInfoElement = document.createElement("div");
    setStyles(gameInfoElement);
    gameInfoElement.id = "playerPosition";

    document.body.appendChild(gameInfoElement);

    const updateGameInfo = () => {
        const currentTime = Date.now();
        const timeRemaining = resetTime - currentTime;
        document.getElementById("playerPosition").innerText = `[Kick (%): ${Math.round(
            calculateKickPercentage(kickCount, 5400)
        )}/100]\n [Reset: ${(timeRemaining / 1000).toFixed(1)} | PPM: ${kickCount}]`;
    };

    setInterval(updateGameInfo, 100);
};

MooMoo.onClientPacket = incrementKickCount;
MooMoo.onGameLoad = displayGameInfo;