AutoInsta

R for auto Insta dont abuse this or i patch OwO

// ==UserScript==
// @name         AutoInsta
// @namespace    none
// @version      0.1
// @description  R for auto Insta dont abuse this or i patch OwO
// @author       xxgirlxx
// @match        https://*.moomoo.io/*
// @icon         http://moomoo.io/img/weapons/musket_1.png
// @grant        none
// ==/UserScript==
/* jshint esversion:8 */

/*
    Author: XxgirlxX
    Discord: IceCream Or xxgirlxx
    Greasyfork: https://greasyfork.org/en/users/1064285-vcrazy-gaming
*/
const MooMoo = function () {} [69];
var preInsta = false,
   canInsta = false;

function updatePreInstaStatus() {
   var e = document.getElementById("preInstaStatus");
   preInsta ? (e.innerText = "[true]") : (e.innerText = "[false]");
}
async function asyncInsta() {
   let e = MooMoo.ActivePlayerManager.getClosestEnemyDistance(); // returns the distance to the nearest enemy
   if (preInsta && !canInsta && e && e <= 200) {
      canInsta = true;
      let {
         secondary: o
      } = MooMoo.myPlayer.inventory,
         t = MooMoo.ActivePlayerManager.getClosestEnemyAngle(), {
            // returns the angle to the nearest enemy
            primary: a,
         } = MooMoo.myPlayer.inventory;
      MooMoo.myPlayer.hit(t);
      MooMoo.sendPacket("5", a, true);
      MooMoo.myPlayer.buyHat(7);
      MooMoo.myPlayer.equipHat(7);
      MooMoo.myPlayer.unequipAccessory();
      setTimeout(() => {
         MooMoo.myPlayer.hit(t);
         MooMoo.myPlayer.buyHat(53);
         MooMoo.myPlayer.equipHat(53);
         MooMoo.sendPacket("5", o, true);
      }, 100);
      setTimeout(() => {
         MooMoo.sendPacket("5", a, true);
         MooMoo.myPlayer.buyHat(6);
         MooMoo.myPlayer.equipHat(6);
         MooMoo.myPlayer.buyAccessory(11);
         MooMoo.myPlayer.equipAccessory(11);
         2400 > MooMoo.myPlayer.y ?
            (MooMoo.myPlayer.buyHat(15), MooMoo.myPlayer.equipHat(15)) :
            6850 < MooMoo.myPlayer.y && MooMoo.myPlayer.y < 7550 ?
            (MooMoo.myPlayer.buyHat(31), MooMoo.myPlayer.equipHat(31)) :
            (MooMoo.myPlayer.buyHat(12), MooMoo.myPlayer.equipHat(12));
         canInsta = false;
         preInsta = false;
         document.getElementById("preInstaStatus").innerText = "[false]";
      }, 200);
   }
}
var isKeyDown = false;

function handleKeyDown(e) {
   82 !== e.which ||
      isKeyDown ||
      "chatbox" === document.activeElement.id.toLowerCase() ||
      ((isKeyDown = true),
         preInsta ? ((preInsta = false), (canInsta = false)) : (preInsta = true),
         asyncInsta(),
         updatePreInstaStatus());
}

function handleKeyUp(e) {
   82 === e.which && (isKeyDown = false);
}
document.addEventListener("keydown", handleKeyDown);
document.addEventListener("keyup", handleKeyUp);
document.addEventListener("keydown", handleKeyDown);
MooMoo.addEventListener("updatePlayers", function (e) {
   canInsta || asyncInsta();
});
var preInstaStatusElement = document.createElement("div");
preInstaStatusElement.id = "preInstaStatus";
preInstaStatusElement.style.position = "fixed";
preInstaStatusElement.style.top = "5%";
preInstaStatusElement.style.left = "5%";
preInstaStatusElement.style.transform = "translate(-50%, -50%)";
preInstaStatusElement.style.color = "white";
preInstaStatusElement.style.fontSize = "25px";
document.body.appendChild(preInstaStatusElement);
updatePreInstaStatus();