Multibox script Working December 2023

multibox

  1. // ==UserScript==
  2. // @name Multibox script Working December 2023
  3. // @namespace http://tampermonkey.net/
  4. // @version 20232
  5. // @description multibox
  6. // @author Mi300#4401
  7. // @match https://diep.io/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @license dont copy thx
  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. let canRespawn = false;
  22. let worldPosition = [0, 0];
  23. let overlay;
  24. let mouseOffset = [0, 0];
  25. let gui = true;
  26. let moveKeys = new Array(4)
  27. let tabId = Math.round(Math.random()*10000)
  28. GM_setValue('multiboxEnabled', false)
  29.  
  30. setInterval(function(){
  31. document.title = 'diep.io tab #' + tabId
  32. }, 1000)
  33.  
  34. const canvas = document.getElementById ('canvas');
  35.  
  36. function hook(target, callback){
  37.  
  38. const check = () => {
  39. window.requestAnimationFrame(check)
  40. const func = CanvasRenderingContext2D.prototype[target]
  41.  
  42. if(func.toString().includes(target)){
  43.  
  44. CanvasRenderingContext2D.prototype[target] = new Proxy (func, {
  45. apply (method, thisArg, args) {
  46. callback(method, thisArg, args)
  47.  
  48. return Reflect.apply (method, thisArg, args)
  49. }
  50. });
  51. }
  52. }
  53. check()
  54. }
  55. let dgg = 'i';
  56.  
  57. function hookMinimapArrow () {
  58.  
  59. let drawInstructions = 0;
  60. let minimapArrowVertex = [];
  61. hook ('beginPath', (method, thisArg, args) => {
  62. //console.log('beginPath', args)
  63. drawInstructions = 1;
  64. minimapArrowVertex = [];
  65. });
  66. hook ('moveTo', (method, thisArg, args) => {
  67. //console.log('moveTo', args)
  68. drawInstructions = 2;
  69. minimapArrowVertex.push ( args );
  70. });
  71. hook ('lineTo', (method, thisArg, args) => {
  72. //console.log('lineTo', args)
  73. if (drawInstructions >= 2 && drawInstructions <= 5) {
  74. drawInstructions ++;
  75. minimapArrowVertex.push ( args );
  76.  
  77. } else {
  78. drawInstructions = 0;
  79. }
  80. });
  81. hook ('fill', (method, thisArg, args) => {
  82. //console.log('fill', args)
  83. if (thisArg.fillStyle != '#000000' || thisArg.globalAlpha < 1) {
  84. return;
  85. }
  86. if (drawInstructions === 4) {
  87. const pos = getAverage (minimapArrowVertex);
  88. //console.log(pos)
  89. worldPosition = getWorldPosition (pos);
  90. }
  91. });
  92. }
  93. let minimapPosition = [0, 0];
  94. let minimapDim = [0, 0];
  95.  
  96. function hookMinimap () {
  97. hook ('strokeRect', (method, thisArg, args) => {
  98. const transform = thisArg.getTransform ();
  99. minimapPosition = [transform.e, transform.f];
  100. minimapDim = [transform.a, transform.d];
  101. });
  102. }
  103.  
  104. function getWorldPosition (position) {
  105. const ret = [
  106. parseFloat((((position[0] - minimapPosition[0] - minimapDim[0] / 2) / minimapDim[0] * 100) * 460).toFixed (3)),
  107. parseFloat((((position[1] - minimapPosition[1] - minimapDim[1] / 2) / minimapDim[1] * 100) * 460).toFixed (3)),
  108. ]
  109. return ret;
  110. }
  111. const Mi = '';
  112.  
  113. function getAverage (points) {
  114. let ret = [0, 0];
  115. points.forEach (point => {
  116. ret[0] += point[0];
  117. ret[1] += point[1];
  118. });
  119. ret[0] /= points.length;
  120. ret[1] /= points.length;
  121.  
  122. return ret;
  123. }
  124. let dgh = 'M';
  125.  
  126.  
  127. const getDist = (t1, t2) => {
  128. const distX = t1[0] - t2[0];
  129. const distY = t1[1] - t2[1];
  130.  
  131. return [Math.hypot(distX, distY), distX, distY];
  132. };
  133.  
  134. function moveBot () {
  135. if (input.should_prevent_unload()) {
  136. canRespawn = true;
  137. }
  138. let masterMouse = GM_getValue('multiboxMouse');
  139. let masterMove = GM_getValue ('multiboxWorld');
  140.  
  141. console.log(masterMove, worldPosition)
  142. const distanceMove = getDist (masterMove, worldPosition);
  143. if (!masterMouse[0] || !masterMouse[1] || !masterMove[0] || !masterMove[1]) {
  144. return;
  145. }
  146.  
  147.  
  148.  
  149. if (GM_getValue('copyMovement')) {
  150. //console.log(distanceMove[0])
  151. if (distanceMove[0] > 400) {
  152. angleMove(distanceMove[1], distanceMove[2])
  153. } else {
  154. copyMove(GM_getValue('keys'))
  155. }
  156. }
  157. if (GM_getValue('copyMouse')) {
  158. angleShoot(...masterMouse)
  159. }
  160. }
  161.  
  162.  
  163.  
  164. function angleMove(dX, dY){
  165. if (dX > 0) {
  166. input.key_up (65);
  167. input.key_down (68);
  168. } else if (dX < 0) {
  169. input.key_up (68);
  170. input.key_down (65);
  171. } else {
  172. input.key_up (68);
  173. input.key_up (65);
  174. }
  175.  
  176. if (dY > 0) {
  177. input.key_up (87);
  178. input.key_down (83);
  179. } else if (dY < 0) {
  180. input.key_up (83);
  181. input.key_down (87);
  182. } else {
  183. input.key_up (83);
  184. input.key_up (87);
  185. }
  186. }
  187. function angleShoot(stepX, stepY){
  188. const x = stepX * canvas.width * window.devicePixelRatio;
  189. const y = stepY * canvas.height * window.devicePixelRatio;
  190.  
  191. input.mouse(x, y)
  192. }
  193. function copyMove(keys){
  194. if(keys[0]){
  195. input.key_down(87)
  196. }
  197. else{
  198. input.key_up(87)
  199. }
  200. if(keys[1]){
  201. input.key_down(65)
  202. }
  203. else {
  204. input.key_up(65)
  205. }
  206. if(keys[2]){
  207. input.key_down(83)
  208. }
  209. else {
  210. input.key_up(83)
  211. }
  212. if(keys[3]){
  213. input.key_down(68)
  214. }
  215. else {
  216. input.key_up(68)
  217. }
  218. }
  219.  
  220.  
  221.  
  222. function frame () {
  223. overlay.innerHTML = `
  224. <h1>MULTIBOX</h1>
  225. <br> <br>
  226. World position: <br> ${Math.round(worldPosition[0]) || 0} ${Math.round(worldPosition[1]) || 0}
  227. <br> <br>
  228. [P] Master Tab: #${GM_getValue('master') || 0}
  229. <br> <br>
  230. [F] Multibox Enabled: ${GM_getValue('multiboxEnabled') || false}
  231. <br> <br>
  232. [G] Copy Movement: ${GM_getValue('copyMovement') || false}
  233. <br> <br>
  234. [J] Copy Mouse: ${GM_getValue('copyMouse') || false}
  235. <br> <br>
  236. [Q] Toggle Gui: true
  237. <br> <br>
  238. [Z] Auto Respawn: ${GM_getValue('autoRespawn') || false}
  239. <br> <br>
  240. [,] Always Shoot: ${GM_getValue('autoShoot') || false}
  241. <br> <br>
  242. `
  243. if(GM_getValue('autoShoot')){
  244. input.key_down(1)
  245. }
  246. else{
  247. input.key_up(1)
  248. }
  249. if (GM_getValue('autoRespawn')) {
  250. input.execute('game_spawn ' + localStorage.name)
  251. }
  252. if (GM_getValue('master') == tabId){
  253. GM_setValue('multiboxWorld', worldPosition)
  254. GM_setValue('multiboxMouse', mouseOffset)
  255. GM_setValue('keys', moveKeys)
  256.  
  257. } else if (GM_getValue('multiboxEnabled')) {
  258. moveBot ();
  259. }
  260. window.requestAnimationFrame (frame);
  261. }
  262.  
  263.  
  264. document.addEventListener ('keydown', e => {
  265. if (e.key === 'f') {
  266. GM_setValue('multiboxEnabled', !GM_getValue('multiboxEnabled'))
  267. if(GM_getValue('multiboxEnabled')){
  268. GM_setValue('master', tabId)
  269. }
  270. }
  271. if (e.key === 'g') {
  272. GM_setValue('copyMovement', !GM_getValue('copyMovement'))
  273. }
  274. if (e.key === 'j') {
  275. GM_setValue('copyMouse', !GM_getValue('copyMouse'))
  276. }
  277. if (e.key === 'q') {
  278. gui = !gui;
  279. overlay.style.display = gui ? 'block' : 'none'
  280. }
  281. if (e.key === ',') {
  282. GM_setValue('autoShoot', !GM_getValue('autoShoot'))
  283. }
  284. if (e.key === 'z') {
  285. GM_setValue('autoRespawn', !GM_getValue('autoRespawn'))
  286. }
  287. if(e.key === 'p'){
  288. GM_setValue('master', tabId)
  289. }
  290.  
  291. if(e.key === 'w'){
  292. moveKeys[0] = true;
  293. }
  294. if(e.key === 'a') {
  295. moveKeys[1] = true;
  296. }
  297. if(e.key === 's') {
  298. moveKeys[2] = true;
  299. }
  300. if(e.key === 'd') {
  301. moveKeys[3] = true;
  302. }
  303. })
  304. document.addEventListener('keyup', e => {
  305. if(e.key === 'w'){
  306. moveKeys[0] = false;
  307. }
  308. if(e.key === 'a') {
  309. moveKeys[1] = false;
  310. }
  311. if(e.key === 's') {
  312. moveKeys[2] = false;
  313. }
  314. if(e.key === 'd') {
  315. moveKeys[3] = false;
  316. }
  317. });
  318.  
  319. document.addEventListener ('mousemove', e => {
  320. mouseOffset = [
  321. e.x / canvas.width,
  322. e.y / canvas.height,
  323. ]
  324. });
  325. function terminate () {
  326. overlay = document.createElement('div');
  327. overlay.style.position = 'fixed';
  328. overlay.style.top = '1px';
  329. overlay.style.left = '1px';
  330. overlay.style.fontFamily = 'Lucida Console, Courier, monospace';
  331. overlay.style.fontSize = '12px';
  332. overlay.style.color = '#ffffff';
  333. overlay.style.pointerEvents = 'none';
  334. overlay.style.userSelect = 'none';
  335. overlay.style.fontSize = '14px';
  336. overlay.style.backgroundColor = 'gray';
  337. overlay.style.height = '450px';
  338. overlay.style.width = '250px';
  339. overlay.style.borderRadius = '1px'
  340. overlay.style.borderStyle = 'solid'
  341. overlay.style.borderColor = '#404040'
  342. overlay.style.borderWidth = '5px'
  343. overlay.style.textAlign = 'center';
  344. document.body.appendChild(overlay);
  345.  
  346. frame ();
  347. hookMinimapArrow ();
  348. hookMinimap ();
  349.  
  350.  
  351.  
  352. }
  353. terminate ();
  354. },400);

QingJ © 2025

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