private stacking script leak

stacking bullets while using sandbox hacks

  1. // ==UserScript==
  2. // @name private stacking script leak
  3. // @include *://diep.io/*
  4. // @author r!PsAw, SBB
  5. // @description stacking bullets while using sandbox hacks
  6. // @connect diep.io
  7. // @namespace aaa
  8. // @version 1.0.2
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. /*
  13. How to Use:
  14. Press Shift+R to cycle through the tanks.
  15. Press Shift+Q to disable/enable the script.
  16. Press I to hide the dialog. (The script remains functional, though).
  17. Hold rightclick to activate . For best results, leave autofire off for a bit before doing so.
  18. If necessary, press Shift+M to re-calibrate the script. Wait for the ms to stabilise.
  19. Note: This calibration may break for Triple Twin, and is unnecessary for Streamliner.
  20. */
  21. (function(){//info
  22. if(window.updateInfo) return;
  23.  
  24.  
  25. var info = {};
  26. var info_container = document.createElement("div");
  27. info_container.style.position = "fixed";
  28. info_container.style.color = "white";
  29. info_container.style["pointer-events"] = "none";
  30. document.body.appendChild(info_container);
  31.  
  32. function toggle_info_container(e){
  33. if(e.key == "i"){
  34. info_container.style.display = info_container.style.display=="block" ? "none" : "block";
  35. }
  36. }
  37. window.addEventListener("keyup", toggle_info_container);
  38.  
  39. window.updateInfo = function(key, value){
  40. if(!value) delete info[key];
  41. else info[key] = value;
  42. var s = "";
  43. for(var _key in info){
  44. s += info[_key] + "\n";
  45. }
  46. info_container.innerText = s;
  47. };
  48. })();
  49.  
  50. function MeasureCycle(){
  51. var canvas = document.getElementById("canvas");
  52. var ctx = canvas.getContext("2d");
  53. var real_arc = ctx.arc;
  54. var real_setTransform = ctx.setTransform;
  55.  
  56. var a;
  57. var tx = 0, ty = 0;
  58. var a11 = 1;
  59.  
  60. var state = false;
  61. var found = false;
  62. var inA = null;
  63. var direction = 1;
  64.  
  65. var frameRequest;
  66. var intervalEMA = null; // ms
  67.  
  68. function arc(){
  69. real_arc.apply(ctx, arguments);
  70.  
  71. if(!found){
  72. var aimX = window.innerWidth / 2 + 50 * direction;
  73. var aimY = window.innerHeight / 2;
  74. found = (tx - a11 < aimX) && (tx + a11 > aimX) && (ty - a11 < aimY) && (ty + a11 > aimY);
  75. }
  76. }
  77.  
  78. function setTransform(b11, b12, b21, b22, bx, by){
  79. real_setTransform.apply(ctx, arguments);
  80. tx = bx, ty = by, a11 = b11;
  81. }
  82.  
  83. function onFrame(_a){
  84. frameRequest = window.requestAnimationFrame(onFrame);
  85. a = _a;
  86. if(!state && found){
  87. if(inA){
  88. var da = a - inA;
  89. inA = a;
  90. intervalEMA = intervalEMA ? 0.8 * intervalEMA + 0.2 * da : da;
  91. window.updateInfo && window.updateInfo(
  92. "intervalEMA",
  93. "Fire Period: " + intervalEMA.toString().substr(0, 5) + "ms"
  94. );
  95.  
  96. }else{
  97. inA = a;
  98. }
  99. }
  100. state = found;
  101. found = false;
  102. }
  103.  
  104. function onMouseEvent(e){
  105. e.stopPropagation();
  106. }
  107.  
  108. this.start = function(_direction){
  109. _direction = _direction || 1;
  110. direction = _direction > 0 ? 1 : -1;
  111. inA = null;
  112. intervalEMA = null;
  113. state = found = false;
  114.  
  115. ctx.setTransform = setTransform;
  116. ctx.arc = arc;
  117.  
  118. var aimX = window.innerWidth / 2 + 50 * direction;
  119. var aimY = window.innerHeight / 2;
  120. canvas.dispatchEvent(new MouseEvent("mousemove", {clientX: aimX, clientY: aimY}));
  121. canvas.dispatchEvent(new MouseEvent("mousedown", {clientX: aimX, clientY: aimY}));
  122.  
  123. window.addEventListener("mousemove", onMouseEvent, true);
  124. window.addEventListener("mouseup", onMouseEvent, true);
  125. window.addEventListener("mousedown", onMouseEvent, true);
  126. frameRequest = window.requestAnimationFrame(onFrame);
  127.  
  128. window.updateInfo && window.updateInfo("measuring", "Measuring...");
  129. }
  130.  
  131. this.terminate = function(){
  132. ctx.setTransform = real_setTransform;
  133. ctx.arc = real_arc;
  134.  
  135. window.removeEventListener("mousemove", onMouseEvent, true);
  136. window.removeEventListener("mousedown", onMouseEvent, true);
  137. window.removeEventListener("mouseup", onMouseEvent, true);
  138. window.cancelAnimationFrame(frameRequest);
  139.  
  140. canvas.dispatchEvent(new MouseEvent("mouseup", {clientX: 10, clientY: 10}));
  141.  
  142. window.updateInfo && window.updateInfo("measuring", null);
  143. return intervalEMA;
  144. }
  145. };
  146.  
  147. (function(){
  148. var cycleRate = 0.003125; // ms^-1
  149. var maxAngle = Math.PI * 45 / 180;
  150. var secAngle = 0;
  151. var cycleCounter = 1;
  152. var NCANNON = 3;
  153. var angleUnit = maxAngle / (NCANNON - 1);
  154. var secUnit = secAngle;
  155. var ax30945=1;
  156. var sec=false;
  157. var tankData = [
  158. {name: "TriFlank/G2T Stack", cycleRate: 0.002541, maxAngle: Math.PI * 150 / 180, secondaryAngle: Math.PI * 150 / 180, NCANNON: 2},
  159. {name: "Bomber Stack", cycleRate: 0.002573, maxAngle: Math.PI * 150 / 180, secondaryAngle: Math.PI * 150 / 180, NCANNON: 2},
  160. {name: "Deathstar Stack", cycleRate: 0.002541, maxAngle: Math.PI/4, secondaryAngle: Math.PI/4, NCANNON: 2},
  161. {name: "Over Trapper",cycleRate: 0.002200, maxAngle: Math.PI, secondaryAngle: Math.PI, NCANNON: 2},
  162. {name: "Twin Bullet Stack", cycleRate: 0.002200, maxAngle: Math.PI * 15 / 180, secondaryAngle: Math.PI * 15 / 180, NCANNON: 3}
  163. ];
  164. var tankIndex = 0;
  165.  
  166. var measure = new MeasureCycle();
  167. var measuring = false;
  168.  
  169. var effective = false;
  170. var frameRequest;
  171. var toggle1 = true;
  172. var toggle2 = false;
  173. var canvas = window.document.getElementById("canvas");
  174.  
  175. var mouseX;
  176. var mouseY;
  177. var a = 0;
  178. var startA = 0;
  179. var artificialMouseMove = false;
  180.  
  181. var disabled = false;
  182. function onMouseDown(e){
  183. if(e.button == 2){
  184. sec=false;
  185. if(!effective){
  186. startA = a - 25;
  187. mouseX = e.clientX;
  188. mouseY = e.clientY;
  189. canvas.dispatchEvent(new MouseEvent("mousedown", {clientX: mouseX, clientY: mouseY}));
  190. }
  191. effective = true;
  192. cycleCounter=0;
  193. }
  194. }
  195.  
  196. function onMouseUp(e){
  197. if(e.button == 2){
  198. if(effective){
  199. canvas.dispatchEvent(new MouseEvent("mouseup", {clientX: mouseX, clientY: mouseY}));
  200. }
  201. effective = false;
  202. }
  203. }
  204.  
  205. function onMouseMove(e){
  206. if(effective){
  207. if(!artificialMouseMove){
  208. e.stopPropagation();
  209. mouseX = e.clientX;
  210. mouseY = e.clientY;
  211. }
  212. }else{
  213. mouseX = e.clientX;
  214. mouseY = e.clientY;
  215. }
  216. }
  217.  
  218. function update(_a){
  219. frameRequest = window.requestAnimationFrame(update);
  220. a = _a;
  221.  
  222. if(effective){
  223. var da = a - startA;
  224. var state = Math.floor(cycleRate * da * NCANNON) % (NCANNON * 2);
  225. var state1 = state % NCANNON;
  226. var state2 = Math.floor(state / NCANNON);
  227. var remainder=cycleRate*da*NCANNON-Math.floor(cycleRate*da*NCANNON);
  228. var angle = angleUnit * state1 * ax30945;
  229. var angle2 = secUnit * state1 * ax30945;
  230. var cx = window.innerWidth / 2;
  231. var cy = window.innerHeight / 2;
  232. window.updateInfo && window.updateInfo("reeeee", remainder);
  233.  
  234. if (toggle2 && state1==0) {
  235. toggle2=false;
  236. cycleCounter++;
  237. }
  238. if (state1!=0) toggle2=true;
  239. if (cycleCounter%3==2) angle=angle2;
  240. //if (remainder>0.5) angle=0;
  241. //if (cycleCounter%2==1) angle=-angle;
  242. var sin = Math.sin(angle);
  243. var cos = Math.cos(angle);
  244.  
  245. var x = mouseX - cx;
  246. var y = mouseY - cy;
  247. var _x = cos * x - sin * y;
  248. var _y = sin * x + cos * y;
  249. x = _x + cx;
  250. y = _y + cy;
  251.  
  252. artificialMouseMove = true;
  253. canvas.dispatchEvent(new MouseEvent("mousemove", {clientX: x, clientY: y}));
  254. artificialMouseMove = false;
  255. } else {
  256. var data = tankData[tankIndex];
  257. if (data.name=="random spinny flick shit idk") {
  258. da = a - startA;
  259. state = Math.floor(0.01 * da * 4) % (4 * 2);
  260. state1 = state % 4;
  261. state2 = Math.floor(state / 4);
  262. angle = Math.PI/3 * state1;
  263.  
  264. cx = window.innerWidth / 2;
  265. cy = window.innerHeight / 2;
  266. sin = Math.sin(angle);
  267. cos = Math.cos(angle);
  268.  
  269. x = mouseX - cx;
  270. y = mouseY - cy;
  271. _x = cos * x - sin * y;
  272. _y = sin * x + cos * y;
  273. x = _x + cx;
  274. y = _y + cy;
  275.  
  276. artificialMouseMove = true;
  277. canvas.dispatchEvent(new MouseEvent("mousemove", {clientX: x, clientY: y}));
  278. artificialMouseMove = false;
  279. }
  280. }
  281. }
  282.  
  283. function onKeyUp(e){
  284. if(e.key == "Z") {
  285. ax30945=1;
  286. }
  287. if(e.key == "Q"){
  288. disabled = !disabled;
  289. if(disabled){
  290. if(measuring){
  291. cycleRate = 1 / measure.terminate();
  292. measuring = false;
  293. } else stop();
  294. }else start();
  295. window.updateInfo && window.updateInfo("off", disabled ? "Disabled." : null);
  296. return;
  297. }
  298.  
  299. if(disabled) return;
  300.  
  301. if(e.key == "N"){
  302. if(measuring){
  303. cycleRate = 1 / measure.terminate();
  304. start();
  305. measuring = false;
  306. }else{
  307. stop();
  308. measure.start(mouseX - window.innerWidth / 2);
  309. measuring = true;
  310. }
  311. }else if(e.key == "R"){
  312. changeTank((tankIndex + 1) % tankData.length);
  313. }
  314. }
  315.  
  316. function changeTank(index){
  317. var data = tankData[index];
  318. tankIndex = index;
  319.  
  320. cycleRate = data.cycleRate; // ms^-1
  321. maxAngle = data.maxAngle;
  322. secAngle = data.secondaryAngle;
  323. NCANNON = data.NCANNON;
  324. angleUnit = maxAngle / (NCANNON - 1);
  325. secUnit = secAngle / (NCANNON - 1);
  326.  
  327. window.updateInfo && window.updateInfo("changeTank", "Tank: " + data.name);
  328. }
  329.  
  330. function init(){
  331. window.addEventListener("keyup", onKeyUp);
  332. start();
  333. changeTank(0);
  334. }
  335.  
  336. function start(){
  337. canvas.addEventListener("mousedown", onMouseDown);
  338. canvas.addEventListener("mouseup", onMouseUp);
  339. window.addEventListener("mousemove", onMouseMove, true);
  340. frameRequest = window.requestAnimationFrame(update);
  341. }
  342.  
  343. function stop(){
  344. canvas.removeEventListener("mousedown", onMouseDown);
  345. canvas.removeEventListener("mouseup", onMouseUp);
  346. window.removeEventListener("mousemove", onMouseMove, true);
  347. window.cancelAnimationFrame(frameRequest);
  348. effective = false;
  349. }
  350.  
  351.  
  352. init();
  353.  
  354. })();

QingJ © 2025

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