MooMoo.io - AutoHeal + Anti AD & sarter resources

Simple Autoheal and anti AD

  1. // ==UserScript==
  2. // @name MooMoo.io - AutoHeal + Anti AD & sarter resources
  3. // @version v1
  4. // @description Simple Autoheal and anti AD
  5. // @author W4IT
  6. // @match *://*.moomoo.io/*
  7. // @require https://code.jquery.com/jquery-3.3.1.slim.min.js
  8. // @require https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.5/socket.io.min.js
  9. // @require http://code.jquery.com/jquery-3.3.1.min.js
  10. // @require https://cdn.jsdelivr.net/npm/msgpack-lite@0.1.26/dist/msgpack.min.js
  11. // @require https://cdn.jsdelivr.net/npm/fontfaceobserver@2.1.0/fontfaceobserver.standalone.min.js
  12. // @grant none
  13. // @namespace https://greasyfork.org/en/users/752105-w4it
  14. // ==/UserScript==
  15. document.querySelector("#pre-content-container").remove();
  16. document.getElementById("enterGame").addEventListener('click', autohide);
  17. function autohide(){
  18. $("#ot-sdk-btn-floating").hide();
  19. }
  20. let sr = setInterval(() => {
  21. window.follmoo && (window.follmoo(), clearInterval(sr));
  22. }, 10);
  23. let mouseX;
  24. let mouseY;
  25. let width;
  26. let height;
  27. function aim(x, y){
  28. var cvs = document.getElementById("gameCanvas");
  29. cvs.dispatchEvent(new MouseEvent("mousemove", {
  30. clientX: x,
  31. clientY: y
  32. }));
  33. }
  34. let coreURL = new URL(window.location.href);
  35. window.sessionStorage.force = coreURL.searchParams.get("fc");
  36. var foodType;
  37. var ws;
  38. var msgpack5 = msgpack;
  39. let myPlayer = {
  40. id: null,
  41. x: null,
  42. y: null,
  43. dir: null,
  44. object: null,
  45. weapon: null,
  46. clan: null,
  47. isLeader: null,
  48. hat: null,
  49. accessory: null,
  50. isSkull: null
  51. };
  52. let healSpeed = 100;
  53. let healToggle = 1;
  54. document.msgpack = msgpack;
  55. function n(){
  56. this.buffer = new Uint8Array([0]);
  57. this.buffer.__proto__ = new Uint8Array;
  58. this.type = 0;
  59. }
  60. WebSocket.prototype.oldSend = WebSocket.prototype.send;
  61. WebSocket.prototype.send = function(m){
  62. if (!ws){
  63. document.ws = this;
  64. ws = this;
  65. socketFound(this);
  66. }
  67. this.oldSend(m);
  68. };
  69. function socketFound(socket){
  70. socket.addEventListener('message', function(message){
  71. handleMessage(message);
  72. });
  73. }
  74. function handleMessage(m){
  75. let temp = msgpack5.decode(new Uint8Array(m.data));
  76. let data;
  77. if(temp.length > 1) {
  78. data = [temp[0], ...temp[1]];
  79. if (data[1] instanceof Array){
  80. data = data;
  81. }
  82. } else {
  83. data = temp;
  84. }
  85. let item = data[0];
  86. if(!data) {return};
  87. if(item === "io-init") {
  88. let cvs = document.getElementById("gameCanvas");
  89. width = cvs.clientWidth;
  90. height = cvs.clientHeight;
  91. $(window).resize(function() {
  92. width = cvs.clientWidth;
  93. height = cvs.clientHeight;
  94. });
  95. cvs.addEventListener("mousemove", e => {
  96. mouseX = e.clientX;
  97. mouseY = e.clientY;
  98. });
  99. }
  100. if (item == "1" && myPlayer.id == null){
  101. myPlayer.id = data[1];
  102. }
  103. if (item == '33') {
  104. for (let i; i < data[1].length / 13; i++) {
  105. var object = data[1].slice(13 * i, 13 * i + 13);
  106. if (object[0] == myPlayer.id) {
  107. myPlayer.x = object[1];
  108. myPlayer.y = object[2];
  109. myPlayer.dir = object[3];
  110. myPlayer.object = object[4];
  111. myPlayer.weapon = object[5];
  112. myPlayer.clan = object[7];
  113. myPlayer.isLeader = object[8];
  114. myPlayer.hat = object[9];
  115. myPlayer.accessory = object[10];
  116. myPlayer.isSkull = object[11];
  117. }
  118. }
  119. }
  120. if(item == "h" && data[1] == myPlayer.id) {
  121. if(data[2] < 90 && data[2] > 0 && healToggle == 1) {
  122. setTimeout(() => {
  123. place(foodType, null);
  124. place(foodType, null);
  125. }, healSpeed);
  126. }
  127. }
  128. update();
  129. }
  130. function doNewSend(sender){
  131. ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
  132. }
  133. function place(id) {
  134. doNewSend(["5", [id, null]]);
  135. doNewSend(['c', [1]]);
  136. doNewSend(['c', [0]]);
  137. doNewSend(['5', [myPlayer.weapon, true]]);
  138. doNewSend(["5", [id, null]]);
  139. doNewSend(['c', [1]]);
  140. doNewSend(['c', [0]]);
  141. doNewSend(['5', [myPlayer.weapon, true]]);
  142. }
  143. document.addEventListener('keydown', (e)=> {
  144. if(e.keyCode == 80 && document.activeElement.id.toLowerCase()!== 'chatbox') {
  145. healToggle = (healToggle + 1) % 2;
  146. if(healToggle == 1) {
  147. document.title = "Autoheal On";
  148. } else {
  149. document.title = " Autoheal Off";
  150. }
  151. }
  152. })
  153. function isElementVisible(e) {
  154. return (e.offsetParent !== null);
  155. }
  156. function update() {
  157. for (let i=16;i<19;i++){
  158. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  159. foodType = i - 16;
  160. }
  161. }
  162. }