Gats.io with Agar.io Movement

Agar.io Movement for Gats.io

目前为 2022-12-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         Gats.io with Agar.io Movement
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Agar.io Movement for Gats.io
// @author       Taureon
// @match        https://gats.io/
// @match        https://gats2.com/
// @grant        none
// @license      Unlicense
// ==/UserScript==

(function main(){
 
    //if the game hasn't loaded yet, wait until it is loaded
    //it is checked if the game has loaded by checking if the game tick function exists
    if (typeof a41 !== 'function') return setTimeout(main);

    //hooking into the main game loop
    let old_a41 = a41;
    a41 = () => {
        old_a41();
        
        //sanity check
        if (c3 === null) return;
    
        //reset movement
        for (let inputId of [0, 1, 2, 3]) RF.list[0].send(a59("key-press", {inputId, state: 0}));
        
        //you can change this if you want the circle to be smaller or larger or something else
        let radius = 50,
        
            playerMe = RD.pool[c3],
            me = c2.getRelPos(RD.pool[c3]),
            cursor = {x:  j9[0] / j6, y: j9[1] / j5},
            ctx = j58;
        
        //else "me" is one tick too forward
        me.x -= Math.round(playerMe.spdX / 2.5);
        me.y -= Math.round(playerMe.spdY / 2.5);
        
        //circle
        ctx.strokeStyle = '#444';
        ctx.lineWidth = 2;
        ctx.beginPath();
        ctx.moveTo(me.x + radius, me.y);
        ctx.arc(me.x, me.y, radius, 0, Math.PI * 2);
        ctx.stroke();
        
        //lines in circle
        for (let i = Math.PI / 8; i < Math.PI * 2; i += Math.PI / 4) {
            ctx.lineWidth = 1;
            ctx.beginPath();
            ctx.moveTo(me.x, me.y);
            ctx.lineTo(me.x + Math.sin(i) * radius, me.y + Math.cos(i) * radius);
            ctx.stroke();
        }
        
        //line from player to cursor
        ctx.strokeStyle = '#000';
        ctx.lineWidth = 1;
        ctx.beginPath();
        ctx.moveTo(me.x, me.y);
        ctx.lineTo(cursor.x, cursor.y);
        ctx.stroke();
    
        //calculate movement packets to send
        for (let inputId of [
            [1],   //'right',
            [1, 3],//'down right',
            [3],   //'down',
            [3, 0],//'down left',
            [0],   //'left',
            [2, 0],//'up left',
            [2],   //'up',
            [2, 1] //'up right'
        ][

            //SUPER COMPLICATED MAAAAAAAAAAAAAATH
            Math.round( ( Math.atan2(me.y - cursor.y, me.x - cursor.x) / Math.PI ) * 4 + 4) % 8

        //send these movement packets
        ]) RF.list[0].send(a59("key-press", {inputId, state: 1}));
    };
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址