Moomoo.io Public AutoMacroMod

Best Legit moomoo.io script for 1.8.0

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