Auto Stats Upgrade Script & AFK Diep.io - UPDATED!

• Added Auto Repel • Added SANDBOX Auto Level Up • Added SANDBOX Auto Respawn • Added Copy Link - CUSTOM SAVED UPGRADES COMING SOON!!

  1. // ==UserScript==
  2. // @name Auto Stats Upgrade Script & AFK Diep.io - UPDATED!
  3. // @namespace http://tampermonkey.net/
  4. // @version v1.7.3
  5. // @description • Added Auto Repel • Added SANDBOX Auto Level Up • Added SANDBOX Auto Respawn • Added Copy Link - CUSTOM SAVED UPGRADES COMING SOON!!
  6. // @author Comma
  7. // @match https://diep.io/*
  8. // @icon https://i.imgur.com/E20fTA6.png
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @license MIT
  12. // @run-at document-start
  13. // ==/UserScript==
  14.  
  15.  
  16.  
  17. // Press the TAB key to view the menu
  18. // Press the TAB key to view the menu
  19.  
  20. /* If you're unsure of how to use this script read along:
  21.  
  22. 1. Firstly make sure you're using Google Chrome or Microsoft Edge
  23. 2. Download the Tampermonkey extension: https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en
  24. 3. Enable developer mode for whatever browser you're using:
  25.  
  26. For Chrome:
  27. - Paste this into the address bar at the top: chrome://extensions/ then hit enter
  28. - Tick the Developer mode slider in the top right corner and do the same with the tampermonkey extension
  29. - An update button should appear in the top left area, click on it to save the changes
  30.  
  31. For Edge:
  32. - Paste this into the address bar at the top: edge://extensions/ then hit enter
  33. - Tick the "Developer mode" slider and the "Allow extensions from other stores" slider and do the same with the tampermonkey extension
  34. - An update button should appear on screen, click on it to save the changes
  35.  
  36. 4. Enable the extension by clicking the Tampermonkey icon in the top right corner then go into "Dashboard" and enable the script.
  37. This should be enabled by default, if you don't see the Tampermonkey icon you have to pin it to the toolbar
  38.  
  39. 5. Go into Diep.io and refresh, the script should work perfectly fine, use the TAB key to toggle the menu's visibility.
  40. If you have any issues DM me on Discord: Comma#4169
  41.  
  42. */
  43.  
  44. document.addEventListener('keydown', function(event) {
  45. if (event.key === 'Tab') {
  46. event.preventDefault();
  47. }
  48. });
  49.  
  50. var myTimeout = setTimeout(startt, 1000);
  51. function startt() {
  52.  
  53.  
  54.  
  55. var exit_btn = document.getElementById('quick-exit-game');
  56. var add = document.getElementById("last-updated");
  57. var add_2 = document.getElementById('apes-io-promo');
  58. if(add_2){add_2.remove()};
  59. if(add){add.style.display = "none"};
  60. if(exit_btn){exit_btn.style.display = "none"};
  61.  
  62. (function() {
  63. 'use strict';
  64. var welcome_msg = document.createElement("h1");
  65. var menuVisible = GM_getValue('menuVisible', true);
  66.  
  67.  
  68. (function() {
  69. const hasRunBefore = GM_getValue('hasRunBefore', false);
  70.  
  71. if (!hasRunBefore) {
  72.  
  73.  
  74. document.body.prepend(welcome_msg);
  75. GM_setValue('hasRunBefore', true);
  76. }
  77. })();
  78. var build_message = document.createElement("h1");
  79.  
  80. function build_msg() {
  81. build_message.style.display = 'block';
  82. build_message.textContent = "Build";
  83. build_message.style.zIndex = "9999";
  84. build_message.style.width = "45vw";
  85. build_message.style.height = "auto";
  86. build_message.style.whiteSpace = "nowrap";
  87. build_message.style.fontSize = "1em";
  88. build_message.style.position = "absolute";
  89. build_message.style.textAlign = "center";
  90. build_message.style.top = "7%";
  91. build_message.style.left = "50%";
  92. build_message.style.transform = "translate(-50%, -50%)";
  93. build_message.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
  94. build_message.style.color = "white";
  95. build_message.style.padding = "0.5em";
  96. build_message.style.borderRadius = "5px";
  97.  
  98. document.body.appendChild(build_message)
  99. }
  100.  
  101. setTimeout(function() {
  102.  
  103.  
  104.  
  105. welcome_msg.textContent = "Script by Comma, press TAB to toggle menu, report any bugs via Discord";
  106. welcome_msg.style.zIndex = "9999";
  107. welcome_msg.style.width = "45vw";
  108. welcome_msg.style.height = "auto";
  109. welcome_msg.style.whiteSpace = "nowrap";
  110. welcome_msg.style.fontSize = "1em";
  111. welcome_msg.style.position = "absolute";
  112. welcome_msg.style.textAlign = "center";
  113. welcome_msg.style.top = "7%";
  114. welcome_msg.style.left = "50%";
  115. welcome_msg.style.transform = "translate(-50%, -50%)";
  116. welcome_msg.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
  117. welcome_msg.style.color = "white";
  118. welcome_msg.style.padding = "0.5em";
  119. welcome_msg.style.borderRadius = "5px";
  120.  
  121. setTimeout(function msg(){
  122. welcome_msg.style.display = "none";
  123. }, 5000);
  124. }, 1000);
  125.  
  126.  
  127. var Creator = document.createElement("div");
  128. var Help = document.createElement("p");
  129. var SSP_Ol = document.createElement("p");
  130. var SSP_Fi = document.createElement("p");
  131. var Glass_Fi = document.createElement("p");
  132. var Destroyer = document.createElement("p");
  133. var time_alive = document.createElement("p")
  134. var Ui_Toggle = document.createElement("p");
  135. var Net_Predict_Toggle = document.createElement("p");
  136. var Build_Create = document.createElement("p");
  137. var copy_link = document.createElement("p");
  138. var afkk = document.createElement("p");
  139. var auto_repel = document.createElement("p");
  140. Creator.innerHTML = "Diep Build<br>Comma#4169";
  141. Help.textContent = "TAB Key: Toggle On/Off";
  142. SSP_Ol.textContent = "SSP Overlord: 1";
  143. SSP_Fi.textContent = "SSP Fighter: 2";
  144. Glass_Fi.textContent = "Glass Fighter: 3";
  145. Destroyer.textContent = "Destroyer: 4";
  146. time_alive.textContent = "Time Alive"
  147. Ui_Toggle.textContent = "UI Toggle (F) - Disabled";
  148. Build_Create.textContent = "Build Create: B";
  149. Net_Predict_Toggle.textContent = "NetPredict - Enabled";
  150. afkk.textContent = "Press ` for afk"
  151. copy_link.textContent = "Copy Link"
  152. Creator.style.display = "none";
  153. auto_repel.textContent = "Auto Repel - Disabled"
  154.  
  155. // Key Down and up create for Auto Repel
  156. const RAW_MAPPING = ["KeyA", "KeyB", "KeyC", "KeyD", "KeyE", "KeyF", "KeyG", "KeyH", "KeyI", "KeyJ", "KeyK", "KeyL", "KeyM", "KeyN", "KeyO", "KeyP", "KeyQ", "KeyR", "KeyS", "KeyT", "KeyU", "KeyV", "KeyW", "KeyX", "KeyY", "KeyZ", "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight", "Tab", "Enter", "NumpadEnter", "ShiftLeft", "ShiftRight", "Space", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9", "Digit0", "Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9", "F2", "End", "Home", "Semicolon", "Comma", "NumpadComma", "Period", "Backslash"]; let _win = typeof unsafeWindow === 'undefined' ? window : unsafeWindow;function key_down(keyString) {const index = RAW_MAPPING.indexOf(keyString);if (index === -1) return console.error(`Invalid key string: ${keyString}`);input.onKeyDown(index + 1)}; function key_up(keyString) {const index = RAW_MAPPING.indexOf(keyString);if (index === -1) return console.error(`Invalid key string: ${keyString}`); input.onKeyUp(index + 1)};
  157.  
  158.  
  159. var mark = true;
  160.  
  161. auto_repel.onclick = function(){
  162. if(mark){
  163. auto_repel.textContent = "Auto Repel - Enabled"
  164. key_down("ShiftLeft");
  165. } else {
  166. auto_repel.textContent = "Auto Repel - Disabled"
  167. key_up("ShiftLeft");
  168. }
  169. mark = !mark
  170. }
  171.  
  172.  
  173. function hi() {
  174. if (!t) {
  175.  
  176.  
  177. Creator.style.display = 'none';
  178.  
  179. } else {
  180. Creator.style.display = 'block';
  181.  
  182. }
  183. t = !t;
  184.  
  185. };
  186. Help.onclick = hi;
  187.  
  188. var t__1 = true;
  189. var renUI = true;
  190. var renPREDICT = true;
  191.  
  192. Ui_Toggle.onclick = function() {
  193.  
  194. if(!t__1) {
  195. Ui_Toggle.textContent = "UI Toggle (F) - Disabled"
  196. t__1 = !t__1
  197.  
  198. } else {
  199. if(Ui_Toggle.textContent = "UI Toggle (F) - Enabled") {
  200.  
  201. t__1 = !t__1
  202. }
  203. }
  204. }
  205. Net_Predict_Toggle.onclick = function() {
  206.  
  207. if(Net_Predict_Toggle.textContent === "NetPredict - Enabled") {
  208.  
  209. input.set_convar("net_predict_movement", false)
  210.  
  211. Net_Predict_Toggle.textContent = "NetPredict - Disabled"
  212.  
  213. } else {
  214. if(Net_Predict_Toggle.textContent === "NetPredict - Disabled"){
  215. input.set_convar("net_predict_movement", true)
  216. Net_Predict_Toggle.textContent = "NetPredict - Enabled"
  217.  
  218.  
  219. }
  220. }
  221. }
  222.  
  223.  
  224. Build_Create.onclick = function(){ truthy = !truthy;
  225.  
  226. if(checker == true){
  227. menu.style.display = truthy ? "block" : "none";
  228. document.getElementById('toggle-container').style.display = truthy ? "block" : "none"}
  229. }
  230.  
  231.  
  232. SSP_Ol.onclick = function() {
  233. input.execute('game_stats_build 565656565656568888888444444423233');
  234. build_msg()
  235. build_message.textContent = "SSP Overlord build applied";
  236. setTimeout(function() {
  237. build_message.style.display = "none";
  238. }, 3000);
  239.  
  240. };
  241. SSP_Fi.onclick = function() {
  242. input.execute('game_stats_build 565656565656568888888777777723233');
  243.  
  244. build_msg()
  245. build_message.textContent = "SSP Fighter build applied";
  246.  
  247. setTimeout(function() {
  248. build_message.style.display = "none";
  249. }, 3000);
  250. };
  251. Glass_Fi.onclick = function() {
  252. input.execute('game_stats_build 56565656565656888888877777774444444');
  253.  
  254. build_msg()
  255. build_message.textContent = "Glass Fighter build applied";
  256. setTimeout(function() {
  257. build_message.style.display = "none";
  258. }, 3000);
  259.  
  260. };
  261. Destroyer.onclick = function() {
  262. input.execute('game_stats_build 565656565656888888844444447777777');
  263. build_msg()
  264. build_message.textContent = "Destroyer build applied";
  265.  
  266. setTimeout(function() {
  267. build_message.style.display = "none";
  268. }, 3000);
  269. };
  270.  
  271. Creator.style.position = "fixed";
  272. Creator.style.top = "0px";
  273. Creator.style.left = "0px";
  274. Creator.style.zIndex = "9999";
  275.  
  276. Creator.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
  277. Creator.style.color = "white";
  278. Creator.style.padding = "1.5vh";
  279. Creator.style.borderRadius = "0.6vh";
  280.  
  281.  
  282. document.body.appendChild(Creator);
  283. Creator.appendChild(Help);
  284. Creator.appendChild(SSP_Ol);
  285. Creator.appendChild(SSP_Fi);
  286. Creator.appendChild(Glass_Fi);
  287. Creator.appendChild(Destroyer);
  288. Creator.appendChild(Ui_Toggle);
  289. Creator.appendChild(Build_Create);
  290. Creator.appendChild(Net_Predict_Toggle);
  291. Creator.appendChild(time_alive)
  292. Creator.appendChild(copy_link)
  293. Creator.appendChild(auto_repel)
  294. Creator.appendChild(afkk)
  295. Creator.style.width = "18vw";
  296. Creator.style.height = "56vh";
  297. Creator.querySelectorAll('p').forEach(p => {
  298.  
  299. p.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  300. p.style.margin = "0";
  301. p.style.height = "4%"
  302. p.style.width = "95%"
  303. p.style.overflow = "hidden";
  304. p.style.padding = "1vh";
  305. p.style.borderRadius = "0.6vh";
  306. p.style.transition = "background-color 0.3s";
  307.  
  308. let tooltip = document.getElementById('tooltip')
  309. p.addEventListener('mouseover', (event) => {
  310. event.target.style.backgroundColor = '#014D4E';
  311. });
  312.  
  313. p.addEventListener('mouseout', (event) => {
  314. event.target.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
  315. });
  316. });
  317.  
  318. var t = true;
  319. var t_2 = true;
  320. var t_8 = true;
  321.  
  322.  
  323. document.addEventListener('keydown', function(event) {
  324. if (event.keyCode === 9) { // TAB key
  325. if (!t) {
  326. Creator.style.display = 'none';
  327.  
  328. } else {
  329. Creator.style.display = 'block';
  330. }
  331. t = !t;
  332. }
  333. });
  334.  
  335.  
  336. var checker = true;
  337. (function() { // SSP Overlord
  338. document.addEventListener('keydown', function(event) { //shift + 1
  339. if (event.shiftKey && event.keyCode === 49) { if(checker == true) {
  340. build_msg()
  341. build_message.textContent = "SSP Overlord build applied";
  342. input.execute('game_stats_build 565656565656568888888444444423233');
  343. setTimeout(function() {
  344. build_message.style.display = "none";
  345. }, 3000);
  346. }
  347. }
  348. });
  349. })();
  350.  
  351. (function() { // SSP Fighter
  352. document.addEventListener('keydown', function(event) { //Shift + 2
  353. if (event.shiftKey && event.keyCode === 50) {
  354. if(checker == true){
  355. input.execute('game_stats_build 565656565656568888888777777723233');
  356. build_msg()
  357. build_message.textContent = "SSP Fighter build applied";
  358. setTimeout(function() {
  359. build_message.style.display = "none";
  360. }, 3000);
  361. }
  362. }
  363. });
  364. })();
  365.  
  366.  
  367.  
  368. (function() { // Glass Fighter
  369. document.addEventListener('keydown', function(event) { //shift + 3
  370. if (event.shiftKey && event.keyCode === 51) {
  371. if(checker == true) {
  372. input.execute('game_stats_build 56565656565656888888877777774444444');
  373. build_msg()
  374. build_message.textContent = "Glass Fighter build applied";
  375. setTimeout(function() {
  376. build_message.style.display = "none";
  377. }, 3000);
  378. }
  379. }
  380. });
  381. })();
  382.  
  383. (function() { // Destroyer
  384. document.addEventListener('keydown', function(event) { //shift + 4
  385. if (event.shiftKey && event.keyCode === 52) {
  386. if(checker == true) {
  387. input.execute('game_stats_build 565656565656888888844444447777777');
  388. build_msg()
  389. build_message.textContent = "Destroyer build applied";
  390. setTimeout(function() {
  391. build_message.style.display = "none";
  392. }, 3000);
  393. }
  394. }
  395. });
  396. })();
  397. var tt = true;
  398. var spawn_inputt = document.getElementById("spawn-nickname");
  399.  
  400. spawn_inputt.addEventListener('focus', () => {
  401. tt = false;
  402. checker = false;
  403. });
  404.  
  405. spawn_inputt.addEventListener('blur', () => {
  406. tt = true;
  407. checker = true;
  408. });
  409. (function() { // UI Toggle
  410.  
  411.  
  412. document.addEventListener('keydown', function(event) {
  413. if (event.key === 'f' || event.key === 'F') {
  414. if(Ui_Toggle.textContent === "UI Toggle (F) - Enabled" && renUI == renUI && tt) {
  415.  
  416. renUI = !renUI
  417. input.set_convar("ren_ui", renUI);
  418.  
  419.  
  420. }
  421. }
  422. });
  423. })();
  424. // those reading this script and judging code and shit idc dumb fucks its literal all rushed + its a public script so idc, im not cleaning it up
  425.  
  426. var clock = document.createElement("p");
  427. clock.style.position = "absolute";
  428. clock.style.display = "none";
  429. clock.style.right = "1.3%";
  430. clock.style.bottom = "23%";
  431. clock.style.color = "white";
  432. clock.textContent = "00:00:00";
  433. clock.style.fontSize = "3vw"; clock.style.fontSize = "2vh";
  434. clock.style.zIndex = "9999";
  435. clock.style.fontFamily = "Ubuntu, sans-serif";
  436. clock.style.fontFamily = '"Ubuntu", sans-serif';
  437. clock.style.textShadow =
  438. "-0.1vw -0.2vh 0 #000, " +
  439. "0.1vw -0.2vh 0 #000, " +
  440. "-0.1vw 0.2vh 0 #000, " +
  441. "0.1vw 0.2vh 0 #000, " +
  442. "-0.1vw 0 0 #000, " +
  443. "0.1vw 0 0 #000, " +
  444. "0 -0.1vh 0 #000, " +
  445. "0 0.1vh 0 #000";
  446. document.body.appendChild(clock);
  447.  
  448. var spawn_btn = document.getElementById("spawn-button");
  449. var timerInterval;
  450. var hours = 0;
  451. var minutes = 0;
  452. var seconds = 0;
  453. var isPaused = false;
  454.  
  455. function pauseTimer() {
  456. isPaused = true;
  457. }
  458.  
  459. function resumeTimer() {
  460. isPaused = false;
  461. }
  462.  
  463. spawn_btn.onclick = function() {
  464. clearInterval(timerInterval);
  465. clock.textContent = "00:00:00";
  466. hours = 0;
  467. minutes = 0;
  468. seconds = 0;
  469. if (isPaused) {
  470. resumeTimer();
  471. }
  472.  
  473. timerInterval = setInterval(function() {
  474. if (!isPaused) {
  475. seconds++;
  476.  
  477. if (seconds >= 60) {
  478. seconds = 0;
  479. minutes++;
  480. }
  481.  
  482. if (minutes >= 60) {
  483. minutes = 0;
  484. hours++;
  485. }
  486.  
  487. if (hours >= 24) {
  488. hours = 0;
  489. }
  490.  
  491. clock.textContent = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
  492. }
  493. }, 1000);
  494. };
  495.  
  496. function checkXState() {
  497. var homeScreen = document.getElementById("home-screen");
  498. if (homeScreen) {
  499. var xState = homeScreen.getAttribute("x-state");
  500. if (xState === "game-over") {
  501. pauseTimer();
  502. }
  503. }
  504. }
  505.  
  506. const observer = new MutationObserver(checkXState);
  507. var homeScreen = document.getElementById("home-screen");
  508. if (homeScreen) {
  509. observer.observe(homeScreen, { attributes: true });
  510. }
  511.  
  512. const bodyObserver = new MutationObserver(() => {
  513. var newHomeScreen = document.getElementById("home-screen");
  514. if (newHomeScreen) {
  515. observer.observe(newHomeScreen, { attributes: true });
  516. bodyObserver.disconnect();
  517. }
  518. });
  519.  
  520. bodyObserver.observe(document.body, { childList: true, subtree: true });
  521.  
  522.  
  523. time_alive.onclick = function() {
  524. if (t_8) {
  525.  
  526. clock.style.display = "block";
  527.  
  528. } else {
  529. clock.style.display = "none";
  530.  
  531. }
  532. t_8 = !t_8
  533. };
  534. var menu = document.createElement("div");
  535. var Normal = document.createElement("button");
  536. var Sandbox = document.createElement("button");
  537.  
  538. var Add_Build = document.createElement("button");
  539. var Delete_Build = document.createElement("button");
  540. var Import = document.createElement("button");
  541. var Export = document.createElement("button");
  542. var List = document.createElement("div");
  543.  
  544. menu.style.backgroundColor = "rgba(0, 0, 0, 0.8)";
  545. menu.style.width = "70vw";
  546. menu.style.height = "70vh";
  547. menu.style.zIndex = "9997";
  548. menu.style.position = "absolute";
  549. menu.style.top = "50%";
  550. menu.style.left = "50%";
  551. menu.style.transform = "translate(-50%, -50%)";
  552. menu.style.borderRadius = "5px";
  553. menu.style.color = "white"
  554. menu.style.textAlign = "center";
  555. menu.style.fontSize = "2em";
  556. var Diep_Builds = document.createElement("h4");
  557. menu.style.display = "none";
  558. menu.style.position = 'relative';
  559.  
  560. Normal.style.backgroundColor = "black";
  561. Normal.style.width = "50%";
  562. Normal.style.height = "10%";
  563. Normal.style.zIndex = "9999";
  564. Normal.style.position = "absolute";
  565. Normal.style.top = "0";
  566. Normal.style.left = "0";
  567. Normal.textContent = "Build";
  568. Normal.style.color = "white";
  569. var sbx = true;
  570. Normal.onmouseover = function(){if(sbx == false) {return}else{Normal.style.transition = 'background-color 1s ease'; Normal.style.backgroundColor = "#5d89b6" }};
  571. Normal.onmouseout = function(){if (sbx === true) { Normal.style.backgroundColor = "Black" } else {return}};
  572. Normal.onclick = function(){setTimeout(function(){Diep_Builds.textContent = "Tank Builds"}, 150); Normal.style.backgroundColor = "#5d89b6"; sbx = false; Sandbox.style.backgroundColor = "Black"; document.getElementById('container-box').style.display = 'none'; List.style.display = "flex";};
  573.  
  574. Sandbox.style.backgroundColor = "black";
  575. Sandbox.style.width = "50%";
  576. Sandbox.style.height = "10%";
  577. Sandbox.style.zIndex = "9999";
  578. Sandbox.style.position = "absolute";
  579. Sandbox.style.top = "0";
  580. Sandbox.style.right = "0";
  581. Sandbox.textContent = "Sandbox";
  582. Sandbox.style.color = "white";
  583.  
  584. const style = document.createElement('style');
  585. style.textContent = `
  586. .switch {
  587. position: relative;
  588. display: incline-block;
  589. width: 10vh;
  590. height: 4vh;
  591. }
  592. #container-box{
  593. display: none;
  594. }
  595.  
  596. .switch input {
  597. opacity: 0;
  598. width: 0;
  599. height: 0;
  600. }
  601.  
  602. .slider {
  603. position: absolute;
  604. cursor: pointer;
  605. top: 0;
  606. left: 0;
  607. right: 0;
  608. bottom: 0;
  609. background-color: #ccc;
  610. transition: .4s;
  611. z-index: 9998;
  612. border-radius: 2vh;
  613. }
  614.  
  615. .slider:before {
  616. position: absolute;
  617. content: "";
  618. height: 3vh;
  619. width: 3vh;
  620. left: 0.4vh;
  621. bottom: 0.4vh;
  622. background-color: white;
  623. transition: .4s;
  624. z-index: 9998;
  625. border-radius: 50%;
  626. }
  627.  
  628. input:checked + .slider {
  629. background-color: #2196F3;
  630. }
  631.  
  632. input:focus + .slider {
  633. box-shadow: 0 0 1px #2196F3;
  634. }
  635.  
  636. input:checked + .slider:before {
  637. transform: translateX(4vh);
  638. }
  639.  
  640. .label-container {
  641. display: flex;
  642. align-items: center;
  643. margin-bottom: 3vh;
  644. font-size: 3vh;
  645. }
  646.  
  647. .label-container span {
  648. margin-left: 2vh;
  649. }
  650.  
  651. #toggle-container {
  652. position: fixed;
  653. top: 44vh;
  654. left: 50vh;
  655. transform: translate(-50%, -50%);
  656. transition: all 0.4s;
  657. z-index: 9998;
  658. }
  659.  
  660. `;
  661.  
  662.  
  663.  
  664. var lastGameMode = localStorage.getItem('d:last_gamemode');
  665.  
  666.  
  667. document.head.appendChild(style);
  668. var auto_respawn = false; //Automatically respawns your tank
  669. var auto_level = false; //Automtically gives you level 45
  670. var auto_build_apply = false; //Automatically applies build
  671. var value;
  672. const target = document.getElementById("home-screen");
  673.  
  674. const config = { attributes: true };
  675.  
  676. const callback = (mutationList) => {
  677. for (const mutation of mutationList) {
  678. if (mutation.type === 'attributes' && mutation.attributeName === 'x-state') {
  679. const newXStateValue = mutation.target.getAttribute('x-state');
  680.  
  681. lastGameMode = localStorage.getItem('d:last_gamemode');
  682.  
  683. if(newXStateValue == "game-over" && auto_respawn == true && lastGameMode == `"sandbox"`){
  684.  
  685. value = localStorage.getItem("d:last_spawn_name");
  686. input.execute("game_spawn " + value)
  687. }
  688.  
  689. if(newXStateValue == "in-game" && auto_level == true){
  690.  
  691. document.querySelector("#sandbox-max-level").click();
  692. }
  693. }
  694. }
  695. };
  696.  
  697.  
  698. const observerr = new MutationObserver(callback);
  699.  
  700. observerr.observe(target, config);
  701.  
  702.  
  703. const container = document.createElement('div');
  704. container.id = 'toggle-container';
  705. container.innerHTML = `
  706. <div id="container-box">
  707. <div class="label-container">
  708. <label class="switch">
  709. <input type="checkbox" id="Auto_leveler">
  710. <span class="slider"></span>
  711. </label>
  712. <span>Auto Level Up</span>
  713. </div>
  714. <div class="label-container">
  715. <label class="switch">
  716. <input type="checkbox" id="Auto_respawn">
  717. <span class="slider"></span>
  718. </label>
  719. <span>Auto Respawn</span>
  720. </div>
  721. <div class="label-container">
  722. <label class="switch">
  723. <input type="checkbox" id="Auto_build">
  724. <span class="slider"></span>
  725. </label>
  726. <span>Auto Apply Build</span>
  727. </div>
  728. <h2 style = "margin-left: 2vh;">More Coming Soon!<h2>
  729. </div>
  730.  
  731. `;
  732.  
  733. document.body.appendChild(container);
  734.  
  735. document.getElementById("Auto_leveler").addEventListener('change', (event) => {
  736. document.querySelector("#sandbox-max-level").click();
  737. auto_level = !auto_level;
  738.  
  739.  
  740. });
  741.  
  742. document.getElementById("Auto_respawn").addEventListener('change', (event) => {
  743.  
  744. auto_respawn = !auto_respawn;
  745.  
  746.  
  747. });
  748.  
  749. document.getElementById("Auto_build").addEventListener('change', (event) => {
  750.  
  751.  
  752. });
  753.  
  754. Diep_Builds.style.position = "absolute"
  755. Diep_Builds.textContent = "Tank Builds";
  756. Diep_Builds.style.top = "6%";
  757. Diep_Builds.style.left = "50%";
  758. Diep_Builds.style.transform = "translate(-50%, -50%)";
  759. Diep_Builds.style.color = "white";
  760.  
  761. List.style.zIndex = "9999";
  762. List.style.width = "100%";
  763. List.style.height = "50%";
  764. List.style.position = "absolute";
  765. List.style.top = "43%";
  766. List.style.left = "50%";
  767. List.style.marginTop = "0.5vh"
  768. List.style.transform = "translate(-50%, -50%)";
  769. List.style.display = "flex";
  770. List.style.flexDirection = "column";
  771. List.style.gap = "1vh";
  772. List.style.overflowY = "scroll";
  773.  
  774. //
  775.  
  776. var user_buildd = document.createElement('div');
  777. user_buildd.style.width = "100%";
  778. user_buildd.style.backgroundColor = "black"
  779. user_buildd.style.height = "20%";
  780. user_buildd.style.position = "sticky";
  781. user_buildd.style.top = "0";
  782. user_buildd.style.zIndex = "9999";
  783. user_buildd.style.color = "white"
  784. user_buildd.style.fontSize = "3vh"
  785. user_buildd.style.display = "flex";
  786. user_buildd.style.justifyContent = "space-evenly";
  787. user_buildd.style.alignItems = "center";
  788. user_buildd.style.textAlign = "center";
  789. var bld_namee = document.createElement('p');
  790. bld_namee.textContent = "Build Name"
  791. var tank_namee = document.createElement('p');
  792. tank_namee.textContent = "Tank Name"
  793. var key_shortcutt = document.createElement('p');
  794. key_shortcutt.textContent = "Key Shortcut"
  795. user_buildd.appendChild(bld_namee)
  796. user_buildd.appendChild(tank_namee)
  797. user_buildd.appendChild(key_shortcutt)
  798. List.appendChild(user_buildd)
  799.  
  800.  
  801. var user_build;
  802. function createnew() {
  803. user_build = document.createElement('div');
  804. user_build.className = "user_builder";
  805. user_build.style.width = "100%";
  806. user_build.style.backgroundColor = "white"
  807. user_build.style.height = "20%";
  808. user_build.style.zIndex = "9997";
  809. user_build.style.color = "black"
  810. user_build.style.fontSize = "2.4vh"
  811. user_build.onmouseover = function() {user_build.style.backgroundColor = "rgb(93, 137, 182)"};
  812.  
  813. user_build.onmouseout = function() {user_build.style.backgroundColor = "white"};
  814.  
  815. user_build.style.display = "flex";
  816. user_build.style.justifyContent = "space-evenly";
  817. user_build.style.alignItems = "center";
  818. user_build.style.textAlign = "center";
  819.  
  820.  
  821.  
  822. var bld_name = document.createElement('p');
  823. bld_name.textContent = "Ram Defence"
  824. var tank_name = document.createElement('p');
  825. tank_name.textContent = "Tank Name"
  826. var key_shortcut = document.createElement('p');
  827. key_shortcut.textContent = "SHIFT + 1"
  828. user_build.appendChild(bld_name)
  829. user_build.appendChild(tank_name)
  830. user_build.appendChild(key_shortcut)
  831. List.appendChild(user_build)
  832.  
  833. }
  834. createnew()
  835. createnew()
  836. createnew()
  837. createnew()
  838. createnew()
  839. createnew()
  840. createnew()
  841. createnew()
  842.  
  843.  
  844. Sandbox.onmouseover = function(){if(sbx == false){ return }Sandbox.style.transition = 'background-color 1s ease'; Sandbox.style.backgroundColor = "#5d89b6"};
  845. Sandbox.onmouseout = function(){if (sbx === true) {Sandbox.style.backgroundColor = "Black"} else {return}};
  846. Sandbox.onclick = function(){setTimeout(function(){Diep_Builds.textContent = "Sandbox"}, 150); Sandbox.style.backgroundColor = "#5d89b6"; sbx = false; Normal.style.backgroundColor = "Black"; document.getElementById('container-box').style.display = "inline-block"; List.style.display = "none"; };
  847.  
  848.  
  849. Add_Build.style.backgroundColor = "#00FF00"
  850. Add_Build.textContent = "+"
  851. Add_Build.style.width = "3.9vw";
  852. Add_Build.style.height = "3.9vw";
  853. Add_Build.style.zIndex = "9999";
  854. Add_Build.style.fontSize = "5vh"
  855. Add_Build.style.overflow = "hidden";
  856. Add_Build.style.position = "absolute";
  857. Add_Build.style.bottom = "8%";
  858. Add_Build.style.left = "10%";
  859. Add_Build.style.color = "black";
  860. Add_Build.style.border = "none";
  861. Add_Build.style.cursor = "pointer";
  862.  
  863. Delete_Build.style.backgroundColor = "#FF0000"
  864. Delete_Build.style.width = "3.9vw";
  865. Delete_Build.style.height = "3.9vw";
  866. Delete_Build.style.zIndex = "9999";
  867. Delete_Build.style.position = "absolute";
  868. Delete_Build.style.bottom = "8%";
  869. Delete_Build.style.left = "20%";
  870. Delete_Build.style.border = "none";
  871. Delete_Build.style.backgroundImage = "url('https://i.imgur.com/DNl3R4E.png')";
  872. Delete_Build.style.backgroundPosition = "center";
  873. Delete_Build.style.backgroundSize = "contain";
  874. Delete_Build.style.backgroundRepeat = "no-repeat";
  875. Delete_Build.style.cursor = "pointer";
  876.  
  877. Import.style.zIndex = "9999";
  878. Import.style.color = "white";
  879. Import.style.border = "2px solid white"
  880. Import.style.borderRadius = "6%";
  881. Import.style.position = "absolute";
  882. Import.style.bottom = "8%";
  883. Import.style.right = "22%";
  884. Import.textContent = "Import"
  885. Import.style.height = "9%";
  886. Import.style.width = "10%";
  887. Import.style.cursor = "pointer";
  888.  
  889.  
  890. Import.onmouseover = function(){Import.style.backgroundColor = "Black"};
  891. Import.onmouseout = function(){Import.style.backgroundColor = "transparent"};
  892.  
  893. Export.style.zIndex = "9999";
  894. Export.textContent = "Export"
  895. Export.style.color = "white";
  896. Export.style.border = "2px solid white"
  897. Export.style.borderRadius = "6%";
  898. Export.style.position = "absolute";
  899. Export.style.bottom = "8%";
  900. Export.style.right = "9%";
  901. Export.style.height = "9%";
  902. Export.style.width = "10%";
  903. Export.style.cursor = "pointer";
  904.  
  905. Export.onmouseover = function(){Export.style.backgroundColor = "Black"};
  906. Export.onmouseout = function(){Export.style.backgroundColor = "transparent"};
  907.  
  908. Add_Build.onmouseover = function(){Add_Build.style.backgroundColor = "#008000"};
  909. Add_Build.onmouseout = function(){Add_Build.style.backgroundColor = "#00FF00"};
  910. Delete_Build.onmouseover = function(){Delete_Build.style.backgroundColor = "#800000"};
  911. Delete_Build.onmouseout = function(){Delete_Build.style.backgroundColor = "#FF0000"};
  912.  
  913. document.body.appendChild(menu)
  914. menu.appendChild(Normal);
  915. menu.appendChild(Sandbox);
  916. menu.appendChild(Diep_Builds);
  917. menu.appendChild(List);
  918. menu.appendChild(Import);
  919. menu.appendChild(Export);
  920. menu.appendChild(Add_Build);
  921. menu.appendChild(Delete_Build);
  922. List.appendChild(user_build)
  923. var truthy = false;
  924.  
  925. (function() { // Build Crate
  926. document.addEventListener('keydown', function(event) {
  927. if (event.keyCode === 66) {
  928. truthy = !truthy;
  929.  
  930. if(checker == true){
  931. menu.style.display = truthy ? "block" : "none";
  932. document.getElementById('toggle-container').style.display = truthy ? "block" : "none";
  933.  
  934.  
  935. }
  936. }
  937. });
  938. })();
  939.  
  940. document.addEventListener('keydown', function(event) {
  941. if (event.keyCode === 192) {
  942. Creator.style.display = "none";
  943. t = true
  944. }
  945. });
  946.  
  947.  
  948. copy_link.onclick = function(){var link = document.getElementById("copy-party-link").click(); copy_link.textContent = "Copied!"; setTimeout(function(){copy_link.textContent = "Copy Link"}, 5000); }
  949. // Mouse Coords
  950. let x = event.clientX;
  951. let y = event.clientY;
  952. var help_tool = document.createElement('div');
  953.  
  954. onclick = function(){
  955. help_tool.textContent = "Build";
  956. help_tool.style.backgroundColor = "grey";
  957. help_tool.style.color = "white";
  958. help_tool.style.zIndex = "9999";};
  959. help_tool.style.position = "absolute"
  960. help_tool.style.top = `${y}px`;
  961. help_tool.style.left = `${x}px`;
  962. document.body.appendChild(help_tool);
  963. onmousemove = function(){if(help_tool){help_tool.remove()}};
  964.  
  965.  
  966.  
  967.  
  968. })();
  969. }
  970.  
  971.  
  972. (function() {
  973. const handler = {
  974. apply(r,o,args) {
  975. Error.stackTraceLimit = 0;
  976. return r.apply(o,args)
  977. }
  978. }
  979. Object.freeze = new Proxy(Object.freeze, handler)
  980. const originalAddEventListener = EventTarget.prototype.addEventListener;
  981. const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
  982.  
  983. const callbackMap = new WeakMap();
  984.  
  985. EventTarget.prototype.addEventListener = function(event, callback, options) {
  986. if (['keydown', 'keypress', 'keyup'].includes(event)) {
  987. const wrappedCallback = function(e) {
  988. const originalIsTrusted = e.isTrusted;
  989. const wrappedEvent = new Proxy(e, {
  990. get(target, property) {
  991. if (property === 'isTrusted') {
  992. return true;
  993. } else if (property === 'originalIsTrusted') {
  994. return originalIsTrusted;
  995. }
  996. return target[property];
  997. }
  998. });
  999.  
  1000. callback.call(this, wrappedEvent);
  1001. };
  1002.  
  1003. callbackMap.set(callback, wrappedCallback);
  1004. originalAddEventListener.call(this, event, wrappedCallback, options);
  1005. } else {
  1006. originalAddEventListener.call(this, event, callback, options);
  1007. }
  1008. };
  1009.  
  1010. EventTarget.prototype.removeEventListener = function(event, callback, options) {
  1011. if (callbackMap.has(callback)) {
  1012. const wrappedCallback = callbackMap.get(callback);
  1013. originalRemoveEventListener.call(this, event, wrappedCallback, options);
  1014. callbackMap.delete(callback);
  1015. } else {
  1016. originalRemoveEventListener.call(this, event, callback, options);
  1017. }
  1018. };
  1019. })();
  1020.  
  1021. let win = typeof unsafeWindow != "undefined" ? unsafeWindow : window;
  1022.  
  1023. var int = win.setInterval(function() {
  1024. if(win.input != null) {
  1025. win.clearInterval(int);
  1026. onready();
  1027. }
  1028. }, 100);
  1029.  
  1030. function onready() {
  1031. function key_down(keyCode) {
  1032. let event = new KeyboardEvent('keydown', {
  1033. bubbles: true,
  1034. keyCode: keyCode,
  1035. key: String.fromCharCode(keyCode),
  1036. code: `Key${String.fromCharCode(keyCode).toUpperCase()}`,
  1037. });
  1038. document.dispatchEvent(event);
  1039. }
  1040.  
  1041. function key_up(keyCode) {
  1042. var event = new KeyboardEvent('keyup', {
  1043. bubbles: true,
  1044. keyCode: keyCode,
  1045. key: String.fromCharCode(keyCode),
  1046. code: `Key${String.fromCharCode(keyCode).toUpperCase()}`,
  1047. });
  1048. document.dispatchEvent(event);
  1049. }
  1050. const KEY = '`';
  1051. const scaling = 64;
  1052. const scale = win.devicePixelRatio;
  1053. const canvas = document.getElementById('canvas');
  1054. const ctx = canvas.getContext('2d');
  1055. const c = CanvasRenderingContext2D.prototype;
  1056.  
  1057. function getRatio() {
  1058. if(canvas.height * 16 / 9 >= canvas.width) {
  1059. return canvas.height;
  1060. } else {
  1061. return canvas.width / 16 * 9;
  1062. }
  1063. }
  1064.  
  1065. function getScale() {
  1066. return getRatio() / (1080 * scale);
  1067. }
  1068.  
  1069. function withinMinimap(x, y) {
  1070. const r = getRatio();
  1071. if(x >= canvas.width - r * 0.2 && y >= canvas.height - r * 0.2) {
  1072. return true;
  1073. } else {
  1074. return false;
  1075. }
  1076. }
  1077.  
  1078. function dist(x1, y1, x2, y2) {
  1079. return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
  1080. }
  1081.  
  1082. var FoV = 1;
  1083. var background_alpha = 0.05;
  1084.  
  1085. var got = false;
  1086. var posCount = 0;
  1087. var firstPos = [];
  1088. var secondPos = [];
  1089. var playerPos = [-1, 0];
  1090. var vel = [0, 0];
  1091. var mvel = [0, 0];
  1092.  
  1093. var mouse = [0, 0];
  1094. var realMouse = [0, 0];
  1095. var afkSpot = [-1, 0];
  1096. var picking = false;
  1097. var afk = false;
  1098. var slowerAfk = 0;
  1099.  
  1100. var relyKeys = true;
  1101. var menuVisible = false;
  1102. var menu;
  1103. var textOverlay = 0;
  1104.  
  1105. var multibox = false;
  1106. var aim = 0;
  1107. var movement = false;
  1108. var mov;
  1109. var aimm;
  1110.  
  1111. var buttons = 0;
  1112. const KEYS = {
  1113. 48 : 1,
  1114. 49 : 2,
  1115. 50 : 4,
  1116. 51 : 8,
  1117. 52 : 16,
  1118. 53 : 32,
  1119. 54 : 64,
  1120. 55 : 128,
  1121. 56 : 256,
  1122. 57 : 512,
  1123. 67 : 1024,
  1124. 69 : 2048,
  1125. 75 : 4096,
  1126. 79 : 8192,
  1127. 77 : 16384,
  1128. 85 : 32768,
  1129. 59 : 65536,
  1130. 220 : 131072,
  1131. 13 : 262144,
  1132. 0 : 524288,
  1133. 2 : 1048576,
  1134. 32 : 2097152,
  1135. 16 : 4194304
  1136. };
  1137. const KEYS2 = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 67, 69, 75, 79, 77, 85, 59, 220, 13, 0, 2, 32, 16];
  1138.  
  1139. var bmov = 0;
  1140. const MKEYS = {
  1141. 87: 1,
  1142. 38: 1,
  1143.  
  1144. 83: 2,
  1145. 40: 2,
  1146.  
  1147. 65: 4,
  1148. 37: 4,
  1149.  
  1150. 68: 8,
  1151. 39: 8
  1152. };
  1153.  
  1154. const RD = 2.5;
  1155. const MRD = 0.1;
  1156. const SRD = RD + MRD;
  1157. const DRD = SRD * (Math.sqrt(2) / 2);
  1158.  
  1159. const keybinds = localStorage.getItem("multbox_keybinds") ? JSON.parse(localStorage.getItem("multbox_keybinds")) : ["XD", "XD", "XD", "XD", "XD", "XD"];
  1160.  
  1161. if(keybinds.length != 6) {
  1162. for(let i = keybinds.length; i < 6; ++i) {
  1163. keybinds[i] = "XD";
  1164. }
  1165. localStorage.setItem("multbox_keybinds", JSON.stringify(keybinds));
  1166. }
  1167.  
  1168. function normalizeVel() {
  1169. const d = dist(0, 0, vel[0], vel[1]);
  1170. if(d > 1) {
  1171. mvel[0] = Math.sign(vel[0]) * DRD;
  1172. mvel[1] = Math.sign(vel[1]) * DRD;
  1173. } else {
  1174. mvel = [Math.sign(vel[0]) * SRD, Math.sign(vel[1]) * SRD];
  1175. }
  1176. }
  1177.  
  1178. function getMousePos(e) {
  1179. var rect = canvas.getBoundingClientRect();
  1180. return [(e.clientX - rect.left) / (rect.right - rect.left) * canvas.width, (e.clientY - rect.top) / (rect.bottom - rect.top) * canvas.height];
  1181. }
  1182.  
  1183. win.onmousemove = new Proxy(win.onmousemove ?? function(){}, {
  1184. apply: function(to, what, args) {
  1185. const e = args[0];
  1186. mouse = getMousePos(e);
  1187. realMouse = [playerPos[0] + (mouse[0] - canvas.width / 2) / getScale() / FoV / scaling,
  1188. playerPos[1] + (mouse[1] - canvas.height / 2) / getScale() / FoV / scaling];
  1189. return to.apply(what, args);
  1190. }
  1191. });
  1192. win.onmousedown = new Proxy(win.onmousedown ?? function(){}, {
  1193. apply: function(to, what, args) {
  1194. const e = args[0];
  1195. if(picking == true) {
  1196. const w = canvas.width;
  1197. const h = canvas.height;
  1198. const r = getRatio();
  1199. if(withinMinimap(e.clientX * scale, e.clientY * scale) == true) {
  1200. afkSpot = [(e.clientX * scale - w + r * 0.2) / getScale(), (e.clientY * scale - h + r * 0.2) / getScale()];
  1201. } else if(e.clientX * scale > w - r * 0.3 - 1 && e.clientX * scale < w - r * 0.2 - 1 && e.clientY * scale > h - r * 0.3 - 1 && e.clientY * scale < h - r * 0.2 - 1) {
  1202. afkSpot = [-1, 0];
  1203. } else {
  1204. afkSpot = realMouse;
  1205. }
  1206. picking = false;
  1207. }
  1208. if(KEYS[e.button] != null && (buttons & KEYS[e.button]) == 0) {
  1209. buttons |= KEYS[e.button];
  1210. }
  1211. return to.apply(what, args);
  1212. }
  1213. });
  1214. win.onmouseup = new Proxy(win.onmouseup ?? function(){}, {
  1215. apply: function(to, what, args) {
  1216. const e = args[0];
  1217. if(KEYS[e.button] != null && (buttons & KEYS[e.button]) != 0) {
  1218. buttons ^= KEYS[e.button];
  1219. }
  1220. return to.apply(what, args);
  1221. }
  1222. });
  1223. win.onkeydown = new Proxy(win.onkeydown ?? function(){}, {
  1224. apply: function(to, what, args) {
  1225. const e = args[0];
  1226. if(e.key == KEY && (textOverlay == 0 || (textOverlay != 0 && textOverlay > 6))) {
  1227. menuVisible = !menuVisible;
  1228. if(menuVisible == true) {
  1229. menu.style.display = 'block';
  1230. } else {
  1231. menu.style.display = 'none';
  1232. }
  1233. }
  1234. if(KEYS[e.keyCode] != null && (buttons & KEYS[e.keyCode]) == 0) {
  1235. buttons |= KEYS[e.keyCode];
  1236. }
  1237. if(MKEYS[e.keyCode] != null && (bmov & MKEYS[e.keyCode]) == 0) {
  1238. let code = MKEYS[e.keyCode];
  1239. bmov |= code;
  1240. switch(code) {
  1241. case 4: {
  1242. vel[0] -= 1;
  1243. break;
  1244. }
  1245. case 8: {
  1246. vel[0] += 1;
  1247. break;
  1248. }
  1249. case 2: {
  1250. vel[1] += 1;
  1251. break;
  1252. }
  1253. case 1: {
  1254. vel[1] -= 1;
  1255. break;
  1256. }
  1257. }
  1258. normalizeVel();
  1259. }
  1260. if(textOverlay == 0 || textOverlay > 6) {
  1261. for(let i = 0; i < keybinds.length; ++i) {
  1262. if(e.key == keybinds[i]) {
  1263. document.getElementById('mboxb' + (i + 1)).dispatchEvent(new MouseEvent("click"));
  1264. }
  1265. }
  1266. } else {
  1267. if(e.key == KEY) {
  1268. keybinds[textOverlay - 1] = "XD";
  1269. document.getElementById('mboxk' + textOverlay).innerHTML = '-';
  1270. } else {
  1271. keybinds[textOverlay - 1] = e.key;
  1272. document.getElementById('mboxk' + textOverlay).innerHTML = e.key;
  1273. }
  1274. localStorage.setItem("multibox_keybinds", JSON.stringify(keybinds));
  1275. textOverlay = 0;
  1276. e.stopPropagation();
  1277. e.preventDefault();
  1278. return;
  1279. }
  1280. return to.apply(what, args);
  1281. }
  1282. });
  1283. win.onkeyup = new Proxy(win.onkeyup ?? function(){}, {
  1284. apply: function(to, what, args) {
  1285. const e = args[0];
  1286. let code = KEYS[e.keyCode];
  1287. if(code != null && (buttons & code) != 0) {
  1288. buttons ^= code;
  1289. }
  1290. code = MKEYS[e.keyCode];
  1291. if(code != null && (bmov & code) != 0) {
  1292. bmov ^= code;
  1293. switch(code) {
  1294. case 4: {
  1295. vel[0] += 1;
  1296. break;
  1297. }
  1298. case 8: {
  1299. vel[0] -= 1;
  1300. break;
  1301. }
  1302. case 2: {
  1303. vel[1] -= 1;
  1304. break;
  1305. }
  1306. case 1: {
  1307. vel[1] += 1;
  1308. break;
  1309. }
  1310. }
  1311. if((bmov & MKEYS[65]) == 0 && (bmov & MKEYS[68]) == 0) {
  1312. vel[0] = 0;
  1313. }
  1314. if((bmov & MKEYS[83]) == 0 && (bmov & MKEYS[87]) == 0) {
  1315. vel[1] = 0;
  1316. }
  1317. normalizeVel();
  1318. }
  1319. return to.apply(what, args);
  1320. }
  1321. });
  1322.  
  1323. c.moveTo = new Proxy(c.moveTo, {
  1324. apply: function(to, what, args) {
  1325. const x = args[0];
  1326. const y = args[1];
  1327. if(withinMinimap(x, y) == true) {
  1328. firstPos = [x, y];
  1329. posCount = 1;
  1330. } else {
  1331. posCount = 0;
  1332. }
  1333. return to.apply(what, args);
  1334. }
  1335. });
  1336.  
  1337. c.stroke = new Proxy(c.stroke, {
  1338. apply: function(to, what, args) {
  1339. if((what.fillStyle == '#cdcdcd' || what.fillStyle == '#cccccc') && what.strokeStyle == '#000000') {
  1340. FoV = what.globalAlpha / background_alpha;
  1341. }
  1342. posCount = 0;
  1343. return to.apply(what);
  1344. }
  1345. });
  1346.  
  1347. c.lineTo = new Proxy(c.lineTo, {
  1348. apply: function(to, what, args) {
  1349. const x = args[0];
  1350. const y = args[1];
  1351. switch(posCount) {
  1352. case 1: {
  1353. if(withinMinimap(x, y) == true && dist(x, y, firstPos[0], firstPos[1]) < 15 * scale * getScale()) {
  1354. secondPos = [x, y];
  1355. ++posCount;
  1356. } else {
  1357. posCount = 0;
  1358. }
  1359. break;
  1360. }
  1361. case 2: {
  1362. const d = dist(firstPos[0], firstPos[1], secondPos[0], secondPos[1]);
  1363. if(withinMinimap(x, y) == true && d < 15 * scale * getScale() && what.fillStyle == "#000000" && !got) {
  1364. const angle = Math.atan2(secondPos[1] - y, secondPos[0] - x) - 0.3674113;
  1365. const r = getRatio();
  1366. const xx = (x + Math.cos(angle) * d * 0.8660111 - canvas.width + r * 0.2) / getScale();
  1367. const yy = (y + Math.sin(angle) * d * 0.8660111 - canvas.height + r * 0.2) / getScale();
  1368. console.log(xx.toFixed(2), yy.toFixed(2), getScale(), getRatio());
  1369. playerPos = [xx, yy];
  1370. got = true;
  1371. realMouse = [playerPos[0] + (mouse[0] - canvas.width / 2) / getScale() / FoV / scaling,
  1372. playerPos[1] + (mouse[1] - canvas.height / 2) / getScale() / FoV / scaling];
  1373. }
  1374. posCount = 0;
  1375. break;
  1376. }
  1377. }
  1378. return to.call(what, x, y);
  1379. }
  1380. });
  1381.  
  1382. function drawOverlay() {
  1383. if(picking == true) {
  1384. const r = getRatio();
  1385. var draw = true;
  1386. var angle;
  1387. const w = canvas.width;
  1388. const h = canvas.height;
  1389. ctx.beginPath();
  1390. ctx.fillStyle = '#00000077';
  1391. ctx.fillRect(0, 0, w, (h - r * 0.2) | 0);
  1392. ctx.fillRect(0, (h - r * 0.2) | 0, (w - r * 0.2) | 0, h);
  1393. ctx.fillStyle = '#FF000077';
  1394. ctx.fillRect(w - r * 0.3 - 1, h - r * 0.3 - 1, r * 0.1, r * 0.1);
  1395. ctx.moveTo(mouse[0] - 15, mouse[1]);
  1396. ctx.lineTo(mouse[0] + 15, mouse[1]);
  1397. ctx.moveTo(mouse[0], mouse[1] - 15);
  1398. ctx.lineTo(mouse[0], mouse[1] + 15);
  1399. ctx.lineWidth = 2;
  1400. ctx.strokeStyle = '#00000077';
  1401. ctx.stroke();
  1402. ctx.fillStyle = '#FFFFFF77';
  1403. ctx.font = `${30 * scale}px Arial`;
  1404. ctx.textAlign = 'center';
  1405. ctx.fillText('drag your cursor on the minimap', w / 2, (h - h / 2.5) / 2);
  1406. ctx.fillText('left click to select where you want to stay', w / 2, (h - h / 5) / 2);
  1407. ctx.fillText('click on the red area to reset your AFK location', w / 2, (h) / 2);
  1408. ctx.fillText('click anywhere else to stay at that location', w / 2, (h + h / 5) / 2);
  1409. ctx.fillText('press the button again to hide this overlay', w / 2, (h + h / 2.5) / 2);
  1410. } else if(textOverlay != 0) {
  1411. const w = canvas.width / 2;
  1412. const h = canvas.height / 2;
  1413. ctx.beginPath();
  1414. ctx.fillStyle = '#00000077';
  1415. ctx.fillRect(0, 0, w * 2, h * 2);
  1416. ctx.fillStyle = '#FFFFFF77';
  1417. ctx.font = `${30 * scale}px Arial`;
  1418. ctx.textAlign = 'center';
  1419. switch(textOverlay) {
  1420. case 1: {
  1421. ctx.fillText('press the key you want to bind to picking AFK location', w, h - h / (10 / 3));
  1422. break;
  1423. }
  1424. case 2: {
  1425. ctx.fillText('press the key you want to bind to toggling AFK', w, h - h / (10 / 3));
  1426. break;
  1427. }
  1428.  
  1429.  
  1430. case 7: {
  1431. ctx.fillText('picks the location which your tank will be going towards', w, h - h / 10);
  1432. ctx.fillText('when you toggle AFK option to be on', w, h + h / 10);
  1433. break;
  1434. }
  1435. case 8: {
  1436. ctx.fillText('moves your tank towards the position you set previously', w, h - h / 10);
  1437. ctx.fillText('if you did not set AFK location, it will be set to your current position', w, h + h / 10);
  1438. break;
  1439. }
  1440. case 9: {
  1441. ctx.fillText('enables / disables multibox (aim, movement, key copying)', w, h - h / 10);
  1442. ctx.fillText('can be set for each tab individually', w, h + h / 10);
  1443. break;
  1444. }
  1445. case 10: {
  1446. ctx.fillText('toggles between different aiming styles for other tabs', w, h - h / 2.5);
  1447. ctx.fillText('precise - tabs will aim based on mouse position on the map', w, h - h / 5);
  1448. ctx.fillText('copy - tabs will aim based on mouse position on the screen', w, h);
  1449. ctx.fillText('reverse - tabs will aim the opposite precise direction', w, h + h / 5);
  1450. ctx.fillText('\'reverse\' option is mostly useful when having movement set to \'mouse\'', w, h + h / 2.5);
  1451. break;
  1452. }
  1453. case 11: {
  1454. ctx.fillText('toggles between different movement styles for other tabs', w, h - h / 5);
  1455. ctx.fillText('player - moves tabs towards the player, uses own movement prediction', w, h);
  1456. ctx.fillText('mouse - moves tabs towards the mouse to act like drones', w, h + h / 5);
  1457. break;
  1458. }
  1459. case 12: {
  1460. ctx.fillText('decides whether keys pressed on your master tab will affect this tab', w, h - h / 5);
  1461. ctx.fillText('keep it on if you want all your tabs to be coordinated no matter what', w, h);
  1462. ctx.fillText('keep it off if eg. auto fire off shouldn\'t affect other tabs', w, h + h / 5);
  1463. break;
  1464. }
  1465. }
  1466. if(textOverlay < 7) {
  1467. ctx.fillText('pressing ' + KEY + ' will set the keybind to inactive (no key will be assigned)', w, h - h / 10);
  1468. ctx.fillText('you can change the keybind anytime afterwards', w, h + h / 10);
  1469. ctx.fillText('press the button again to hide this overlay', w, h + h / (10 / 3));
  1470. }
  1471. }
  1472. got = false;
  1473. requestAnimationFrame(drawOverlay);
  1474. }
  1475.  
  1476. function moveToWithRadius(x, y, r) {
  1477. if(dist(x, y, playerPos[0], playerPos[1]) <= r) {
  1478. key_up(65);
  1479. key_up(68);
  1480. key_up(83);
  1481. key_up(87);
  1482. return;
  1483. }
  1484. key_up(65);
  1485. key_up(68);
  1486. key_up(83);
  1487. key_up(87);
  1488. const angle = Math.atan2(y - playerPos[1], x - playerPos[0]);
  1489. if(angle > -Math.PI * 2/6 && angle < Math.PI * 2/6) {
  1490. key_down(68);
  1491. } else if(angle < -Math.PI * 4/6 || angle > Math.PI * 4/6) {
  1492. key_down(65);
  1493. }
  1494. if(angle > Math.PI * 1/6 && angle < Math.PI * 5/6) {
  1495. key_down(83);
  1496. } else if(angle > -Math.PI * 5/6 && angle < -Math.PI * 1/6) {
  1497. key_down(87);
  1498. }
  1499. }
  1500.  
  1501. function moveToAFKSpot() {
  1502. if(afk == true) {
  1503. if(afkSpot[0] == -1) {
  1504. afkSpot = playerPos;
  1505. }
  1506. if(!win.tripletTroll || ++slowerAfk % 3 == 0) {
  1507. moveToWithRadius(afkSpot[0], afkSpot[1], -1);
  1508. } else {
  1509. key_up(65);
  1510. key_up(68);
  1511. key_up(83);
  1512. key_up(87);
  1513. }
  1514. }
  1515. }
  1516.  
  1517. function simulateKeyPress(key, down) {
  1518. down ? key_down(key) : key_up(key);
  1519. }
  1520.  
  1521. function simulateMousePress(button, down) {
  1522. win.input.mouse(...mouse);
  1523. ++button;
  1524. down ? key_down(button) : key_up(button);
  1525. }
  1526.  
  1527. function ReadVarUint(packet, at) {
  1528. var number = 0;
  1529. var count = 0;
  1530. do {
  1531. number |= (packet[at] & 0x7f) << (7 * count++);
  1532. } while((packet[at++] >> 7) == 1);
  1533. return [number, count];
  1534. }
  1535.  
  1536. function WriteVarUint(number) {
  1537. let vu = [];
  1538. while(number > 0x7f) {
  1539. vu[vu.length] = (number & 0x7f) | 0x80;
  1540. number >>>= 7;
  1541. }
  1542. vu[vu.length] = number;
  1543. return vu;
  1544. }
  1545.  
  1546. function createData() {
  1547. var o;
  1548. if(movement == false) {
  1549. o = [0, ...WriteVarUint((playerPos[0] + mvel[0]) * 1000), ...WriteVarUint((playerPos[1] + mvel[1]) * 1000), (mvel[0] == 0 && mvel[1] == 0) ? 0 : 1, ...WriteVarUint((Math.atan2(mvel[1], mvel[0]) + 4) * 1000)];
  1550. } else {
  1551. o = [1, ...WriteVarUint(realMouse[0] * 1000), ...WriteVarUint(realMouse[1] * 1000)];
  1552. }
  1553. if(aim == 0) {
  1554. o = [...o, 0, ...WriteVarUint(realMouse[0] * 1000), ...WriteVarUint(realMouse[1] * 1000)];
  1555. } else if(aim == 1) {
  1556. o = [...o, 1, ...WriteVarUint(32000 + (mouse[0] - canvas.width / 2) / getScale() * 10), ...WriteVarUint(32000 + (mouse[1] - canvas.height / 2) / getScale() * 10)];
  1557. } else {
  1558. o = [...o, 2, ...WriteVarUint(realMouse[0] * 1000), ...WriteVarUint(realMouse[1] * 1000)];
  1559. }
  1560. o = [...o, ...WriteVarUint(buttons)];
  1561. return o;
  1562. }
  1563.  
  1564. function parseData(o) {
  1565. if(afk == false) {
  1566. win.clearInterval(mov);
  1567. win.clearInterval(aimm);
  1568. const w = canvas.width / 2;
  1569. const h = canvas.height / 2;
  1570. const type = o[0];
  1571. var at = 1;
  1572. const x = ReadVarUint(o, at);
  1573. at += x[1];
  1574. x[0] /= 1000;
  1575. const y = ReadVarUint(o, at);
  1576. at += y[1];
  1577. y[0] /= 1000;
  1578. if(type == 0) {
  1579. const hasVel = ReadVarUint(o, at);
  1580. at += hasVel[1];
  1581. const ang = ReadVarUint(o, at);
  1582. at += ang[1];
  1583. ang[0] = ang[0] / 1000 - 4;
  1584. const lmfao = function() {
  1585. if(hasVel[0] == 1 && dist(x[0], y[0], playerPos[0], playerPos[1]) <= RD) {
  1586. const a1 = Math.atan2(y[0] - playerPos[1], x[0] - playerPos[0]);
  1587. if(Math.abs(a1 - ang[0]) < 0.5) {
  1588. if(a1 < ang[0]) {
  1589. moveToWithRadius(x[0] + Math.cos(ang[0] + Math.PI / 2) * SRD, y[0] + Math.sin(ang[0] + Math.PI / 2) * SRD, -1);
  1590. } else {
  1591. moveToWithRadius(x[0] + Math.cos(ang[0] - Math.PI / 2) * SRD, y[0] + Math.sin(ang[0] - Math.PI / 2) * SRD, -1);
  1592. }
  1593. } else {
  1594. moveToWithRadius(x[0] - Math.cos(ang[0]) * SRD * 2, y[0] - Math.sin(ang[0]) * SRD * 2, RD);
  1595. }
  1596. } else {
  1597. moveToWithRadius(x[0], y[0], RD);
  1598. }
  1599. };
  1600. mov = win.setInterval(lmfao, 50);
  1601. lmfao();
  1602. } else {
  1603. mov = win.setInterval(function() {
  1604. moveToWithRadius(x[0], y[0], -1);
  1605. }, 50);
  1606. moveToWithRadius(x[0], y[0], -1);
  1607. }
  1608. const a = o[at++];
  1609. const xx = ReadVarUint(o, at);
  1610. at += xx[1];
  1611. const yy = ReadVarUint(o, at);
  1612. at += yy[1];
  1613. if(a == 0) {
  1614. const lmfao = function() {
  1615. const angle = Math.atan2(yy[0] / 1000 - playerPos[1], xx[0] / 1000 - playerPos[0]);
  1616. var distance = dist(xx[0] / 1000, yy[0] / 1000, playerPos[0], playerPos[1]) * getScale() * FoV * scaling;
  1617. mouse = [w + Math.cos(angle) * distance, h + Math.sin(angle) * distance];
  1618. win.input.mouse(w + Math.cos(angle) * distance, h + Math.sin(angle) * distance);
  1619. };
  1620. aimm = win.setInterval(lmfao, 50);
  1621. lmfao();
  1622. } else if(a == 1) {
  1623. mouse = [(xx[0] - 32000) / 10 * getScale() + w, (yy[0] - 32000) / 10 * getScale() + h];
  1624. win.input.mouse((xx[0] - 32000) / 10 * getScale() + w, (yy[0] - 32000) / 10 * getScale() + h);
  1625. } else {
  1626. const lmfao = function() {
  1627. const angle = Math.atan2(playerPos[1] - yy[0] / 1000, playerPos[0] - xx[0] / 1000);
  1628. var distance = dist(xx[0] / 1000, yy[0] / 1000, playerPos[0], playerPos[1]) * getScale() * FoV * scaling;
  1629. mouse = [w + Math.cos(angle) * distance, h + Math.sin(angle) * distance];
  1630. win.input.mouse(w + Math.cos(angle) * distance, h + Math.sin(angle) * distance);
  1631. };
  1632. aimm = win.setInterval(lmfao, 50);
  1633. lmfao();
  1634. }
  1635. if(relyKeys == true) {
  1636. const b = ReadVarUint(o, at);
  1637. at += b[1];
  1638. const d = b[0] ^ buttons;
  1639. for(let i = 0; i < KEYS2.length; ++i) {
  1640. if((d & (2 ** i)) != 0) {
  1641. if(KEYS2[i] < 3) {
  1642. simulateMousePress(KEYS2[i], (buttons & (2 ** i)) == 0);
  1643. } else {
  1644. simulateKeyPress(KEYS2[i], (buttons & (2 ** i)) == 0);
  1645. }
  1646. }
  1647. }
  1648. buttons = b[0];
  1649. }
  1650. }
  1651. }
  1652.  
  1653. Object.freeze(CanvasRenderingContext2D.prototype);
  1654.  
  1655. win.goUp = true;
  1656. function updateCycle() {
  1657. if(document.hasFocus() == true) {
  1658. win.clearInterval(mov);
  1659. win.clearInterval(aimm);
  1660. if(multibox == true) {
  1661. GM_setValue("mbox", JSON.stringify(createData()));
  1662. }
  1663. } else if(multibox == true) {
  1664. try {
  1665. var g = JSON.parse(GM_getValue("mbox"));
  1666. parseData(g);
  1667. } catch(err){}
  1668. }
  1669. if(win.octoAFK == true) {
  1670. key_up(65);
  1671. key_up(68);
  1672. key_up(83);
  1673. key_up(87);
  1674. if(playerPos[0] < 184) {
  1675. key_down(68);
  1676. } else if(playerPos[0] > 186) {
  1677. key_down(65);
  1678. }
  1679. if(playerPos[1] < 30) {
  1680. win.goUp = false;
  1681. } else if(playerPos[1] > 186) {
  1682. win.goUp = true;
  1683. }
  1684. if(win.goUp == true) {
  1685. key_down(87);
  1686. } else {
  1687. key_down(83);
  1688. }
  1689. }
  1690. requestAnimationFrame(updateCycle);
  1691. }
  1692.  
  1693. const html = `
  1694. <div id="mbox">
  1695. <button id="mboxb1" class="mboxb">Pick AFK location</button>
  1696. <button id="mboxb2" class="mboxb">AFK: off</button>
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702. </div>
  1703. `;
  1704. const css = `
  1705. <style>
  1706. .mboxb {
  1707. border: none;
  1708. text-align: center;
  1709. text-decoration: none;
  1710. font-size: max(calc(0.3em + 0.7vw), 0.8em);
  1711. width: 70%;
  1712. height: 16.66666666666666%;
  1713. display: block;
  1714. transition-duration: 0.2s;
  1715. cursor: pointer;
  1716. -webkit-touch-callout: none;
  1717. -webkit-user-select: none;
  1718. -khtml-user-select: none;
  1719. -moz-user-select: none;
  1720. -ms-user-select: none;
  1721. user-select: none;
  1722. }
  1723. #mbox {
  1724. position: absolute;
  1725. top: 30%;
  1726. width: max(7em, 15%);
  1727. height: max(7em, 35%);
  1728. display: none;
  1729. z-index: 200;
  1730. }
  1731. #mboxb1 {
  1732. position: absolute;
  1733. top: 0;
  1734. left: 30%;
  1735. background-color: #4CAF50;
  1736. color: #FFFFFF;
  1737. border: 0.3em solid #4CAF50;
  1738. }
  1739. #mboxb1:hover {
  1740. background-color: #4CAF5000;
  1741. }
  1742. #mboxk1 {
  1743. position: absolute;
  1744. width: 15%;
  1745. top: 0;
  1746. left: 15%;
  1747. background-color: #4CAF50;
  1748. color: #FFFFFF;
  1749. border: 0.3em solid #4CAF50;
  1750. }
  1751. #mboxk1:hover {
  1752. background-color: #4CAF5000;
  1753. }
  1754. #mboxh1 {
  1755. position: absolute;
  1756. width: 15%;
  1757. top: 0;
  1758. left: 0;
  1759. background-color: #4CAF50;
  1760. color: #FFFFFF;
  1761. border: 0.3em solid #4CAF50;
  1762. }
  1763. #mboxh1:hover {
  1764. background-color: #4CAF5000;
  1765. }
  1766. #mboxb2 {
  1767. position: absolute;
  1768. top: 16.66666666666666%;
  1769. left: 30%;
  1770. background-color: #008CBA;
  1771. color: #FFFFFF;
  1772. border: 0.3em solid #008CBA;
  1773. }
  1774. #mboxb2:hover {
  1775. background-color: #008CBA00;
  1776. }
  1777. #mboxk2 {
  1778. position: absolute;
  1779. width: 15%;
  1780. top: 16.66666666666666%;
  1781. left: 15%;
  1782. background-color: #008CBA;
  1783. color: #FFFFFF;
  1784. border: 0.3em solid #008CBA;
  1785. }
  1786. #mboxk2:hover {
  1787. background-color: #008CBA00;
  1788. }
  1789. #mboxh2 {
  1790. position: absolute;
  1791. width: 15%;
  1792. top: 16.66666666666666%;
  1793. left: 0;
  1794. background-color: #008CBA;
  1795. color: #FFFFFF;
  1796. border: 0.3em solid #008CBA;
  1797. }
  1798. #mboxh2:hover {
  1799. background-color: #008CBA00;
  1800. }
  1801.  
  1802. </style>
  1803. `;
  1804.  
  1805. requestAnimationFrame(drawOverlay);
  1806. requestAnimationFrame(updateCycle);
  1807. win.setInterval(moveToAFKSpot, 100);
  1808. canvas.insertAdjacentHTML('afterend', css);
  1809. canvas.insertAdjacentHTML('afterend', html);
  1810. menu = document.getElementById('mbox');
  1811. const AFKLocationButton = document.getElementById('mboxb1');
  1812. AFKLocationButton.addEventListener("click", function(e) {
  1813. if(!document.hasFocus() || !(e instanceof MouseEvent)) return;
  1814. if(textOverlay != 0) {
  1815. textOverlay = 0;
  1816. }
  1817. picking = !picking;
  1818. });
  1819. const AFKButton = document.getElementById('mboxb2');
  1820. AFKButton.addEventListener("click", function(e) {
  1821. if(!document.hasFocus() || !(e instanceof MouseEvent)) return;
  1822. afk = !afk;
  1823. if(afk == true) {
  1824. win.clearInterval(mov);
  1825. win.clearInterval(aimm);
  1826. this.innerHTML = 'AFK: on';
  1827. } else {
  1828. this.innerHTML = 'AFK: off';
  1829. key_up(65);
  1830. key_up(68);
  1831. key_up(83);
  1832. key_up(87);
  1833.  
  1834. }
  1835.  
  1836.  
  1837.  
  1838. });
  1839.  
  1840.  
  1841.  
  1842. };