Greasy Fork

Greasy Fork is available in English.

MooMoo.io Auto Triple Mill

MooMoo.io Auto Triple Mill when [M] key is pressed

当前为 2023-08-26 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         MooMoo.io Auto Triple Mill
// @namespace    http://greasyfork.icu/users/1064285-vcrazy-gaming
// @version      0.1
// @description  MooMoo.io Auto Triple Mill when [M] key is pressed
// @match        *://moomoo.io/*
// @match        *://*.moomoo.io/*
// @author       _VcrazY_
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/msgpack.min.js
// @grant        none
// @icon         https://moomoo.io/img/favicon.png?v=1
// @license      MIT
// ==/UserScript==
/* eslint-disable */
/* jshint esversion:8 */

let primary,
  secondary,
  food,
  wall,
  spike,
  mill,
  mine,
  turret,
  spawnpad,
  ws,
  x,
  y,
  X,
  Y,
  width,
  height,
  msgpack5 = msgpack,
  AutoTriplemMillX = 10,
  AutoTriplemMillY = 10,
  AutoTripleMill = false,
  myPlayer = {
    id: null,
    x: null,
    y: null,
    dir: null,
    object: null,
    weapon: null,
    clan: null,
    isLeader: null,
    hat: null,
    accessory: null,
    isSkull: null,
  };
function join(e) {
  return Array.isArray(e) ? [...e] : Array.from(e);
}
function joinServer(e) {
  e.addEventListener("message", hookWS);
}
function hookWS(e) {
  let l = msgpack5.decode(new Uint8Array(e.data));
  if (
    ((e = void 0), (l = (e = 1 < l.length ? [l[0], ...join(l[1])] : l)[0]), e)
  ) {
    if (("1" == l && null == myPlayer.id && (myPlayer.id = e[1]), "33" == l))
      for (l = 0; l < e[1].length / 13; l++) {
        let a = e[1].slice(13 * l, 13 * l + 13);
        a[0] == myPlayer.id &&
          ((myPlayer.x = a[1]),
          (myPlayer.y = a[2]),
          (myPlayer.dir = a[3]),
          (myPlayer.object = a[4]),
          (myPlayer.weapon = a[5]),
          (myPlayer.clan = a[7]),
          (myPlayer.isLeader = a[8]),
          (myPlayer.hat = a[9]),
          (myPlayer.accessory = a[10]),
          (myPlayer.isSkull = a[11]));
      }
    0 == AutoTriplemMillX && (AutoTriplemMillX = myPlayer.x),
      0 == AutoTriplemMillY && (AutoTriplemMillY = myPlayer.y),
      (y != myPlayer.y || x != myPlayer.x) &&
        (1 == AutoTripleMill &&
          100 <=
            Math.sqrt(
              Math.pow(myPlayer.y - AutoTriplemMillY, 2) +
                Math.pow(myPlayer.x - AutoTriplemMillX, 2),
            ) &&
          (place(
            mill,
            Math.atan2(y - myPlayer.y, x - myPlayer.x) +
              1.25,
          ),
          place(
            mill,
            Math.atan2(y - myPlayer.y, x - myPlayer.x) -
              1.25,
          ),
          place(
            mill,
            Math.atan2(y - myPlayer.y, x - myPlayer.x) -
              0,
          ),
          sendPacket([
            "2",
            [Math.atan2(Y - height / 2, X - width / 2)],
          ]),
          (AutoTriplemMillX = myPlayer.x),
          (AutoTriplemMillY = myPlayer.y)),
        (x = myPlayer.x),
        (y = myPlayer.y)),
      cacheItems();
  }
}
function sendPacket(e) {
  ws.send(new Uint8Array(Array.from(msgpack5.encode(e))));
}
function place(e, l = Math.atan2(Y - height / 2, X - width / 2)) {
  sendPacket(["5", [e, null]]),
    sendPacket(["c", [1, l]]),
    sendPacket(["c", [0, l]]),
    sendPacket(["5", [myPlayer.weapon, true]]);
}
function cacheItems() {
  for (let e = 0; 9 > e; e++)
    null !==
      document.getElementById("actionBarItem" + e.toString()).offsetParent &&
      (primary = e);
  for (let l = 9; 16 > l; l++)
    null !==
      document.getElementById("actionBarItem" + l.toString()).offsetParent &&
      (secondary = l);
  for (let a = 16; 19 > a; a++)
    null !==
      document.getElementById("actionBarItem" + a.toString()).offsetParent &&
      (food = a - 16);
  for (let t = 19; 22 > t; t++)
    null !==
      document.getElementById("actionBarItem" + t.toString()).offsetParent &&
      (wall = t - 16);
  for (let y = 22; 26 > y; y++)
    null !==
      document.getElementById("actionBarItem" + y.toString()).offsetParent &&
      (spike = y - 16);
  for (let n = 26; 29 > n; n++)
    null !==
      document.getElementById("actionBarItem" + n.toString()).offsetParent &&
      (mill = n - 16);
  for (let r = 29; 31 > r; r++)
    null !==
      document.getElementById("actionBarItem" + r.toString()).offsetParent &&
      (mine = r - 16);
  for (let o = 31; 33 > o; o++)
    null !==
      document.getElementById("actionBarItem" + o.toString()).offsetParent &&
      36 != o &&
      (turret = o - 16);
  spawnpad = 36;
}
(document.msgpack = msgpack),
  (WebSocket.prototype.oldSend = WebSocket.prototype.send),
  (WebSocket.prototype.send = function (e) {
    ws || ((document.ws = this), (ws = this), joinServer(this)),
      this.oldSend(e);
  }),
  document.addEventListener("keydown", function (e) {
    77 == e.keyCode &&
      "chatbox" !== document.activeElement.id.toLowerCase() &&
      sendPacket([
        "ch",
        ["Auto Triple Mill : " + (AutoTripleMill = !AutoTripleMill)],
      ]);
  });