🏠 Home 

Greasy Fork is available in English.

Moomoo.io Public AutoMacroMod

Best Legit moomoo.io script for 1.8.0


Installer dette script?
  1. // ==UserScript==
  2. // @name Moomoo.io Public AutoMacroMod
  3. // @author T h e S l a u g h t e r h o u s e
  4. // @description Best Legit moomoo.io script for 1.8.0
  5. // @version V1
  6. // @match *://*.moomoo.io/*
  7. // @match *://*sandbox.moomoo.io/*
  8. // @namespace https://greasyfork.org/users/1190411
  9. // @icon https://cdn.glitch.com/82ae8945-dcc6-4276-98a9-665381b4cd2b/cursor12.png
  10. // @license MIT
  11. // @grant none
  12. // @run-at document-end
  13. // ==/UserScript==
  14. localStorage.moofoll = !0;
  15. (function () {
  16. var mt = 0;
  17. var mel = null;
  18. var mv = false;
  19. var isd = false;
  20. var ix;
  21. var iy;
  22. var menuElement = null;
  23. var hhk = {
  24. 0: 0, //unnequip hat
  25. 51: 0,// Moo Cap
  26. 50: 0, // Apple Cap
  27. 28: 0, // Moo Head
  28. 29: 0, // Pig Head
  29. 30: 0, // Fluff Head
  30. 36: 0, // Pandou Head
  31. 37: 0, // Bear Head
  32. 38: 0, // Monkey Head
  33. 44: 0, // Polar Head
  34. 35: 0, // Fez Hat
  35. 42: 0, // Enigma Hat
  36. 43: 0, // Blitz Hat
  37. 49: 0, // Bob XIII Hat
  38. 57: 0, // Pumpkin
  39. 8: 0, // Bummle Hat
  40. 2: 0, // Straw Hat
  41. 15: 0, // Winter Cap
  42. 5: 0, // Cowboy Hat
  43. 4: 0, // Ranger Hat
  44. 18: 0, // Explorer Hat
  45. 31: 0, // Flipper Hat
  46. 1: 0, // Marksman Cap
  47. 10: 0, // Bush Gear
  48. 48: 0, // Halo
  49. 6: 0, // Soldier Helmet
  50. 23: 0, // Anti Venom Gear
  51. 13: 0, // Medic Gear
  52. 9: 0, // Miners Helmet
  53. 32: 0, // Musketeer Hat
  54. 7: 0, // Bull Helmet
  55. 22: 0, // Emp Helmet
  56. 12: 0, // Booster Hat
  57. 26: 0, // Barbarian Armor
  58. 21: 0, // Plague Mask
  59. 46: 0, // Bull Mask
  60. 14: 0, // Windmill Hat
  61. 11: 0, // Spike Gear
  62. 53: 0, // Turret Gear
  63. 20: 0, // Samurai Armor
  64. 58: 0, // Dark Knight
  65. 27: 0, // Scavenger Gear
  66. 40: 0, // #### Gear
  67. 52: 0, // Thief Gear
  68. 55: 0, // Bloodthirster
  69. 56: 0 // Assassin Gear
  70. };
  71. function iso() {
  72. return document.activeElement.id.toLowerCase() === 'chatbox';
  73. }
  74. function iaia() {
  75. return document.activeElement.id.toLowerCase() === 'allianceinput';
  76. }
  77. function shhk() {
  78. return !iso() && !iaia();
  79. }
  80. function toggleMacros() {
  81. mt = (mt + 1) % 2;
  82. document.title = mt === 1 ? "AutoMacroMod" : "AutoMacroMod";
  83. var macroStateElement = document.getElementById("macroState");
  84. macroStateElement.textContent = mt === 1 ? "On" : "Off";
  85. if (mt === 1) {
  86. mel = function (e) {
  87. if (shhk()) {
  88. for (var hatId in hhk) {
  89. if (e.keyCode === hhk[hatId]) {
  90. storeEquip(hatId);
  91. break;
  92. }
  93. }
  94. }
  95. };
  96. document.addEventListener('keydown', mel);
  97. } else {
  98. document.removeEventListener('keydown', mel);
  99. mel = null;
  100. }
  101. }
  102. function toggleMenu() {
  103. var menuElement = document.getElementById('hatMacroMenu');
  104. if (mv) {
  105. menuElement.style.display = 'none';
  106. mv = false;
  107. } else {
  108. menuElement.style.display = 'block';
  109. mv = true;
  110. }
  111. }
  112. function dragStart(e) {
  113. isd = true;
  114. ix = e.clientX - menuElement.getBoundingClientRect().left;
  115. iy = e.clientY - menuElement.getBoundingClientRect().top;
  116. }
  117. function dragEnd() {
  118. isd = false;
  119. }
  120. function drag(e) {
  121. if (!isd) return;
  122. menuElement.style.left = (e.clientX - ix) + 'px';
  123. menuElement.style.top = (e.clientY - iy) + 'px';
  124. }
  125. function createMenu() {
  126. menuElement = document.createElement('div');
  127. menuElement.id = 'hatMacroMenu';
  128. menuElement.style.display = 'none';
  129. menuElement.style.background = 'rgba(0, 0, 0, 0.8)';
  130. menuElement.style.fontFamily = 'Hammersmith One, sans-serif';
  131. menuElement.style.position = 'absolute';
  132. menuElement.style.width = '300px';
  133. menuElement.style.height = '250px';
  134. menuElement.style.border = '1.5px solid #000';
  135. menuElement.style.borderRadius = '8px';
  136. menuElement.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 1)';
  137. menuElement.style.top = 'calc(20px + 2vh)';
  138. menuElement.style.right = 'calc(20px + 2vw)';
  139. menuElement.style.zIndex = '9999';
  140. menuElement.style.overflowY = 'auto';
  141. menuElement.style.color = '#fff';
  142. menuElement.style.fontSize = '17px !important';
  143. menuElement.style.boxShadow = '5px 5px 10px rgba(0, 0, 0, 0.4)';
  144. menuElement.style.padding = '18px';
  145. document.body.appendChild(menuElement);
  146. var hti = {
  147. 0: "No Hat",
  148. 51: "Moo Cap",
  149. 50: "Apple Cap",
  150. 28: "Moo Head",
  151. 29: "Pig Head",
  152. 30: "Fluff Head",
  153. 36: "Pandou Head",
  154. 37: "Bear Head",
  155. 38: "Monkey Head",
  156. 44: "Polar Head",
  157. 35: "Fez Hat",
  158. 42: "Enigma Hat",
  159. 43: "Blitz Hat",
  160. 49: "Bob XIII Hat",
  161. 57: "Pumpkin",
  162. 8: "Bummle Hat",
  163. 2: "Straw Hat",
  164. 15: "Winter Cap",
  165. 5: "Cowboy Hat",
  166. 4: "Ranger Hat",
  167. 18: "Explorer Hat",
  168. 31: "Flipper Hat",
  169. 1: "Marksman Cap",
  170. 10: "Bush Gear",
  171. 48: "Halo",
  172. 6: "Soldier Helmet",
  173. 23: "Anti Venom Gear",
  174. 13: "Medic Gear",
  175. 9: "Miners Helmet",
  176. 32: "Musketeer Hat",
  177. 7: "Bull Helmet",
  178. 22: "Emp Helmet",
  179. 12: "Booster Hat",
  180. 26: "Barbarian Armor",
  181. 21: "Plague Mask",
  182. 46: "Bull Mask",
  183. 14: "Windmill Hat",
  184. 11: "Spike Gear",
  185. 53: "Turret Gear",
  186. 20: "Samurai Armor",
  187. 58: "Dark Knight",
  188. 27: "Scavenger Gear",
  189. 40: "#### Gear",
  190. 52: "Thief Gear",
  191. 55: "Bloodthirster",
  192. 56: "Assassin Gear"
  193. };
  194. var ohti = {
  195. 0: "No Hat",
  196. 51: "Moo Cap",
  197. 50: "Apple Cap",
  198. 28: "Moo Head",
  199. 29: "Pig Head",
  200. 30: "Fluff Head",
  201. 36: "Pandou Head",
  202. 37: "Bear Head",
  203. 38: "Monkey Head",
  204. 44: "Polar Head",
  205. 35: "Fez Hat",
  206. 42: "Enigma Hat",
  207. 43: "Blitz Hat",
  208. 49: "Bob XIII Hat",
  209. 57: "Pumpkin",
  210. 8: "Bummle Hat",
  211. 2: "Straw Hat",
  212. 15: "Winter Cap",
  213. 5: "Cowboy Hat",
  214. 4: "Ranger Hat",
  215. 18: "Explorer Hat",
  216. 31: "Flipper Hat",
  217. 1: "Marksman Cap",
  218. 10: "Bush Gear",
  219. 48: "Halo",
  220. 6: "Soldier Helmet",
  221. 23: "Anti Venom Gear",
  222. 13: "Medic Gear",
  223. 9: "Miners Helmet",
  224. 32: "Musketeer Hat",
  225. 7: "Bull Helmet",
  226. 22: "Emp Helmet",
  227. 12: "Booster Hat",
  228. 26: "Barbarian Armor",
  229. 21: "Plague Mask",
  230. 46: "Bull Mask",
  231. 14: "Windmill Hat",
  232. 11: "Spike Gear",
  233. 53: "Turret Gear",
  234. 20: "Samurai Armor",
  235. 58: "Dark Knight",
  236. 27: "Scavenger Gear",
  237. 40: "#### Gear",
  238. 52: "Thief Gear",
  239. 55: "Bloodthirster",
  240. 56: "Assassin Gear"
  241. };
  242. var predefinedKeycodes = {
  243. "No Hat": 16,
  244. "Bull Helmet": 82,
  245. "#### Gear": 90,
  246. "Soldier Helmet": 71,
  247. "Booster Hat": 66,
  248. "Flipper Hat": 89,
  249. "Winter Cap": 78,
  250. "Emp Helmet": 74,
  251. "Fluff Head": 73,
  252. "Turret Gear": 84,
  253. "Barbarian Armor": 77,
  254. "Samurai Armor": 85,
  255. "Spike Gear": 72
  256. };
  257. for (var hatId in hti) {
  258. var input = hti[hatId];
  259. var keycode = predefinedKeycodes[input];
  260. hhk[hatId] = keycode;
  261. }
  262. var tableHTML = `
  263. <h1 style="font-size: 28px !important; margin-top: 15px; text-align: center;">Hat Shortcuts <span id="macroState"">Off</span></h1>
  264. <hr>
  265. <table style="margin: 0 auto; text-align: center;">
  266. <tr>
  267. <td><b>Hats</b></td>
  268. <td></td>
  269. <td><b>Keycodes</b></td>
  270. </tr>`;
  271. var ukwii = {
  272. 51: "https://static.wikia.nocookie.net/moom/images/a/ac/Hat_51.png",
  273. 50: "https://static.wikia.nocookie.net/moom/images/2/2e/Hat_50.png",
  274. 28: "https://static.wikia.nocookie.net/moom/images/5/58/Hat_28.png",
  275. 29: "https://static.wikia.nocookie.net/moom/images/0/0d/Hat_29.png",
  276. 30: "https://static.wikia.nocookie.net/moom/images/4/49/Hat_30.png",
  277. 36: "https://static.wikia.nocookie.net/moom/images/4/4e/Hat_36.png",
  278. 37: "https://static.wikia.nocookie.net/moom/images/b/bf/Hat_37.png",
  279. 38: "https://static.wikia.nocookie.net/moom/images/b/b6/Hat_38.png",
  280. 44: "https://static.wikia.nocookie.net/moom/images/2/21/Hat_44.png",
  281. 35: "https://static.wikia.nocookie.net/moom/images/d/df/Hat_35.png",
  282. 42: "https://static.wikia.nocookie.net/moom/images/9/90/Hat_42.png",
  283. 43: "https://static.wikia.nocookie.net/moom/images/f/fb/Hat_43.png",
  284. 49: "https://static.wikia.nocookie.net/moom/images/b/b7/Hat_49.png",
  285. 57: "https://static.wikia.nocookie.net/moom/images/7/7c/Hat_57.png",
  286. 8: "https://static.wikia.nocookie.net/moom/images/e/e9/Hat_8.png",
  287. 2: "https://static.wikia.nocookie.net/moom/images/9/9b/Hat_2.png",
  288. 15: "https://static.wikia.nocookie.net/moom/images/6/66/Hat_15.png",
  289. 5: "https://static.wikia.nocookie.net/moom/images/5/51/Hat_5.png",
  290. 4: "https://static.wikia.nocookie.net/moom/images/e/e8/Hat_4.png",
  291. 18: "https://static.wikia.nocookie.net/moom/images/a/ad/Hat_18.png",
  292. 31: "https://static.wikia.nocookie.net/moom/images/4/43/Hat_31.png",
  293. 1: "https://static.wikia.nocookie.net/moom/images/b/b1/Hat_1.png",
  294. 10: "https://static.wikia.nocookie.net/moom/images/9/90/Hat_10.png",
  295. 48: "https://static.wikia.nocookie.net/moom/images/d/d4/Hat_48.png",
  296. 6: "https://static.wikia.nocookie.net/moom/images/3/3f/Hat_6.png",
  297. 23: "https://static.wikia.nocookie.net/moom/images/b/b1/Hat_23.png",
  298. 13: "https://static.wikia.nocookie.net/moom/images/b/b0/Hat_13.png",
  299. 9: "https://static.wikia.nocookie.net/moom/images/e/eb/Hat_9.png",
  300. 32: "https://static.wikia.nocookie.net/moom/images/4/45/Hat_32.png",
  301. 7: "https://static.wikia.nocookie.net/moom/images/f/f9/Hat_7.png",
  302. 22: "https://static.wikia.nocookie.net/moom/images/f/fd/Hat_22.png",
  303. 12: "https://static.wikia.nocookie.net/moom/images/3/31/Hat_12.png",
  304. 26: "https://static.wikia.nocookie.net/moom/images/1/11/Hat_26.png",
  305. 21: "https://static.wikia.nocookie.net/moom/images/c/c6/Hat_21.png",
  306. 46: "https://static.wikia.nocookie.net/moom/images/3/3f/Hat_46.png",
  307. 14: "https://static.wikia.nocookie.net/moom/images/4/42/Hat_14_P.png",
  308. 11: "https://static.wikia.nocookie.net/moom/images/a/a3/Hat_11_P.png",
  309. 53: "https://static.wikia.nocookie.net/moom/images/e/e8/Hat_53_P.png",
  310. 20: "https://static.wikia.nocookie.net/moom/images/2/2a/Hat_20.png",
  311. 58: "https://static.wikia.nocookie.net/moom/images/d/da/Hat_58.png",
  312. 27: "https://static.wikia.nocookie.net/moom/images/8/88/Hat_27.png",
  313. 40: "https://static.wikia.nocookie.net/moom/images/0/08/Hat_40.png",
  314. 52: "https://static.wikia.nocookie.net/moom/images/9/9b/Hat_52.png",
  315. 55: "https://static.wikia.nocookie.net/moom/images/0/0d/Hat_55.png",
  316. 56: "https://static.wikia.nocookie.net/moom/images/5/53/Hat_56.png"
  317. };
  318. for (hatId in hti) {
  319. input = hti[hatId];
  320. keycode = hhk[hatId];
  321. var imagePath = ukwii[hatId];
  322. if (keycode === undefined) {
  323. keycode = "";
  324. }
  325. if (hatId === "0") {
  326. tableHTML += `
  327. <tr>
  328. <td>${input}</td>
  329. <td></td>
  330. <td>
  331. <input type="text" id="${input}Key" value="${keycode}" maxlength="3" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 3em;">
  332. <span id="${input}KeyLabel" style="color: gray;"></span>
  333. </td>
  334. </tr>`;
  335. } else {
  336. var imageWidth = "35px";
  337. var imageHeight = "35px";
  338. tableHTML += `
  339. <tr>
  340. <td>${input}</td>
  341. <td><img src="${ukwii[hatId]}" alt="${input}" style="width: ${imageWidth}; height: ${imageHeight};"></td>
  342. <td>
  343. <input type="text" id="${input}Key" value="${keycode}" maxlength="3" oninput="this.value = this.value.replace(/[^0-9]/g, '')" style="width: 3em;">
  344. <span id="${input}KeyLabel" style="color: gray;"></span>
  345. </td>
  346. </tr>`;
  347. }
  348. }
  349. tableHTML += `
  350. </tr>
  351. </table>
  352. <hr>
  353. <div style="text-align: center; margin-top: 20px;">
  354. <button id="Save">Save</button>
  355. </div>`;
  356. menuElement.innerHTML = tableHTML;
  357. function saveHotkeys() {
  358. var savedHotkeys = {};
  359. for (var hatId in hhk) {
  360. var inputField = document.getElementById(`${hti[hatId]}Key`);
  361. var nkc = parseInt(inputField.value);
  362. savedHotkeys[hatId] = nkc;
  363. }
  364. localStorage.setItem('hhk', JSON.stringify(savedHotkeys));
  365. }
  366. function loadHotkeys() {
  367. var savedHotkeysStr = localStorage.getItem('hhk');
  368. if (savedHotkeysStr) {
  369. var savedHotkeys = JSON.parse(savedHotkeysStr);
  370. for (var hatId in savedHotkeys) {
  371. hhk[hatId] = savedHotkeys[hatId];
  372. var inputField = document.getElementById(`${hti[hatId]}Key`);
  373. inputField.value = savedHotkeys[hatId];
  374. }
  375. }
  376. }
  377. document.getElementById("Save").addEventListener("click", function () {
  378. for (var hatId in ohti) {
  379. var input = ohti[hatId];
  380. var nkc = parseInt(document.getElementById(`${input}Key`).value);
  381. hhk[hatId] = nkc;
  382. var keyLabel = document.getElementById(`${input}KeyLabel`);
  383. keyLabel.textContent = keyCodeToLabel(nkc);
  384. keyLabel.style.color = '#909090';
  385. var macroStateElement = document.getElementById("macroState");
  386. macroStateElement.style.fontSize = "28px";
  387. }
  388. saveHotkeys();
  389. });
  390. loadHotkeys();
  391. function keyCodeToLabel(keyCode) {
  392. var label = '';
  393. switch (keyCode) {
  394. case 3:
  395. label = 'Cancel';
  396. break;
  397. case 8:
  398. label = 'Backspace';
  399. break;
  400. case 9:
  401. label = 'Tab';
  402. break;
  403. case 12:
  404. label = 'Clear';
  405. break;
  406. case 13:
  407. label = 'Enter';
  408. break;
  409. case 16:
  410. case 160:
  411. label = 'Shift';
  412. break;
  413. case 17:
  414. case 161:
  415. label = 'Control';
  416. break;
  417. case 18:
  418. case 162:
  419. label = 'Alt';
  420. break;
  421. case 19:
  422. label = 'Pause';
  423. break;
  424. case 20:
  425. label = 'Caps Lock';
  426. break;
  427. case 21:
  428. label = 'Unidentified';
  429. break;
  430. case 25:
  431. label = 'Unidentified';
  432. break;
  433. case 27:
  434. label = 'Escape';
  435. break;
  436. case 28:
  437. label = 'Henkan';
  438. break;
  439. case 29:
  440. label = 'Muhenkan';
  441. break;
  442. case 32:
  443. label = '(blank space)';
  444. break;
  445. case 33:
  446. label = 'PageUp';
  447. break;
  448. case 34:
  449. label = 'PageDown';
  450. break;
  451. case 35:
  452. label = 'End';
  453. break;
  454. case 36:
  455. label = 'Home';
  456. break;
  457. case 37:
  458. label = 'ArrowLeft';
  459. break;
  460. case 38:
  461. label = 'ArrowUp';
  462. break;
  463. case 39:
  464. label = 'ArrowRight';
  465. break;
  466. case 40:
  467. label = 'ArrowDown';
  468. break;
  469. case 41:
  470. label = 'Select';
  471. break;
  472. case 42:
  473. label = 'Print';
  474. break;
  475. case 43:
  476. label = 'Execute';
  477. break;
  478. case 44:
  479. label = 'F13';
  480. break;
  481. case 45:
  482. label = 'Insert';
  483. break;
  484. case 46:
  485. label = 'Delete';
  486. break;
  487. case 47:
  488. label = 'Help';
  489. break;
  490. case 48:
  491. label = '0';
  492. break;
  493. case 49:
  494. label = '1';
  495. break;
  496. case 50:
  497. label = '2';
  498. break;
  499. case 51:
  500. label = '3';
  501. break;
  502. case 52:
  503. label = '4';
  504. break;
  505. case 53:
  506. label = '5';
  507. break;
  508. case 54:
  509. label = '6';
  510. break;
  511. case 55:
  512. label = '7';
  513. break;
  514. case 56:
  515. label = '8';
  516. break;
  517. case 57:
  518. label = '9';
  519. break;
  520. case 58:
  521. label = ':';
  522. break;
  523. case 59:
  524. label = ';';
  525. break;
  526. case 60:
  527. label = '<';
  528. break;
  529. case 61:
  530. label = '=';
  531. break;
  532. case 63:
  533. label = 'ß';
  534. break;
  535. case 64:
  536. label = '@';
  537. break;
  538. case 65:
  539. label = 'a';
  540. break;
  541. case 66:
  542. label = 'b';
  543. break;
  544. case 67:
  545. label = 'c';
  546. break;
  547. case 68:
  548. label = 'd';
  549. break;
  550. case 69:
  551. label = 'e';
  552. break;
  553. case 70:
  554. label = 'f';
  555. break;
  556. case 71:
  557. label = 'g';
  558. break;
  559. case 72:
  560. label = 'h';
  561. break;
  562. case 73:
  563. label = 'i';
  564. break;
  565. case 74:
  566. label = 'j';
  567. break;
  568. case 75:
  569. label = 'k';
  570. break;
  571. case 76:
  572. label = 'l';
  573. break;
  574. case 77:
  575. label = 'm';
  576. break;
  577. case 78:
  578. label = 'n';
  579. break;
  580. case 79:
  581. label = 'o';
  582. break;
  583. case 80:
  584. label = 'p';
  585. break;
  586. case 81:
  587. label = 'q';
  588. break;
  589. case 82:
  590. label = 'r';
  591. break;
  592. case 83:
  593. label = 's';
  594. break;
  595. case 84:
  596. label = 't';
  597. break;
  598. case 85:
  599. label = 'u';
  600. break;
  601. case 86:
  602. label = 'v';
  603. break;
  604. case 87:
  605. label = 'w';
  606. break;
  607. case 88:
  608. label = 'x';
  609. break;
  610. case 89:
  611. label = 'y';
  612. break;
  613. case 90:
  614. label = 'z';
  615. break;
  616. case 91:
  617. case 224:
  618. label = 'Meta';
  619. break;
  620. case 92:
  621. case 225:
  622. label = 'Meta';
  623. break;
  624. case 93:
  625. label = 'ContextMenu';
  626. break;
  627. case 95:
  628. label = 'Standby';
  629. break;
  630. case 96:
  631. label = '0';
  632. break;
  633. case 97:
  634. label = '1';
  635. break;
  636. case 98:
  637. label = '2';
  638. break;
  639. case 99:
  640. label = '3';
  641. break;
  642. case 100:
  643. label = '4';
  644. break;
  645. case 101:
  646. label = '5';
  647. break;
  648. case 102:
  649. label = '6';
  650. break;
  651. case 103:
  652. label = '7';
  653. break;
  654. case 104:
  655. label = '8';
  656. break;
  657. case 105:
  658. label = '9';
  659. break;
  660. case 106:
  661. label = '*';
  662. break;
  663. case 107:
  664. label = '+';
  665. break;
  666. case 108:
  667. label = ',';
  668. break;
  669. case 109:
  670. label = '-';
  671. break;
  672. case 110:
  673. label = '.';
  674. break;
  675. case 111:
  676. label = '/';
  677. break;
  678. case 112:
  679. label = 'F1';
  680. break;
  681. case 113:
  682. label = 'F2';
  683. break;
  684. case 114:
  685. label = 'F3';
  686. break;
  687. case 115:
  688. label = 'F4';
  689. break;
  690. case 116:
  691. label = 'F5';
  692. break;
  693. case 117:
  694. label = 'F6';
  695. break;
  696. case 118:
  697. label = 'F7';
  698. break;
  699. case 119:
  700. label = 'F8';
  701. break;
  702. case 120:
  703. label = 'F9';
  704. break;
  705. case 121:
  706. label = 'F10';
  707. break;
  708. case 122:
  709. label = 'F11';
  710. break;
  711. case 123:
  712. label = 'F12';
  713. break;
  714. case 124:
  715. label = 'F13';
  716. break;
  717. case 125:
  718. label = 'F14';
  719. break;
  720. case 126:
  721. label = 'F15';
  722. break;
  723. case 127:
  724. label = 'F16';
  725. break;
  726. case 128:
  727. label = 'F17';
  728. break;
  729. case 129:
  730. label = 'F18';
  731. break;
  732. case 130:
  733. label = 'F19';
  734. break;
  735. case 131:
  736. label = 'F20';
  737. break;
  738. case 132:
  739. label = 'F21';
  740. break;
  741. case 133:
  742. label = 'F22';
  743. break;
  744. case 134:
  745. label = 'F23';
  746. break;
  747. case 135:
  748. label = 'F24';
  749. break;
  750. case 136:
  751. label = 'F25';
  752. break;
  753. case 137:
  754. label = 'F26';
  755. break;
  756. case 138:
  757. label = 'F27';
  758. break;
  759. case 139:
  760. label = 'F28';
  761. break;
  762. case 140:
  763. label = 'F29';
  764. break;
  765. case 141:
  766. label = 'F30';
  767. break;
  768. case 142:
  769. label = 'F31';
  770. break;
  771. case 143:
  772. label = 'F32';
  773. break;
  774. case 144:
  775. label = 'NumLock';
  776. break;
  777. case 145:
  778. label = 'ScrollLock';
  779. break;
  780. case 151:
  781. label = 'Airplane Mode';
  782. break;
  783. case 161:
  784. label = 'Volume Mute';
  785. break;
  786. case 162:
  787. label = 'Volume Down';
  788. break;
  789. case 163:
  790. label = 'Volume Up';
  791. break;
  792. case 186:
  793. label = ';';
  794. break;
  795. case 187:
  796. label = '=';
  797. break;
  798. case 188:
  799. label = ',';
  800. break;
  801. case 189:
  802. label = '-';
  803. break;
  804. case 190:
  805. label = '.';
  806. break;
  807. case 191:
  808. label = '/';
  809. break;
  810. case 192:
  811. label = '`';
  812. break;
  813. case 193:
  814. label = '/';
  815. break;
  816. case 219:
  817. label = '[';
  818. break;
  819. case 220:
  820. label = '\\';
  821. break;
  822. case 221:
  823. label = ']';
  824. break;
  825. case 222:
  826. label = "'";
  827. break;
  828. case 223:
  829. label = '`';
  830. break;
  831. case 224:
  832. label = 'Meta';
  833. break;
  834. case 225:
  835. label = 'AltGraph';
  836. break;
  837. case 226:
  838. label = '\\';
  839. break;
  840. case 229:
  841. label = 'Non-conversion';
  842. break;
  843. case 230:
  844. label = 'Alphanumeric';
  845. break;
  846. case 231:
  847. label = 'Hiragana/Katakana';
  848. break;
  849. case 233:
  850. label = 'Zenkaku/Hankaku';
  851. break;
  852. case 234:
  853. label = 'Kanji Mode';
  854. break;
  855. case 240:
  856. label = 'WakeUp';
  857. break;
  858. case 255:
  859. label = 'WakeUp';
  860. break;
  861. default:
  862. label = '';
  863. }
  864. return label;
  865. }
  866. menuElement.querySelectorAll('span, td, p').forEach(element => {
  867. element.style.fontSize = '17px';
  868. element.style.color = '#fff';
  869. });
  870. menuElement.addEventListener('mousedown', dragStart);
  871. menuElement.addEventListener('mouseup', dragEnd);
  872. menuElement.addEventListener('mousemove', drag);
  873. document.getElementById("Save").click();
  874. var Save = document.getElementById("Save");
  875. Save.addEventListener('click', saveHotkeys);
  876. document.getElementById("Save").click();
  877. }
  878. createMenu();
  879. function saveHotkeys() {
  880. for (var hatId in hhk) {
  881. (function (currentHatId) {
  882. var inputField = document.getElementById("hat" + currentHatId + "Key");
  883. var nkc = parseInt(inputField.value);
  884. hhk[currentHatId] = nkc;
  885. document.removeEventListener('keydown', onKeydown);
  886. document.addEventListener('keydown', onKeydown);
  887. function onKeydown(e) {
  888. if (e.keyCode === nkc && shhk()) {
  889. storeEquip(currentHatId);
  890. }
  891. }
  892. })(hatId);
  893. }
  894. }
  895. document.addEventListener('keydown', function (e) {
  896. if (e.keyCode === 76 && !iso() && !iaia()) {
  897. toggleMacros();
  898. } else if (e.keyCode === 27 && shhk() && storeMenu.style.display !== 'block') {
  899. toggleMenu();
  900. }
  901. });
  902. var headerText = document.querySelector('h1').textContent;
  903. var macrosEnabled = headerText.includes('Macros On');
  904. if (macrosEnabled) {
  905. toggleMacros();
  906. }
  907. })();
  908. (() => {
  909. // Constants and Variables
  910. let ws = null;
  911. let x = 0;
  912. let y = 0;
  913. let msgpack5 = window.msgpack;
  914. let scale = 45;
  915. let placeOffset = 5;
  916. let autoMill = false;
  917. const inventory = {
  918. primary: null,
  919. secondary: null,
  920. food: null,
  921. wall: null,
  922. spike: null,
  923. mill: null,
  924. mine: null,
  925. boostPad: null,
  926. trap: null,
  927. turret: null,
  928. spawnpad: null
  929. };
  930. const vars = {
  931. camX: 0,
  932. camY: 0
  933. };
  934. const myPlayer = {
  935. sid: null,
  936. x: null,
  937. y: null,
  938. dir: null,
  939. buildIndex: null,
  940. weaponIndex: null,
  941. weaponVariant: null,
  942. team: null,
  943. isLeader: null,
  944. skinIndex: null,
  945. tailIndex: null,
  946. iconIndex: null
  947. };
  948. // Helper Functions
  949. /**
  950. * Utility function to join arrays
  951. * @param {Array} message - The array to join
  952. * @returns {Array} - Joined array
  953. */
  954. const join = message => Array.isArray(message) ? [...message] : [...message];
  955. /**
  956. * Hook function for WebSocket
  957. * @param {object} ms - WebSocket message
  958. */
  959. const hookWS = ms => {
  960. let tmpData = msgpack5.decode(new Uint8Array(ms.data));
  961. if ((ms = undefined) || (tmpData = (ms = tmpData.length > 1 ? [tmpData[0], ...join(tmpData[1])] : tmpData)[0]) || ms) {
  962. if ("C" == tmpData && null === myPlayer.sid && (myPlayer.sid = ms[1]) || "a" == tmpData) {
  963. for (tmpData = 0; tmpData < ms[1].length / 13; tmpData++) {
  964. let data = ms[1].slice(13 * tmpData, 13 * (tmpData + 1));
  965. if (data[0] == myPlayer.sid) {
  966. Object.assign(myPlayer, {
  967. x: data[1],
  968. y: data[2],
  969. dir: data[3],
  970. buildIndex: data[4],
  971. weaponIndex: data[5],
  972. weaponVariant: data[6],
  973. team: data[7],
  974. isLeader: data[8],
  975. skinIndex: data[9],
  976. tailIndex: data[10],
  977. iconIndex: data[11]
  978. });
  979. }
  980. }
  981. }
  982. vars.camX || (vars.camX = myPlayer.x);
  983. vars.camY || (vars.camY = myPlayer.y);
  984. if (y !== myPlayer.y || x !== myPlayer.x) {
  985. // AUTO MILL CODE:
  986. if (Math.atan2(y - myPlayer.y, x - myPlayer.x) < (scale + placeOffset) * 2) {
  987. if (autoMill) {
  988. let angle = Math.atan2(y - myPlayer.y, x - myPlayer.x);
  989. place(inventory.mill, angle + Math.PI / 2.5);
  990. place(inventory.mill, angle);
  991. place(inventory.mill, angle - Math.PI / 2.5);
  992. }
  993. x = myPlayer.x;
  994. y = myPlayer.y;
  995. }
  996. }
  997. cacheItems();
  998. }
  999. };
  1000. /**
  1001. * Function to emit a packet
  1002. * @param {string} event - Event type
  1003. * @param {*} a - Parameter a
  1004. * @param {*} b - Parameter b
  1005. * @param {*} c - Parameter c
  1006. * @param {*} m - Parameter m
  1007. * @param {*} r - Parameter r
  1008. */
  1009. const emit = (event, a, b, c, m, r) => ws.send(Uint8Array.from([...msgpack5.encode([event, [a, b, c, m, r]])]));
  1010. /**
  1011. * Function to place an item
  1012. * @param {number} event - Event type
  1013. * @param {number} l - Angle
  1014. */
  1015. const place = (event, l) => {
  1016. emit("G", event, false);
  1017. emit("d", 1, l);
  1018. emit("d", 0, l);
  1019. emit("G", myPlayer.weaponIndex, true);
  1020. };
  1021. /**
  1022. * Function to send a chat message
  1023. * @param {string} event - The chat message
  1024. */
  1025. const chat = event => emit("6", event);
  1026. /**
  1027. * Cache the player's items
  1028. */
  1029. const cacheItems = () => {
  1030. for (let c = 0; c < 9; c++) {
  1031. var _document$getElementB;
  1032. if (((_document$getElementB = document.getElementById(`actionBarItem${c}`)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.offsetParent) !== null) {
  1033. inventory.primary = c;
  1034. }
  1035. }
  1036. for (let s = 9; s < 16; s++) {
  1037. var _document$getElementB2;
  1038. if (((_document$getElementB2 = document.getElementById(`actionBarItem${s}`)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.offsetParent) !== null) {
  1039. inventory.secondary = s;
  1040. }
  1041. }
  1042. for (let P = 16; P < 19; P++) {
  1043. var _document$getElementB3;
  1044. if (((_document$getElementB3 = document.getElementById(`actionBarItem${P}`)) === null || _document$getElementB3 === void 0 ? void 0 : _document$getElementB3.offsetParent) !== null) {
  1045. inventory.food = P - 16;
  1046. }
  1047. }
  1048. for (let f = 19; f < 22; f++) {
  1049. var _document$getElementB4;
  1050. if (((_document$getElementB4 = document.getElementById(`actionBarItem${f}`)) === null || _document$getElementB4 === void 0 ? void 0 : _document$getElementB4.offsetParent) !== null) {
  1051. inventory.wall = f - 16;
  1052. }
  1053. }
  1054. for (let _ = 22; _ < 26; _++) {
  1055. var _document$getElementB5;
  1056. if (((_document$getElementB5 = document.getElementById(`actionBarItem${_}`)) === null || _document$getElementB5 === void 0 ? void 0 : _document$getElementB5.offsetParent) !== null) {
  1057. inventory.spike = _ - 16;
  1058. }
  1059. }
  1060. for (let u = 26; u < 29; u++) {
  1061. var _document$getElementB6;
  1062. if (((_document$getElementB6 = document.getElementById(`actionBarItem${u}`)) === null || _document$getElementB6 === void 0 ? void 0 : _document$getElementB6.offsetParent) !== null) {
  1063. inventory.mill = u - 16;
  1064. }
  1065. }
  1066. for (let I = 29; I < 31; I++) {
  1067. var _document$getElementB7;
  1068. if (((_document$getElementB7 = document.getElementById(`actionBarItem${I}`)) === null || _document$getElementB7 === void 0 ? void 0 : _document$getElementB7.offsetParent) !== null) {
  1069. inventory.mine = I - 16;
  1070. }
  1071. }
  1072. for (let p = 31; p < 33; p++) {
  1073. var _document$getElementB8;
  1074. if (((_document$getElementB8 = document.getElementById(`actionBarItem${p}`)) === null || _document$getElementB8 === void 0 ? void 0 : _document$getElementB8.offsetParent) !== null) {
  1075. inventory.boostPad = p - 16;
  1076. }
  1077. }
  1078. for (let x = 31; x < 33; x++) {
  1079. var _document$getElementB9;
  1080. if (((_document$getElementB9 = document.getElementById(`actionBarItem${x}`)) === null || _document$getElementB9 === void 0 ? void 0 : _document$getElementB9.offsetParent) !== null) {
  1081. inventory.trap = x - 16;
  1082. }
  1083. }
  1084. for (let g = 29; g < 31; g++) {
  1085. var _document$getElementB10;
  1086. if (((_document$getElementB10 = document.getElementById(`actionBarItem${g}`)) === null || _document$getElementB10 === void 0 ? void 0 : _document$getElementB10.offsetParent) !== null && g !== 36) {
  1087. inventory.turret = g - 16;
  1088. }
  1089. }
  1090. inventory.spawnpad = 36;
  1091. };
  1092. // Override WebSocket's send method
  1093. document.msgpack = window.msgpack;
  1094. WebSocket.prototype.oldSend = WebSocket.prototype.send;
  1095. WebSocket.prototype.send = function (event) {
  1096. ws || (document.ws = this, ws = this, document.ws.addEventListener("message", hookWS));
  1097. this.oldSend(event);
  1098. };
  1099. // Event listener for [M] key to toggle autoMill
  1100. document.addEventListener("keydown", event => {
  1101. if (event.keyCode === 77 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  1102. autoMill = !autoMill;
  1103. chat(`Auto Triple Mill : ${autoMill ? 'enabled' : 'disabled'}`);
  1104. }
  1105. });
  1106. })();
  1107. (function () {
  1108. // Variables
  1109. let AUTO_HEAL_SPEED = 120;
  1110. let AUTO_HEAL_ENABLED = true;
  1111. let items = [];
  1112. let weapons = [];
  1113. let inGame = false;
  1114. let tmpHealth = 100;
  1115. let sTime = 0;
  1116. let sCount = 0;
  1117. let msgpack = window.msgpack;
  1118. let ws;
  1119. // WebSocket setup
  1120. ws = new Promise(function (resolve) {
  1121. let {
  1122. send
  1123. } = WebSocket.prototype;
  1124. WebSocket.prototype.send = function (...x) {
  1125. send.apply(this, x);
  1126. this.send = send;
  1127. this.io = function (...datas) {
  1128. const [packet, ...data] = datas;
  1129. this.send(new Uint8Array(Array.from(msgpack.encode([packet, data]))));
  1130. };
  1131. this.addEventListener("message", function (e) {
  1132. const [packet, data] = msgpack.decode(new Uint8Array(e.data));
  1133. let sid = data[0];
  1134. let health = data[1];
  1135. let inventory = {
  1136. food: items[0],
  1137. walls: items[1],
  1138. spikes: items[2],
  1139. mill: items[3],
  1140. mine: items[4],
  1141. trap: items[5],
  1142. booster: items[6],
  1143. turret: items[7],
  1144. watchtower: items[8],
  1145. buff: items[9],
  1146. spawn: items[10],
  1147. sapling: items[11],
  1148. blocker: items[12],
  1149. teleporter: items[13]
  1150. };
  1151. let addEventListener = {
  1152. setupGame: "C",
  1153. updateHealth: "O",
  1154. killPlayer: "P",
  1155. updateItems: "V"
  1156. };
  1157. switch (packet) {
  1158. case addEventListener.setupGame:
  1159. inGame = true;
  1160. items = [0, 3, 6, 10];
  1161. weapons = [0];
  1162. break;
  1163. case addEventListener.updateHealth:
  1164. if (sid) {
  1165. const AUTOHEAL_SPEED = parseInt(document.getElementById('speedInput').value);
  1166. if (inGame && AUTO_HEAL_ENABLED) {
  1167. if (health < 100 && health > 0) {
  1168. setTimeout(function () {
  1169. place(inventory.food);
  1170. place(inventory.food);
  1171. place(inventory.food);
  1172. place(inventory.food);
  1173. }, AUTOHEAL_SPEED);
  1174. }
  1175. }
  1176. if (tmpHealth - health < 0) {
  1177. if (sTime) {
  1178. let timeHit = Date.now() - sTime;
  1179. sTime = 0;
  1180. sCount = timeHit <= 120 ? sCount + 1 : Math.max(0, sCount - 2);
  1181. }
  1182. } else {
  1183. sTime = Date.now();
  1184. }
  1185. tmpHealth = health;
  1186. }
  1187. break;
  1188. case addEventListener.killPlayer:
  1189. inGame = false;
  1190. break;
  1191. case addEventListener.updateItems:
  1192. if (sid) {
  1193. if (health) {
  1194. weapons = sid;
  1195. } else {
  1196. items = sid;
  1197. }
  1198. }
  1199. break;
  1200. }
  1201. });
  1202. resolve(this);
  1203. };
  1204. });
  1205. // Functions
  1206. const sendPacket = function (...datas) {
  1207. const [type, ...data] = datas;
  1208. var binary = msgpack.encode([type, data]);
  1209. ws.then(function (wsInstance) {
  1210. wsInstance.send(new Uint8Array(Array.from(binary)));
  1211. });
  1212. };
  1213. // PLACE
  1214. const place = function (id, ang) {
  1215. if (inGame) {
  1216. sendPacket("G", id, false);
  1217. hit(ang);
  1218. selectWeapon();
  1219. }
  1220. };
  1221. // SELECT WEAPON
  1222. const selectWeapon = function () {
  1223. if (inGame) {
  1224. sendPacket("G", weapons[0], true);
  1225. }
  1226. };
  1227. // HIT
  1228. const hit = function (id, ang) {
  1229. if (inGame) {
  1230. sendPacket("d", 1, ang);
  1231. sendPacket("d", 0, ang);
  1232. }
  1233. };
  1234. // CHAT
  1235. const chat = function (e) {
  1236. if (inGame) {
  1237. sendPacket("6", e);
  1238. }
  1239. };
  1240. // SCRIPT MENU:
  1241. let modMenus = document.createElement("div");
  1242. modMenus.id = "modMenus";
  1243. document.body.append(modMenus);
  1244. modMenus.style.display = "block";
  1245. modMenus.style.padding = "10px";
  1246. modMenus.style.backgroundColor = "rgba(0, 0, 0, 0.25)";
  1247. modMenus.style.borderRadius = "4px";
  1248. modMenus.style.position = "absolute";
  1249. modMenus.style.left = "20px";
  1250. modMenus.style.top = "20px";
  1251. modMenus.style.minWidth = "300px";
  1252. modMenus.style.maxWidth = "290px";
  1253. modMenus.style.minHeight = "400";
  1254. modMenus.style.maxHeight = "700";
  1255. function updateInnerHTML() {
  1256. modMenus.innerHTML = `<h2 style="text-align: center; font-size: 28px;">Auto Heal <span ></span></h2>
  1257. <hr>
  1258. <label for="speedInput">Speed</label>
  1259. <input type="number" id="speedInput" oninput="this.value = this.value.slice(0, 4)" value=${AUTO_HEAL_SPEED}>
  1260. <span id="speedValue"></span>
  1261. <hr>
  1262. <input type="checkbox" checked id="AUTO_HEAL">
  1263. Auto Heal
  1264. <br>`;
  1265. }
  1266. updateInnerHTML();
  1267. // THIS IS HOW SCRIPT MENU IS ON/OFF:
  1268. function getEl(id) {
  1269. return document.getElementById(id);
  1270. }
  1271. // PART OF SCRIPT MENU:
  1272. getEl("AUTO_HEAL").onclick = function () {
  1273. AUTO_HEAL_ENABLED = !AUTO_HEAL_ENABLED;
  1274. chat(`Auto Heal : ${AUTO_HEAL_ENABLED ? 'enabled' : 'disabled'}`);
  1275. };
  1276. getEl("speedInput").oninput = function () {
  1277. chat(`Auto Heal Speed : ${getEl("speedInput").value}`);
  1278. };
  1279. })();
  1280. function Xh() {
  1281. Un.onclick = C.checkTrusted(function() {
  1282. ms("Connecting..."),
  1283. cs() ? bs() : Oh()
  1284. }),
  1285. C.hookTouchEvents(Un),
  1286. kn && (kn.onclick = C.checkTrusted(function() {
  1287. Lo("https://krunker.io/?play=SquidGame_KB")
  1288. }),
  1289. C.hookTouchEvents(kn)),
  1290. vn && (vn.onclick = C.checkTrusted(function() {
  1291. setTimeout(function() {
  1292. Rh()
  1293. }, 10)
  1294. }),
  1295. C.hookTouchEvents(vn)),
  1296. Ln.onclick = C.checkTrusted(function() {
  1297. pf()
  1298. }),
  1299. C.hookTouchEvents(Ln),
  1300. hr.onclick = C.checkTrusted(function() {
  1301. nf()
  1302. }),
  1303. C.hookTouchEvents(hr),
  1304. fr.onclick = C.checkTrusted(function() {
  1305. hf()
  1306. }),
  1307. C.hookTouchEvents(fr),
  1308. ur.onclick = C.checkTrusted(function() {
  1309. Mo()
  1310. }),
  1311. C.hookTouchEvents(ur),
  1312. me.onclick = C.checkTrusted(function() {
  1313. Ao()
  1314. }),
  1315. C.hookTouchEvents(me)
  1316. vg(Bb, "AutoMacroMod");
  1317. }