MOOMOO BOT SCRIPT - WORKING 2023

3 bots will spawn and start going to your location.

  1. // ==UserScript==
  2. // @name MOOMOO BOT SCRIPT - WORKING 2023
  3. // @namespace http://tampermonkey.net/
  4. // @description 3 bots will spawn and start going to your location.
  5. // @version 1.2
  6. // @author Blue Cyclone
  7. // @match *://*.moomoo.io/*
  8. // @icon none
  9. // @grant none
  10. // @license MIT
  11. // @require https://greasyfork.org/scripts/423602-msgpack/code/msgpack.js
  12. // ==/UserScript==
  13.  
  14. let msgpack = window.msgpack;
  15. const originalSend = WebSocket.prototype.send;
  16. window.playerSocket = null;
  17. window.botSockets = [];
  18.  
  19. let healSpeed = 125;
  20. let ahth = 86;
  21. let ahrp = 2;
  22. let ahtky = 80;
  23. let healOn = true;
  24.  
  25. WebSocket.prototype.send = function (...args) {
  26. this.addEventListener("message", function (e) {
  27. const [packet, data] = msgpack.decode(new Uint8Array(e.data));
  28. if (packet == "C" && myPlayer.sid == null) {
  29. console.log("game started");
  30. myPlayer.dead = false;
  31. myPlayer.sid = data[0];
  32. }
  33.  
  34. if (packet == "M" && myPlayer.dead) {
  35. myPlayer.dead = false;
  36. }
  37. });
  38.  
  39. if (window.playerSocket == null) {
  40. window.playerSocket = this;
  41. }
  42. originalSend.call(this, ...args);
  43. };
  44.  
  45. const checkChange = setInterval(() => {
  46. if (window.playerSocket != null) {
  47. socketFound(window.playerSocket, -1);
  48. clearInterval(checkChange);
  49. botJoin(3);
  50. }
  51. }, 100);
  52.  
  53. function botJoin(amount) {
  54. let t = window.playerSocket.url.split("wss://")[1].split("?")[0];
  55. for (i = 0; i < amount; i++) {
  56. window.grecaptcha
  57. .execute("6LfahtgjAAAAAF8SkpjyeYMcxMdxIaQeh-VoPATP", {
  58. action: "homepage",
  59. })
  60. .then((a) => {
  61. window.botSockets.push(
  62. new WebSocket(
  63. "wss://" + t + "?token=" + "re:" + encodeURIComponent(a)
  64. )
  65. );
  66. if (i == amount) {
  67. window.botSockets.forEach((botSocket) => {
  68. botSocket.binaryType = "arraybuffer";
  69. botSocket.onopen = () => {
  70. window.bots.push({
  71. number: i,
  72. sid: null,
  73. x: null,
  74. y: null,
  75. angle: null,
  76. dead: true,
  77. health: 100,
  78. items: [0, 3, 6, 10],
  79. });
  80. packet = "M";
  81. data = [{ moofoll: "1", name: atob("Qm90IDop"), skin: 0 }]; // this is the join packet
  82. sendPacket(botSocket, packet, data);
  83. socketFound(botSocket, window.botSockets.indexOf(botSocket));
  84. };
  85. });
  86. }
  87. });
  88. }
  89. }
  90.  
  91. // Define Our Player //
  92.  
  93. const myPlayer = {
  94. sid: null,
  95. x: null,
  96. y: null,
  97. dead: true,
  98. health: 100,
  99. };
  100.  
  101. window.player = myPlayer;
  102.  
  103. window.bots = [];
  104.  
  105. function socketFound(socket, indexOfSocket) {
  106. socket.addEventListener("message", function (message) {
  107. viewMessage(message, indexOfSocket);
  108. });
  109.  
  110. // DEFINE OUR MIDDLEWARE //
  111.  
  112. if (indexOfSocket != -1 && window.bots[indexOfSocket] && !myPlayer.dead) {
  113. setInterval(() => {
  114. sendPacket(window.botSockets[indexOfSocket], "6", [
  115. atob("Qmx1ZSBDeWNsb25lJ3MgQm90cy4="),
  116. ]);
  117. window.bots[indexOfSocket].angle = parseFloat(
  118. Math.atan2(
  119. myPlayer.y - window.bots[indexOfSocket].y,
  120. myPlayer.x - window.bots[indexOfSocket].x
  121. ).toFixed(2)
  122. );
  123. sendPacket(window.botSockets[indexOfSocket], "D", [
  124. window.bots[indexOfSocket].angle,
  125. ]);
  126. sendPacket(window.botSockets[indexOfSocket], "a", [
  127. window.bots[indexOfSocket].angle,
  128. ]);
  129. if (window.bots[indexOfSocket].dead) {
  130. pack = "M";
  131. dat = [{ moofoll: "1", name: atob("Qm90IDop"), skin: 0 }]; // this is the join packet
  132. sendPacket(window.botSockets[indexOfSocket], pack, dat);
  133. }
  134. }, 1000);
  135. }
  136.  
  137. socket.send = function (...args) {
  138. const [packet, data] = msgpack.decode(new Uint8Array(args[0]));
  139.  
  140. // D is for rotation
  141. // G switches your item
  142. // d places your item
  143. // N is for points
  144. // a is for movement
  145.  
  146. if (!["G", "N", "O", "D"].includes(packet)) {
  147. }
  148.  
  149. if (packet === "a" && data[0] != null) {
  150. }
  151. const arr = new Uint8Array(Array.from(msgpack.encode([packet, data])));
  152. originalSend.call(this, arr);
  153. };
  154. }
  155.  
  156. function viewMessage(m, indexOfSocket) {
  157. const [packet, data] = msgpack.decode(new Uint8Array(m.data));
  158. // should always work because interceptor is mounted already
  159. // this sets the bot sid when the game starts
  160. if (["C"].includes(packet) && indexOfSocket != -1) {
  161. console.log("SETTING SID", indexOfSocket);
  162. window.bots[indexOfSocket].sid = data[0];
  163. window.bots[indexOfSocket].dead = false;
  164. window.bots[indexOfSocket].health = 100;
  165. }
  166.  
  167. if (packet == "P") {
  168. indexOfSocket == -1
  169. ? ((myPlayer.dead = true), (myPlayer.health = 100))
  170. : (window.bots[indexOfSocket].dead = true);
  171. }
  172.  
  173. if (["a"].includes(packet) && data[0].length > 0) {
  174. if (indexOfSocket != -1) {
  175. myData = data[0].slice(
  176. data[0].indexOf(window.bots[indexOfSocket].sid),
  177. data[0].indexOf(window.bots[indexOfSocket].sid) + 13
  178. );
  179. window.bots[indexOfSocket].x = myData[1];
  180. window.bots[indexOfSocket].y = myData[2];
  181. } else {
  182. myData = data[0].slice(
  183. data[0].indexOf(myPlayer.sid),
  184. data[0].indexOf(myPlayer.sid) + 13
  185. );
  186. myPlayer.x = myData[1];
  187. myPlayer.y = myData[2];
  188. }
  189. if (indexOfSocket != -1) {
  190. }
  191. }
  192. items = [0, 3, 6, 10];
  193. if (packet == "V" && !data[1]) {
  194. window.bots[indexOfSocket].items = data[0];
  195. }
  196.  
  197. if (packet == "O" && indexOfSocket != -1) {
  198. window.bots[indexOfSocket].health = data[1];
  199. dist = Math.sqrt(
  200. Math.pow(myPlayer.x - window.bots[indexOfSocket].x, 2) +
  201. Math.pow(myPlayer.y - window.bots[indexOfSocket].y, 2)
  202. );
  203. if (
  204. !window.botSockets[indexOfSocket].dead &&
  205. healOn &&
  206. window.bots[indexOfSocket].health < ahth &&
  207. window.bots[indexOfSocket].health > 0 &&
  208. dist > 200
  209. ) {
  210. setTimeout(function () {
  211. for (let i = 0; i < ahrp; i++) {
  212. sendPacket(window.botSockets[indexOfSocket], "G", [
  213. window.bots[indexOfSocket].items[0],
  214. ]);
  215. sendPacket(window.botSockets[indexOfSocket], "d", [1]);
  216. sendPacket(window.botSockets[indexOfSocket], "d", [0]);
  217. }
  218. }, healSpeed);
  219. }
  220. }
  221.  
  222. if (packet == "O" && indexOfSocket == -1) {
  223. myPlayer.health = data[1];
  224. if (
  225. !myPlayer.dead &&
  226. healOn &&
  227. myPlayer.health < ahth &&
  228. myPlayer.health > 0
  229. ) {
  230. setTimeout(function () {
  231. for (let i = 0; i < ahrp; i++) {
  232. sendPacket(window.playerSocket, "G", [0]);
  233. sendPacket(window.playerSocket, "d", [1]);
  234. sendPacket(window.playerSocket, "d", [0]);
  235. }
  236. }, healSpeed);
  237. }
  238. }
  239. }
  240.  
  241. function sendPacket(socket, packet, data) {
  242. const arr = new Uint8Array(Array.from(msgpack.encode([packet, data])));
  243. socket.send(arr);
  244. }