Diep.io Octo stacking script

I am Gay

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Diep.io Octo stacking script
// @namespace    http://tampermonkey.net/
// @license MIT
// @version      1.4
// @description  I am Gay
// @author       Arras Script God YT
// @match        *://diep.io/*
// @grant        none
// ==/UserScript==

(function () {
    let enabled = false;
    let realX = innerWidth / 2;
    let realY = innerHeight / 2;
    let fakeX = realX;
    let fakeY = realY;

    let tickCount = 0;
    const SWEEP_SPEED = 0.11; 
    
    const MAX_SWEEP_ANGLE = 360 * (Math.PI / 180); 

    let lastActiveTime = performance.now();
    let isPaused = false;
    let pauseStartTime = 0;

    function updateTargetCoordinates() {
        const now = performance.now();

        if (!isPaused && (now - lastActiveTime >= 500)) {
            isPaused = true;
            pauseStartTime = now;
        }

        if (isPaused) {
            if (now - pauseStartTime >= 1) {
                isPaused = false;
                lastActiveTime = now;
            } else {
                return; 
            }
        }

        const cx = innerWidth / 2;
        const cy = innerHeight / 2;
        const dx = realX - cx;
        const dy = realY - cy;
        
        const baseAngle = Math.atan2(dy, dx); 
        
        tickCount += SWEEP_SPEED;
        const currentAngleOffset = - (tickCount % MAX_SWEEP_ANGLE); 
        
        const targetAngle = baseAngle + currentAngleOffset;

        const dist = Math.max(Math.hypot(dx, dy), 300);
        
        fakeX = cx + dist * Math.cos(targetAngle);
        fakeY = cy + dist * Math.sin(targetAngle);
    }

    function autoLoop() {
        if (enabled) {
            updateTargetCoordinates();
            const canvas = document.querySelector("canvas");
            if (canvas) {
                const eventDict = { bubbles: true, clientX: fakeX, clientY: fakeY };
                canvas.dispatchEvent(new MouseEvent("mousemove", eventDict));
                canvas.dispatchEvent(new PointerEvent("pointermove", eventDict));
            }
        }
        requestAnimationFrame(autoLoop);
    }
    requestAnimationFrame(autoLoop);

    const oldAdd = EventTarget.prototype.addEventListener;
    EventTarget.prototype.addEventListener = function (type, listener, opts) {
        if (type === "mousemove" || type === "pointermove") {
            const wrapped = function (e) {
                if (e.isTrusted) {
                    realX = e.clientX;
                    realY = e.clientY;
                    
                    if (enabled) {
                        e.stopPropagation();
                        return; 
                    }
                }

                if (!enabled) return listener.call(this, e);

                const proxy = new Proxy(e, {
                    get(target, prop) {
                        if (['clientX', 'pageX', 'offsetX', 'screenX', 'x'].includes(prop)) return fakeX;
                        if (['clientY', 'pageY', 'offsetY', 'screenY', 'y'].includes(prop)) return fakeY;
                        if (['movementX', 'movementY'].includes(prop)) return 0;
                        
                        const value = target[prop];
                        return typeof value === 'function' ? value.bind(target) : value;
                    }
                });

                return listener.call(this, proxy);
            };
            return oldAdd.call(this, type, wrapped, opts);
        }
        return oldAdd.call(this, type, listener, opts);
    };

    addEventListener("keydown", e => {
        if (e.key.toLowerCase() === "p") {
            enabled = !enabled;
            if (enabled) {
                fakeX = realX;
                fakeY = realY;
                tickCount = 0; 
                lastActiveTime = performance.now();
                isPaused = false;
            }
        }
    });
})();