Diep.io x03 Mod Menu

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

当前为 2023-04-26 提交的版本,查看 最新版本

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