Anti Projectile.

Anti bow insta.

当前为 2024-08-24 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Anti Projectile.
// @namespace    https://sandbox.moomoo.io/
// @version      v1.1
// @description  Anti bow insta.
// @author       Bianos Sozinho, Discord: istisna.bianos
// @match        *://*.moomoo.io/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/msgpack.min.js
// @icon         https://moomoo.io/img/favicon.png?v=1
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let msgpack_lite = window.msgpack, possibleBowInsta = false, moving = false, ownPlayer = {}, projectiles = [], packetLimitazition = {max: 120, count: 0}, mill, socket, mouseX, mouseY, mouseAngle, height, width, resize, OriginalWebSocket = window.WebSocket;
    window.WebSocket = function(...args) {
        socket = new OriginalWebSocket(...args);
        socket.addEventListener('message', (event) => {
            let decoded = msgpack_lite.decode(new Uint8Array(event.data));
            let hooked;
            if (decoded.length > 1 && Array.isArray(decoded[1])) {
                hooked = [decoded[0], ...decoded[1]];
            } else {
                hooked = decoded
            }

            if(hooked[0] === "io-init") {
                let cvs = document.getElementById("gameCanvas");
                width = cvs.clientWidth;
                height = cvs.clientHeight;
                $(window).resize(function() {
                    width = cvs.clientWidth;
                    height = cvs.clientHeight;
                });
                resize = function() {
                    width = cvs.clientWidth;
                    height = cvs.clientHeight;
                }
                cvs.addEventListener("mousemove", e => {
                    mouseX = e.clientX;
                    mouseY = e.clientY;
                    mouseAngle = Math.atan2(mouseY - (height / 2), mouseX - (width / 2));
                });
            }
            if(hooked[0] == "C") {
                if(ownPlayer.sid == null || ownPlayer.sid == undefined) {
                    ownPlayer.sid = hooked[1];
                }
            }
            if (hooked[0] == "a") {
                if(!possibleBowInsta) projectiles = [];
                for (let i = 0; i < hooked[1].length / 13; i++) {
                    let playerInfo = hooked[1].slice(13 * i, 13 * i + 13);
                    if (playerInfo[0] == ownPlayer.sid) {
                        ownPlayer.x = playerInfo[1];
                        ownPlayer.y = playerInfo[2];
                    }
                }
                if(moving && !possibleBowInsta) {
                    setTimeout(() => {
                        sendMessage("a", null);
                        moving = false;
                    }, 300);
                }
            }
            if (hooked[0] == "X") {
                projectiles.push({x: hooked[1], y: hooked[2], type: hooked[6]});
                let choosedProjectiles = [0, 2, 5];
                let filteredProjectiles = projectiles.filter(proj => choosedProjectiles.includes(proj.type));
                if(filteredProjectiles[0].type == 0) {
                    possibleBowInsta = true;
                }
                if(filteredProjectiles.length >= 2 && filteredProjectiles[1].type == 2) {
                    let getAngle = Math.atan2(filteredProjectiles[0].y - ownPlayer.y, filteredProjectiles[0].x - ownPlayer.x);
                    place(mill, getAngle);
                    sendMessage("a", getAngle + 35);
                    moving = true;
                    possibleBowInsta = false;
                }
            }

            update();
        });
        return socket;
    };
    let sendMessage = (function(type, ...args) {
        if (packetLimitazition.count < packetLimitazition.max) {
            const message = [type, args];
            const encodedMessage = msgpack_lite.encode(message);
            const byteArray = new Uint8Array(encodedMessage);
            socket.send(byteArray);
            packetLimitazition.count++;
        }
    });
    function place(id, rad) {
        sendMessage("G", id, null);
        sendMessage("d", 1, rad);
        sendMessage("d", 0, rad);
    };

    function isElementVisible(e) {
        return (e.offsetParent !== null);
    }
    function update() {
        for (let i=26;i<29;i++){
            if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
                mill = i - 16;
            }
        }
    }
})();