DigDig.IO Tag Bot

A simple bot that tags people in digdig.io

  1. // ==UserScript==
  2. // @name DigDig.IO Tag Bot
  3. // @namespace https://tampermonkey.net/
  4. // @version 0.0.1
  5. // @description A simple bot that tags people in digdig.io
  6. // @author Zertalious (Zert)
  7. // @match *://digdig.io/*
  8. // @icon https://www.google.com/s2/favicons?domain=digdig.io
  9. // @grant none
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. let inDeathScreen = false;
  14.  
  15. let health = 0;
  16. const healthX = [];
  17.  
  18. let border = null;
  19.  
  20. let waitingText;
  21. let isWaiting = false;
  22. let seekerText, hiderText;
  23. let isSeeker = false;
  24.  
  25. const hiders = [];
  26.  
  27. let angle = 0;
  28. let lastTime = 0;
  29. let canBoost = true;
  30.  
  31. let isRunning = true;
  32.  
  33. Object.defineProperty( window, 'localStorage', {
  34. value: new Proxy( window.localStorage, {
  35. get( target, prop, receiver ) {
  36.  
  37. if ( prop === 'digdig_gamemode' ) {
  38.  
  39. return '2';
  40.  
  41. }
  42.  
  43. return Reflect.get( ...arguments );
  44.  
  45. }
  46. } )
  47. } );
  48.  
  49. window.requestAnimationFrame = new Proxy( window.requestAnimationFrame, {
  50. apply( target, thisArgs, args ) {
  51.  
  52. if ( isRunning === true ) {
  53.  
  54. args[ 0 ] = new Proxy( args[ 0 ], {
  55. apply( target, thisArgs, args ) {
  56.  
  57. inDeathScreen = false;
  58. health = 0;
  59.  
  60. isWaiting = false;
  61.  
  62. hiders.length = 0;
  63.  
  64. healthX.length = 0;
  65. health = 0;
  66.  
  67. border = null;
  68.  
  69. Reflect.apply( ...arguments );
  70.  
  71. if ( inDeathScreen === true || health <= 0 ) {
  72.  
  73. pressEnter();
  74.  
  75. console.log( 'spam enter' );
  76.  
  77. return;
  78.  
  79. }
  80.  
  81. if ( isWaiting === true ) {
  82.  
  83. return;
  84.  
  85. }
  86.  
  87. if ( isSeeker === false ) {
  88.  
  89. cp6.disconnect();
  90.  
  91. return;
  92.  
  93. }
  94.  
  95. if ( health <= 0.05 ) {
  96.  
  97. canBoost = false;
  98.  
  99. setAttack( false );
  100.  
  101. } else if ( health > 0.15 ) {
  102.  
  103. canBoost = true;
  104.  
  105. }
  106.  
  107. if ( hiders.length > 0 ) {
  108.  
  109. const [ x, y ] = hiders[ 0 ];
  110.  
  111. setAttack( canBoost );
  112.  
  113. angle = Math.atan2( y - window.innerHeight / 2, x - window.innerWidth / 2 );
  114.  
  115. mouseMove( x, y );
  116.  
  117. lastTime = Date.now() + 5000;
  118.  
  119. return;
  120.  
  121. }
  122.  
  123. setAttack( false );
  124.  
  125. const now = Date.now();
  126.  
  127. if ( now - lastTime > 1000 ) {
  128.  
  129. angle += ( Math.random() * 2 - 1 ) * Math.PI / 4;
  130.  
  131. lastTime = now;
  132.  
  133. }
  134.  
  135. if ( border !== null ) {
  136.  
  137. const x = border[ 0 ] - window.innerWidth / 2;
  138. const y = border[ 1 ] - window.innerHeight / 2;
  139.  
  140. if ( Math.hypot( x, y ) > border[ 2 ] - 500 ) {
  141.  
  142. angle = Math.atan2( y, x );
  143.  
  144. }
  145.  
  146. }
  147.  
  148. mouseMove(
  149. ( Math.cos( angle ) * 0.5 + 0.5 ) * window.innerWidth,
  150. ( Math.sin( angle ) * 0.5 + 0.5 ) * window.innerHeight
  151. );
  152.  
  153. }
  154. } );
  155.  
  156. }
  157.  
  158. return Reflect.apply( ...arguments );
  159.  
  160. }
  161. } );
  162.  
  163. const Context = CanvasRenderingContext2D.prototype;
  164.  
  165. Context.arc = new Proxy( Context.arc, {
  166. apply( target, thisArgs, [ x, y, r ] ) {
  167.  
  168. if ( r === 25 ) {
  169.  
  170. if ( thisArgs.fillStyle === '#6096b5' ) {
  171.  
  172. const { e, f } = thisArgs.getTransform();
  173.  
  174. if ( Math.hypot( e - window.innerWidth, f - window.innerHeight ) > 10 ) {
  175.  
  176. hiders.push( [ e, f ] );
  177.  
  178. }
  179.  
  180. }
  181.  
  182. } else if ( thisArgs.fillStyle === '#222222' && x !== 0 && y !== 0 ) {
  183.  
  184. border = [ x, y, r ];
  185.  
  186. }
  187.  
  188. return Reflect.apply( ...arguments );
  189.  
  190. }
  191. } );
  192.  
  193. const params = {
  194. apply( target, thisArgs, [ x ] ) {
  195.  
  196. healthX[ target.name === 'moveTo' ? 0 : 1 ] = x;
  197.  
  198. return Reflect.apply( ...arguments );
  199.  
  200. }
  201. };
  202.  
  203. Context.moveTo = new Proxy( Context.moveTo, params );
  204. Context.lineTo = new Proxy( Context.lineTo, params );
  205.  
  206. Context.stroke = new Proxy( Context.stroke, {
  207. apply( target, thisArgs, args ) {
  208.  
  209. if ( thisArgs.strokeStyle === '#75dd34' ) {
  210.  
  211. health = ( healthX[ 0 ] - healthX[ 1 ] ) / ( 2 * healthX[ 0 ] );
  212.  
  213. }
  214.  
  215. return Reflect.apply( ...arguments );
  216.  
  217. }
  218. } );
  219.  
  220. const OffscreenContext = typeof OffscreenCanvasRenderingContext2D !== 'undefined' ?
  221. OffscreenCanvasRenderingContext2D.prototype : Context;
  222.  
  223. OffscreenContext.fillRect = new Proxy( OffscreenContext.fillRect, {
  224. apply( target, thisArgs, args ) {
  225.  
  226. if ( thisArgs.fillStyle === '#000000' ) {
  227.  
  228. inDeathScreen = true;
  229.  
  230. }
  231.  
  232. return Reflect.apply( ...arguments );
  233.  
  234. }
  235. } );
  236.  
  237. OffscreenContext.fillText = new Proxy( OffscreenContext.fillText, {
  238. apply( target, { canvas }, [ text ] ) {
  239.  
  240. if ( text.indexOf( 'Starting in' ) > - 1 && text.indexOf( 'Waiting for' ) > - 1 ) {
  241.  
  242. waitingText = canvas;
  243.  
  244. } else if ( text.indexOf( 'You are a seeker' ) > - 1 ) {
  245.  
  246. seekerText = canvas;
  247.  
  248. } else if ( text.indexOf( 'You are a hider' ) > - 1 ) {
  249.  
  250. hiderText = canvas;
  251.  
  252. }
  253.  
  254. return Reflect.apply( ...arguments );
  255.  
  256. }
  257. } );
  258.  
  259. OffscreenContext.drawImage = new Proxy( OffscreenContext.drawImage, {
  260. apply( target, thisArgs, [ image ] ) {
  261.  
  262. switch ( image ) {
  263.  
  264. case waitingText : isWaiting = true; break;
  265. case seekerText : isSeeker = true; break;
  266. case hiderText : isSeeker = false; break;
  267.  
  268. }
  269.  
  270. return Reflect.apply( ...arguments );
  271.  
  272. }
  273. } );
  274.  
  275. function pressEnter() {
  276.  
  277. keyEvent( 'keydown', 13 );
  278. keyEvent( 'keyup', 13 );
  279.  
  280. }
  281.  
  282. function setAttack( bool ) {
  283.  
  284. keyEvent( bool !== false ? 'keydown' : 'keyup', 32 );
  285.  
  286. }
  287.  
  288. function setHeal( bool ) {
  289.  
  290. keyEvent( bool !== false ? 'keydown' : 'keyup', 16 );
  291.  
  292. }
  293.  
  294. function keyEvent( type, keyCode ) {
  295.  
  296. window.dispatchEvent( new KeyboardEvent( type, { keyCode } ) );
  297.  
  298. }
  299.  
  300. function mouseMove( clientX, clientY ) {
  301.  
  302. window.Module.canvas.dispatchEvent(
  303. new MouseEvent( 'mousemove', {
  304. clientX,
  305. clientY
  306. } )
  307. );
  308.  
  309. }

QingJ © 2025

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