Diep.io x03 Mod Menu

Loop upgrade custom builds, render aim line, render factory guide circle, and more.

目前为 2024-09-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Diep.io x03 Mod Menu
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @homepage https://github.com/x032205/diep_mod_menu
  6. // @description Loop upgrade custom builds, render aim line, render factory guide circle, and more.
  7. // @author https://github.com/x032205
  8. // @match https://diep.io/
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. const main_panel = document.createElement("div");
  17. main_panel.id = "main_panel";
  18.  
  19. const anchor = document.createElement("a");
  20. anchor.id = "anchor";
  21. anchor.style.zIndex = "1000";
  22.  
  23. const header = document.createElement("h1");
  24. header.textContent = "x03 Mod Menu | Toggle: [R]";
  25. anchor.appendChild(header);
  26.  
  27. const holder_panel = document.createElement("div");
  28. holder_panel.id = "holder_panel";
  29. anchor.appendChild(holder_panel);
  30.  
  31. const side_panel = document.createElement("div");
  32. side_panel.classList.add("panel_1");
  33. holder_panel.appendChild(side_panel);
  34.  
  35. const display_panel = document.createElement("div");
  36. display_panel.classList.add("panel_1");
  37. holder_panel.appendChild(display_panel);
  38. display_panel.style.width = "100%";
  39. display_panel.style.marginLeft = "4px";
  40. display_panel.innerHTML = `<h2>select a tab</h2>`;
  41.  
  42. const view_line = document.createElement("div");
  43. view_line.style.textAlign = "left";
  44. view_line.style.alignItems = "center";
  45. view_line.style.height = "33px";
  46. view_line.style.display = "flex";
  47.  
  48. const view_line_text = document.createElement("span");
  49. view_line_text.style.fontWeight = "bold";
  50. view_line_text.textContent = "View Aim Line";
  51.  
  52. const view_line_label = document.createElement("label");
  53. view_line_label.classList.add("switch");
  54.  
  55. const view_line_toggle = document.createElement("INPUT");
  56. view_line_toggle.setAttribute("type", "checkbox");
  57. view_line_label.appendChild(view_line_toggle);
  58.  
  59. const view_line_div = document.createElement("div");
  60. view_line_label.appendChild(view_line_div);
  61. view_line.appendChild(view_line_label);
  62. view_line.appendChild(view_line_text);
  63.  
  64. const view_circle = document.createElement("div");
  65. view_circle.style.textAlign = "left";
  66. view_circle.style.alignItems = "center";
  67. view_circle.style.height = "33px";
  68. view_circle.style.display = "flex";
  69.  
  70. const view_circle_text = document.createElement("span");
  71. view_circle_text.style.fontWeight = "bold";
  72. view_circle_text.textContent = "View Factory Circle";
  73.  
  74. const view_circle_label = document.createElement("label");
  75. view_circle_label.classList.add("switch");
  76.  
  77. const view_circle_toggle = document.createElement("INPUT");
  78. view_circle_toggle.setAttribute("type", "checkbox");
  79. view_circle_label.appendChild(view_circle_toggle);
  80.  
  81. const view_circle_div = document.createElement("div");
  82. view_circle_label.appendChild(view_circle_div);
  83. view_circle.appendChild(view_circle_label);
  84. view_circle.appendChild(view_circle_text);
  85.  
  86. const visual_tab = document.createElement("button");
  87. visual_tab.classList.add("tab_button");
  88. side_panel.appendChild(visual_tab);
  89. visual_tab.textContent = "Visual";
  90. visual_tab.onclick = function () {
  91. display_panel.innerHTML = ``;
  92. display_panel.appendChild(view_line);
  93. display_panel.appendChild(view_circle);
  94. };
  95.  
  96. const au_label = document.createElement("span");
  97. au_label.textContent = "Custom Build";
  98. au_label.style.fontWeight = "bold";
  99.  
  100. const au_input = document.createElement("INPUT");
  101. au_input.ariaReadOnly = "true";
  102. au_input.setAttribute("type", "text");
  103. au_input.style.borderColor = "rgb(20 20 20)";
  104. au_input.style.borderRadius = "5px";
  105. au_input.style.marginTop = "4px";
  106. au_input.style.outline = "none";
  107. au_input.style.color = "white";
  108. au_input.placeholder = "000000000000000000000000000000000";
  109. au_input.style.backgroundColor = "rgb(25 25 25)";
  110.  
  111. const au_set_button = document.createElement("button");
  112. au_set_button.classList.add("button");
  113. au_set_button.textContent = "Set Build";
  114.  
  115. au_set_button.onclick = function () {
  116. input.execute("game_stats_build " + au_input.value);
  117. };
  118.  
  119. const au_autoset = document.createElement("div");
  120. au_autoset.style.textAlign = "left";
  121. au_autoset.style.alignItems = "center";
  122. au_autoset.style.height = "33px";
  123. au_autoset.style.display = "flex";
  124.  
  125. const au_autoset_text = document.createElement("span");
  126. au_autoset_text.style.fontWeight = "bold";
  127. au_autoset_text.textContent = "Keep Build on Respawn";
  128.  
  129. const au_autoset_label = document.createElement("label");
  130. au_autoset_label.classList.add("switch");
  131.  
  132. const au_autoset_toggle = document.createElement("INPUT");
  133. au_autoset_toggle.setAttribute("type", "checkbox");
  134. au_autoset_label.appendChild(au_autoset_toggle);
  135.  
  136. const au_autoset_div = document.createElement("div");
  137. au_autoset_label.appendChild(au_autoset_div);
  138. au_autoset.appendChild(au_autoset_label);
  139. au_autoset.appendChild(au_autoset_text);
  140.  
  141. const auto_upgrades_tab = document.createElement("button");
  142. auto_upgrades_tab.classList.add("tab_button");
  143. side_panel.appendChild(auto_upgrades_tab);
  144. auto_upgrades_tab.textContent = "Auto Upgrades";
  145. auto_upgrades_tab.onclick = function () {
  146. display_panel.innerHTML = ``;
  147. display_panel.style.textAlign = "left";
  148. display_panel.appendChild(au_label);
  149. display_panel.appendChild(au_input);
  150. display_panel.appendChild(au_set_button);
  151. display_panel.appendChild(au_autoset);
  152. };
  153.  
  154. const credits_tab = document.createElement("button");
  155. credits_tab.classList.add("tab_button");
  156. side_panel.appendChild(credits_tab);
  157. credits_tab.textContent = "Credits";
  158. credits_tab.onclick = function () {
  159. display_panel.style.textAlign = "center";
  160. display_panel.innerHTML = `
  161. <br>
  162. <h3>Mod menu made by x03</h3>
  163. <p>Discord: <span style="color: rgb(52 211 153)">@someplace</span></p>
  164. <p>Github: <span style="color: rgb(52 211 153)">@x032205</span></p>
  165.  
  166. <style>
  167. br {
  168. margin-top: 30px;
  169. }
  170. p {
  171. margin: 2px;
  172. font-weight: bold;
  173. }
  174. </style>
  175. `;
  176. };
  177.  
  178. const style = document.createElement("style");
  179. style.textContent = `
  180. #main_panel a {
  181. position: absolute;
  182. font-family: 'Outfit', sans-serif;
  183. src: url('https://fonts.googleapis.com/css2?family=Outfit&display=swap');
  184. }
  185.  
  186. #anchor {
  187. display: inline-flex;
  188. flex-direction: column;
  189. width: 600px;
  190. height: 300px;
  191. text-align: center;
  192. top: 300px;
  193. right: 50px;
  194. padding: 0 7px 14px 7px;
  195. color: white;
  196. background: rgb(15 15 15);
  197. border-radius: 7px;
  198. border-style: solid;
  199. border-width: 2px;
  200. border-color: rgb(60 60 60);
  201. }
  202.  
  203. #holder_panel {
  204. display: inline-flex;
  205. flex-direction: row;
  206. height: 100%;
  207. }
  208.  
  209. h1 {
  210. margin-top: 10px;
  211. margin-bottom: 5px;
  212. color: rgb(52 211 153);
  213. }
  214.  
  215. .switch input {
  216. position: absolute;
  217. opacity: 0;
  218. cursor: pointer;
  219. }
  220.  
  221. .switch {
  222. display: inline-block;
  223. font-size: 20px;
  224. height: 1em;
  225. width: 2em;
  226. background: rgb(50 50 50);
  227. border-radius: 1em;
  228. margin-right: 10px;
  229. cursor: pointer;
  230. }
  231.  
  232. .switch div {
  233. height: 1em;
  234. width: 1em;
  235. border-radius: 1em;
  236. background: rgb(100 100 100);
  237. -webkit-transition: all 100ms;
  238. -moz-transition: all 100ms;
  239. transition: all 100ms;
  240. cursor: pointer;
  241. }
  242.  
  243. .switch input:checked + div {
  244. -webkit-transform: translate3d(100%, 0, 0);
  245. -moz-transform: translate3d(100%, 0, 0);
  246. transform: translate3d(100%, 0, 0);
  247. background: rgb(40 200 140)
  248. }
  249.  
  250. .panel_1 {
  251. display: inline-flex;
  252. flex-direction: column;
  253. padding: 4px;
  254. width: fit-content;
  255. height: 100%;
  256. border-radius: 5px;
  257. background: rgb(30 30 30);
  258. white-space: nowrap;
  259. }
  260.  
  261. .button {
  262. font-family: 'Outfit', sans-serif;
  263. src: url('https://fonts.googleapis.com/css2?family=Outfit&display=swap');
  264. font-weight: bold;
  265. cursor: pointer;
  266. font-size: 14px;
  267. padding: 2px 4px 2px 4px;
  268. margin-top: 2px;
  269. margin-bottom: 2px;
  270. color: white;
  271. background: rgb(50 50 50);
  272. border-radius: 3px;
  273. border-style: solid;
  274. border-width: 2px;
  275. border-color: rgb(60 60 60);
  276. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  277. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  278. transition-duration: 50ms;
  279. }
  280.  
  281. .tab_button {
  282. font-family: 'Outfit', sans-serif;
  283. src: url('https://fonts.googleapis.com/css2?family=Outfit&display=swap');
  284. font-weight: bold;
  285. cursor: pointer;
  286. font-size: 18px;
  287. padding: 4px 8px 4px 8px;
  288. margin-bottom: 4px;
  289. color: white;
  290. background: rgb(50 50 50);
  291. border-radius: 3px;
  292. border-style: solid;
  293. border-width: 2px;
  294. border-color: rgb(60 60 60);
  295. transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  296. transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  297. transition-duration: 50ms;
  298. }
  299.  
  300. .tab_button:hover {
  301. background: rgb(60 60 60);
  302. border-color: rgb(80 80 80);
  303. }
  304.  
  305. .button:hover {
  306. background: rgb(60 60 60);
  307. border-color: rgb(80 80 80);
  308. }
  309.  
  310. .tab_button:focus {
  311. background: rgb(50 60 50);
  312. border-color: rgb(50 100 50);
  313. }
  314. `;
  315.  
  316. main_panel.appendChild(anchor);
  317. document.body.appendChild(main_panel);
  318. document.head.appendChild(style);
  319.  
  320. function ToggleDisplay(element_id) {
  321. var element = document.getElementById(element_id);
  322. element.style.display = element.style.display === "none" ? "block" : "none";
  323. }
  324.  
  325. let X, Y, x, y;
  326. let Z = false;
  327. let radius = [];
  328.  
  329. document.body.onkeyup = function (ctx) {
  330. if (ctx.keyCode === 82) {
  331. ToggleDisplay("main_panel");
  332. } else if (
  333. document.activeElement === au_input &&
  334. parseInt(ctx.key) >= 1 &&
  335. parseInt(ctx.key) <= 8
  336. ) {
  337. au_input.value = au_input.value + ctx.key;
  338. } else if (document.activeElement === au_input && ctx.keyCode === 8) {
  339. au_input.value = au_input.value.slice(0, -1);
  340. }
  341. };
  342.  
  343. document.onmousemove = function (event) {
  344. x = event.clientX;
  345. y = event.clientY;
  346. };
  347.  
  348. document.onmousedown = function (e) {
  349. if (e.button == 2) {
  350. Z = true;
  351. }
  352. };
  353.  
  354. document.onmouseup = function (e) {
  355. if (e.button == 2) {
  356. Z = false;
  357. }
  358. };
  359.  
  360. const canvas = document.createElement("canvas");
  361. canvas.style.zIndex = "1001";
  362.  
  363. function get_Radius() {
  364. X = window.innerWidth / 2;
  365. Y = window.innerHeight / 2;
  366. canvas.width = window.innerWidth;
  367. canvas.height = window.innerHeight;
  368.  
  369. radius[0] = window.innerWidth * 0.17681239669;
  370. radius[1] = window.innerWidth * 0.06545454545;
  371. radius[2] = window.innerWidth * 0.16751239669;
  372. radius[3] = window.innerWidth * 0.36;
  373. }
  374. get_Radius();
  375. window.addEventListener("resize", get_Radius);
  376.  
  377. canvas.style.position = "absolute";
  378. canvas.style.top = "0px";
  379. canvas.style.left = "0px";
  380. canvas.style.pointerEvents = "none";
  381.  
  382. document.body.appendChild(canvas);
  383. const ctx = canvas.getContext("2d");
  384.  
  385. function draw() {
  386. ctx.clearRect(0, 0, canvas.width, canvas.height);
  387.  
  388. if (view_line_toggle.checked) {
  389. ctx.beginPath();
  390. ctx.moveTo(X, Y);
  391. ctx.lineTo(x, y);
  392. ctx.lineWidth = 50;
  393. ctx.strokeStyle = "rgba(0, 0, 0, 0.05)";
  394. ctx.stroke();
  395.  
  396. ctx.beginPath();
  397. ctx.moveTo(X, Y);
  398. ctx.lineTo(x, y);
  399. ctx.lineWidth = 2;
  400. ctx.strokeStyle = "rgba(0, 0, 0, 0.7)";
  401. ctx.stroke();
  402. }
  403.  
  404. if (view_circle_toggle.checked) {
  405. ctx.lineWidth = 2;
  406. ctx.beginPath();
  407. ctx.arc(X, Y, radius[3], 0, 2 * Math.PI);
  408. ctx.strokeStyle = "rgba(0, 0, 0, 0.7)";
  409. ctx.stroke();
  410.  
  411. ctx.beginPath();
  412. ctx.arc(x, y, radius[1], 0, 2 * Math.PI);
  413. ctx.stroke();
  414.  
  415. ctx.beginPath();
  416. if (Z) {
  417. ctx.arc(x, y, radius[0], 0, 2 * Math.PI);
  418. } else {
  419. ctx.arc(x, y, radius[2], 0, 2 * Math.PI);
  420. }
  421. ctx.stroke();
  422. }
  423.  
  424. if (au_autoset_toggle.checked) {
  425. input.execute("game_stats_build " + au_input.value);
  426. }
  427. requestAnimationFrame(draw);
  428. }
  429. draw();
  430. })();