Diep.io+ (added import & export killer names, NEW DISCORD SERVER)

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

  1. // ==UserScript==
  2. // @name Diep.io+ (added import & export killer names, NEW DISCORD SERVER)
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2.3
  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
  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 MIT
  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. };
  1016.  
  1017. console.log(modules);
  1018.  
  1019. let categories = [];
  1020.  
  1021. function create_categories() {
  1022. for (let key in modules) {
  1023. categories.push(new Category(key, modules[key]));
  1024. }
  1025. }
  1026. create_categories();
  1027.  
  1028. //loading / unloading modules
  1029. function load_modules(category_name) {
  1030. const current_category = categories.find(
  1031. (category) => category.name === category_name
  1032. );
  1033. for (let moduleName in current_category.modules) {
  1034. let module = current_category.modules[moduleName];
  1035. module.load();
  1036. if (module.type === "open" && module.active) module.loadSettings();
  1037. }
  1038. }
  1039.  
  1040. function unload_modules(category_name) {
  1041. const current_category = categories.find(
  1042. (category) => category.name === category_name
  1043. );
  1044. for (let moduleName in current_category.modules) {
  1045. let module = current_category.modules[moduleName];
  1046. module.unload();
  1047. module.unloadSettings();
  1048. }
  1049. }
  1050.  
  1051. function find_module_path(_name) {
  1052. for (let category in modules) {
  1053. for (let module in modules[category]) {
  1054. // Iterate over actual modules
  1055. if (modules[category][module].name === _name) {
  1056. return [category, module]; // Return actual category and module
  1057. }
  1058. }
  1059. }
  1060. return -1; // Return -1 if not found
  1061. }
  1062.  
  1063. function handle_categories_selection(current_name) {
  1064. categories.forEach((category) => {
  1065. if (category.name !== current_name && category.selected) {
  1066. category.unselect();
  1067. unload_modules(category.name);
  1068. }
  1069. });
  1070.  
  1071. load_modules(current_name);
  1072. }
  1073.  
  1074. function loadCategories() {
  1075. const categoryCont = document.querySelector("#sub-container-gray");
  1076. categories.forEach((category) =>
  1077. categoryCont.appendChild(category.element.el)
  1078. );
  1079. }
  1080.  
  1081. function load_selected() {
  1082. categories.forEach((category) => {
  1083. if (category.selected) {
  1084. load_modules(category.name);
  1085. }
  1086. });
  1087. }
  1088.  
  1089. function loadGUI() {
  1090. document.body.style.margin = "0";
  1091. document.body.style.display = "flex";
  1092. document.body.style.justifyContent = "left";
  1093.  
  1094. mainCont = new El("Main Cont", "div", "rgb(38, 38, 38)", "500px", "400px");
  1095. mainCont.setBorder("normal", "2px", "lime", "10px");
  1096. mainCont.el.style.display = "flex";
  1097. mainCont.el.style.minHeight = "min-content";
  1098. mainCont.el.style.flexDirection = "column";
  1099. mainCont.add(document.body);
  1100.  
  1101. header = new El("Headline Dp", "div", "transparent", "100%", "40px");
  1102. header.setBorder("bottom", "2px", "rgb(106, 173, 84)");
  1103. header.setText(
  1104. "Diep.io+ by r!PsAw (Hide GUI with J)",
  1105. "white",
  1106. "Calibri",
  1107. "bold",
  1108. "20px",
  1109. "2px",
  1110. "center",
  1111. "center"
  1112. );
  1113. header.add(mainCont.el);
  1114.  
  1115. const contentWrapper = document.createElement("div");
  1116. contentWrapper.style.display = "flex";
  1117. contentWrapper.style.gap = "10px";
  1118. contentWrapper.style.padding = "10px";
  1119. contentWrapper.style.flex = "1";
  1120. mainCont.el.appendChild(contentWrapper);
  1121.  
  1122. subContGray = new El(
  1123. "Sub Container Gray",
  1124. "div",
  1125. "transparent",
  1126. "100px",
  1127. "100%"
  1128. );
  1129. subContGray.el.style.display = "flex";
  1130. subContGray.el.style.flexDirection = "column";
  1131. subContGray.el.style.overflowY = "auto";
  1132. subContGray.add(contentWrapper);
  1133.  
  1134. subContBlack = new El("Sub Container Black", "div", "black", "360px", "100%");
  1135. subContBlack.el.style.display = "flex";
  1136. subContBlack.el.style.gap = "10px";
  1137. subContBlack.add(contentWrapper);
  1138.  
  1139. modCont = new El("Module Container", "div", "transparent", "50%", "100%");
  1140. modCont.el.style.display = "flex";
  1141. modCont.el.style.flexDirection = "column";
  1142. modCont.el.style.overflowY = "auto";
  1143. modCont.setBorder("right", "2px", "white");
  1144. modCont.add(subContBlack.el);
  1145.  
  1146. settCont = new El("Settings Container", "div", "transparent", "50%", "100%");
  1147. settCont.el.style.display = "flex";
  1148. settCont.el.style.flexDirection = "column";
  1149. settCont.el.style.overflowY = "auto";
  1150. settCont.add(subContBlack.el);
  1151.  
  1152. loadCategories();
  1153. load_selected();
  1154. }
  1155.  
  1156. loadGUI();
  1157. document.addEventListener("keydown", toggleGUI);
  1158.  
  1159. function toggleGUI(e) {
  1160. if (e.key === "j" || e.key === "J") {
  1161. if (mainCont.el) {
  1162. mainCont.remove(document.body);
  1163. mainCont.el = null;
  1164. } else {
  1165. loadGUI();
  1166. }
  1167. }
  1168. }
  1169.  
  1170.  
  1171. //actual logic
  1172.  
  1173. //allow user to interact with the gui while in game
  1174. Event.prototype.preventDefault = new Proxy(Event.prototype.preventDefault, {
  1175. apply: function(target, thisArgs, args){
  1176. //console.log(thisArgs.type);
  1177. if(thisArgs.type === "mousedown" || thisArgs.type === "mouseup") return; //console.log('successfully canceled');
  1178. return Reflect.apply(target, thisArgs, args);
  1179. }
  1180. });
  1181.  
  1182. //Move to Mouse
  1183. let approximation_factor = modules.Mouse.Move_2_mouse.settings.Approximation.selected; // Higher = faster movement, but less smooth Lower = slower movement, but more smooth
  1184. let distance_time_factor = modules.Mouse.Move_2_mouse.settings.Time_factor.selected; // transform the distance into Time
  1185. let moving_active = false;
  1186. let current_direction = 'none';
  1187.  
  1188. function calculate_distance(x1, y1, x2, y2) {
  1189. return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
  1190. }
  1191.  
  1192. function get_mouse_move_steps() {
  1193. let center = { x: canvas.width / 2, y: canvas.height / 2 };
  1194. let target = { x: inputs.mouse.real.x, y: inputs.mouse.real.y };
  1195. let full_distance = calculate_distance(center.x, center.y, target.x, target.y);
  1196. let partial_distance = full_distance / approximation_factor;
  1197. let step = { x: (target.x - center.x) / partial_distance, y: (target.y - center.y) / partial_distance };
  1198. return step;
  1199. }
  1200.  
  1201. function move_in_direction(direction, time) {
  1202. moving_active = true;
  1203. current_direction = direction;
  1204. let directions = {
  1205. 'Up': 'KeyW',
  1206. 'Left': 'KeyA',
  1207. 'Down': 'KeyS',
  1208. 'Right': 'KeyD',
  1209. }
  1210. for (let _dir in directions) {
  1211. if (directions[_dir] === undefined) return console.warn("Invalid direction");
  1212. if (_dir === direction) {
  1213. extern.onKeyDown(diep_keys[directions[_dir]]);
  1214. } else {
  1215. extern.onKeyUp(diep_keys[directions[_dir]]);
  1216. }
  1217. }
  1218. setTimeout(() => {
  1219. moving_active = false;
  1220. }, time);
  1221. }
  1222.  
  1223. function move_to_mouse() {
  1224. window.requestAnimationFrame(move_to_mouse);
  1225. if (!modules.Mouse.Move_2_mouse.settings.Move_2_mouse.active || moving_active || !player.inGame || !document.hasFocus()) return;
  1226. //update factors
  1227. approximation_factor = modules.Mouse.Move_2_mouse.settings.Approximation.selected;
  1228. distance_time_factor = modules.Mouse.Move_2_mouse.settings.Time_factor.selected;
  1229. //logic
  1230. let step = get_mouse_move_steps();
  1231. let horizontal = step.x > 0 ? 'Right' : 'Left';
  1232. let vertical = step.y > 0 ? 'Down' : 'Up';
  1233.  
  1234. switch (current_direction) {
  1235. case "none":
  1236. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1237. break;
  1238. case 'Right':
  1239. move_in_direction(vertical, Math.abs(step.y) * distance_time_factor);
  1240. break;
  1241. case 'Left':
  1242. move_in_direction(vertical, Math.abs(step.y) * distance_time_factor);
  1243. break;
  1244. case 'Up':
  1245. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1246. break
  1247. case 'Down':
  1248. move_in_direction(horizontal, Math.abs(step.x) * distance_time_factor);
  1249. break
  1250. }
  1251. }
  1252. window.requestAnimationFrame(move_to_mouse);
  1253.  
  1254.  
  1255. // ]-[ HTML RELATED STUFF
  1256. let homescreen = document.getElementById("home-screen");
  1257. let ingamescreen = document.getElementById("in-game-screen");
  1258. let gameOverScreen = document.getElementById('game-over-screen');
  1259. let gameOverScreenContainer = document.querySelector("#game-over-screen > div > div.game-details > div:nth-child(1)");
  1260. function update_scale_option(selector, label, min, max) {
  1261. let element = document.querySelector(selector);
  1262. let label_element = element.closest("div").querySelector("span");
  1263. label_element.innerHTML = `[DIEP.IO+] ${label}`;
  1264. label_element.style.background = "black";
  1265. label_element.style.color = "purple";
  1266. element.min = min;
  1267. element.max = max;
  1268. }
  1269.  
  1270. function new_ranges_for_scales() {
  1271. update_scale_option("#subsetting-option-ui_scale", "UI Scale", '0.01', '1000');
  1272. update_scale_option("#subsetting-option-border_radius", "UI Border Radius", '0.01', '1000');
  1273. update_scale_option("#subsetting-option-border_intensity", "UI Border Intensity", '0.01', '1000');
  1274. }
  1275.  
  1276. new_ranges_for_scales();
  1277.  
  1278. //VISUAL TEAM SWITCH
  1279. //create container
  1280. let team_select_container = document.createElement("div");
  1281. team_select_container.classList.add("labelled");
  1282. team_select_container.id = "team-selector";
  1283. document.querySelector("#server-selector").appendChild(team_select_container);
  1284.  
  1285. //create Text "Team"
  1286. let team_select_label = document.createElement("label");
  1287. team_select_label.innerText = "[Diep.io+] Team Selector";
  1288. team_select_label.style.color = "purple";
  1289. team_select_label.style.backgroundColor = "black";
  1290. team_select_container.appendChild(team_select_label);
  1291.  
  1292. //create Selector
  1293. let team_select_selector = document.createElement("div");
  1294. team_select_selector.classList.add("selector");
  1295. team_select_container.appendChild(team_select_selector);
  1296.  
  1297. //create placeholder "Choose Team"
  1298. let teams_visibility = true;
  1299. let ph_div = document.createElement("div");
  1300. let ph_text_div = document.createElement("div");
  1301. let sel_state;
  1302. ph_text_div.classList.add("dropdown-label");
  1303. ph_text_div.innerHTML = "Choose Team";
  1304. ph_div.style.backgroundColor = "gray";
  1305. ph_div.classList.add("selected");
  1306. ph_div.addEventListener("click", () => {
  1307. //toggle Team List
  1308. toggle_team_list(teams_visibility);
  1309. teams_visibility = !teams_visibility;
  1310. });
  1311.  
  1312. team_select_selector.appendChild(ph_div);
  1313. ph_div.appendChild(document.createElement("div"));
  1314. ph_div.appendChild(ph_text_div);
  1315.  
  1316. // Create refresh button
  1317. /*
  1318. let refresh_btn = document.createElement("button");
  1319. refresh_btn.style.width = "30%";
  1320. refresh_btn.style.height = "10%";
  1321. refresh_btn.style.backgroundColor = "black";
  1322. refresh_btn.textContent = "Refresh";
  1323.  
  1324. refresh_btn.onclick = () => {
  1325. remove_previous_teams();
  1326. links_to_teams_GUI_convert();
  1327. };
  1328.  
  1329. team_select_container.appendChild(refresh_btn);
  1330. */
  1331.  
  1332. //create actual teams
  1333. let team_values = [];
  1334.  
  1335. function create_team_div(text, color, link) {
  1336. team_values.push(text);
  1337. let team_div = document.createElement("div");
  1338. let text_div = document.createElement("div");
  1339. let sel_state;
  1340. text_div.classList.add("dropdown-label");
  1341. text_div.innerHTML = text;
  1342. team_div.style.backgroundColor = color;
  1343. team_div.classList.add("unselected");
  1344. team_div.value = text;
  1345. team_div.addEventListener("click", () => {
  1346. const answer = confirm("You're about to open the link in a new tab, do you want to continue?");
  1347. if (answer) {
  1348. window.open(link, "_blank");
  1349. }
  1350. });
  1351.  
  1352. team_select_selector.appendChild(team_div);
  1353. team_div.appendChild(document.createElement("div"));
  1354. team_div.appendChild(text_div);
  1355. }
  1356.  
  1357. function toggle_team_list(boolean) {
  1358. if (boolean) {
  1359. //true
  1360. team_select_selector.classList.remove("selector");
  1361. team_select_selector.classList.add("selector-active");
  1362. } else {
  1363. //false
  1364. team_select_selector.classList.remove("selector-active");
  1365. team_select_selector.classList.add("selector");
  1366. }
  1367. }
  1368.  
  1369. //example
  1370. //create_team_div("RedTeam", "Red", "https://diep.io/");
  1371. //create_team_div("OrangeTeam", "Orange", "https://diep.io/");
  1372. //create_team_div("YellowTeam", "Yellow", "https://diep.io/");
  1373. function links_to_teams_GUI_convert() {
  1374. let gamemode = get_gamemode();
  1375. let lobby = get_your_lobby();
  1376. let links = get_links(gamemode, lobby);
  1377. let team_names = ["Team-Blue", "Team-Red", "Team-Purple", "Team-Green", "Teamless-Gamemode"];
  1378. let team_colors = ["blue", "red", "purple", "green", "orange"];
  1379. for (let i = 0; i < links.length; i++) {
  1380. !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]);
  1381. }
  1382. }
  1383.  
  1384. function remove_previous_teams() {
  1385. for (let i = team_select_selector.childNodes.length - 1; i >= 0; i--) {
  1386. console.log(team_select_selector);
  1387. let child = team_select_selector.childNodes[i];
  1388. if (child.nodeType === Node.ELEMENT_NODE && child.innerText !== "Choose Team") {
  1389. child.remove();
  1390. }
  1391. }
  1392. }
  1393.  
  1394. let party_link_info = {
  1395. old_link: null,
  1396. current_link: null
  1397. }
  1398. function detect_refresh(){
  1399. if(!party_link_info.old_link || !party_link_info.current_link) return;
  1400. party_link_info.current_link = window.lobby_ip + _c.party_link;
  1401. if(party_link_info.current_link != party_link_info.old_link){
  1402. console.log('Link change detected!');
  1403. remove_previous_teams();
  1404. links_to_teams_GUI_convert();
  1405. party_link_info.old_link = party_link_info.current_link;
  1406. }
  1407. }
  1408. setInterval(detect_refresh, 100);
  1409.  
  1410. function wait_For_Link() {
  1411. if (_c.party_link === '') {
  1412. setTimeout(() => {
  1413. console.log("[Diep.io+] LOADING...");
  1414. wait_For_Link();
  1415. }, 100);
  1416. } else {
  1417. console.log("[Diep.io+] link loaded!");
  1418. remove_previous_teams();
  1419. links_to_teams_GUI_convert();
  1420. party_link_info.current_link = window.lobby_ip + _c.party_link;
  1421. party_link_info.old_link = party_link_info.current_link;
  1422. }
  1423. }
  1424.  
  1425. wait_For_Link();
  1426.  
  1427. //detect gamemode
  1428. let gamemode = document.querySelector("#gamemode-selector > div > div.selected > div.dropdown-label").innerHTML;
  1429. let last_gamemode = localStorage.getItem(`[Diep.io+] last_gm`);
  1430. localStorage.setItem(`[Diep.io+] last_gm`, gamemode);
  1431.  
  1432. function check_gamemode() {
  1433. gamemode = document.querySelector("#gamemode-selector > div > div.selected > div.dropdown-label").innerHTML;
  1434. save_gm();
  1435. }
  1436.  
  1437. setInterval(check_gamemode, 250);
  1438.  
  1439. function save_gm() {
  1440. let saved_gm = localStorage.getItem(`[Diep.io+] last_gm`);
  1441. if (saved_gm != null && saved_gm != gamemode) {
  1442. last_gamemode = saved_gm;
  1443. }
  1444. saved_gm === null ? localStorage.setItem(`[Diep.io+] last_gm}`, gamemode) : null;
  1445. }
  1446.  
  1447. //personal best
  1448. let your_final_score = 0;
  1449. const personal_best = document.createElement('div');
  1450. const gameDetail = document.createElement('div');
  1451. const label = document.createElement('div');
  1452. //applying class
  1453. gameDetail.classList.add("game-detail");
  1454. label.classList.add("label");
  1455. personal_best.classList.add("value");
  1456. //text context
  1457. label.textContent = "Best:";
  1458. //adding to html
  1459. gameOverScreenContainer.appendChild(gameDetail);
  1460. gameDetail.appendChild(label);
  1461. gameDetail.appendChild(personal_best);
  1462.  
  1463. function load_ls() {
  1464. return localStorage.getItem(gamemode);
  1465. }
  1466.  
  1467. function save_ls() {
  1468. localStorage.setItem(gamemode, your_final_score);
  1469. }
  1470.  
  1471. function check_final_score() {
  1472. if (_c.screen_state === "game-over") {
  1473. your_final_score = _c.death_score;
  1474. let saved_score = parseFloat(load_ls());
  1475. personal_best.textContent = saved_score;
  1476. if (saved_score < your_final_score) {
  1477. personal_best.textContent = your_final_score;
  1478. save_ls();
  1479. }
  1480. }
  1481. }
  1482.  
  1483. setInterval(check_final_score, 100);
  1484.  
  1485. //remove annoying html elements
  1486. function instant_remove() {
  1487. // Define selectors for elements to remove
  1488. const selectors = [
  1489. "#cmpPersistentLink",
  1490. "#apes-io-promo",
  1491. "#apes-io-promo > img",
  1492. "#last-updated",
  1493. "#diep-io_300x250"
  1494. ];
  1495.  
  1496. // Remove each selected element
  1497. selectors.forEach(selector => {
  1498. const element = document.querySelector(selector);
  1499. if (element) {
  1500. element.remove();
  1501. }
  1502. });
  1503.  
  1504. // If all elements have been removed, clear the interval
  1505. if (selectors.every(selector => !document.querySelector(selector))) {
  1506. deep_debug("Removed all ads, quitting...");
  1507. clearInterval(interval);
  1508. }
  1509. }
  1510.  
  1511. // Set an interval to check for ads
  1512. const interval = setInterval(instant_remove, 100);
  1513.  
  1514. // ]-[
  1515.  
  1516. //Predator Stack
  1517. let predator_reloads = [
  1518. //0
  1519. {
  1520. scd2: 600,
  1521. scd3: 1000,
  1522. wcd1: 1500,
  1523. wcd2: 2900,
  1524. },
  1525. //1
  1526. {
  1527. scd2: 500,
  1528. scd3: 900,
  1529. wcd1: 1400,
  1530. wcd2: 2800,
  1531. },
  1532. //2
  1533. {
  1534. scd2: 500,
  1535. scd3: 900,
  1536. wcd1: 1200,
  1537. wcd2: 2400,
  1538. },
  1539. //3
  1540. {
  1541. scd2: 400,
  1542. scd3: 900,
  1543. wcd1: 1200,
  1544. wcd2: 2300,
  1545. },
  1546. //4
  1547. {
  1548. scd2: 400,
  1549. scd3: 900,
  1550. wcd1: 1000,
  1551. wcd2: 2000,
  1552. },
  1553. //5
  1554. {
  1555. scd2: 400,
  1556. scd3: 800,
  1557. wcd1: 900,
  1558. wcd2: 1800,
  1559. },
  1560. //6
  1561. {
  1562. scd2: 300,
  1563. scd3: 800,
  1564. wcd1: 900,
  1565. wcd2: 1750,
  1566. },
  1567. //7
  1568. {
  1569. scd2: 300,
  1570. scd3: 800,
  1571. wcd1: 750,
  1572. wcd2: 1500,
  1573. },
  1574. ];
  1575.  
  1576.  
  1577. function shoot(cooldown = 100) {
  1578. deep_debug("Shoot started!", cooldown);
  1579. extern.onKeyDown(36);
  1580. setTimeout(() => {
  1581. deep_debug("Ending Shoot!", cooldown);
  1582. extern.onKeyUp(36);
  1583. }, cooldown);
  1584. }
  1585.  
  1586. function get_reload(){
  1587. let arr = [...extern.get_convar("game_stats_build")];
  1588. let counter = 0;
  1589. let l = arr.length;
  1590. for(let i = 0; i < l; i++){
  1591. if(arr[i] === '7'){
  1592. counter++;
  1593. }
  1594. }
  1595. return counter;
  1596. }
  1597.  
  1598. function predator_stack(reload) {
  1599. deep_debug("func called");
  1600. let current = predator_reloads[reload];
  1601. deep_debug(current);
  1602. shoot();
  1603. setTimeout(() => {
  1604. shoot(current.scd2);
  1605. }, current.wcd1);
  1606. setTimeout(() => {
  1607. shoot(current.scd3);
  1608. }, current.wcd2);
  1609. }
  1610.  
  1611. //Bot tab
  1612.  
  1613. //iframe creation
  1614. function createInvisibleIframe(url) {
  1615. let existingIframe = document.getElementById('hiddenIframe');
  1616. if (existingIframe) {
  1617. return;
  1618. }
  1619.  
  1620. let iframe = document.createElement('iframe');
  1621. iframe.src = url;
  1622. iframe.id = 'hiddenIframe';
  1623. document.body.appendChild(iframe);
  1624. }
  1625.  
  1626. function removeIframe() {
  1627. let iframe = document.getElementById('hiddenIframe');
  1628. if (iframe) {
  1629. iframe.remove();
  1630. }
  1631. }
  1632.  
  1633. function bot_tab_active_check(){
  1634. if(modules.Functional.Bot_tab.active){
  1635. createInvisibleIframe(link(get_baseUrl(), get_your_lobby(), get_gamemode(), get_team()));
  1636. }else{
  1637. removeIframe();
  1638. }
  1639. }
  1640. setInterval(bot_tab_active_check, 1000);
  1641.  
  1642. //DiepConsole
  1643. function active_diepconsole_render_default(){
  1644. let defaults = ['ren_scoreboard', 'ren_upgrades', 'ren_stats', 'ren_names', 'ren_scoreboard_names'];
  1645. for(let _def of defaults){
  1646. let _setting = modules.DiepConsole.Render.settings[_def]
  1647. _setting.active = true;
  1648. }
  1649. }
  1650. active_diepconsole_render_default();
  1651.  
  1652. function handle_con_toggle(state){
  1653. if(!extern.isConActive() && state && player.inGame){
  1654. one_time_notification('canceled, due to a bug. Make sure to not enable it while in game', notification_rgbs.warning, 5000);
  1655. return;
  1656. }
  1657. if(extern.isConActive() != state){
  1658. extern.execute('con_toggle');
  1659. }
  1660. }
  1661.  
  1662. function update_diep_console(){
  1663. //Modules
  1664. for(let param in modules.DiepConsole){
  1665. let state = modules.DiepConsole[param].active;
  1666. if(param === "con_toggle"){
  1667. handle_con_toggle(state)
  1668. }else if(modules.DiepConsole[param].name != "Render things"){
  1669. extern.set_convar(param, state);
  1670. }
  1671. }
  1672. //Render Settings
  1673. for(let ren_param in modules.DiepConsole.Render.settings){
  1674. let state = modules.DiepConsole.Render.settings[ren_param].active;
  1675. if(modules.DiepConsole.Render.settings[ren_param].name != "Rendering"){
  1676. extern.set_convar(ren_param, state);
  1677. }
  1678. }
  1679. }
  1680. setInterval(update_diep_console, 100);
  1681.  
  1682.  
  1683. //////
  1684. //mouse functions
  1685.  
  1686. window.addEventListener('mousemove', function(event) {
  1687. inputs.mouse.real.x = event.clientX;
  1688. inputs.mouse.real.y = event.clientY;
  1689. });
  1690.  
  1691. window.addEventListener('mousedown', function(event) {
  1692. if (modules.Mouse.Anti_aim.settings.Anti_aim.active) {
  1693. if (inputs.mouse.shooting) {
  1694. return;
  1695. }
  1696. inputs.mouse.shooting = true;
  1697. pauseMouseMove();
  1698. //freezeMouseMove();
  1699. setTimeout(function() {
  1700. inputs.mouse.shooting = false;
  1701. mouse_move('extern', inputs.mouse.real.x, inputs.mouse.real.y);
  1702. click_at('extern', inputs.mouse.real.x, inputs.mouse.real.y);
  1703. }, modules.Mouse.Anti_aim.settings.Timing.selected);
  1704. };
  1705. });
  1706.  
  1707. function handle_mouse_functions() {
  1708. window.requestAnimationFrame(handle_mouse_functions);
  1709. if (!player.connected) {
  1710. return;
  1711. }
  1712. modules.Mouse.Freeze_mouse.active ? freezeMouseMove() : unfreezeMouseMove();
  1713. modules.Mouse.Anti_aim.settings.Anti_aim.active ? anti_aim("On") : anti_aim("Off");
  1714. }
  1715. window.requestAnimationFrame(handle_mouse_functions);
  1716.  
  1717. //anti aim
  1718. function detect_corner() {
  1719. deep_debug('corner detect called');
  1720. let w = window.innerWidth;
  1721. let h = window.innerHeight;
  1722. let center = {
  1723. x: w / 2,
  1724. y: h / 2
  1725. };
  1726. let lr, ud;
  1727. inputs.mouse.real.x > center.x ? lr = "r" : lr = "l";
  1728. inputs.mouse.real.y > center.y ? ud = "d" : ud = "u";
  1729. deep_debug('output: ', lr + ud);
  1730. return lr + ud;
  1731. }
  1732.  
  1733. function look_at_corner(corner) {
  1734. deep_debug('look at corner called with corner', corner);
  1735. if (!inputs.mouse.shooting) {
  1736. let w = window.innerWidth;
  1737. let h = window.innerHeight;
  1738. deep_debug('w and h', w, h);
  1739. deep_debug('inputs: ', inputs);
  1740. switch (corner) {
  1741. case "lu":
  1742. anti_aim_at('extern', w, h);
  1743. break
  1744. case "ld":
  1745. anti_aim_at('extern', w, 0);
  1746. break
  1747. case "ru":
  1748. anti_aim_at('extern', 0, h);
  1749. break
  1750. case "rd":
  1751. anti_aim_at('extern', 0, 0);
  1752. break
  1753. }
  1754. }
  1755. }
  1756.  
  1757. function anti_aim(toggle) {
  1758. deep_debug('anti aim called with:', toggle);
  1759. if(!player.inGame) return;
  1760. switch (toggle) {
  1761. case "On":
  1762. if (modules.Mouse.Anti_aim.settings.Anti_aim.active && !inputs.mouse.isFrozen) {
  1763. deep_debug('condition !modules.Mouse.Anti_aim.settings.active met');
  1764. look_at_corner(detect_corner());
  1765. }
  1766. break
  1767. case "Off":
  1768. //(inputs.mouse.isFrozen && !modules.Mouse.Freeze_mouse.active) ? unfreezeMouseMove() : null;
  1769. (inputs.mouse.isPaused && !modules.Mouse.Freeze_mouse.active) ? unpauseMouseMove() : null;
  1770. break
  1771. }
  1772. }
  1773.  
  1774. // Example: Freeze and unfreeze
  1775. function pauseMouseMove() {
  1776. if(!inputs.mouse.isPaused){
  1777. inputs.mouse.isForced = true;
  1778. inputs.mouse.force.x = inputs.mouse.real.x
  1779. inputs.mouse.force.y = inputs.mouse.real.y;
  1780. inputs.mouse.isPaused = true; //tell the script that freezing finished
  1781. }
  1782. }
  1783.  
  1784. function freezeMouseMove() {
  1785. if(!inputs.mouse.isFrozen){
  1786. inputs.mouse.isForced = true;
  1787. inputs.mouse.force.x = inputs.mouse.real.x
  1788. inputs.mouse.force.y = inputs.mouse.real.y;
  1789. inputs.mouse.isFrozen = true; //tell the script that freezing finished
  1790. }
  1791. /*
  1792. if (!inputs.mouse.isFrozen) {
  1793. inputs.mouse.isFrozen = true;
  1794. clear_onTouch();
  1795. deep_debug("Mousemove events are frozen.");
  1796. }
  1797. */
  1798. }
  1799.  
  1800. function unpauseMouseMove(){
  1801. if (inputs.mouse.isPaused && !inputs.mouse.isShooting) {
  1802. inputs.mouse.isForced = false;
  1803. inputs.mouse.isPaused = false; //tell the script that unfreezing finished
  1804. }
  1805. }
  1806.  
  1807. function unfreezeMouseMove() {
  1808. if (inputs.mouse.isFrozen) {
  1809. inputs.mouse.isForced = false;
  1810. inputs.mouse.isFrozen = false; //tell the script that unfreezing finished
  1811. }
  1812. /*
  1813. if (inputs.mouse.isFrozen && !inputs.mouse.isShooting) {
  1814. inputs.mouse.isFrozen = false;
  1815. redefine_onTouch();
  1816. deep_debug("Mousemove events are active.");
  1817. }
  1818. */
  1819. }
  1820.  
  1821. function click_at(input_or_extern, x, y, delay1 = 150, delay2 = 500) {
  1822. i_e(input_or_extern, 'onTouchStart', -1, x, y);
  1823. setTimeout(() => {
  1824. i_e(input_or_extern, 'onTouchEnd', -1, x, y);
  1825. }, delay1);
  1826. setTimeout(() => {
  1827. inputs.mouse.shooting = false;
  1828. }, delay2);
  1829. }
  1830.  
  1831. /* it was a bug and is now patched
  1832. function ghost_click_at(input_or_extern, x, y, delay1 = 150, delay2 = 500) {
  1833. i_e(input_or_extern, 'onTouchStart', -2, x, y);
  1834. setTimeout(() => {
  1835. i_e(input_or_extern, 'onTouchEnd', -2, x, y);
  1836. }, delay1);
  1837. setTimeout(() => {
  1838. inputs.mouse.shooting = false;
  1839. }, delay2);
  1840. }
  1841. */
  1842.  
  1843. function mouse_move(input_or_extern, x, y) {
  1844. deep_debug('mouse move called with', x, y);
  1845. apply_force(x, y);
  1846. i_e(input_or_extern, 'onTouchMove', -1, x, y);
  1847. disable_force();
  1848. }
  1849.  
  1850. function anti_aim_at(input_or_extern, x, y) {
  1851. deep_debug('frozen, shooting', inputs.mouse.isFrozen, inputs.mouse.isShooting);
  1852. deep_debug('anti aim at called with:', x, y);
  1853. if (inputs.mouse.shooting) {
  1854. deep_debug('quit because inputs.mouse.shooting');
  1855. return;
  1856. }
  1857. mouse_move(input_or_extern, x, y);
  1858. }
  1859. //////
  1860.  
  1861. //Custom Auto Spin
  1862. function getMouseAngle(x, y) {
  1863. const centerX = window.innerWidth / 2;
  1864. const centerY = window.innerHeight / 2;
  1865.  
  1866. const dx = x - centerX;
  1867. const dy = y - centerY;
  1868.  
  1869. let angle = Math.atan2(dy, dx) * (180 / Math.PI);
  1870.  
  1871. return angle < 0 ? angle + 360 : angle;
  1872. }
  1873.  
  1874. function offset_Angle(angle){
  1875. let _angle;
  1876. if(angle <= 360){
  1877. _angle = angle;
  1878. }else{
  1879. _angle = angle-360;
  1880. while(_angle > 360){
  1881. _angle -= 360;
  1882. }
  1883. }
  1884. return _angle;
  1885. }
  1886.  
  1887. function getPointOnCircle(degrees) {
  1888. const centerX = window.innerWidth / 2;
  1889. const centerY = window.innerHeight / 2;
  1890. const radius = Math.min(window.innerWidth, window.innerHeight) / 2;
  1891.  
  1892. const radians = degrees * (Math.PI / 180);
  1893. const x = centerX + radius * Math.cos(radians);
  1894. const y = centerY + radius * Math.sin(radians);
  1895.  
  1896. return { x:x, y:y };
  1897. }
  1898.  
  1899. let cas_force = false;
  1900. let cas_active = false;
  1901. let starting_angle = 0;
  1902. let temp_interval = setInterval(start_custom_spin, modules.Mouse.Custom_auto_spin.settings.Interval.selected);
  1903. function start_keyDown_Proxy(){
  1904. extern.onKeyDown = new Proxy(extern.onKeyDown, {
  1905. apply: function (target, thisArgs, args){
  1906. if(modules.Mouse.Custom_auto_spin.settings.Replace_auto_spin.active && args[0] === diep_keys.KeyC){
  1907. cas_active = !cas_active;
  1908. new_notification(`Custom Auto Spin: ${cas_active?'On':'Off'}`, notification_rgbs.normal, 4000);
  1909. return;
  1910. }
  1911. return Reflect.apply(target, thisArgs, args);
  1912. }
  1913. });
  1914. }
  1915.  
  1916. function start_custom_spin(){
  1917. clearInterval(temp_interval);
  1918. temp_interval = setInterval(start_custom_spin, modules.Mouse.Custom_auto_spin.settings.Interval.selected);
  1919. if(!player.inGame) return;
  1920. if(!modules.Mouse.Custom_auto_spin.settings.Replace_auto_spin.active) cas_active = modules.Mouse.Custom_auto_spin.settings.Custom_auto_spin.active;
  1921. if(!cas_active){
  1922. starting_angle = getMouseAngle(inputs.mouse.real.x, inputs.mouse.real.y);
  1923. if(inputs.mouse.isForced && cas_force){
  1924. disable_force();
  1925. cas_force = false;
  1926. }
  1927. }else{
  1928. cas_force = true;
  1929. let l = Math.pow(2, modules.Mouse.Custom_auto_spin.settings.Smoothness.selected);
  1930. console.log(l);
  1931. let angle_peace = 360/l;
  1932. console.log(angle_peace);
  1933. let time_peace = modules.Mouse.Custom_auto_spin.settings.Interval.selected/l;
  1934. for(let i = 0; i < l; i++){
  1935. setTimeout(() => {
  1936. let temp_angle = offset_Angle(starting_angle + angle_peace * i);
  1937. let temp_coords = getPointOnCircle(temp_angle);
  1938. apply_force(temp_coords.x, temp_coords.y);
  1939. i_e('extern', 'onTouchMove', -1, temp_coords.x, temp_coords.y);
  1940. }, time_peace*i);
  1941. }
  1942. }
  1943. }
  1944.  
  1945. //Sandbox Auto Lvl up
  1946. function sandbox_lvl_up() {
  1947. if (modules.Functional.Sandbox_lvl_up.active && player.connected && player.inGame && player.gamemode === "sandbox") {
  1948. document.querySelector("#sandbox-max-level").click();
  1949. }
  1950. }
  1951. setInterval(sandbox_lvl_up, 500);
  1952.  
  1953. //START, autorespawn Module
  1954.  
  1955. //name saving logic
  1956. var killer_names = localStorage.getItem("[Diep.io+] saved names") ? JSON.parse(localStorage.getItem("[Diep.io+] saved names")) : ['r!PsAw', 'TestTank'];
  1957. function import_killer_names(){
  1958. let imported_string = prompt('Paste killer names here: ', '["name1", "name2", "name3"]');
  1959. killer_names = killer_names.concat(JSON.parse(imported_string));
  1960. killer_names = [...new Set(killer_names)];
  1961. localStorage.setItem("[Diep.io+] saved names", JSON.stringify(killer_names));
  1962. }
  1963. let banned_names = ["Pentagon", "Triangle", "Square", "Crasher", "Mothership", "Guardian of Pentagons", "Fallen Booster", "Fallen Overlord", "Necromancer", "Defender", "Unnamed Tank"];
  1964. function check_and_save_name(){
  1965. deep_debug(_c.killer_name, !killer_names.includes(_c.killer_name));
  1966. if(_c.screen_state === 'game-over' && !banned_names.includes(_c.killer_name) && !killer_names.includes(_c.killer_name)){
  1967. deep_debug("Condition met!");
  1968. killer_names.push(_c.killer_name);
  1969. deep_debug("Added");
  1970. killer_names = [...new Set(killer_names)];
  1971. if(modules.Functional.Auto_respawn.settings.Remember.active){
  1972. localStorage.setItem("[Diep.io+] saved names", JSON.stringify(killer_names));
  1973. deep_debug("saved list");
  1974. }
  1975. }
  1976. }
  1977.  
  1978. function get_random_killer_name(){
  1979. let l = killer_names.length;
  1980. let index = Math.floor(Math.random() * l);
  1981. return killer_names[index];
  1982. }
  1983.  
  1984. //Random Symbols/Numbers/Letters
  1985. function generate_random_name_string(type){
  1986. let final_result = '';
  1987. let chars = '';
  1988. switch(type){
  1989. case "Symbols":
  1990. chars = '!@#$%^&*()_+=-.,][';
  1991. break
  1992. case "Numbers":
  1993. chars = '1234567890';
  1994. break
  1995. case "Letters":
  1996. chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  1997. break
  1998. }
  1999. for (let i = 0; i < 16; i++) {
  2000. final_result += chars[Math.floor(Math.random() * chars.length)];
  2001. }
  2002. return final_result;
  2003. }
  2004. //ascii inject
  2005. function get_ascii_inject(type){
  2006. let asciiArray = [];
  2007. switch(type){
  2008. case "Glitched":
  2009. asciiArray = [0x110000];
  2010. break
  2011. case "N A M E":
  2012. asciiArray = player.name.split("").flatMap(char => [char.charCodeAt(0), 10]).slice(0, -1);
  2013. break
  2014. }
  2015. let interesting = {
  2016. length: asciiArray.length,
  2017. charCodeAt(i) {
  2018. return asciiArray[i];
  2019. },
  2020. };
  2021. const argument = {
  2022. toString() {
  2023. return interesting;
  2024. },
  2025. };
  2026. return argument;
  2027. }
  2028.  
  2029. //main Loop
  2030. function get_respawn_name_by_type(type){
  2031. let temp_name = '';
  2032. switch(type){
  2033. case "Normal":
  2034. temp_name = player.name;
  2035. break
  2036. case "Glitched":
  2037. temp_name = get_ascii_inject(type);
  2038. break
  2039. case "N A M E":
  2040. temp_name = get_ascii_inject(type);
  2041. break
  2042. case "Random Killer":
  2043. temp_name = get_random_killer_name();
  2044. break
  2045. case "Random Symbols":
  2046. temp_name = generate_random_name_string('Symbols');
  2047. break
  2048. case "Random Numbers":
  2049. temp_name = generate_random_name_string('Numbers');
  2050. break
  2051. case "Random Letters":
  2052. temp_name = generate_random_name_string('Letters');
  2053. break
  2054. }
  2055. return temp_name;
  2056. }
  2057. function respawn() {
  2058. check_and_save_name();
  2059. if (modules.Functional.Auto_respawn.settings.Auto_respawn.active && player.connected && !player.inGame) {
  2060. //prevent respawn after 300k flag
  2061. if(modules.Functional.Auto_respawn.settings.Prevent.active && _c.death_score >= 300000){
  2062. return;
  2063. }
  2064. let type = modules.Functional.Auto_respawn.settings.Name.selected;
  2065. let temp_name = get_respawn_name_by_type(type);
  2066. extern.try_spawn(temp_name);
  2067. }
  2068. }
  2069.  
  2070. setInterval(respawn, 1000);
  2071.  
  2072. //END
  2073.  
  2074. //AntiAfk Timeout
  2075. function AntiAfkTimeout() {
  2076. if (modules.Mouse.Anti_timeout.active && player.connected) {
  2077. extern.onTouchMove(inputs.mouse.real.x, inputs.mouse.real.y);
  2078. }
  2079. }
  2080. setInterval(AntiAfkTimeout, 1000);
  2081.  
  2082. //Zoom
  2083. function start_zoom_proxy(){
  2084. input.setScreensizeZoom = new Proxy(input.setScreensizeZoom, {
  2085. apply: function(target, thisArgs, args){
  2086. player.base_value = args[1];
  2087. let factor = modules.Functional.Zoom.value / 100;
  2088. player.dpr = player.base_value * factor;
  2089. let newargs = [args[0], player.dpr];
  2090. return Reflect.apply(target, thisArgs, newargs);
  2091. }
  2092. });
  2093. }
  2094. function HandleZoom() {
  2095. if(player.connected){
  2096. //let base_value = 1;
  2097. //let factor = modules.Functional.Zoom.value / 100;
  2098. //player.dpr = base_value * factor;
  2099. let diepScale = player.base_value * Math.floor(player.ui_scale * windowScaling() * 25) / 25;
  2100. extern.setScreensizeZoom(diepScale, player.base_value);
  2101. extern.updateDPR(player.dpr);
  2102. }
  2103. }
  2104. setInterval(HandleZoom, 100);
  2105.  
  2106. //ctx helper functions
  2107. function ctx_arc(x, y, r, sAngle, eAngle, counterclockwise, c, stroke_or_fill = 'fill', _globalAlpha=1, _lineWidth = '2px') {
  2108. let original_ga = ctx.globalAlpha;
  2109. let original_lw = ctx.lineWidth;
  2110. ctx.beginPath();
  2111. ctx.arc(x, y, r, sAngle, eAngle, counterclockwise);
  2112. ctx.globalAlpha = _globalAlpha;
  2113. switch(stroke_or_fill){
  2114. case "fill":
  2115. ctx.fillStyle = c;
  2116. ctx.fill();
  2117. break
  2118. case "stroke":
  2119. ctx.lineWidth = _lineWidth;
  2120. ctx.strokeStyle = c;
  2121. ctx.stroke();
  2122. ctx.lineWidth = original_lw;
  2123. break
  2124. }
  2125. ctx.globalAlpha = original_ga;
  2126. }
  2127.  
  2128. function ctx_text(fcolor, scolor, lineWidth, font, text, textX, textY) {
  2129. deep_debug('called crx_text with: ', fcolor, scolor, lineWidth, font, text, textX, textY);
  2130. ctx.fillStyle = fcolor;
  2131. ctx.lineWidth = lineWidth;
  2132. ctx.font = font;
  2133. ctx.strokeStyle = scolor;
  2134. ctx.strokeText(`${text}`, textX, textY)
  2135. ctx.fillText(`${text}`, textX, textY)
  2136. }
  2137.  
  2138. function ctx_rect(x, y, a, b, c) {
  2139. deep_debug('called ctx_rect with: ', x, y, a, b, c);
  2140. ctx.beginPath();
  2141. ctx.strokeStyle = c;
  2142. ctx.strokeRect(x, y, a, b);
  2143. }
  2144.  
  2145. function transparent_rect_fill(x, y, a, b, scolor, fcolor, opacity){
  2146. deep_debug('called transparent_rect_fill with: ', x, y, a, b, scolor, fcolor, opacity);
  2147. ctx.beginPath();
  2148. ctx.rect(x, y, a, b);
  2149.  
  2150. // Set stroke opacity
  2151. ctx.globalAlpha = 1;// Reset to 1 for stroke, or set as needed
  2152. ctx.strokeStyle = scolor;
  2153. ctx.stroke();
  2154.  
  2155. // Set fill opacity
  2156. ctx.globalAlpha = opacity;// Set the opacity for the fill color
  2157. ctx.fillStyle = fcolor;
  2158. ctx.fill();
  2159.  
  2160. // Reset globalAlpha back to 1 for future operations
  2161. ctx.globalAlpha = 1;
  2162. }
  2163.  
  2164. //key visualiser
  2165. let ctx_wasd = {
  2166. square_sizes: { //in windowScaling
  2167. a: 50,
  2168. b: 50
  2169. },
  2170. text_props: {
  2171. lineWidth: 3,
  2172. font: 1 + "em Ubuntu",
  2173. },
  2174. square_colors: {
  2175. stroke: "black",
  2176. unpressed: "yellow",
  2177. pressed: "orange"
  2178. },
  2179. text_colors: {
  2180. stroke: "black",
  2181. unpressed: "orange",
  2182. pressed: "red"
  2183. },
  2184. w: {
  2185. x: 300,
  2186. y: 200,
  2187. pressed: false,
  2188. text: 'W'
  2189. },
  2190. a: {
  2191. x: 350,
  2192. y: 150,
  2193. pressed: false,
  2194. text: 'A'
  2195. },
  2196. s: {
  2197. x: 300,
  2198. y: 150,
  2199. pressed: false,
  2200. text: 'S'
  2201. },
  2202. d: {
  2203. x: 250,
  2204. y: 150,
  2205. pressed: false,
  2206. text: 'D'
  2207. },
  2208. l_m: {
  2209. x: 350,
  2210. y: 75,
  2211. pressed: false,
  2212. text: 'LMC'
  2213. },
  2214. r_m: {
  2215. x: 250,
  2216. y: 75,
  2217. pressed: false,
  2218. text: 'RMC'
  2219. },
  2220. }
  2221.  
  2222. function visualise_keys(){
  2223. let keys = ['w', 'a', 's', 'd', 'l_m', 'r_m'];
  2224. let l = keys.length;
  2225. for(let i = 0; i < l; i++){
  2226. let args = {
  2227. x: canvas.width - dim_c.windowScaling_2_canvas(ctx_wasd[keys[i]].x),
  2228. y: canvas.height - dim_c.windowScaling_2_canvas(ctx_wasd[keys[i]].y),
  2229. a: dim_c.windowScaling_2_canvas(ctx_wasd.square_sizes.a),
  2230. b: dim_c.windowScaling_2_canvas(ctx_wasd.square_sizes.b),
  2231. s_c: ctx_wasd.square_colors.stroke,
  2232. f_c: ctx_wasd[keys[i]].pressed? ctx_wasd.square_colors.pressed : ctx_wasd.square_colors.unpressed,
  2233. t_s: ctx_wasd.text_colors.stroke,
  2234. t_f: ctx_wasd[keys[i]].pressed? ctx_wasd.text_colors.pressed : ctx_wasd.text_colors.unpressed,
  2235. t_lineWidth: ctx_wasd.text_props.lineWidth,
  2236. t_font: ctx_wasd.text_props.font,
  2237. text: ctx_wasd[keys[i]].text,
  2238. opacity: 0.25
  2239. }
  2240. deep_debug(args);
  2241. transparent_rect_fill(
  2242. args.x,
  2243. args.y,
  2244. args.a,
  2245. args.b,
  2246. args.s_c,
  2247. args.f_c,
  2248. args.opacity
  2249. );
  2250. ctx_text(
  2251. args.t_f,
  2252. args.t_s,
  2253. args.t_lineWidth,
  2254. args.t_font,
  2255. args.text,
  2256. args.x+(args.a/2),
  2257. args.y+(args.b/2)
  2258. );
  2259. }
  2260. }
  2261.  
  2262. //Key Binds for Tank Upgrading
  2263. let selected_box = null;
  2264. let _bp = { //box parameters
  2265. startX: 47,
  2266. startY: 67,
  2267. distX: 13,
  2268. distY: 9,
  2269. width: 86,
  2270. height: 86,
  2271. outer_xy: 2
  2272. }
  2273.  
  2274. let _bo = { //box offsets
  2275. offsetX: _bp.width + (_bp.outer_xy * 2) + _bp.distX,
  2276. offsetY: _bp.height + (_bp.outer_xy * 2) + _bp.distY
  2277. }
  2278.  
  2279. function step_offset(steps, offset){
  2280. let final_offset = 0;
  2281. switch(offset){
  2282. case "x":
  2283. final_offset = _bp.startX + (steps * _bo.offsetX);
  2284. break
  2285. case "y":
  2286. final_offset = _bp.startY + (steps * _bo.offsetY);
  2287. break
  2288. }
  2289. return final_offset;
  2290. }
  2291.  
  2292. const boxes = [
  2293. {
  2294. color: "lightblue",
  2295. LUcornerX: _bp.startX,
  2296. LUcornerY: _bp.startY,
  2297. KeyBind: "R"
  2298. },
  2299. {
  2300. color: "green",
  2301. LUcornerX: _bp.startX + _bo.offsetX,
  2302. LUcornerY: _bp.startY,
  2303. KeyBind: "T"
  2304. },
  2305. {
  2306. color: "red",
  2307. LUcornerX: _bp.startX,
  2308. LUcornerY: _bp.startY + _bo.offsetY,
  2309. KeyBind: "F"
  2310. },
  2311. {
  2312. color: "yellow",
  2313. LUcornerX: _bp.startX + _bo.offsetX,
  2314. LUcornerY: _bp.startY + _bo.offsetY,
  2315. KeyBind: "G"
  2316. },
  2317. {
  2318. color: "blue",
  2319. LUcornerX: _bp.startX,
  2320. LUcornerY: step_offset(2, "y"),
  2321. KeyBind: "V"
  2322. },
  2323. {
  2324. color: "purple",
  2325. LUcornerX: _bp.startX + _bo.offsetX,
  2326. LUcornerY: step_offset(2, "y"),
  2327. KeyBind: "B"
  2328. }
  2329. ]
  2330.  
  2331. //upgrading Tank logic
  2332. function upgrade_get_coords(color){
  2333. let l = boxes.length;
  2334. let upgrade_coords = {x: "not defined", y: "not defined"};
  2335. for(let i = 0; i < l; i++){
  2336. if(boxes[i].color === color){
  2337. upgrade_coords.x = dim_c.windowScaling_2_window(boxes[i].LUcornerX + (_bp.width/2));
  2338. upgrade_coords.y = dim_c.windowScaling_2_window(boxes[i].LUcornerY + (_bp.height/2));
  2339. }
  2340. }
  2341. deep_debug(upgrade_coords);
  2342. return upgrade_coords;
  2343. }
  2344.  
  2345. function upgrade(color, delay = 100, cdelay1, cdelay2){
  2346. let u_coords = upgrade_get_coords(color);
  2347. //ghost_click_at('extern', u_coords.x, u_coords.y, cdelay1, cdelay2);
  2348. click_at('extern', u_coords.x, u_coords.y, cdelay1, cdelay2); //using this since ghost_click was patched
  2349. }
  2350.  
  2351. function visualise_tank_upgrades(){
  2352. let l = boxes.length;
  2353. for (let i = 0; i < l; i++) {
  2354. let coords = upgrade_get_coords(boxes[i].color);
  2355. ctx_text(boxes[i].color, "black", 6, 1.5 + "em Ubuntu", `[${boxes[i].KeyBind}]`, coords.x, coords.y);
  2356. }
  2357. }
  2358.  
  2359. function check_tu_KeyBind(_KeyBind){
  2360. let l = boxes.length;
  2361. for (let i = 0; i < l; i++) {
  2362. if(_KeyBind === `Key${boxes[i].KeyBind}`){
  2363. deep_debug(_KeyBind, `Key${boxes[i].KeyBind}`, _KeyBind === `Key${boxes[i].KeyBind}`);
  2364. upgrade(boxes[i].color);
  2365. }
  2366. }
  2367. }
  2368.  
  2369. document.body.addEventListener("keydown", function(e) {
  2370. switch(e.code){
  2371. case "KeyW":
  2372. ctx_wasd.w.pressed = true;
  2373. break
  2374. case "KeyA":
  2375. ctx_wasd.a.pressed = true;
  2376. break
  2377. case "KeyS":
  2378. ctx_wasd.s.pressed = true;
  2379. break
  2380. case "KeyD":
  2381. ctx_wasd.d.pressed = true;
  2382. break
  2383. }
  2384. if(modules.Functional.Tank_upgrades.settings.Tank_upgrades.active){
  2385. check_tu_KeyBind(e.code);
  2386. }
  2387. });
  2388.  
  2389. document.body.addEventListener("keyup", function(e) {
  2390. deep_debug(`unpressed ${e.code}`);
  2391. switch(e.code){
  2392. case "KeyW":
  2393. ctx_wasd.w.pressed = false;
  2394. break
  2395. case "KeyA":
  2396. ctx_wasd.a.pressed = false;
  2397. break
  2398. case "KeyS":
  2399. ctx_wasd.s.pressed = false;
  2400. break
  2401. case "KeyD":
  2402. ctx_wasd.d.pressed = false;
  2403. break
  2404. }
  2405. deep_debug('====DID UNPRESS??', ctx_wasd.w.pressed, ctx_wasd.a.pressed, ctx_wasd.s.pressed, ctx_wasd.d.pressed);
  2406. });
  2407.  
  2408. document.body.addEventListener("mousedown", function(e) {
  2409. switch(e.button){
  2410. case 0:
  2411. ctx_wasd.l_m.pressed = true;
  2412. break
  2413. case 2:
  2414. ctx_wasd.r_m.pressed = true;
  2415. break
  2416. }
  2417. });
  2418.  
  2419. document.body.addEventListener("mouseup", function(e) {
  2420. switch(e.button){
  2421. case 0:
  2422. ctx_wasd.l_m.pressed = false;
  2423. break
  2424. case 2:
  2425. ctx_wasd.r_m.pressed = false;
  2426. break
  2427. }
  2428. });
  2429. //destroyer cooldown visualiser
  2430. let times_watcher = {
  2431. waiting: false,
  2432. cooldowns: [2540, 2311, 2201, 1911, 1760, 1681, 1560, 1381],
  2433. }
  2434.  
  2435. function draw_destroyer_cooldown(){
  2436. let c = times_watcher.waiting? 'red' : 'lime' ;
  2437. ctx_arc(inputs.mouse.real.x, inputs.mouse.real.y, 50*player.dpr, 0, 2 * Math.PI, false, c, 'fill', 0.3);
  2438. }
  2439.  
  2440. function handle_cooldown(_cd){
  2441. times_watcher.waiting = true;
  2442. setTimeout(() => {
  2443. times_watcher.waiting = false;
  2444. }, _cd);
  2445. }
  2446. document.body.addEventListener("mousedown", function(e) {
  2447. if(e.button === 0 && !times_watcher.waiting && player.inGame){
  2448. let _cd = times_watcher.cooldowns[modules.Visual.destroyer_cooldown.settings.reload.selected];
  2449. handle_cooldown(_cd);
  2450. }
  2451. });
  2452.  
  2453. document.body.addEventListener("keydown", function(e){
  2454. if(e.keyCode === 32 && !times_watcher.waiting && player.inGame){
  2455. let _cd = times_watcher.cooldowns[modules.Visual.destroyer_cooldown.settings.reload.selected];
  2456. handle_cooldown(_cd);
  2457. }
  2458. });
  2459.  
  2460. //debug function
  2461. function draw_canvas_debug(){
  2462. let temp_textX = canvas.width/2, temp_textY = canvas.height/2;
  2463. let temp_texts = [
  2464. `Your Real mouse position! x: ${inputs.mouse.real.x} y: ${inputs.mouse.real.y}`,
  2465. `Scaled down for the game! x: ${(inputs.mouse.game.x).toFixed(2)} y: ${(inputs.mouse.game.y).toFixed(2)}`,
  2466. `player values! DPR: ${player.dpr} base value: ${player.base_value} ui scale: ${player.ui_scale}`,
  2467. `window Scaling: ${windowScaling()}`,
  2468. `Canvas! width: ${canvas.width} height: ${canvas.height}`,
  2469. `Window! width: ${window.innerWidth} height: ${window.innerHeight}`,
  2470. `Ratio between Window and Canvas: ${dim_c.window_2_canvas(1)}`
  2471. ];
  2472. let l = temp_texts.length;
  2473. let _d = (canvas.height/3)/l;
  2474. for(let i = 0; i < l; i++){
  2475. ctx_text('yellow', 'black', 5, 1.5 + "em Ubuntu", temp_texts[i], temp_textX, temp_textY + (i * _d));
  2476. }
  2477. //drawing line from your real mouse position, to your ingame mouse position
  2478. ctx.beginPath();
  2479. ctx.strokeStyle = "Red";
  2480. ctx.moveTo(inputs.mouse.real.x, inputs.mouse.real.y);
  2481. ctx.lineTo(inputs.mouse.game.x*player.dpr, inputs.mouse.game.y*player.dpr);
  2482. ctx.stroke();
  2483. }
  2484.  
  2485. //canvas gui (try to keep this in the end
  2486. setTimeout(() => {
  2487. let gui = () => {
  2488. if (player.inGame) {
  2489. //DEBUG start
  2490. if(deep_debug_properties.canvas){
  2491. draw_canvas_debug();
  2492. }
  2493. //DEBUG end
  2494. if(modules.Functional.Tank_upgrades.settings.visualise.active){
  2495. visualise_tank_upgrades();
  2496. }
  2497. if (modules.Visual.Key_inputs_visualiser.active) {
  2498. visualise_keys();
  2499. }
  2500. if (modules.Visual.destroyer_cooldown.settings.destroyer_cooldown.active){
  2501. draw_destroyer_cooldown();
  2502. }
  2503. }
  2504. window.requestAnimationFrame(gui); // Start animation loop
  2505. };
  2506. gui();
  2507. }, 500); // Delay before starting the rendering
  2508.  
  2509. //init
  2510.  
  2511. function update_information() {
  2512. window.requestAnimationFrame(update_information);
  2513. let teams = ["blue", "red", "purple", "green"];
  2514. player.connected = !!window.lobby_ip;
  2515. player.connected? player.inGame = !!extern.doesHaveTank() : null;
  2516. player.name = document.getElementById("spawn-nickname").value;
  2517. player.team = teams[parseInt(_c.party_link.split('x')[1])];
  2518. player.gamemode = _c.active_gamemode;
  2519. player.ui_scale = parseFloat(localStorage.getItem("d:ui_scale"));
  2520. }
  2521. window.requestAnimationFrame(update_information);
  2522.  
  2523. function waitForConnection() {
  2524. if (player.connected) {
  2525. define_onTouch();
  2526. start_input_proxies();
  2527. start_zoom_proxy();
  2528. start_keyDown_Proxy()
  2529. } else {
  2530. setTimeout(waitForConnection, 100);
  2531. }
  2532. }
  2533. waitForConnection();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址