Diep.io+ (added Farm Bot)

Quick Tank Upgrades, Highscore saver, Team Switcher, Advanced Auto Respawn, Anti Aim, Zoom hack, Anti AFK Timeout, Sandbox Auto K, Sandbox Arena Increase, Tank Aim lines, Farm Bot

当前为 2025-04-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Diep.io+ (added Farm Bot)
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2.5
  5. // @description Quick Tank Upgrades, Highscore saver, Team Switcher, Advanced Auto Respawn, Anti Aim, Zoom hack, Anti AFK Timeout, Sandbox Auto K, Sandbox Arena Increase, Tank Aim lines, Farm Bot
  6. // @author r!PsAw
  7. // @match https://diep.io/*
  8. // @icon https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQFMDAvSZe2hsFwAIeAPcDSNx8X2lUMp-rLPA&s
  9. // @grant none
  10. // @license Mi300 don't steal my scripts ;)
  11. // ==/UserScript==
  12.  
  13. //inner script settings
  14. let deep_debug_properties = {
  15. active: false, //display information in console
  16. canvas: false, //display information on screen
  17. }
  18.  
  19. function deep_debug(...args) {
  20. if (deep_debug_properties.active) {
  21. console.log(...args);
  22. }
  23. }
  24.  
  25. //Information for script
  26. let _c = window.__common__;
  27. function is_fullscreen(){
  28. return ((window.innerHeight == screen.height) && (window.innerWidth == screen.width));
  29. }
  30.  
  31. const diep_keys = [ //document has to be focused to execute these, also C and E don't work right now
  32. "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",
  33. "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight", "Tab", "Enter", "NumpadEnter", "ShiftLeft", "ShiftRight", "Space", "Numpad0", "Numpad1", "Numpad2", "Numpad3", "Numpad4", "Numpad5", "Numpad6", "Numpad7", "Numpad8", "Numpad9",
  34. "Digit0", "Digit1", "Digit2", "Digit3", "Digit4", "Digit5", "Digit6", "Digit7", "Digit8", "Digit9", "F2", "End", "Home", "Semicolon", "Comma", "NumpadComma", "Period", "Backslash"
  35. ].reduce((n, e, c) => {
  36. n[e] = c + 1;
  37. return n;
  38. }, {});
  39.  
  40. let player = {
  41. connected: false,
  42. inGame: false,
  43. name: '',
  44. team: null,
  45. gamemode: null,
  46. ui_scale: 1,
  47. dpr: 1,
  48. base_value: 1,
  49. };
  50.  
  51. let inputs = {
  52. mouse: {
  53. real: {
  54. x: 0,
  55. y: 0,
  56. },
  57. game: {
  58. x: 0,
  59. y: 0,
  60. },
  61. force: {
  62. x: 0,
  63. y: 0,
  64. },
  65. isForced: false, //input mouse operations flag (overwrites your inputs to forced one's)
  66. isFrozen: false, //Mouse Freeze flag
  67. isShooting: false, //Anti Aim flag
  68. isPaused: false, //Anti Aim flag (different from isFrozen & isForced for better readability)
  69. original: {
  70. onTouchMove: null,
  71. onTouchStart: null,
  72. onTouchEnd: null,
  73. }
  74. },
  75. keys_pressed: [],
  76. };
  77.  
  78. function windowScaling() {
  79. const a = canvas.height / 1080;
  80. const b = canvas.width / 1920;
  81. return b < a ? a : b;
  82. }
  83.  
  84. //basic function to construct links
  85. function link(baseUrl, lobby, gamemode, team) {
  86. let str = "";
  87. str += baseUrl + "?s=" + lobby + "&g=" + gamemode + "&l=" + team;
  88. return str;
  89. }
  90.  
  91. function get_baseUrl() {
  92. return location.origin + location.pathname;
  93. }
  94.  
  95. function get_your_lobby() {
  96. return window.lobby_ip;
  97. }
  98.  
  99. function get_gamemode() {
  100. //return window.__common__.active_gamemode;
  101. return window.lobby_gamemode;
  102. }
  103.  
  104. function get_team() {
  105. return window.__common__.party_link;
  106. }
  107.  
  108. //all team links
  109. function get_links(gamemode, lobby, team = get_team()) {
  110. let baseUrl = get_baseUrl();
  111. let colors = ["🔵", "🔴", "🟣", "🟢", "👥❌"];
  112. let final_links = [];
  113. switch (gamemode) {
  114. case "4teams":
  115. for (let i = 0; i < 4; i++) {
  116. final_links.push([colors[i], link(baseUrl, lobby, gamemode, team.split("x")[0] + `x${i}`)]);
  117. }
  118. break
  119. case "teams":
  120. for (let i = 0; i < 2; i++) {
  121. final_links.push([colors[i], link(baseUrl, lobby, gamemode, team.split("x")[0] + `x${i}`)]);
  122. }
  123. break
  124. default:
  125. final_links.push([colors[colors.length - 1], link(baseUrl, lobby, gamemode, team)]);
  126. }
  127. return final_links;
  128. }
  129.  
  130. //dimensions
  131.  
  132. class dimensions_converter {
  133. constructor() {
  134. this.scalingFactor = null; //undetectable without bypass
  135. this.fieldFactor = null; //undetectable without bypass
  136. }
  137. canvas_2_window(a) {
  138. let b = a / (canvas.width / window.innerWidth);
  139. return b;
  140. }
  141.  
  142. window_2_canvas(a) {
  143. let b = a * (canvas.width / window.innerWidth);
  144. return b;
  145. }
  146.  
  147. windowScaling_2_window(a) {
  148. let b = (this.windowScaling_2_canvas(a)) / (canvas.width / window.innerWidth);
  149. return b;
  150. }
  151.  
  152. windowScaling_2_canvas(a) {
  153. let b = a * windowScaling();
  154. deep_debug('windowScaling_2_canvas called! a, b', a, b);
  155. return b;
  156. }
  157. /* DISABLED FOR NOW
  158. diepUnits_2_canvas(a) {
  159. let b = a / scalingFactor;
  160. return b;
  161. }
  162.  
  163. diepUnits_2_window(a) {
  164. let b = (this.diepUnits_2_canvas(a)) / (canvas.width / window.innerWidth);
  165. return b;
  166. }
  167.  
  168. window_2_diepUnits(a) {
  169. let b = (this.canvas_2_diepUnits(a)) * (canvas.width / window.innerWidth);
  170. return b;
  171. }
  172.  
  173. canvas_2_diepUnits(a) {
  174. let b = a * this.scalingFactor;
  175. return b;
  176. }
  177. */
  178.  
  179. window_2_windowScaling(a) {
  180. let b = (this.canvas_2_windowScaling(a)) * (canvas.width / window.innerWidth) * player.ui_scale;
  181. return b;
  182. }
  183.  
  184. canvas_2_windowScaling(a) {
  185. let b = a * windowScaling();
  186. return b;
  187. }
  188. /* DISABLED FOR NOW
  189. diepUnits_2_windowScaling(a) {
  190. let b = (this.diepUnits_2_canvas(a)) * this.fieldFactor;
  191. return b;
  192. }
  193.  
  194. windowScaling_2_diepUntis(a) {
  195. let b = (a / this.fieldFactor) * this.scalingFactor;
  196. return b;
  197. }
  198. */
  199. }
  200.  
  201. let dim_c = new dimensions_converter();
  202.  
  203. function i_e(type, key, ...args) {
  204. switch (type) {
  205. case "input":
  206. input[key](...args);
  207. break
  208. case "extern":
  209. extern[key](...args);
  210. break
  211. }
  212. }
  213.  
  214. function apply_force(x, y) {
  215. inputs.mouse.force = {
  216. x: x,
  217. y: y,
  218. }
  219. inputs.mouse.isForced = true;
  220. }
  221.  
  222. function disable_force() {
  223. inputs.mouse.isForced = false;
  224. }
  225.  
  226. const touchMethods = ['onTouchMove', 'onTouchStart', 'onTouchEnd'];
  227. let canvas = document.getElementById("canvas");
  228. let ctx = canvas.getContext('2d');
  229.  
  230. function define_onTouch() {
  231. touchMethods.forEach(function(method) {
  232. inputs.mouse.original[method] = input[method];
  233. deep_debug('defined input.', method);
  234. });
  235. }
  236.  
  237. function clear_onTouch() {
  238. touchMethods.forEach(function(method) {
  239. input[method] = () => {};
  240. });
  241. }
  242.  
  243. function redefine_onTouch() {
  244. touchMethods.forEach(function(method) {
  245. input[method] = inputs.mouse.original[method];
  246. });
  247. }
  248.  
  249. function start_input_proxies(_filter = false, _single = false, _method = null) {
  250. ((_filter || _single) && !_method) ? console.warn("missing _method at start_input_proxies"): null;
  251. let temp_methods = touchMethods;
  252. if (_filter) {
  253. temp_methods.filter((item) => item != _method);
  254. } else if (_single) {
  255. temp_methods = [_method];
  256. }
  257. temp_methods.forEach(function(method) {
  258. input[method] = new Proxy(input[method], {
  259. apply: function(definition, input_obj, args) {
  260. let x, y, type, new_args;
  261. if (inputs.mouse.isForced) {
  262. x = inputs.mouse.force.x;
  263. y = inputs.mouse.force.y;
  264. } else {
  265. x = args[1];
  266. y = args[2];
  267. }
  268. type = args[0];
  269. new_args = [type, dim_c.window_2_canvas(x / player.dpr), dim_c.window_2_canvas(y / player.dpr)];
  270. inputs.mouse.game = {
  271. x: new_args[1],
  272. y: new_args[2],
  273. }
  274. return Reflect.apply(definition, input_obj, new_args);
  275. }
  276. });
  277. });
  278. }
  279.  
  280. //create ingame Notifications
  281. function rgbToNumber(r, g, b) {
  282. return (r << 16) | (g << 8) | b;
  283. }
  284. const notification_rgbs = {
  285. require: [255, 165, 0], //orange
  286. warning: [255, 0, 0], //red
  287. normal: [0, 0, 128] //blue
  288. }
  289.  
  290. let notifications = [];
  291.  
  292. function new_notification(text, color, duration) {
  293. input.inGameNotification(text, rgbToNumber(...color), duration);
  294. }
  295.  
  296. function one_time_notification(text, color, duration){
  297. if(notifications.includes(text)){
  298. return;
  299. }
  300. if(player.inGame){
  301. new_notification(text, color, duration);
  302. notifications.push(text);
  303. }else{
  304. notifications = [];
  305. }
  306. }
  307.  
  308. //GUI
  309. function n2id(string) {
  310. return string.toLowerCase().replace(/ /g, "-");
  311. }
  312.  
  313. class El {
  314. constructor(
  315. name,
  316. type,
  317. el_color,
  318. width,
  319. height,
  320. opacity = "1",
  321. zindex = "100"
  322. ) {
  323. this.el = document.createElement(type);
  324. this.el.style.backgroundColor = el_color;
  325. this.el.style.width = width;
  326. this.el.style.height = height;
  327. this.el.style.opacity = opacity;
  328. this.el.style.zIndex = zindex;
  329. this.el.id = n2id(name);
  330. this.display = "block"; // store default display
  331. }
  332.  
  333. setBorder(type, width, color, radius = 0) {
  334. const borderStyle = `${width} solid ${color}`;
  335. switch (type) {
  336. case "normal":
  337. this.el.style.border = borderStyle;
  338. break;
  339. case "top":
  340. this.el.style.borderTop = borderStyle;
  341. break;
  342. case "left":
  343. this.el.style.borderLeft = borderStyle;
  344. break;
  345. case "right":
  346. this.el.style.borderRight = borderStyle;
  347. break;
  348. case "bottom":
  349. this.el.style.borderBottom = borderStyle;
  350. break;
  351. }
  352. this.el.style.borderRadius = radius;
  353. }
  354.  
  355. setPosition(
  356. position,
  357. display,
  358. top,
  359. left,
  360. flexDirection,
  361. justifyContent,
  362. translate
  363. ) {
  364. this.el.style.position = position;
  365. this.el.style.display = display;
  366. if (top) this.el.style.top = top;
  367. if (left) this.el.style.left = left;
  368. // Flex properties
  369. if (flexDirection) this.el.style.flexDirection = flexDirection;
  370. if (justifyContent) this.el.style.justifyContent = justifyContent;
  371. if (translate) this.el.style.transform = `translate(${translate})`;
  372. this.display = display;
  373. }
  374.  
  375. margin(top, left, right, bottom) {
  376. this.el.style.margin = `${top} ${right} ${bottom} ${left}`;
  377. }
  378.  
  379. setText(
  380. text,
  381. txtColor,
  382. font,
  383. weight,
  384. fontSize,
  385. stroke,
  386. alignContent,
  387. textAlign
  388. ) {
  389. this.el.innerHTML = text;
  390. this.el.style.color = txtColor;
  391. this.el.style.fontFamily = font;
  392. this.el.style.fontWeight = weight;
  393. this.el.style.fontSize = fontSize;
  394. this.el.style.textShadow = stroke;
  395. this.el.style.alignContent = alignContent;
  396. this.el.style.textAlign = textAlign;
  397. }
  398.  
  399. add(parent) {
  400. parent.appendChild(this.el);
  401. }
  402.  
  403. remove(parent) {
  404. parent.removeChild(this.el);
  405. }
  406.  
  407. toggle(showOrHide) {
  408. this.el.style.display = showOrHide === "hide" ? "none" : this.display;
  409. }
  410. }
  411.  
  412. let mainCont, header, subContGray, subContBlack, modCont, settCont;
  413.  
  414. class Setting {
  415. constructor(name, type, options) {
  416. this.name = name;
  417. this.options = options;
  418. this.elements = [];
  419. this.desc = new El(
  420. name + " Setting",
  421. "div",
  422. "transparent",
  423. "170px",
  424. "50px"
  425. );
  426. this.desc.setPosition("relative", "block");
  427. this.desc.setText(
  428. name,
  429. "white",
  430. "Calibri",
  431. "bold",
  432. "15px",
  433. "2px",
  434. "center",
  435. "center"
  436. );
  437. this.elements.push(this.desc.el);
  438.  
  439. switch (type) {
  440. case "title":
  441. this.desc.el.style.backgroundColor = "rgb(50, 50, 50)";
  442. this.desc.setText(
  443. name,
  444. "lightgray",
  445. "Calibri",
  446. "bold",
  447. "20px",
  448. "2px",
  449. "center",
  450. "center"
  451. );
  452. this.desc.setBorder("normal", "2px", "gray", "5px");
  453. break;
  454. case "select": {
  455. if (!this.options) return console.warn("Missing Options!");
  456. let index = 0;
  457. this.selected = options[index];
  458. //temp cont
  459. let temp_container = new El(
  460. name + " temp Container",
  461. "div",
  462. "transparent"
  463. );
  464. temp_container.el.style.display = "flex";
  465. temp_container.el.style.alignItems = "center";
  466. temp_container.el.style.justifyContent = "center";
  467. temp_container.el.style.gap = "10px";
  468.  
  469. //displ
  470. let displ = new El(
  471. name + " Setting Display",
  472. "div",
  473. "lightgray",
  474. "125px",
  475. "25px"
  476. );
  477. displ.setText(
  478. this.selected,
  479. "black",
  480. "Calibri",
  481. "bold",
  482. "15px",
  483. "2px",
  484. "center",
  485. "center"
  486. );
  487.  
  488. //left Arrow
  489. let l_arrow = new El(
  490. name + " left Arrow",
  491. "div",
  492. "transparent",
  493. "0px",
  494. "0px"
  495. );
  496. l_arrow.setBorder("bottom", "8px", "transparent");
  497. l_arrow.setBorder("left", "0px", "transparent");
  498. l_arrow.setBorder("right", "16px", "blue");
  499. l_arrow.setBorder("top", "8px", "transparent");
  500.  
  501. l_arrow.el.addEventListener("mouseover", () => {
  502. l_arrow.el.style.cursor = "pointer";
  503. l_arrow.setBorder("right", "16px", "darkblue");
  504. });
  505.  
  506. l_arrow.el.addEventListener("mouseout", () => {
  507. l_arrow.el.style.cursor = "normal";
  508. l_arrow.setBorder("right", "16px", "blue");
  509. });
  510.  
  511. l_arrow.el.addEventListener("mousedown", (e) => {
  512. if (e.button != 0) return;
  513. let limit = options.length - 1;
  514. if (index - 1 < 0) {
  515. index = limit;
  516. } else {
  517. index--;
  518. }
  519. this.selected = options[index];
  520. displ.el.innerHTML = this.selected;
  521. });
  522.  
  523. //right Arrow
  524. let r_arrow = new El(
  525. name + " right Arrow",
  526. "div",
  527. "transparent",
  528. "0px",
  529. "0px"
  530. );
  531. r_arrow.setBorder("bottom", "8px", "transparent");
  532. r_arrow.setBorder("left", "16px", "blue");
  533. r_arrow.setBorder("right", "0px", "transparent");
  534. r_arrow.setBorder("top", "8px", "transparent");
  535.  
  536. r_arrow.el.addEventListener("mouseover", () => {
  537. r_arrow.el.style.cursor = "pointer";
  538. r_arrow.setBorder("left", "16px", "darkblue");
  539. });
  540.  
  541. r_arrow.el.addEventListener("mouseout", () => {
  542. r_arrow.el.style.cursor = "normal";
  543. r_arrow.setBorder("left", "16px", "blue");
  544. });
  545.  
  546. r_arrow.el.addEventListener("mousedown", (e) => {
  547. if (e.button != 0) return;
  548. let limit = options.length - 1;
  549. if (index + 1 > limit) {
  550. index = 0;
  551. } else {
  552. index++;
  553. }
  554. this.selected = options[index];
  555. displ.el.innerHTML = this.selected;
  556. });
  557.  
  558. //connect together
  559. temp_container.el.appendChild(l_arrow.el);
  560. temp_container.el.appendChild(displ.el);
  561. temp_container.el.appendChild(r_arrow.el);
  562.  
  563. //remember them
  564. this.elements.push(temp_container.el);
  565. break;
  566. }
  567. case "toggle": {
  568. this.active = false;
  569. this.desc.el.style.display = "flex";
  570. this.desc.el.style.alignItems = "center";
  571. this.desc.el.style.justifyContent = "space-between";
  572. let empty_checkbox = new El(
  573. this.name + " Setting checkbox",
  574. "div",
  575. "lightgray",
  576. "20px",
  577. "20px"
  578. );
  579. empty_checkbox.setBorder("normal", "2px", "gray", "4px");
  580. //event listeners
  581. empty_checkbox.el.addEventListener("mousedown", (e) => {
  582. if (e.button != 0) return;
  583. this.active = !this.active;
  584. if (this.active) {
  585. empty_checkbox.el.innerHTML = "✔";
  586. empty_checkbox.el.style.backgroundColor = "green";
  587. empty_checkbox.setBorder("normal", "2px", "lime", "4px");
  588. } else {
  589. empty_checkbox.el.innerHTML = "";
  590. empty_checkbox.el.style.backgroundColor = "lightgray";
  591. empty_checkbox.setBorder("normal", "2px", "gray", "4px");
  592. }
  593. });
  594. empty_checkbox.el.addEventListener("mouseover", () => {
  595. empty_checkbox.el.style.backgroundColor = this.active
  596. ? "darkgreen"
  597. : "darkgray";
  598. empty_checkbox.el.style.cursor = "pointer";
  599. });
  600. empty_checkbox.el.addEventListener("mouseout", () => {
  601. empty_checkbox.el.style.backgroundColor = this.active
  602. ? "green"
  603. : "lightgray";
  604. });
  605. this.desc.el.appendChild(empty_checkbox.el);
  606. break;
  607. }
  608. }
  609. }
  610. load() {
  611. this.elements.forEach((element) => settCont.el.appendChild(element));
  612. }
  613.  
  614. unload() {
  615. this.elements.forEach((element) => {
  616. if (settCont.el.contains(element)) {
  617. settCont.el.removeChild(element);
  618. }
  619. });
  620. }
  621. }
  622.  
  623. class Module {
  624. constructor(name, type, settings, callback) {
  625. this.name = name;
  626. this.type = type;
  627. this.callbackFunc = callback;
  628. this.settings = settings;
  629. this.title = new El(name, "div", "transparent", "100%", "50px");
  630. this.title.setPosition("relative", "block");
  631. this.title.setText(
  632. name,
  633. "white",
  634. "Calibri",
  635. "bold",
  636. "15px",
  637. "2px",
  638. "center",
  639. "center"
  640. );
  641. this.elements = [];
  642. this.elements.push(this.title.el);
  643. switch (type) {
  644. case "toggle": {
  645. this.active = false;
  646. this.title.el.style.display = "flex";
  647. this.title.el.style.alignItems = "center";
  648. this.title.el.style.justifyContent = "space-between";
  649. let empty_checkbox = new El(
  650. this.name + " checkbox",
  651. "div",
  652. "lightgray",
  653. "20px",
  654. "20px"
  655. );
  656. empty_checkbox.setBorder("normal", "2px", "gray", "4px");
  657. //event listeners
  658. empty_checkbox.el.addEventListener("mousedown", (e) => {
  659. if (e.button != 0) return;
  660. this.active = !this.active;
  661. if (this.active) {
  662. empty_checkbox.el.innerHTML = "✔";
  663. empty_checkbox.el.style.backgroundColor = "green";
  664. empty_checkbox.setBorder("normal", "2px", "lime", "4px");
  665. } else {
  666. empty_checkbox.el.innerHTML = "";
  667. empty_checkbox.el.style.backgroundColor = "lightgray";
  668. empty_checkbox.setBorder("normal", "2px", "gray", "4px");
  669. }
  670. });
  671. empty_checkbox.el.addEventListener("mouseover", () => {
  672. empty_checkbox.el.style.backgroundColor = this.active
  673. ? "darkgreen"
  674. : "darkgray";
  675. empty_checkbox.el.style.cursor = "pointer";
  676. });
  677. empty_checkbox.el.addEventListener("mouseout", () => {
  678. empty_checkbox.el.style.backgroundColor = this.active
  679. ? "green"
  680. : "lightgray";
  681. });
  682. this.title.el.appendChild(empty_checkbox.el);
  683. break;
  684. }
  685. case "slider": {
  686. this.value = 100;
  687. this.title.el.innerHTML = `${this.name}: ${this.value} %`;
  688. const slider = document.createElement("input");
  689. slider.type = "range";
  690. slider.value = this.value;
  691. slider.min = 0;
  692. slider.max = 100;
  693.  
  694. slider.addEventListener("input", () => {
  695. this.value = slider.value;
  696. this.title.el.innerHTML = `${this.name}: ${this.value} %`;
  697. });
  698.  
  699. this.elements.push(slider);
  700. break;
  701. }
  702. case "button":
  703. this.title.el.style.width = "100%";
  704. this.title.el.style.boxSizing = "border-box";
  705. this.title.el.style.whiteSpace = "normal"; // Allows text wrapping
  706. this.title.setBorder("normal", "2px", "white", "10px");
  707. this.title.el.style.cursor = "pointer";
  708. this.title.el.addEventListener("mousedown", () => {
  709. if (this.callbackFunc) {
  710. this.callbackFunc();
  711. }
  712. });
  713. break;
  714. case "open": {
  715. this.active = false;
  716. this.title.el.style.display = "flex";
  717. this.title.el.style.alignItems = "center";
  718. this.title.el.style.justifyContent = "space-between";
  719. let opener_box = new El(
  720. this.name + " opener box",
  721. "div",
  722. "rgb(75, 75, 75)",
  723. "20px",
  724. "20px"
  725. );
  726. opener_box.setBorder("normal", "2px", "gray", "4px");
  727. opener_box.el.style.display = "flex";
  728. opener_box.el.style.alignItems = "center";
  729. opener_box.el.style.justifyContent = "center";
  730. //
  731. let triangle = new El(
  732. name + " triangle",
  733. "div",
  734. "transparent",
  735. "0px",
  736. "0px"
  737. );
  738. triangle.setBorder("bottom", "16px", "lime");
  739. triangle.setBorder("left", "8px", "transparent");
  740. triangle.setBorder("right", "8px", "transparent");
  741. triangle.setBorder("top", "0px", "transparent");
  742. //
  743. //event listeners
  744. opener_box.el.addEventListener("mousedown", (e) => {
  745. if (e.button != 0) return;
  746. this.active = !this.active;
  747. if (this.active) {
  748. triangle.setBorder("bottom", "0px", "transparent");
  749. triangle.setBorder("left", "8px", "transparent");
  750. triangle.setBorder("right", "8px", "transparent");
  751. triangle.setBorder("top", "16px", "red");
  752. this.loadSettings();
  753. } else {
  754. triangle.setBorder("bottom", "16px", "lime");
  755. triangle.setBorder("left", "8px", "transparent");
  756. triangle.setBorder("right", "8px", "transparent");
  757. triangle.setBorder("top", "0px", "transparent");
  758. this.unloadSettings();
  759. }
  760. });
  761. opener_box.el.addEventListener("mouseover", () => {
  762. opener_box.el.style.backgroundColor = "rgb(50, 50, 50)";
  763. opener_box.el.style.cursor = "pointer";
  764. });
  765. opener_box.el.addEventListener("mouseout", () => {
  766. opener_box.el.style.backgroundColor = "rgb(75, 75, 75)";
  767. });
  768. opener_box.el.appendChild(triangle.el);
  769. this.title.el.appendChild(opener_box.el);
  770. break;
  771. }
  772. }
  773. }
  774. load() {
  775. this.elements.forEach((element) => modCont.el.appendChild(element));
  776. }
  777.  
  778. unload() {
  779. this.elements.forEach((element) => {
  780. if (modCont.el.contains(element)) {
  781. modCont.el.removeChild(element);
  782. }
  783. });
  784. }
  785.  
  786. loadSettings() {
  787. if (!this.settings) return;
  788. for (let _sett in this.settings) {
  789. this.settings[_sett].load();
  790. }
  791. }
  792.  
  793. unloadSettings() {
  794. if (!this.settings) return;
  795. for (let _sett in this.settings) {
  796. this.settings[_sett].unload();
  797. }
  798. }
  799. }
  800.  
  801. class Category {
  802. constructor(name, modules) {
  803. this.name = name;
  804. this.element = new El(name, "div", "rgb(38, 38, 38)", "90px", "50px");
  805. this.element.setPosition("relative", "block");
  806. this.element.setText(
  807. name,
  808. "white",
  809. "Calibri",
  810. "bold",
  811. "20px",
  812. "2px",
  813. "center",
  814. "center"
  815. );
  816. this.element.setBorder("normal", "2px", "transparent", "10px");
  817. this.selected = false;
  818. this.modules = modules;
  819.  
  820. this.element.el.addEventListener("mousedown", (e) => {
  821. if (e.button !== 0) return;
  822. this.selected = !this.selected;
  823. this.element.el.style.backgroundColor = this.selected
  824. ? "lightgray"
  825. : "rgb(38, 38, 38)";
  826. handle_categories_selection(this.name);
  827. if (!this.selected) unload_modules(this.name);
  828. });
  829.  
  830. this.element.el.addEventListener("mouseover", () => {
  831. if (!this.selected) {
  832. this.element.el.style.backgroundColor = "rgb(58, 58, 58)";
  833. this.element.el.style.cursor = "pointer";
  834. }
  835. });
  836.  
  837. this.element.el.addEventListener("mouseout", () => {
  838. if (!this.selected)
  839. this.element.el.style.backgroundColor = "rgb(38, 38, 38)";
  840. });
  841. }
  842. unselect() {
  843. this.selected = false;
  844. this.element.el.style.backgroundColor = "rgb(38, 38, 38)";
  845. }
  846. }
  847.  
  848. //1travel
  849. let modules = {
  850. Info: {
  851. hall_of_Fame: new Module("Hall of Fame", "open", {
  852. darkdealer_00249: new Setting("darkdealer_00249", "title"),
  853. }),
  854. q_a1: new Module(
  855. "Where are the old scripts from diep.io+?",
  856. "button",
  857. null,
  858. () => {
  859. alert(
  860. "They're either patched, or not fully integrated yet."
  861. );
  862. }
  863. ),
  864. q_a2: new Module(
  865. "Can you make me a script?",
  866. "button",
  867. null,
  868. () => {
  869. alert(
  870. "If it's simple - yes, if not give me a donation or a private script and I will do it for you, unless I don't know how to implement it."
  871. );
  872. }
  873. ),
  874. q_a3: new Module(
  875. "This script is so confusing!",
  876. "button",
  877. null,
  878. () => {
  879. alert(
  880. "Maybe I will make full tutorial, but for now ask me anything about it. Discord: h3llside"
  881. );
  882. }
  883. ),
  884. q_a4: new Module(
  885. "How can I join your discord server?",
  886. "button",
  887. null,
  888. () => {
  889. alert(
  890. "Join and follow instructions: https://discord.gg/S3ZzgDNAuG please dm me if the link doesn't work, discord: h3llside"
  891. );
  892. }
  893. ),
  894. q_a5: new Module(
  895. "Why do you update it so often?",
  896. "button",
  897. null,
  898. () => {
  899. alert(
  900. "I get it, it can be annoying to constantly update the script, but sometimes new ideas come, sometimes game updates and breaks this script so I have no choice but to update frequently"
  901. );
  902. }
  903. ),
  904. q_a6: new Module(
  905. "What is the import, export for?",
  906. "button",
  907. null,
  908. () => {
  909. alert(
  910. "it's for auto respawn+, mainly spawn type: Random Killer. It basically chooses random saved name and you can share those saved names with each other :)"
  911. );
  912. }
  913. ),
  914. },
  915.  
  916. Visual: {
  917. Key_inputs_visualiser: new Module("Key Inputs Visualiser", "toggle"),
  918. destroyer_cooldown: new Module("Destroyer Cooldown", "open", {
  919. Title: new Setting("Destroyer Cooldown", "title"),
  920. reload: new Setting("Reload?", "select", [0, 1, 2, 3, 4, 5, 6, 7]),
  921. destroyer_cooldown: new Setting("enable Destroyer Cooldown", "toggle"),
  922. }),
  923. },
  924.  
  925. Functional: {
  926. CopyLink: new Module("Copy Party Link", "button", null, () => {
  927. document.getElementById("copy-party-link").click();
  928. }),
  929. Predator_stack: new Module("Predator Stack", "button", null, () => {
  930. predator_stack(get_reload());
  931. }),
  932. Sandbox_lvl_up: new Module("Sandbox Auto Level Up", "toggle"),
  933. Auto_respawn: new Module("Auto Respawn", "open", {
  934. Title: new Setting("Auto Respawn", "title"),
  935. Remember: new Setting("Remember and store Killer Names", "toggle"),
  936. Prevent: new Setting("Prevent respawning after 300k score", "toggle"),
  937. Name: new Setting("Spawn Name Type: ", "select", [
  938. "Normal",
  939. "Glitched",
  940. "N A M E",
  941. "Random Killer",
  942. "Random Symbols",
  943. "Random Numbers",
  944. "Random Letters",
  945. ]),
  946. Auto_respawn: new Setting("Auto Respawn", "toggle"),
  947. }),
  948. Import_names: new Module("Import Killer Names", "button", null, import_killer_names),
  949. Export_names: new Module("Export Killer Names", "button", null, () => {
  950. let exported_string = localStorage.getItem("[Diep.io+] saved names") ? localStorage.getItem("[Diep.io+] saved names") : -1;
  951. if(exported_string < 0) return alert('not copied, because 0 saved names');
  952. navigator.clipboard.writeText("'" + exported_string + "'");
  953. alert(`copied ${JSON.parse(exported_string).length} saved names`);
  954. }),
  955. Bot_tab: new Module("Sandbox Arena size increase", "toggle"),
  956. Tank_upgrades: new Module("Tank Upgrades Keybinds", "open", {
  957. Title: new Setting("Tank Upgrades Keybinds", "title"),
  958. visualise: new Setting("Show positions and keys", "toggle"),
  959. Tank_upgrades: new Setting("enable Tank Upgrades Keybinds", "toggle"),
  960. }),
  961. Zoom: new Module("Zoom Out", "slider"),
  962. },
  963.  
  964. Mouse: {
  965. Anti_aim: new Module("Anti Aim", "open", {
  966. Title: new Setting("Anti Aim", "title"),
  967. Timing: new Setting(
  968. "Follow mouse on click, how long?",
  969. "select",
  970. [50, 100, 150, 200, 250, 300]
  971. ),
  972. Anti_aim: new Setting("enable Anti Aim", "toggle"),
  973. }),
  974. Freeze_mouse: new Module("Freeze Mouse", "toggle"),
  975. Anti_timeout: new Module("Anti AFK Timeout", "toggle"),
  976. Move_2_mouse: new Module("Move to mouse", "open", {
  977. Title: new Setting("Move to mouse", "title"),
  978. Approximation: new Setting(
  979. "Approximation Factor (lower = smoother)",
  980. "select",
  981. [10, 25, 40, 65, 80, 100]
  982. ),
  983. Time_factor: new Setting(
  984. "Time Factor (higher = longer)",
  985. "select",
  986. [10, 20, 30, 40, 50]
  987. ),
  988. Move_2_mouse: new Setting("enable Move to Mouse", "toggle"),
  989. }),
  990. Custom_auto_spin: new Module("Custom Auto Spin", "open", {
  991. Title: new Setting("Custom Auto Spin", "title"),
  992. Interval: new Setting("Movement Interval", "select", [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2500, 3000, 3500, 4000, 5000]),
  993. Smoothness: new Setting("Smoothness", "select", [3, 4, 5, 6, 7, 8]),
  994. Replace_auto_spin: new Setting("replace Auto Spin", "toggle"),
  995. Custom_auto_spin: new Setting("enable Custom Auto Spin", "toggle"),
  996. }),
  997. },
  998.  
  999. DiepConsole: {
  1000. con_toggle: new Module("Show/hide Diep Console", "toggle"),
  1001. net_predict_movement: new Module("predict movement", "toggle"),
  1002. Render: new Module("Render things", "open", {
  1003. Title: new Setting("Rendering", "title"),
  1004. ren_scoreboard: new Setting("Leaderboard", "toggle"),
  1005. ren_scoreboard_names: new Setting("Scoreboard Names", "toggle"),
  1006. ren_fps: new Setting("FPS", "toggle"),
  1007. ren_upgrades: new Setting("Tank Upgrades", "toggle"),
  1008. ren_stats: new Setting("Stat Upgrades", "toggle"),
  1009. ren_names: new Setting("Names", "toggle"),
  1010. }),
  1011. //game builds
  1012. },
  1013.  
  1014. Addons: {
  1015. aim_lines: new Module("Tank Aim lines", "open", {
  1016. Title: new Setting("Tank Aim lines", "title"),
  1017. adjust_length: new Setting("Adjust aim line length", "select", [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 5, 7.5, 10]),
  1018. toggle_aim_lines: new Setting("Toggle Aim Lines", "toggle"),
  1019. }),
  1020. farm_bot: new Module("Farm Bot", "open", {
  1021. Title: new Setting("Farm Bot", "title"),
  1022. ignore_shapes: new Setting("Shapes you want to ignore:"),
  1023. toggle_squares: new Setting("Squares", "toggle"),
  1024. toggle_crashers: new Setting("Crashers", "toggle"),
  1025. toggle_pentagons: new Setting("Pentagons", "toggle"),
  1026. toggle_triangles: new Setting("Triangles", "toggle"),
  1027. other_setts: new Setting("other Settings:"),
  1028. toggle_lines: new Setting("Toggle Line to Shape", "toggle"),
  1029. toggle_farm_bot: new Setting("Toggle Farm Bot", "toggle"),
  1030. }),
  1031. },
  1032. };
  1033.  
  1034. console.log(modules);
  1035.  
  1036. let categories = [];
  1037.  
  1038. function create_categories() {
  1039. for (let key in modules) {
  1040. categories.push(new Category(key, modules[key]));
  1041. }
  1042. }
  1043. create_categories();
  1044.  
  1045. //loading / unloading modules
  1046. function load_modules(category_name) {
  1047. const current_category = categories.find(
  1048. (category) => category.name === category_name
  1049. );
  1050. for (let moduleName in current_category.modules) {
  1051. let module = current_category.modules[moduleName];
  1052. module.load();
  1053. if (module.type === "open" && module.active) module.loadSettings();
  1054. }
  1055. }
  1056.  
  1057. function unload_modules(category_name) {
  1058. const current_category = categories.find(
  1059. (category) => category.name === category_name
  1060. );
  1061. for (let moduleName in current_category.modules) {
  1062. let module = current_category.modules[moduleName];
  1063. module.unload();
  1064. module.unloadSettings();
  1065. }
  1066. }
  1067.  
  1068. function find_module_path(_name) {
  1069. for (let category in modules) {
  1070. for (let module in modules[category]) {
  1071. // Iterate over actual modules
  1072. if (modules[category][module].name === _name) {
  1073. return [category, module]; // Return actual category and module
  1074. }
  1075. }
  1076. }
  1077. return -1; // Return -1 if not found
  1078. }
  1079.  
  1080. function handle_categories_selection(current_name) {
  1081. categories.forEach((category) => {
  1082. if (category.name !== current_name && category.selected) {
  1083. category.unselect();
  1084. unload_modules(category.name);
  1085. }
  1086. });
  1087.  
  1088. load_modules(current_name);
  1089. }
  1090.  
  1091. function loadCategories() {
  1092. const categoryCont = document.querySelector("#sub-container-gray");
  1093. categories.forEach((category) =>
  1094. categoryCont.appendChild(category.element.el)
  1095. );
  1096. }
  1097.  
  1098. function load_selected() {
  1099. categories.forEach((category) => {
  1100. if (category.selected) {
  1101. load_modules(category.name);
  1102. }
  1103. });
  1104. }
  1105.  
  1106. function loadGUI() {
  1107. document.body.style.margin = "0";
  1108. document.body.style.display = "flex";
  1109. document.body.style.justifyContent = "left";
  1110.  
  1111. mainCont = new El("Main Cont", "div", "rgb(38, 38, 38)", "500px", "400px");
  1112. mainCont.setBorder("normal", "2px", "lime", "10px");
  1113. mainCont.el.style.display = "flex";
  1114. mainCont.el.style.minHeight = "min-content";
  1115. mainCont.el.style.flexDirection = "column";
  1116. mainCont.add(document.body);
  1117.  
  1118. header = new El("Headline Dp", "div", "transparent", "100%", "40px");
  1119. header.setBorder("bottom", "2px", "rgb(106, 173, 84)");
  1120. header.setText(
  1121. "Diep.io+ by r!PsAw (Hide GUI with J)",
  1122. "white",
  1123. "Calibri",
  1124. "bold",
  1125. "20px",
  1126. "2px",
  1127. "center",
  1128. "center"
  1129. );
  1130. header.add(mainCont.el);
  1131.  
  1132. const contentWrapper = document.createElement("div");
  1133. contentWrapper.style.display = "flex";
  1134. contentWrapper.style.gap = "10px";
  1135. contentWrapper.style.padding = "10px";
  1136. contentWrapper.style.flex = "1";
  1137. mainCont.el.appendChild(contentWrapper);
  1138.  
  1139. subContGray = new El(
  1140. "Sub Container Gray",
  1141. "div",
  1142. "transparent",
  1143. "100px",
  1144. "100%"
  1145. );
  1146. subContGray.el.style.display = "flex";
  1147. subContGray.el.style.flexDirection = "column";
  1148. subContGray.el.style.overflowY = "auto";
  1149. subContGray.add(contentWrapper);
  1150.  
  1151. subContBlack = new El("Sub Container Black", "div", "black", "360px", "100%");
  1152. subContBlack.el.style.display = "flex";
  1153. subContBlack.el.style.gap = "10px";
  1154. subContBlack.add(contentWrapper);
  1155.  
  1156. modCont = new El("Module Container", "div", "transparent", "50%", "100%");
  1157. modCont.el.style.display = "flex";
  1158. modCont.el.style.flexDirection = "column";
  1159. modCont.el.style.overflowY = "auto";
  1160. modCont.setBorder("right", "2px", "white");
  1161. modCont.add(subContBlack.el);
  1162.  
  1163. settCont = new El("Settings Container", "div", "transparent", "50%", "100%");
  1164. settCont.el.style.display = "flex";
  1165. settCont.el.style.flexDirection = "column";
  1166. settCont.el.style.overflowY = "auto";
  1167. settCont.add(subContBlack.el);
  1168.  
  1169. loadCategories();
  1170. load_selected();
  1171. }
  1172.  
  1173. loadGUI();
  1174. document.addEventListener("keydown", toggleGUI);
  1175.  
  1176. function toggleGUI(e) {
  1177. if (e.key === "j" || e.key === "J") {
  1178. if (mainCont.el) {
  1179. mainCont.remove(document.body);
  1180. mainCont.el = null;
  1181. } else {
  1182. loadGUI();
  1183. }
  1184. }
  1185. }
  1186.  
  1187.  
  1188. //actual logic
  1189.  
  1190. //allow user to interact with the gui while in game
  1191. Event.prototype.preventDefault = new Proxy(Event.prototype.preventDefault, {
  1192. apply: function(target, thisArgs, args){
  1193. //console.log(thisArgs.type);
  1194. if(thisArgs.type === "mousedown" || thisArgs.type === "mouseup") return; //console.log('successfully canceled');
  1195. return Reflect.apply(target, thisArgs, args);
  1196. }
  1197. });
  1198.  
  1199. //Move to Mouse
  1200. let approximation_factor = modules.Mouse.Move_2_mouse.settings.Approximation.selected; // Higher = faster movement, but less smooth Lower = slower movement, but more smooth
  1201. let distance_time_factor = modules.Mouse.Move_2_mouse.settings.Time_factor.selected; // transform the distance into Time
  1202. let moving_active = false;
  1203. let current_direction = 'none';
  1204.  
  1205. function calculate_distance(x1, y1, x2, y2) {
  1206. return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
  1207. }
  1208.  
  1209. function get_mouse_move_steps() {
  1210. let center = { x: canvas.width / 2, y: canvas.height / 2 };
  1211. let target = { x: inputs.mouse.real.x, y: inputs.mouse.real.y };
  1212. let full_distance = calculate_distance(center.x, center.y, target.x, target.y);
  1213. let partial_distance = full_distance / approximation_factor;
  1214. let step = { x: (target.x - center.x) / partial_distance, y: (target.y - center.y) / partial_distance };
  1215. return step;
  1216. }
  1217.  
  1218. function move_in_direction(direction, time) {
  1219. moving_active = true;
  1220. current_direction = direction;
  1221. let directions = {
  1222. 'Up': 'KeyW',
  1223. 'Left': 'KeyA',
  1224. 'Down': 'KeyS',
  1225. 'Right': 'KeyD',
  1226. }
  1227. for (let _dir in directions) {
  1228. if (directions[_dir] === undefined) return console.warn("Invalid direction");
  1229. if (_dir === direction) {
  1230. extern.onKeyDown(diep_keys[directions[_dir]]);
  1231. } else {
  1232. extern.onKeyUp(diep_keys[directions[_dir]]);
  1233. }
  1234. }
  1235. setTimeout(() => {
  1236. moving_active = false;
  1237. }, time);
  1238. }
  1239.  
  1240. function move_to_mouse() {
  1241. window.requestAnimationFrame(move_to_mouse);
  1242. if (!modules.Mouse.Move_2_mouse.settings.Move_2_mouse.active || moving_active || !player.inGame || !document.hasFocus()) return;
  1243. //update factors
  1244. approximation_factor = modules.Mouse.Move_2_mouse.settings.Approximation.selected;
  1245. distance_time_factor = modules.Mouse.Move_2_mouse.settings.Time_factor.selected;
  1246. //logic
  1247. let step = get_mouse_move_steps();
  1248. let horizontal = step.x > 0 ? 'Right' : 'Left';
  1249. let vertical = step.y > 0 ? 'Down' : 'Up';
  1250.  
  1251. switch (current_direction) {
  1252. case "none":
  1253. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1254. break;
  1255. case 'Right':
  1256. move_in_direction(vertical, Math.abs(step.y) * distance_time_factor);
  1257. break;
  1258. case 'Left':
  1259. move_in_direction(vertical, Math.abs(step.y) * distance_time_factor);
  1260. break;
  1261. case 'Up':
  1262. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1263. break
  1264. case 'Down':
  1265. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1266. break
  1267. }
  1268. }
  1269. window.requestAnimationFrame(move_to_mouse);
  1270.  
  1271.  
  1272. // ]-[ HTML RELATED STUFF
  1273. let homescreen = document.getElementById("home-screen");
  1274. let ingamescreen = document.getElementById("in-game-screen");
  1275. let gameOverScreen = document.getElementById('game-over-screen');
  1276. let gameOverScreenContainer = document.querySelector("#game-over-screen > div > div.game-details > div:nth-child(1)");
  1277. function update_scale_option(selector, label, min, max) {
  1278. let element = document.querySelector(selector);
  1279. let label_element = element.closest("div").querySelector("span");
  1280. label_element.innerHTML = `[DIEP.IO+] ${label}`;
  1281. label_element.style.background = "black";
  1282. label_element.style.color = "purple";
  1283. element.min = min;
  1284. element.max = max;
  1285. }
  1286.  
  1287. function new_ranges_for_scales() {
  1288. update_scale_option("#subsetting-option-ui_scale", "UI Scale", '0.01', '1000');
  1289. update_scale_option("#subsetting-option-border_radius", "UI Border Radius", '0.01', '1000');
  1290. update_scale_option("#subsetting-option-border_intensity", "UI Border Intensity", '0.01', '1000');
  1291. }
  1292.  
  1293. new_ranges_for_scales();
  1294.  
  1295. //VISUAL TEAM SWITCH
  1296. //create container
  1297. let team_select_container = document.createElement("div");
  1298. team_select_container.classList.add("labelled");
  1299. team_select_container.id = "team-selector";
  1300. document.querySelector("#server-selector").appendChild(team_select_container);
  1301.  
  1302. //create Text "Team"
  1303. let team_select_label = document.createElement("label");
  1304. team_select_label.innerText = "[Diep.io+] Team Selector";
  1305. team_select_label.style.color = "purple";
  1306. team_select_label.style.backgroundColor = "black";
  1307. team_select_container.appendChild(team_select_label);
  1308.  
  1309. //create Selector
  1310. let team_select_selector = document.createElement("div");
  1311. team_select_selector.classList.add("selector");
  1312. team_select_container.appendChild(team_select_selector);
  1313.  
  1314. //create placeholder "Choose Team"
  1315. let teams_visibility = true;
  1316. let ph_div = document.createElement("div");
  1317. let ph_text_div = document.createElement("div");
  1318. let sel_state;
  1319. ph_text_div.classList.add("dropdown-label");
  1320. ph_text_div.innerHTML = "Choose Team";
  1321. ph_div.style.backgroundColor = "gray";
  1322. ph_div.classList.add("selected");
  1323. ph_div.addEventListener("click", () => {
  1324. //toggle Team List
  1325. toggle_team_list(teams_visibility);
  1326. teams_visibility = !teams_visibility;
  1327. });
  1328.  
  1329. team_select_selector.appendChild(ph_div);
  1330. ph_div.appendChild(document.createElement("div"));
  1331. ph_div.appendChild(ph_text_div);
  1332.  
  1333. // Create refresh button
  1334. /*
  1335. let refresh_btn = document.createElement("button");
  1336. refresh_btn.style.width = "30%";
  1337. refresh_btn.style.height = "10%";
  1338. refresh_btn.style.backgroundColor = "black";
  1339. refresh_btn.textContent = "Refresh";
  1340.  
  1341. refresh_btn.onclick = () => {
  1342. remove_previous_teams();
  1343. links_to_teams_GUI_convert();
  1344. };
  1345.  
  1346. team_select_container.appendChild(refresh_btn);
  1347. */
  1348.  
  1349. //create actual teams
  1350. let team_values = [];
  1351.  
  1352. function create_team_div(text, color, link) {
  1353. team_values.push(text);
  1354. let team_div = document.createElement("div");
  1355. let text_div = document.createElement("div");
  1356. let sel_state;
  1357. text_div.classList.add("dropdown-label");
  1358. text_div.innerHTML = text;
  1359. team_div.style.backgroundColor = color;
  1360. team_div.classList.add("unselected");
  1361. team_div.value = text;
  1362. team_div.addEventListener("click", () => {
  1363. const answer = confirm("You're about to open the link in a new tab, do you want to continue?");
  1364. if (answer) {
  1365. window.open(link, "_blank");
  1366. }
  1367. });
  1368.  
  1369. team_select_selector.appendChild(team_div);
  1370. team_div.appendChild(document.createElement("div"));
  1371. team_div.appendChild(text_div);
  1372. }
  1373.  
  1374. function toggle_team_list(boolean) {
  1375. if (boolean) {
  1376. //true
  1377. team_select_selector.classList.remove("selector");
  1378. team_select_selector.classList.add("selector-active");
  1379. } else {
  1380. //false
  1381. team_select_selector.classList.remove("selector-active");
  1382. team_select_selector.classList.add("selector");
  1383. }
  1384. }
  1385.  
  1386. //example
  1387. //create_team_div("RedTeam", "Red", "https://diep.io/");
  1388. //create_team_div("OrangeTeam", "Orange", "https://diep.io/");
  1389. //create_team_div("YellowTeam", "Yellow", "https://diep.io/");
  1390. function links_to_teams_GUI_convert() {
  1391. let gamemode = get_gamemode();
  1392. let lobby = get_your_lobby();
  1393. let links = get_links(gamemode, lobby);
  1394. let team_names = ["Team-Blue", "Team-Red", "Team-Purple", "Team-Green", "Teamless-Gamemode"];
  1395. let team_colors = ["blue", "red", "purple", "green", "orange"];
  1396. for (let i = 0; i < links.length; i++) {
  1397. !gamemode.includes("teams") ? create_team_div(team_names[team_names.length - 1], team_colors[team_colors.length - 1], links[0][1]) : create_team_div(team_names[i], team_colors[i], links[i][1]);
  1398. }
  1399. }
  1400.  
  1401. function remove_previous_teams() {
  1402. for (let i = team_select_selector.childNodes.length - 1; i >= 0; i--) {
  1403. console.log(team_select_selector);
  1404. let child = team_select_selector.childNodes[i];
  1405. if (child.nodeType === Node.ELEMENT_NODE && child.innerText !== "Choose Team") {
  1406. child.remove();
  1407. }
  1408. }
  1409. }
  1410.  
  1411. let party_link_info = {
  1412. old_link: null,
  1413. current_link: null
  1414. }
  1415. function detect_refresh(){
  1416. if(!party_link_info.old_link || !party_link_info.current_link) return;
  1417. party_link_info.current_link = window.lobby_ip + _c.party_link;
  1418. if(party_link_info.current_link != party_link_info.old_link){
  1419. console.log('Link change detected!');
  1420. remove_previous_teams();
  1421. links_to_teams_GUI_convert();
  1422. party_link_info.old_link = party_link_info.current_link;
  1423. }
  1424. }
  1425. setInterval(detect_refresh, 100);
  1426.  
  1427. function wait_For_Link() {
  1428. if (_c.party_link === '') {
  1429. setTimeout(() => {
  1430. console.log("[Diep.io+] LOADING...");
  1431. wait_For_Link();
  1432. }, 100);
  1433. } else {
  1434. console.log("[Diep.io+] link loaded!");
  1435. remove_previous_teams();
  1436. links_to_teams_GUI_convert();
  1437. party_link_info.current_link = window.lobby_ip + _c.party_link;
  1438. party_link_info.old_link = party_link_info.current_link;
  1439. }
  1440. }
  1441.  
  1442. wait_For_Link();
  1443.  
  1444. //detect gamemode
  1445. let gamemode = document.querySelector("#gamemode-selector > div > div.selected > div.dropdown-label").innerHTML;
  1446. let last_gamemode = localStorage.getItem(`[Diep.io+] last_gm`);
  1447. localStorage.setItem(`[Diep.io+] last_gm`, gamemode);
  1448.  
  1449. function check_gamemode() {
  1450. gamemode = document.querySelector("#gamemode-selector > div > div.selected > div.dropdown-label").innerHTML;
  1451. save_gm();
  1452. }
  1453.  
  1454. setInterval(check_gamemode, 250);
  1455.  
  1456. function save_gm() {
  1457. let saved_gm = localStorage.getItem(`[Diep.io+] last_gm`);
  1458. if (saved_gm != null && saved_gm != gamemode) {
  1459. last_gamemode = saved_gm;
  1460. }
  1461. saved_gm === null ? localStorage.setItem(`[Diep.io+] last_gm}`, gamemode) : null;
  1462. }
  1463.  
  1464. //personal best
  1465. let your_final_score = 0;
  1466. const personal_best = document.createElement('div');
  1467. const gameDetail = document.createElement('div');
  1468. const label = document.createElement('div');
  1469. //applying class
  1470. gameDetail.classList.add("game-detail");
  1471. label.classList.add("label");
  1472. personal_best.classList.add("value");
  1473. //text context
  1474. label.textContent = "Best:";
  1475. //adding to html
  1476. gameOverScreenContainer.appendChild(gameDetail);
  1477. gameDetail.appendChild(label);
  1478. gameDetail.appendChild(personal_best);
  1479.  
  1480. function load_ls() {
  1481. return localStorage.getItem(gamemode);
  1482. }
  1483.  
  1484. function save_ls() {
  1485. localStorage.setItem(gamemode, your_final_score);
  1486. }
  1487.  
  1488. function check_final_score() {
  1489. if (_c.screen_state === "game-over") {
  1490. your_final_score = _c.death_score;
  1491. let saved_score = parseFloat(load_ls());
  1492. personal_best.textContent = saved_score;
  1493. if (saved_score < your_final_score) {
  1494. personal_best.textContent = your_final_score;
  1495. save_ls();
  1496. }
  1497. }
  1498. }
  1499.  
  1500. setInterval(check_final_score, 100);
  1501.  
  1502. //remove annoying html elements
  1503. function instant_remove() {
  1504. // Define selectors for elements to remove
  1505. const selectors = [
  1506. "#cmpPersistentLink",
  1507. "#apes-io-promo",
  1508. "#apes-io-promo > img",
  1509. "#last-updated",
  1510. "#diep-io_300x250"
  1511. ];
  1512.  
  1513. // Remove each selected element
  1514. selectors.forEach(selector => {
  1515. const element = document.querySelector(selector);
  1516. if (element) {
  1517. element.remove();
  1518. }
  1519. });
  1520.  
  1521. // If all elements have been removed, clear the interval
  1522. if (selectors.every(selector => !document.querySelector(selector))) {
  1523. deep_debug("Removed all ads, quitting...");
  1524. clearInterval(interval);
  1525. }
  1526. }
  1527.  
  1528. // Set an interval to check for ads
  1529. const interval = setInterval(instant_remove, 100);
  1530.  
  1531. // ]-[
  1532.  
  1533. //Predator Stack
  1534. let predator_reloads = [
  1535. //0
  1536. {
  1537. scd2: 600,
  1538. scd3: 1000,
  1539. wcd1: 1500,
  1540. wcd2: 2900,
  1541. },
  1542. //1
  1543. {
  1544. scd2: 500,
  1545. scd3: 900,
  1546. wcd1: 1400,
  1547. wcd2: 2800,
  1548. },
  1549. //2
  1550. {
  1551. scd2: 500,
  1552. scd3: 900,
  1553. wcd1: 1200,
  1554. wcd2: 2400,
  1555. },
  1556. //3
  1557. {
  1558. scd2: 400,
  1559. scd3: 900,
  1560. wcd1: 1200,
  1561. wcd2: 2300,
  1562. },
  1563. //4
  1564. {
  1565. scd2: 400,
  1566. scd3: 900,
  1567. wcd1: 1000,
  1568. wcd2: 2000,
  1569. },
  1570. //5
  1571. {
  1572. scd2: 400,
  1573. scd3: 800,
  1574. wcd1: 900,
  1575. wcd2: 1800,
  1576. },
  1577. //6
  1578. {
  1579. scd2: 300,
  1580. scd3: 800,
  1581. wcd1: 900,
  1582. wcd2: 1750,
  1583. },
  1584. //7
  1585. {
  1586. scd2: 300,
  1587. scd3: 800,
  1588. wcd1: 750,
  1589. wcd2: 1500,
  1590. },
  1591. ];
  1592.  
  1593.  
  1594. function shoot(cooldown = 100) {
  1595. deep_debug("Shoot started!", cooldown);
  1596. extern.onKeyDown(36);
  1597. setTimeout(() => {
  1598. deep_debug("Ending Shoot!", cooldown);
  1599. extern.onKeyUp(36);
  1600. }, cooldown);
  1601. }
  1602.  
  1603. function get_reload(){
  1604. let arr = [...extern.get_convar("game_stats_build")];
  1605. let counter = 0;
  1606. let l = arr.length;
  1607. for(let i = 0; i < l; i++){
  1608. if(arr[i] === '7'){
  1609. counter++;
  1610. }
  1611. }
  1612. return counter;
  1613. }
  1614.  
  1615. function predator_stack(reload) {
  1616. deep_debug("func called");
  1617. let current = predator_reloads[reload];
  1618. deep_debug(current);
  1619. shoot();
  1620. setTimeout(() => {
  1621. shoot(current.scd2);
  1622. }, current.wcd1);
  1623. setTimeout(() => {
  1624. shoot(current.scd3);
  1625. }, current.wcd2);
  1626. }
  1627.  
  1628. //Bot tab
  1629.  
  1630. //iframe creation
  1631. function createInvisibleIframe(url) {
  1632. let existingIframe = document.getElementById('hiddenIframe');
  1633. if (existingIframe) {
  1634. return;
  1635. }
  1636.  
  1637. let iframe = document.createElement('iframe');
  1638. iframe.src = url;
  1639. iframe.id = 'hiddenIframe';
  1640. document.body.appendChild(iframe);
  1641. }
  1642.  
  1643. function removeIframe() {
  1644. let iframe = document.getElementById('hiddenIframe');
  1645. if (iframe) {
  1646. iframe.remove();
  1647. }
  1648. }
  1649.  
  1650. function bot_tab_active_check(){
  1651. if(modules.Functional.Bot_tab.active){
  1652. createInvisibleIframe(link(get_baseUrl(), get_your_lobby(), get_gamemode(), get_team()));
  1653. }else{
  1654. removeIframe();
  1655. }
  1656. }
  1657. setInterval(bot_tab_active_check, 1000);
  1658.  
  1659. //DiepConsole
  1660. function active_diepconsole_render_default(){
  1661. let defaults = ['ren_scoreboard', 'ren_upgrades', 'ren_stats', 'ren_names', 'ren_scoreboard_names'];
  1662. for(let _def of defaults){
  1663. let _setting = modules.DiepConsole.Render.settings[_def]
  1664. _setting.active = true;
  1665. }
  1666. }
  1667. active_diepconsole_render_default();
  1668.  
  1669. function handle_con_toggle(state){
  1670. if(!extern.isConActive() && state && player.inGame){
  1671. one_time_notification('canceled, due to a bug. Make sure to not enable it while in game', notification_rgbs.warning, 5000);
  1672. return;
  1673. }
  1674. if(extern.isConActive() != state){
  1675. extern.execute('con_toggle');
  1676. }
  1677. }
  1678.  
  1679. function update_diep_console(){
  1680. //Modules
  1681. for(let param in modules.DiepConsole){
  1682. let state = modules.DiepConsole[param].active;
  1683. if(param === "con_toggle"){
  1684. handle_con_toggle(state)
  1685. }else if(modules.DiepConsole[param].name != "Render things"){
  1686. extern.set_convar(param, state);
  1687. }
  1688. }
  1689. //Render Settings
  1690. for(let ren_param in modules.DiepConsole.Render.settings){
  1691. let state = modules.DiepConsole.Render.settings[ren_param].active;
  1692. if(modules.DiepConsole.Render.settings[ren_param].name != "Rendering"){
  1693. extern.set_convar(ren_param, state);
  1694. }
  1695. }
  1696. }
  1697. setInterval(update_diep_console, 100);
  1698.  
  1699.  
  1700. //////
  1701. //mouse functions
  1702.  
  1703. window.addEventListener('mousemove', function(event) {
  1704. inputs.mouse.real.x = event.clientX;
  1705. inputs.mouse.real.y = event.clientY;
  1706. });
  1707.  
  1708. window.addEventListener('mousedown', function(event) {
  1709. if (modules.Mouse.Anti_aim.settings.Anti_aim.active) {
  1710. if (inputs.mouse.shooting) {
  1711. return;
  1712. }
  1713. inputs.mouse.shooting = true;
  1714. pauseMouseMove();
  1715. //freezeMouseMove();
  1716. setTimeout(function() {
  1717. inputs.mouse.shooting = false;
  1718. mouse_move('extern', inputs.mouse.real.x, inputs.mouse.real.y);
  1719. click_at('extern', inputs.mouse.real.x, inputs.mouse.real.y);
  1720. }, modules.Mouse.Anti_aim.settings.Timing.selected);
  1721. };
  1722. });
  1723.  
  1724. function handle_mouse_functions() {
  1725. window.requestAnimationFrame(handle_mouse_functions);
  1726. if (!player.connected) {
  1727. return;
  1728. }
  1729. modules.Mouse.Freeze_mouse.active ? freezeMouseMove() : unfreezeMouseMove();
  1730. modules.Mouse.Anti_aim.settings.Anti_aim.active ? anti_aim("On") : anti_aim("Off");
  1731. }
  1732. window.requestAnimationFrame(handle_mouse_functions);
  1733.  
  1734. //anti aim
  1735. function detect_corner() {
  1736. deep_debug('corner detect called');
  1737. let w = window.innerWidth;
  1738. let h = window.innerHeight;
  1739. let center = {
  1740. x: w / 2,
  1741. y: h / 2
  1742. };
  1743. let lr, ud;
  1744. inputs.mouse.real.x > center.x ? lr = "r" : lr = "l";
  1745. inputs.mouse.real.y > center.y ? ud = "d" : ud = "u";
  1746. deep_debug('output: ', lr + ud);
  1747. return lr + ud;
  1748. }
  1749.  
  1750. function look_at_corner(corner) {
  1751. deep_debug('look at corner called with corner', corner);
  1752. if (!inputs.mouse.shooting) {
  1753. let w = window.innerWidth;
  1754. let h = window.innerHeight;
  1755. deep_debug('w and h', w, h);
  1756. deep_debug('inputs: ', inputs);
  1757. switch (corner) {
  1758. case "lu":
  1759. anti_aim_at('extern', w, h);
  1760. break
  1761. case "ld":
  1762. anti_aim_at('extern', w, 0);
  1763. break
  1764. case "ru":
  1765. anti_aim_at('extern', 0, h);
  1766. break
  1767. case "rd":
  1768. anti_aim_at('extern', 0, 0);
  1769. break
  1770. }
  1771. }
  1772. }
  1773.  
  1774. function anti_aim(toggle) {
  1775. deep_debug('anti aim called with:', toggle);
  1776. if(!player.inGame) return;
  1777. switch (toggle) {
  1778. case "On":
  1779. if (modules.Mouse.Anti_aim.settings.Anti_aim.active && !inputs.mouse.isFrozen) {
  1780. deep_debug('condition !modules.Mouse.Anti_aim.settings.active met');
  1781. look_at_corner(detect_corner());
  1782. }
  1783. break
  1784. case "Off":
  1785. //(inputs.mouse.isFrozen && !modules.Mouse.Freeze_mouse.active) ? unfreezeMouseMove() : null;
  1786. (inputs.mouse.isPaused && !modules.Mouse.Freeze_mouse.active) ? unpauseMouseMove() : null;
  1787. break
  1788. }
  1789. }
  1790.  
  1791. // Example: Freeze and unfreeze
  1792. function pauseMouseMove() {
  1793. if(!inputs.mouse.isPaused){
  1794. inputs.mouse.isForced = true;
  1795. inputs.mouse.force.x = inputs.mouse.real.x
  1796. inputs.mouse.force.y = inputs.mouse.real.y;
  1797. inputs.mouse.isPaused = true; //tell the script that freezing finished
  1798. }
  1799. }
  1800.  
  1801. function freezeMouseMove() {
  1802. if(!inputs.mouse.isFrozen){
  1803. inputs.mouse.isForced = true;
  1804. inputs.mouse.force.x = inputs.mouse.real.x
  1805. inputs.mouse.force.y = inputs.mouse.real.y;
  1806. inputs.mouse.isFrozen = true; //tell the script that freezing finished
  1807. }
  1808. /*
  1809. if (!inputs.mouse.isFrozen) {
  1810. inputs.mouse.isFrozen = true;
  1811. clear_onTouch();
  1812. deep_debug("Mousemove events are frozen.");
  1813. }
  1814. */
  1815. }
  1816.  
  1817. function unpauseMouseMove(){
  1818. if (inputs.mouse.isPaused && !inputs.mouse.isShooting) {
  1819. inputs.mouse.isForced = false;
  1820. inputs.mouse.isPaused = false; //tell the script that unfreezing finished
  1821. }
  1822. }
  1823.  
  1824. function unfreezeMouseMove() {
  1825. if (inputs.mouse.isFrozen) {
  1826. inputs.mouse.isForced = false;
  1827. inputs.mouse.isFrozen = false; //tell the script that unfreezing finished
  1828. }
  1829. /*
  1830. if (inputs.mouse.isFrozen && !inputs.mouse.isShooting) {
  1831. inputs.mouse.isFrozen = false;
  1832. redefine_onTouch();
  1833. deep_debug("Mousemove events are active.");
  1834. }
  1835. */
  1836. }
  1837.  
  1838. function click_at(input_or_extern, x, y, delay1 = 150, delay2 = 500) {
  1839. i_e(input_or_extern, 'onTouchStart', -1, x, y);
  1840. setTimeout(() => {
  1841. i_e(input_or_extern, 'onTouchEnd', -1, x, y);
  1842. }, delay1);
  1843. setTimeout(() => {
  1844. inputs.mouse.shooting = false;
  1845. }, delay2);
  1846. }
  1847.  
  1848. /* it was a bug and is now patched
  1849. function ghost_click_at(input_or_extern, x, y, delay1 = 150, delay2 = 500) {
  1850. i_e(input_or_extern, 'onTouchStart', -2, x, y);
  1851. setTimeout(() => {
  1852. i_e(input_or_extern, 'onTouchEnd', -2, x, y);
  1853. }, delay1);
  1854. setTimeout(() => {
  1855. inputs.mouse.shooting = false;
  1856. }, delay2);
  1857. }
  1858. */
  1859.  
  1860. function mouse_move(input_or_extern, x, y) {
  1861. deep_debug('mouse move called with', x, y);
  1862. apply_force(x, y);
  1863. i_e(input_or_extern, 'onTouchMove', -1, x, y);
  1864. disable_force();
  1865. }
  1866.  
  1867. function anti_aim_at(input_or_extern, x, y) {
  1868. deep_debug('frozen, shooting', inputs.mouse.isFrozen, inputs.mouse.isShooting);
  1869. deep_debug('anti aim at called with:', x, y);
  1870. if (inputs.mouse.shooting) {
  1871. deep_debug('quit because inputs.mouse.shooting');
  1872. return;
  1873. }
  1874. mouse_move(input_or_extern, x, y);
  1875. }
  1876. //////
  1877.  
  1878. //Custom Auto Spin
  1879. function getMouseAngle(x, y) {
  1880. const centerX = window.innerWidth / 2;
  1881. const centerY = window.innerHeight / 2;
  1882.  
  1883. const dx = x - centerX;
  1884. const dy = y - centerY;
  1885.  
  1886. let angle = Math.atan2(dy, dx) * (180 / Math.PI);
  1887.  
  1888. return angle < 0 ? angle + 360 : angle;
  1889. }
  1890.  
  1891. function offset_Angle(angle){
  1892. let _angle;
  1893. if(angle <= 360){
  1894. _angle = angle;
  1895. }else{
  1896. _angle = angle-360;
  1897. while(_angle > 360){
  1898. _angle -= 360;
  1899. }
  1900. }
  1901. return _angle;
  1902. }
  1903.  
  1904. function getPointOnCircle(degrees) {
  1905. const centerX = window.innerWidth / 2;
  1906. const centerY = window.innerHeight / 2;
  1907. const radius = Math.min(window.innerWidth, window.innerHeight) / 2;
  1908.  
  1909. const radians = degrees * (Math.PI / 180);
  1910. const x = centerX + radius * Math.cos(radians);
  1911. const y = centerY + radius * Math.sin(radians);
  1912.  
  1913. return { x:x, y:y };
  1914. }
  1915.  
  1916. let cas_force = false;
  1917. let cas_active = false;
  1918. let starting_angle = 0;
  1919. let temp_interval = setInterval(start_custom_spin, modules.Mouse.Custom_auto_spin.settings.Interval.selected);
  1920. function start_keyDown_Proxy(){
  1921. extern.onKeyDown = new Proxy(extern.onKeyDown, {
  1922. apply: function (target, thisArgs, args){
  1923. if(modules.Mouse.Custom_auto_spin.settings.Replace_auto_spin.active && args[0] === diep_keys.KeyC){
  1924. cas_active = !cas_active;
  1925. new_notification(`Custom Auto Spin: ${cas_active?'On':'Off'}`, notification_rgbs.normal, 4000);
  1926. return;
  1927. }
  1928. return Reflect.apply(target, thisArgs, args);
  1929. }
  1930. });
  1931. }
  1932.  
  1933. function start_custom_spin(){
  1934. clearInterval(temp_interval);
  1935. temp_interval = setInterval(start_custom_spin, modules.Mouse.Custom_auto_spin.settings.Interval.selected);
  1936. if(!player.inGame) return;
  1937. if(!modules.Mouse.Custom_auto_spin.settings.Replace_auto_spin.active) cas_active = modules.Mouse.Custom_auto_spin.settings.Custom_auto_spin.active;
  1938. if(!cas_active){
  1939. starting_angle = getMouseAngle(inputs.mouse.real.x, inputs.mouse.real.y);
  1940. if(inputs.mouse.isForced && cas_force){
  1941. disable_force();
  1942. cas_force = false;
  1943. }
  1944. }else{
  1945. cas_force = true;
  1946. let l = Math.pow(2, modules.Mouse.Custom_auto_spin.settings.Smoothness.selected);
  1947. console.log(l);
  1948. let angle_peace = 360/l;
  1949. console.log(angle_peace);
  1950. let time_peace = modules.Mouse.Custom_auto_spin.settings.Interval.selected/l;
  1951. for(let i = 0; i < l; i++){
  1952. setTimeout(() => {
  1953. let temp_angle = offset_Angle(starting_angle + angle_peace * i);
  1954. let temp_coords = getPointOnCircle(temp_angle);
  1955. apply_force(temp_coords.x, temp_coords.y);
  1956. i_e('extern', 'onTouchMove', -1, temp_coords.x, temp_coords.y);
  1957. }, time_peace*i);
  1958. }
  1959. }
  1960. }
  1961.  
  1962. //Sandbox Auto Lvl up
  1963. function sandbox_lvl_up() {
  1964. if (modules.Functional.Sandbox_lvl_up.active && player.connected && player.inGame && player.gamemode === "sandbox") {
  1965. document.querySelector("#sandbox-max-level").click();
  1966. }
  1967. }
  1968. setInterval(sandbox_lvl_up, 500);
  1969.  
  1970. //START, autorespawn Module
  1971.  
  1972. //name saving logic
  1973. var killer_names = localStorage.getItem("[Diep.io+] saved names") ? JSON.parse(localStorage.getItem("[Diep.io+] saved names")) : ['r!PsAw', 'TestTank'];
  1974. function import_killer_names(){
  1975. let imported_string = prompt('Paste killer names here: ', '["name1", "name2", "name3"]');
  1976. killer_names = killer_names.concat(JSON.parse(imported_string));
  1977. killer_names = [...new Set(killer_names)];
  1978. localStorage.setItem("[Diep.io+] saved names", JSON.stringify(killer_names));
  1979. }
  1980. let banned_names = ["Pentagon", "Triangle", "Square", "Crasher", "Mothership", "Guardian of Pentagons", "Fallen Booster", "Fallen Overlord", "Necromancer", "Defender", "Unnamed Tank"];
  1981. function check_and_save_name(){
  1982. deep_debug(_c.killer_name, !killer_names.includes(_c.killer_name));
  1983. if(_c.screen_state === 'game-over' && !banned_names.includes(_c.killer_name) && !killer_names.includes(_c.killer_name)){
  1984. deep_debug("Condition met!");
  1985. killer_names.push(_c.killer_name);
  1986. deep_debug("Added");
  1987. killer_names = [...new Set(killer_names)];
  1988. if(modules.Functional.Auto_respawn.settings.Remember.active){
  1989. localStorage.setItem("[Diep.io+] saved names", JSON.stringify(killer_names));
  1990. deep_debug("saved list");
  1991. }
  1992. }
  1993. }
  1994.  
  1995. function get_random_killer_name(){
  1996. let l = killer_names.length;
  1997. let index = Math.floor(Math.random() * l);
  1998. return killer_names[index];
  1999. }
  2000.  
  2001. //Random Symbols/Numbers/Letters
  2002. function generate_random_name_string(type){
  2003. let final_result = '';
  2004. let chars = '';
  2005. switch(type){
  2006. case "Symbols":
  2007. chars = '!@#$%^&*()_+=-.,][';
  2008. break
  2009. case "Numbers":
  2010. chars = '1234567890';
  2011. break
  2012. case "Letters":
  2013. chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  2014. break
  2015. }
  2016. for (let i = 0; i < 16; i++) {
  2017. final_result += chars[Math.floor(Math.random() * chars.length)];
  2018. }
  2019. return final_result;
  2020. }
  2021. //ascii inject
  2022. function get_ascii_inject(type){
  2023. let asciiArray = [];
  2024. switch(type){
  2025. case "Glitched":
  2026. asciiArray = [0x110000];
  2027. break
  2028. case "N A M E":
  2029. asciiArray = player.name.split("").flatMap(char => [char.charCodeAt(0), 10]).slice(0, -1);
  2030. break
  2031. }
  2032. let interesting = {
  2033. length: asciiArray.length,
  2034. charCodeAt(i) {
  2035. return asciiArray[i];
  2036. },
  2037. };
  2038. const argument = {
  2039. toString() {
  2040. return interesting;
  2041. },
  2042. };
  2043. return argument;
  2044. }
  2045.  
  2046. //main Loop
  2047. function get_respawn_name_by_type(type){
  2048. let temp_name = '';
  2049. switch(type){
  2050. case "Normal":
  2051. temp_name = player.name;
  2052. break
  2053. case "Glitched":
  2054. temp_name = get_ascii_inject(type);
  2055. break
  2056. case "N A M E":
  2057. temp_name = get_ascii_inject(type);
  2058. break
  2059. case "Random Killer":
  2060. temp_name = get_random_killer_name();
  2061. break
  2062. case "Random Symbols":
  2063. temp_name = generate_random_name_string('Symbols');
  2064. break
  2065. case "Random Numbers":
  2066. temp_name = generate_random_name_string('Numbers');
  2067. break
  2068. case "Random Letters":
  2069. temp_name = generate_random_name_string('Letters');
  2070. break
  2071. }
  2072. return temp_name;
  2073. }
  2074. function respawn() {
  2075. check_and_save_name();
  2076. if (modules.Functional.Auto_respawn.settings.Auto_respawn.active && player.connected && !player.inGame) {
  2077. //prevent respawn after 300k flag
  2078. if(modules.Functional.Auto_respawn.settings.Prevent.active && _c.death_score >= 300000){
  2079. return;
  2080. }
  2081. let type = modules.Functional.Auto_respawn.settings.Name.selected;
  2082. let temp_name = get_respawn_name_by_type(type);
  2083. extern.try_spawn(temp_name);
  2084. }
  2085. }
  2086.  
  2087. setInterval(respawn, 1000);
  2088.  
  2089. //END
  2090.  
  2091. //AntiAfk Timeout
  2092. function AntiAfkTimeout() {
  2093. if (modules.Mouse.Anti_timeout.active && player.connected) {
  2094. extern.onTouchMove(inputs.mouse.real.x, inputs.mouse.real.y);
  2095. }
  2096. }
  2097. setInterval(AntiAfkTimeout, 1000);
  2098.  
  2099. //Zoom
  2100. function start_zoom_proxy(){
  2101. input.setScreensizeZoom = new Proxy(input.setScreensizeZoom, {
  2102. apply: function(target, thisArgs, args){
  2103. player.base_value = args[1];
  2104. let factor = modules.Functional.Zoom.value / 100;
  2105. player.dpr = player.base_value * factor;
  2106. let newargs = [args[0], player.dpr];
  2107. return Reflect.apply(target, thisArgs, newargs);
  2108. }
  2109. });
  2110. }
  2111. function HandleZoom() {
  2112. if(player.connected){
  2113. //let base_value = 1;
  2114. //let factor = modules.Functional.Zoom.value / 100;
  2115. //player.dpr = base_value * factor;
  2116. let diepScale = player.base_value * Math.floor(player.ui_scale * windowScaling() * 25) / 25;
  2117. extern.setScreensizeZoom(diepScale, player.base_value);
  2118. extern.updateDPR(player.dpr);
  2119. }
  2120. }
  2121. setInterval(HandleZoom, 100);
  2122.  
  2123. //ctx helper functions
  2124. function ctx_arc(x, y, r, sAngle, eAngle, counterclockwise, c, stroke_or_fill = 'fill', _globalAlpha=1, _lineWidth = '2px') {
  2125. let original_ga = ctx.globalAlpha;
  2126. let original_lw = ctx.lineWidth;
  2127. ctx.beginPath();
  2128. ctx.arc(x, y, r, sAngle, eAngle, counterclockwise);
  2129. ctx.globalAlpha = _globalAlpha;
  2130. switch(stroke_or_fill){
  2131. case "fill":
  2132. ctx.fillStyle = c;
  2133. ctx.fill();
  2134. break
  2135. case "stroke":
  2136. ctx.lineWidth = _lineWidth;
  2137. ctx.strokeStyle = c;
  2138. ctx.stroke();
  2139. ctx.lineWidth = original_lw;
  2140. break
  2141. }
  2142. ctx.globalAlpha = original_ga;
  2143. }
  2144.  
  2145. function ctx_text(fcolor, scolor, lineWidth, font, text, textX, textY) {
  2146. deep_debug('called crx_text with: ', fcolor, scolor, lineWidth, font, text, textX, textY);
  2147. ctx.fillStyle = fcolor;
  2148. ctx.lineWidth = lineWidth;
  2149. ctx.font = font;
  2150. ctx.strokeStyle = scolor;
  2151. ctx.strokeText(`${text}`, textX, textY)
  2152. ctx.fillText(`${text}`, textX, textY)
  2153. }
  2154.  
  2155. function ctx_rect(x, y, a, b, c) {
  2156. deep_debug('called ctx_rect with: ', x, y, a, b, c);
  2157. ctx.beginPath();
  2158. ctx.strokeStyle = c;
  2159. ctx.strokeRect(x, y, a, b);
  2160. }
  2161.  
  2162. function transparent_rect_fill(x, y, a, b, scolor, fcolor, opacity){
  2163. deep_debug('called transparent_rect_fill with: ', x, y, a, b, scolor, fcolor, opacity);
  2164. ctx.beginPath();
  2165. ctx.rect(x, y, a, b);
  2166.  
  2167. // Set stroke opacity
  2168. ctx.globalAlpha = 1;// Reset to 1 for stroke, or set as needed
  2169. ctx.strokeStyle = scolor;
  2170. ctx.stroke();
  2171.  
  2172. // Set fill opacity
  2173. ctx.globalAlpha = opacity;// Set the opacity for the fill color
  2174. ctx.fillStyle = fcolor;
  2175. ctx.fill();
  2176.  
  2177. // Reset globalAlpha back to 1 for future operations
  2178. ctx.globalAlpha = 1;
  2179. }
  2180.  
  2181. //key visualiser
  2182. let ctx_wasd = {
  2183. square_sizes: { //in windowScaling
  2184. a: 50,
  2185. b: 50
  2186. },
  2187. text_props: {
  2188. lineWidth: 3,
  2189. font: 1 + "em Ubuntu",
  2190. },
  2191. square_colors: {
  2192. stroke: "black",
  2193. unpressed: "yellow",
  2194. pressed: "orange"
  2195. },
  2196. text_colors: {
  2197. stroke: "black",
  2198. unpressed: "orange",
  2199. pressed: "red"
  2200. },
  2201. w: {
  2202. x: 300,
  2203. y: 200,
  2204. pressed: false,
  2205. text: 'W'
  2206. },
  2207. a: {
  2208. x: 350,
  2209. y: 150,
  2210. pressed: false,
  2211. text: 'A'
  2212. },
  2213. s: {
  2214. x: 300,
  2215. y: 150,
  2216. pressed: false,
  2217. text: 'S'
  2218. },
  2219. d: {
  2220. x: 250,
  2221. y: 150,
  2222. pressed: false,
  2223. text: 'D'
  2224. },
  2225. l_m: {
  2226. x: 350,
  2227. y: 75,
  2228. pressed: false,
  2229. text: 'LMC'
  2230. },
  2231. r_m: {
  2232. x: 250,
  2233. y: 75,
  2234. pressed: false,
  2235. text: 'RMC'
  2236. },
  2237. }
  2238.  
  2239. function visualise_keys(){
  2240. let keys = ['w', 'a', 's', 'd', 'l_m', 'r_m'];
  2241. let l = keys.length;
  2242. for(let i = 0; i < l; i++){
  2243. let args = {
  2244. x: canvas.width - dim_c.windowScaling_2_canvas(ctx_wasd[keys[i]].x),
  2245. y: canvas.height - dim_c.windowScaling_2_canvas(ctx_wasd[keys[i]].y),
  2246. a: dim_c.windowScaling_2_canvas(ctx_wasd.square_sizes.a),
  2247. b: dim_c.windowScaling_2_canvas(ctx_wasd.square_sizes.b),
  2248. s_c: ctx_wasd.square_colors.stroke,
  2249. f_c: ctx_wasd[keys[i]].pressed? ctx_wasd.square_colors.pressed : ctx_wasd.square_colors.unpressed,
  2250. t_s: ctx_wasd.text_colors.stroke,
  2251. t_f: ctx_wasd[keys[i]].pressed? ctx_wasd.text_colors.pressed : ctx_wasd.text_colors.unpressed,
  2252. t_lineWidth: ctx_wasd.text_props.lineWidth,
  2253. t_font: ctx_wasd.text_props.font,
  2254. text: ctx_wasd[keys[i]].text,
  2255. opacity: 0.25
  2256. }
  2257. deep_debug(args);
  2258. transparent_rect_fill(
  2259. args.x,
  2260. args.y,
  2261. args.a,
  2262. args.b,
  2263. args.s_c,
  2264. args.f_c,
  2265. args.opacity
  2266. );
  2267. ctx_text(
  2268. args.t_f,
  2269. args.t_s,
  2270. args.t_lineWidth,
  2271. args.t_font,
  2272. args.text,
  2273. args.x+(args.a/2),
  2274. args.y+(args.b/2)
  2275. );
  2276. }
  2277. }
  2278.  
  2279. //Key Binds for Tank Upgrading
  2280. let selected_box = null;
  2281. let _bp = { //box parameters
  2282. startX: 47,
  2283. startY: 67,
  2284. distX: 13,
  2285. distY: 9,
  2286. width: 86,
  2287. height: 86,
  2288. outer_xy: 2
  2289. }
  2290.  
  2291. let _bo = { //box offsets
  2292. offsetX: _bp.width + (_bp.outer_xy * 2) + _bp.distX,
  2293. offsetY: _bp.height + (_bp.outer_xy * 2) + _bp.distY
  2294. }
  2295.  
  2296. function step_offset(steps, offset){
  2297. let final_offset = 0;
  2298. switch(offset){
  2299. case "x":
  2300. final_offset = _bp.startX + (steps * _bo.offsetX);
  2301. break
  2302. case "y":
  2303. final_offset = _bp.startY + (steps * _bo.offsetY);
  2304. break
  2305. }
  2306. return final_offset;
  2307. }
  2308.  
  2309. const boxes = [
  2310. {
  2311. color: "lightblue",
  2312. LUcornerX: _bp.startX,
  2313. LUcornerY: _bp.startY,
  2314. KeyBind: "R"
  2315. },
  2316. {
  2317. color: "green",
  2318. LUcornerX: _bp.startX + _bo.offsetX,
  2319. LUcornerY: _bp.startY,
  2320. KeyBind: "T"
  2321. },
  2322. {
  2323. color: "red",
  2324. LUcornerX: _bp.startX,
  2325. LUcornerY: _bp.startY + _bo.offsetY,
  2326. KeyBind: "F"
  2327. },
  2328. {
  2329. color: "yellow",
  2330. LUcornerX: _bp.startX + _bo.offsetX,
  2331. LUcornerY: _bp.startY + _bo.offsetY,
  2332. KeyBind: "G"
  2333. },
  2334. {
  2335. color: "blue",
  2336. LUcornerX: _bp.startX,
  2337. LUcornerY: step_offset(2, "y"),
  2338. KeyBind: "V"
  2339. },
  2340. {
  2341. color: "purple",
  2342. LUcornerX: _bp.startX + _bo.offsetX,
  2343. LUcornerY: step_offset(2, "y"),
  2344. KeyBind: "B"
  2345. }
  2346. ]
  2347.  
  2348. //upgrading Tank logic
  2349. function upgrade_get_coords(color){
  2350. let l = boxes.length;
  2351. let upgrade_coords = {x: "not defined", y: "not defined"};
  2352. for(let i = 0; i < l; i++){
  2353. if(boxes[i].color === color){
  2354. upgrade_coords.x = dim_c.windowScaling_2_window(boxes[i].LUcornerX + (_bp.width/2));
  2355. upgrade_coords.y = dim_c.windowScaling_2_window(boxes[i].LUcornerY + (_bp.height/2));
  2356. }
  2357. }
  2358. deep_debug(upgrade_coords);
  2359. return upgrade_coords;
  2360. }
  2361.  
  2362. function upgrade(color, delay = 100, cdelay1, cdelay2){
  2363. let u_coords = upgrade_get_coords(color);
  2364. //ghost_click_at('extern', u_coords.x, u_coords.y, cdelay1, cdelay2);
  2365. click_at('extern', u_coords.x, u_coords.y, cdelay1, cdelay2); //using this since ghost_click was patched
  2366. }
  2367.  
  2368. function visualise_tank_upgrades(){
  2369. let l = boxes.length;
  2370. for (let i = 0; i < l; i++) {
  2371. let coords = upgrade_get_coords(boxes[i].color);
  2372. ctx_text(boxes[i].color, "black", 6, 1.5 + "em Ubuntu", `[${boxes[i].KeyBind}]`, coords.x, coords.y);
  2373. }
  2374. }
  2375.  
  2376. function check_tu_KeyBind(_KeyBind){
  2377. let l = boxes.length;
  2378. for (let i = 0; i < l; i++) {
  2379. if(_KeyBind === `Key${boxes[i].KeyBind}`){
  2380. deep_debug(_KeyBind, `Key${boxes[i].KeyBind}`, _KeyBind === `Key${boxes[i].KeyBind}`);
  2381. upgrade(boxes[i].color);
  2382. }
  2383. }
  2384. }
  2385.  
  2386. document.body.addEventListener("keydown", function(e) {
  2387. switch(e.code){
  2388. case "KeyW":
  2389. ctx_wasd.w.pressed = true;
  2390. break
  2391. case "KeyA":
  2392. ctx_wasd.a.pressed = true;
  2393. break
  2394. case "KeyS":
  2395. ctx_wasd.s.pressed = true;
  2396. break
  2397. case "KeyD":
  2398. ctx_wasd.d.pressed = true;
  2399. break
  2400. }
  2401. if(modules.Functional.Tank_upgrades.settings.Tank_upgrades.active){
  2402. check_tu_KeyBind(e.code);
  2403. }
  2404. });
  2405.  
  2406. document.body.addEventListener("keyup", function(e) {
  2407. deep_debug(`unpressed ${e.code}`);
  2408. switch(e.code){
  2409. case "KeyW":
  2410. ctx_wasd.w.pressed = false;
  2411. break
  2412. case "KeyA":
  2413. ctx_wasd.a.pressed = false;
  2414. break
  2415. case "KeyS":
  2416. ctx_wasd.s.pressed = false;
  2417. break
  2418. case "KeyD":
  2419. ctx_wasd.d.pressed = false;
  2420. break
  2421. }
  2422. deep_debug('====DID UNPRESS??', ctx_wasd.w.pressed, ctx_wasd.a.pressed, ctx_wasd.s.pressed, ctx_wasd.d.pressed);
  2423. });
  2424.  
  2425. document.body.addEventListener("mousedown", function(e) {
  2426. switch(e.button){
  2427. case 0:
  2428. ctx_wasd.l_m.pressed = true;
  2429. break
  2430. case 2:
  2431. ctx_wasd.r_m.pressed = true;
  2432. break
  2433. }
  2434. });
  2435.  
  2436. document.body.addEventListener("mouseup", function(e) {
  2437. switch(e.button){
  2438. case 0:
  2439. ctx_wasd.l_m.pressed = false;
  2440. break
  2441. case 2:
  2442. ctx_wasd.r_m.pressed = false;
  2443. break
  2444. }
  2445. });
  2446. //destroyer cooldown visualiser
  2447. let times_watcher = {
  2448. waiting: false,
  2449. cooldowns: [2540, 2311, 2201, 1911, 1760, 1681, 1560, 1381],
  2450. }
  2451.  
  2452. function draw_destroyer_cooldown(){
  2453. let c = times_watcher.waiting? 'red' : 'lime' ;
  2454. ctx_arc(inputs.mouse.real.x, inputs.mouse.real.y, 50*player.dpr, 0, 2 * Math.PI, false, c, 'fill', 0.3);
  2455. }
  2456.  
  2457. function handle_cooldown(_cd){
  2458. times_watcher.waiting = true;
  2459. setTimeout(() => {
  2460. times_watcher.waiting = false;
  2461. }, _cd);
  2462. }
  2463. document.body.addEventListener("mousedown", function(e) {
  2464. if(e.button === 0 && !times_watcher.waiting && player.inGame){
  2465. let _cd = times_watcher.cooldowns[modules.Visual.destroyer_cooldown.settings.reload.selected];
  2466. handle_cooldown(_cd);
  2467. }
  2468. });
  2469.  
  2470. document.body.addEventListener("keydown", function(e){
  2471. if(e.keyCode === 32 && !times_watcher.waiting && player.inGame){
  2472. let _cd = times_watcher.cooldowns[modules.Visual.destroyer_cooldown.settings.reload.selected];
  2473. handle_cooldown(_cd);
  2474. }
  2475. });
  2476.  
  2477. //debug function
  2478. function draw_canvas_debug(){
  2479. let temp_textX = canvas.width/2, temp_textY = canvas.height/2;
  2480. let temp_texts = [
  2481. `Your Real mouse position! x: ${inputs.mouse.real.x} y: ${inputs.mouse.real.y}`,
  2482. `Scaled down for the game! x: ${(inputs.mouse.game.x).toFixed(2)} y: ${(inputs.mouse.game.y).toFixed(2)}`,
  2483. `player values! DPR: ${player.dpr} base value: ${player.base_value} ui scale: ${player.ui_scale}`,
  2484. `window Scaling: ${windowScaling()}`,
  2485. `Canvas! width: ${canvas.width} height: ${canvas.height}`,
  2486. `Window! width: ${window.innerWidth} height: ${window.innerHeight}`,
  2487. `Ratio between Window and Canvas: ${dim_c.window_2_canvas(1)}`
  2488. ];
  2489. let l = temp_texts.length;
  2490. let _d = (canvas.height/3)/l;
  2491. for(let i = 0; i < l; i++){
  2492. ctx_text('yellow', 'black', 5, 1.5 + "em Ubuntu", temp_texts[i], temp_textX, temp_textY + (i * _d));
  2493. }
  2494. //drawing line from your real mouse position, to your ingame mouse position
  2495. ctx.beginPath();
  2496. ctx.strokeStyle = "Red";
  2497. ctx.moveTo(inputs.mouse.real.x, inputs.mouse.real.y);
  2498. ctx.lineTo(inputs.mouse.game.x*player.dpr, inputs.mouse.game.y*player.dpr);
  2499. ctx.stroke();
  2500. }
  2501.  
  2502. //CANVAS API REQUIRED FOR EVERYTHING HERE
  2503.  
  2504. //maths helper functions
  2505. function get_average(points) {
  2506. let result = [0, 0];
  2507. for (let point of points) {
  2508. result[0] += point[0];
  2509. result[1] += point[1];
  2510. }
  2511. result[0] /= points.length;
  2512. result[1] /= points.length;
  2513. return result;
  2514. }
  2515.  
  2516. //api detecting logic
  2517. let current_tries = 0;
  2518. let notify_after_tries = 100;
  2519. let notified_about_missing = false;
  2520. let api_loaded = false;
  2521. let api_missing = false;
  2522.  
  2523. function notify_about_missing(){
  2524. if(notified_about_missing) return;
  2525. alert('Missing Canvas Api to run addon script, join our discord server to get it: https://discord.gg/S3ZzgDNAuG');
  2526. notified_about_missing = true;
  2527. }
  2528.  
  2529. function await_api(){
  2530. if(current_tries > notify_after_tries) {
  2531. api_missing = true;
  2532. return;
  2533. }
  2534. current_tries++;
  2535. api_loaded = !!window.ripsaw_api;
  2536. console.log('did api load?', api_loaded);
  2537. window.ripsaw_api ? clearInterval(interval_api) : setTimeout(await_api, 100);
  2538. }
  2539. var interval_api = setInterval(await_api, 100);
  2540.  
  2541. //aim lines
  2542. function draw_aim_lines(len_factor=1){
  2543. let temp_tanks = window.ripsaw_api.get_tanks();
  2544. if(temp_tanks.length <= 0) return;
  2545. for(let temp_tank of temp_tanks){
  2546. for(let temp_turret of temp_tank.turrets){
  2547. switch(temp_turret.source_array){
  2548. case "rectangular":{
  2549. let diff = {
  2550. x: temp_turret.coords.endX - temp_turret.coords.startX,
  2551. y: temp_turret.coords.endY - temp_turret.coords.startY,
  2552. };
  2553. ctx.moveTo(temp_turret.coords.startX, temp_turret.coords.startY);
  2554. ctx.lineTo(temp_turret.coords.startX + (diff.x * len_factor), temp_turret.coords.startY + (diff.y * len_factor));
  2555. ctx_text('yellow', 'black', 5, 1.5 + "em Ubuntu", temp_tank.name, temp_turret.coords.startX + (diff.x * len_factor), temp_turret.coords.startY + (diff.y * len_factor));
  2556. ctx.stroke();
  2557. }
  2558. break
  2559. case "other":{
  2560. if(temp_turret.points.length < 4) return console.warn('less than 4 points');
  2561. let start = get_average([temp_turret.points[0], temp_turret.points[3]]);
  2562. let end = get_average([temp_turret.points[1], temp_turret.points[2]]);
  2563. let diff = [
  2564. end[0]-start[0],
  2565. end[1]-start[1]
  2566. ];
  2567. ctx.moveTo(...start);
  2568. ctx.lineTo(start[0]+(diff[0] * len_factor), start[1]+(diff[1] * len_factor));
  2569. ctx_text('yellow', 'black', 5, 1.5 + "em Ubuntu", temp_tank.name, start[0]+(diff[0] * len_factor), start[1]+(diff[1] * len_factor));
  2570. ctx.stroke();
  2571. }
  2572. break
  2573. }
  2574. }
  2575. }
  2576. }
  2577.  
  2578. //Farm Bot
  2579. let get_closest_update_notified = false;
  2580. let last_shape = [0, 0];
  2581.  
  2582. function handle_farmbot_aim(){
  2583. window.requestAnimationFrame(handle_farmbot_aim);
  2584. if(!player.connected || !player.inGame || !modules.Addons.farm_bot.settings.toggle_farm_bot.active) return;
  2585. mouse_move('extern', ...last_shape);
  2586. }
  2587. window.requestAnimationFrame(handle_farmbot_aim);
  2588.  
  2589. function start_farming(shape_types){
  2590. //I commented this function previously, so I had to update it with the uncommented version
  2591. if(!get_closest_update_notified && window.ripsaw_api && !window.ripsaw_api.get_closest){
  2592. get_closest_update_notified = true;
  2593. return alert('please update the canvas API');
  2594. }
  2595. if(player.inGame && player.connected){
  2596. //argument checking to avoid errors
  2597. let allowed_types = ['crashers', 'pentagons', 'squares', 'triangles'];
  2598. if(!(shape_types instanceof Array)) return console.warn('expected Array at start_farming, quitting...');
  2599. let api_response = window.ripsaw_api.get_shapes();
  2600. let temp_arr = [];
  2601. for(let temp_arg of shape_types){
  2602. if(!allowed_types.includes(temp_arg)) return console.warn(temp_arg, ' was not found in allowed types at start_farming, quitting...');
  2603. if(api_response[temp_arg].length > 0){ //push only if array not empty
  2604. temp_arr.push(...api_response[temp_arg]);
  2605. }
  2606. }
  2607. if(temp_arr.length <= 0) return;
  2608. last_shape = window.ripsaw_api.get_closest(temp_arr);
  2609. //drawing
  2610. if(modules.Addons.farm_bot.settings.toggle_lines.active){
  2611. ctx.moveTo(canvas.width/2, canvas.height/2);
  2612. ctx.lineTo(...last_shape);
  2613. ctx.stroke();
  2614. }
  2615. }
  2616. }
  2617.  
  2618. //canvas gui (try to keep this in the end
  2619. setTimeout(() => {
  2620. let gui = () => {
  2621. if (player.inGame) {
  2622. //DEBUG start
  2623. if(deep_debug_properties.canvas){
  2624. draw_canvas_debug();
  2625. }
  2626. //DEBUG end
  2627. if(modules.Functional.Tank_upgrades.settings.visualise.active){
  2628. visualise_tank_upgrades();
  2629. }
  2630. if (modules.Visual.Key_inputs_visualiser.active) {
  2631. visualise_keys();
  2632. }
  2633. if (modules.Visual.destroyer_cooldown.settings.destroyer_cooldown.active){
  2634. draw_destroyer_cooldown();
  2635. }
  2636. if(modules.Addons.aim_lines.settings.toggle_aim_lines.active){
  2637. if(api_missing) {
  2638. notify_about_missing();
  2639. return;
  2640. }
  2641. draw_aim_lines(modules.Addons.aim_lines.settings.adjust_length.selected);
  2642. }
  2643. if(modules.Addons.farm_bot.settings.toggle_farm_bot.active){
  2644. if(api_missing) {
  2645. notify_about_missing();
  2646. return;
  2647. }
  2648. let temp_shape_array = [];
  2649. if(!modules.Addons.farm_bot.settings.toggle_squares.active) temp_shape_array.push('squares');
  2650. if(!modules.Addons.farm_bot.settings.toggle_crashers.active) temp_shape_array.push('crashers');
  2651. if(!modules.Addons.farm_bot.settings.toggle_pentagons.active) temp_shape_array.push('pentagons');
  2652. if(!modules.Addons.farm_bot.settings.toggle_triangles.active) temp_shape_array.push('triangles');
  2653. if(temp_shape_array.length === 0) one_time_notification("You're currently ignoring all shapes, disable at least one of them or the bot won't shoot", notification_rgbs.warning, 5000);
  2654. start_farming(temp_shape_array);
  2655. }
  2656. }
  2657. window.requestAnimationFrame(gui); // Start animation loop
  2658. };
  2659. gui();
  2660. }, 500); // Delay before starting the rendering
  2661.  
  2662. //init
  2663.  
  2664. function update_information() {
  2665. window.requestAnimationFrame(update_information);
  2666. let teams = ["blue", "red", "purple", "green"];
  2667. player.connected = !!window.lobby_ip;
  2668. player.connected? player.inGame = !!extern.doesHaveTank() : null;
  2669. player.name = document.getElementById("spawn-nickname").value;
  2670. player.team = teams[parseInt(_c.party_link.split('x')[1])];
  2671. player.gamemode = _c.active_gamemode;
  2672. player.ui_scale = parseFloat(localStorage.getItem("d:ui_scale"));
  2673. }
  2674. window.requestAnimationFrame(update_information);
  2675.  
  2676. function waitForConnection() {
  2677. if (player.connected) {
  2678. define_onTouch();
  2679. start_input_proxies();
  2680. start_zoom_proxy();
  2681. start_keyDown_Proxy()
  2682. } else {
  2683. setTimeout(waitForConnection, 100);
  2684. }
  2685. }
  2686. waitForConnection();