Flipfire script 2023

Press F to sync bullets DO NOT use autofire or shoot, then just click right mouse button and it stacks

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

  1. // ==UserScript==
  2. // @name Flipfire script 2023
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Press F to sync bullets DO NOT use autofire or shoot, then just click right mouse button and it stacks
  6. // @author Mi300
  7. // @match https://diep.io/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. let bruh = setInterval (function() {
  14. if (!document.querySelector('d-base').shadowRoot.children[0].shadowRoot.getElementById('username-input')) {
  15. return;
  16. }
  17. clearInterval (bruh)
  18. const toRadians = (degrees) => degrees * Math.PI / 180
  19.  
  20. let angle = 180;
  21. let scriptActive = false;
  22. let mouseX = 0;
  23. let mouseY = 0;
  24. let artificialX = 0;
  25. let artificialY = 0;
  26. let stacking = false;
  27. let position = 0;
  28.  
  29. const Wu = window.devicePixelRatio || 1;
  30. let canvas = window.document.getElementById("canvas");
  31.  
  32. const scriptInfo = [
  33. {name: 'Triangle-Rear', angles: [0, 210], timings: [100, 200, 300, 330]},
  34. {name: 'Fighter-Side', angles: [0, 90], timings: [100, 200, 300, 330]},
  35. {name: 'Gunner-Trapper', angles: [180, 0], timings: [150, 250, 1000, 1100]},
  36. //{name: 'Booster', angles: [0, 210], timings: [100, 150, 350, 370]},
  37. {name: 'Octo', angles: [0, 45], timings: [100, 200, 300, 330]},
  38. ]
  39.  
  40. let currentMode = scriptInfo[0];
  41.  
  42. document.addEventListener('mousemove', e => {
  43. e.stopPropagation();
  44. mouseX = e.x;
  45. mouseY = e.y;
  46.  
  47. if (scriptActive && stacking) {
  48. input.mouse (artificialX * Wu, artificialY * Wu)
  49. }
  50. });
  51.  
  52. document.addEventListener('keydown', e => {
  53. if (e.key === 'f') {
  54. scriptActive = !scriptActive;
  55. }
  56. if (e.key === 'r') {
  57. position++;
  58. currentMode = scriptInfo[Math.abs(position) % scriptInfo.length];
  59.  
  60. clearInterval(interval)
  61. interval = setInterval (flip, currentMode.timings[3])
  62. }
  63.  
  64. });
  65.  
  66. document.addEventListener('mousedown', e => {
  67. if (e.button === 2) {
  68. stacking = true;
  69. }
  70. });
  71.  
  72. document.addEventListener('mouseup', e => {
  73. if (e.button === 2) {
  74. stacking = false;
  75. }
  76. });
  77.  
  78. function frame() {
  79. overlay.innerHTML = `
  80. [F] Bullets Synced: ${scriptActive}
  81. <br><br>
  82. [Right Click] Stack: ${stacking}
  83. <br><br>
  84. [R] Tank: ${currentMode.name}
  85. `
  86.  
  87. let radians = toRadians(angle)
  88. let tankX = window.innerWidth / 2;
  89. let tankY = window.innerHeight / 2;
  90. let angleSin = Math.sin(radians);
  91. let angleCos = Math.cos(radians);
  92.  
  93. let x = mouseX - tankX;
  94. let y = mouseY - tankY;
  95. let _x = angleCos * x - angleSin * y;
  96. let _y = angleSin * x + angleCos * y;
  97. artificialX = _x + tankX;
  98. artificialY = _y + tankY;
  99.  
  100. if (scriptActive && stacking) {
  101. input.mouse (artificialX * Wu, artificialY * Wu)
  102. }
  103.  
  104. window.requestAnimationFrame(frame)
  105. }
  106.  
  107. function flip() {
  108. if (!scriptActive) {
  109. return;
  110. }
  111. angle = currentMode.angles[0];
  112.  
  113. setTimeout (function() {
  114. input.keyDown(32);
  115. },currentMode.timings[0]);
  116.  
  117. setTimeout (function() {
  118. angle = currentMode.angles[1];
  119. },currentMode.timings[1]);
  120.  
  121. setTimeout (function () {
  122. input.keyUp(32);
  123. },currentMode.timings[2]);
  124. }
  125.  
  126. let interval = setInterval(flip, currentMode.timings[3])
  127.  
  128. var overlay = document.createElement('div');
  129. overlay.style.position = 'fixed';
  130. overlay.style.top = '20px';
  131. overlay.style.left = '15%';
  132. overlay.style.fontFamily = 'Lucida Console, Courier, monospace';
  133. overlay.style.fontSize = '12px';
  134. overlay.style.color = '#ffffff';
  135. overlay.style.pointerEvents = 'none';
  136. overlay.style.userSelect = 'none';
  137. overlay.style.fontSize = '20px';
  138. document.body.appendChild(overlay);
  139.  
  140. frame()
  141. }, 400);