[R] Memory AutoFire [V] Memory AutoSpin

JOIN OUR DISCORD FOR MORE: https://discord.gg/S3ZzgDNAuG

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         [R] Memory AutoFire [V] Memory AutoSpin
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  JOIN OUR DISCORD FOR MORE: https://discord.gg/S3ZzgDNAuG
// @author       r!PsAw
// @match        https://diep.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=diep.io
// @grant        unsafeWindow
// @run-at       document-start
// @license      MIT
// ==/UserScript==

const win = typeof unsafeWindow !== "undefined" ? unsafeWindow : window;
win.Object.defineProperty(win.Object.prototype, "HEAPF32", {
        get: function() {
            return undefined;
        },
        set: function(newHeapF32) {
            if (!newHeapF32 || !this.HEAPU32) return;
            delete win.Object.prototype.HEAPF32;
            window.Module = this;
            window.Module.HEAPF32 = newHeapF32;
            win.Module = window.Module;
            win.aim = false;
            initialize();
        },
        configurable: true,
        enumerable: true
    });

let states = {
    autofire: false,
    autospin: false,
}

let pressed_keys = new Set();

function read_states(){
    switch(window.Module.HEAPF32[18009]){
        case 0:
            states.autofire = false;
            states.autospin = false;
            break
        case 3.587324068671532e-43:
            states.autofire = true;
            states.autospin = false;
            break
        case 1.401298464324817e-45:
            states.autofire = false;
            states.autospin = true;
            break
        case 3.60133705331478e-43:
            states.autofire = true;
            states.autospin = true;
            break
    }
}

function initialize() {
    document.addEventListener("keydown", (e) => {
        read_states();
        if (e.code === "KeyR") {
            if (states.autofire) {
                input.inGameNotification('[Memory] Auto Fire: Off', 14425003);
                window.Module.HEAPF32[18009] = states.autospin ? 1.401298464324817e-45 : 0;
            } else {
                input.inGameNotification('[Memory] Auto Fire: On', 14425003);
                window.Module.HEAPF32[18009] = states.autospin ? 3.60133705331478e-43 : 3.587324068671532e-43;
            }
        }
        if (e.code === "KeyV") {
            if (states.autospin) {
                input.inGameNotification('[Memory] Auto Spin: Off', 14425003);
                window.Module.HEAPF32[18009] = states.autofire ? 3.587324068671532e-43 : 0;
            } else {
                input.inGameNotification('[Memory] Auto Spin: On', 14425003);
                window.Module.HEAPF32[18009] = states.autofire ? 3.60133705331478e-43 : 1.401298464324817e-45;
            }
        }
    });
}