Multibox script UPDATED

multibox after 2023 patch

当前为 2023-09-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Multibox script UPDATED
  3. // @namespace http://tampermonkey.net/
  4. // @version 4
  5. // @description multibox after 2023 patch
  6. // @author Mi300#4401
  7. // @match https://diep.io/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @license MIT
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // ==/UserScript==
  13.  
  14.  
  15. let WTF = setInterval (function() {
  16. if (!document.querySelector('d-base').shadowRoot.children[0].shadowRoot.getElementById('username-input')) {
  17. return;
  18. }
  19. clearInterval (WTF)
  20.  
  21. (function() {
  22. var delay = 1000;
  23. (function loop() {
  24. setTimeout(() => {
  25. localStorage.removeItem("rivet:token")
  26. loop();
  27. }, delay);
  28. })();
  29. })();
  30. const p = CanvasRenderingContext2D.prototype
  31.  
  32. const _fill = p.fill,
  33. _beginPath = p.beginPath,
  34. _lineTo = p.lineTo,
  35. _moveTo = p.moveTo,
  36. _getGamepads = window.navigator.getGamepads,
  37. _strokeRect = p.strokeRect,
  38. _toString = Function.prototype.toString;
  39.  
  40.  
  41. let fill,
  42. beginPath,
  43. lineTo,
  44. moveTo,
  45. getGamepads,
  46. strokeRect;
  47.  
  48. let canRespawn = false;
  49. let worldPosition = [0, 0];
  50. let overlay;
  51. let mouseOffset = [0, 0];
  52. let gui = true;
  53. let test = 1;
  54.  
  55. let gamepadConnected = false;
  56. let gamepadAxes = [0, 0, 0, 0]
  57. let gamepadButtons = [
  58. ...Array(17)].map((x) => {
  59. return { pressed: false };
  60. });
  61.  
  62. const fetchGamepad = () => {
  63. return {
  64. axes: gamepadAxes,
  65. buttons: gamepadButtons,
  66. mapping: 'standard',
  67. }
  68. }
  69.  
  70. getGamepads = function(...args) {
  71. if (gamepadConnected) {
  72. return [fetchGamepad()]
  73. }
  74. return false;
  75. }
  76.  
  77.  
  78. let cameraZoom = 0.5;
  79.  
  80. const canvas = document.getElementById ('canvas');
  81.  
  82. let dgg = 'i';
  83.  
  84. function hookMinimapArrow () {
  85.  
  86. let drawInstructions = 0;
  87. let minimapArrowVertex = [];
  88. beginPath = function(...args) {
  89. drawInstructions = 1;
  90. minimapArrowVertex = [];
  91. _beginPath.call(this, ...args);
  92. }
  93. moveTo = function(...args) {
  94. drawInstructions = 2;
  95. minimapArrowVertex.push (args);
  96. _moveTo.call(this, ...args)
  97. }
  98. lineTo = function(...args) {
  99. if (drawInstructions >= 2 && drawInstructions <= 5) {
  100. drawInstructions ++;
  101. minimapArrowVertex.push (args);
  102. } else {
  103. drawInstructions = 0;
  104. }
  105. _lineTo.call(this, ...args)
  106. }
  107. fill = function(...args) {
  108. if (this.globalAlpha != 1) {
  109. _fill.call(this, ...args)
  110. return;
  111. }
  112. if (this.fillStyle != '#000000') {
  113. _fill.call(this, ...args)
  114. return;
  115. }
  116. if (drawInstructions === 4) {
  117. const pos = getAverage (minimapArrowVertex);
  118. worldPosition = getWorldPosition (pos);
  119. }
  120. _fill.call(this, ...args)
  121. }
  122. }
  123. let minimapPosition = [0, 0];
  124. let minimapDim = [0, 0];
  125.  
  126. function hookMinimap () {
  127. strokeRect = function(...args) {
  128. const transform = this.getTransform ();
  129. minimapPosition = [transform.e, transform.f];
  130. minimapDim = [transform.a, transform.d];
  131. _strokeRect.call(this, ...args)
  132. }
  133. }
  134.  
  135. function getWorldPosition (position) {
  136. const ret = [
  137. parseFloat((((position[0] - minimapPosition[0] - minimapDim[0] / 2) / minimapDim[0] * 100) * 460).toFixed (3)),
  138. parseFloat((((position[1] - minimapPosition[1] - minimapDim[1] / 2) / minimapDim[1] * 100) * 460).toFixed (3)),
  139. ]
  140. return ret;
  141. }
  142. const Mi = '';
  143.  
  144. function getAverage (points) {
  145. let ret = [0, 0];
  146. points.forEach (point => {
  147. ret[0] += point[0];
  148. ret[1] += point[1];
  149. });
  150. ret[0] /= points.length;
  151. ret[1] /= points.length;
  152.  
  153. return ret;
  154. }
  155. let dgh = 'M';
  156.  
  157.  
  158. const getDist = (t1, t2) => {
  159. const distX = t1[0] - t2[0];
  160. const distY = t1[1] - t2[1];
  161.  
  162. return [Math.hypot(distX, distY), distX, distY];
  163. };
  164.  
  165. function moveBot () {
  166. input.execute('game_stats_build 565656565656567878787878784478422')
  167. const dangerRadius = Boolean(parseInt(localStorage.followCursor)) ? 750 : 250
  168. gamepadButtons[7].pressed = Boolean(parseInt(localStorage.autoShoot))
  169.  
  170. if (Boolean(parseInt(localStorage.autoRespawn))) {
  171. if (canRespawn) {
  172. input.try_spawn (localStorage.name)
  173. }
  174. }
  175. if (input.should_prevent_unload()) {
  176. canRespawn = true;
  177. }
  178. let masterMouse = GM_getValue('multiboxMouse');
  179. let masterMove = GM_getValue ('multiboxWorld');
  180.  
  181. if (Boolean(parseInt(localStorage.followCursor))) {
  182. masterMove = masterMouse;
  183. }
  184.  
  185. const distanceMouse = getDist (masterMouse, worldPosition);
  186. const distanceMove = getDist (masterMove, worldPosition);
  187.  
  188. if (!masterMouse[0] || !masterMouse[1] || !masterMove[0] || !masterMove[1]) {
  189. return;
  190. }
  191.  
  192.  
  193.  
  194. if (Boolean(parseInt(localStorage.copyMovement))) {
  195. gamepadAxes[0] = masterMove[0] + distanceMove[1] * 100;
  196. gamepadAxes[1] = masterMove[1] + distanceMove[2] * 100;
  197. } else {
  198. gamepadAxes[0] = worldPosition[0];
  199. gamepadAxes[1] = worldPosition[1];
  200. }
  201. gamepadAxes[2] = masterMouse[0] + distanceMouse[1] * 100;
  202. gamepadAxes[3] = masterMouse[1] + distanceMouse[2] * 100;
  203. gamepadConnected = true;
  204. }
  205.  
  206.  
  207.  
  208. function frame () {
  209. overlay.innerHTML = `
  210. <h1>MULTIBOX</h1>
  211. <br> <br>
  212. World position: <br> ${Math.round(worldPosition[0]) + ', ' + Math.round(worldPosition[1])}
  213. <br> <br>
  214. Master Tab: ${Boolean (document.hasFocus ())}
  215. <br> <br>
  216. [F] Multibox Enabled: ${Boolean (parseInt (localStorage.multiboxEnabled))}
  217. <br> <br>
  218. [G] Copy Movement: ${Boolean (parseInt (localStorage.copyMovement))}
  219. <br> <br>
  220. [R] Follow Cursor: ${Boolean (parseInt (localStorage.followCursor))}
  221. <br> <br>
  222. [Q] Toggle Gui: true
  223. <br> <br>
  224. [Z] Auto Respawn: ${Boolean (parseInt (localStorage.autoRespawn))}
  225. <br> <br>
  226. [,] Always Shoot: ${Boolean (parseInt (localStorage.autoShoot))}
  227. <br> <br>
  228. `
  229.  
  230. if (Boolean (document.hasFocus ())) {
  231. gamepadConnected = false;
  232.  
  233.  
  234. const pos1 = mouseOffset[0] / Math.abs(mouseOffset[0])
  235. const pos2 = mouseOffset[1] / Math.abs(mouseOffset[1])
  236. GM_setValue('multiboxWorld', worldPosition);
  237. GM_setValue('multiboxMouse', [
  238. worldPosition[0] + ( (mouseOffset[0] * (4 - (mouseOffset[0] / Math.abs(mouseOffset[0])))) * (1 - (cameraZoom)) * 1.35 ) * 1.6,
  239. worldPosition[1] + ( (mouseOffset[1] * 4) * (1 - cameraZoom) * 1.35 ) * 1.6,
  240. ]);
  241. //0.46699 1 2.14137
  242. //0.38238 1.15
  243. //
  244.  
  245. } else if (localStorage.multiboxEnabled === '1') {
  246. moveBot ();
  247. } else {
  248. gamepadConnected = false;
  249. }
  250. window.requestAnimationFrame (frame);
  251. }
  252.  
  253.  
  254.  
  255.  
  256. document.addEventListener ('keydown', e => {
  257. if (e.key === 'f') {
  258. localStorage.multiboxEnabled = Number (!Boolean (parseInt (localStorage.multiboxEnabled)))
  259. }
  260. if (e.key === 'g') {
  261. localStorage.copyMovement = Number (!Boolean (parseInt (localStorage.copyMovement)))
  262. }
  263. if (e.key === 'r') {
  264. localStorage.followCursor = Number (!Boolean (parseInt (localStorage.followCursor)))
  265. }
  266. if (e.key === 'q') {
  267. gui = !gui;
  268. overlay.style.display = gui ? 'block' : 'none'
  269. }
  270. if (e.key === ',') {
  271. localStorage.autoShoot = Number (!Boolean (parseInt (localStorage.autoShoot)))
  272. }
  273. if (e.key === 'z') {
  274. localStorage.autoRespawn = Number (!Boolean (parseInt (localStorage.autoRespawn)))
  275. }
  276. if (e.key === '[') {
  277. test += 0.25;
  278. }
  279. })
  280.  
  281. document.addEventListener ('mousemove', e => {
  282. const aimRatioX = 1 - (e.x / canvas.width);
  283. const aimRatioY = 1 - (e.y / canvas.height);
  284.  
  285. if (Boolean (document.hasFocus ())) {
  286. localStorage.aimRatioX = aimRatioX;
  287. localStorage.aimRatioY = aimRatioY;
  288. }
  289.  
  290. mouseOffset = [
  291. e.x - canvas.width / 2,
  292. e.y - canvas.height / 2,
  293. ]
  294. });
  295. function terminate () {
  296. if (!localStorage.multiboxEnabled) {
  297. localStorage.multiboxEnabled = 0;
  298. }
  299. if (!localStorage.copyMovement) {
  300. localStorage.copyMovement = 1;
  301. }
  302. if (!localStorage.followCursor) {
  303. localStorage.followCursor = 0;
  304. }
  305. if (!localStorage.autoRespawn) {
  306. localStorage.autoRespawn = 0;
  307. }
  308. if (!localStorage.autoShoot) {
  309. localStorage.autoShoot = 0;
  310. }
  311.  
  312. overlay = document.createElement('div');
  313. overlay.style.position = 'fixed';
  314. overlay.style.top = '1px';
  315. overlay.style.left = '1px';
  316. overlay.style.fontFamily = 'Lucida Console, Courier, monospace';
  317. overlay.style.fontSize = '12px';
  318. overlay.style.color = '#ffffff';
  319. overlay.style.pointerEvents = 'none';
  320. overlay.style.userSelect = 'none';
  321. overlay.style.fontSize = '14px';
  322. overlay.style.backgroundColor = 'gray';
  323. overlay.style.height = '450px';
  324. overlay.style.width = '250px';
  325. overlay.style.borderRadius = '1px'
  326. overlay.style.borderStyle = 'solid'
  327. overlay.style.borderColor = '#404040'
  328. overlay.style.borderWidth = '5px'
  329. overlay.style.textAlign = 'center';
  330. document.body.appendChild(overlay);
  331.  
  332. frame ();
  333. hookMinimapArrow ();
  334. hookMinimap ();
  335.  
  336.  
  337.  
  338. }
  339. terminate ();
  340.  
  341.  
  342.  
  343.  
  344. const toString = function() {
  345.  
  346. switch(this) {
  347. case fill: return _toString.call(_fill);
  348. case moveTo: return _toString.call(_moveTo);
  349. case beginPath: return _toString.call(_beginPath);
  350. case lineTo: return _toString.call(_lineTo);
  351. case getGamepads: return _toString.call(_getGamepads);
  352. case strokeRect: return _toString.call(_strokeRect);
  353. case toString: return _toString.call(_toString);
  354. }
  355.  
  356. return _toString.call(this);
  357.  
  358. };
  359. p.fill = fill;
  360. p.beginPath = beginPath;
  361. p.moveTo = moveTo;
  362. p.lineTo = lineTo;
  363. window.navigator.getGamepads = getGamepads;
  364. p.strokeRect = strokeRect;
  365. Function.prototype.toString = toString;
  366. },400);

QingJ © 2025

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