Predator and Hunter Stack (Any reload)

Press J to stack predator, U to stack hunter and , and . to change the reload

  1. // ==UserScript==
  2. // @name Predator and Hunter Stack (Any reload)
  3. // @namespace http://tampermonkey.net/
  4. // @version 2
  5. // @description Press J to stack predator, U to stack hunter and , and . to change the reload
  6. // @author MI300#4401
  7. // @match https://diep.io/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // @license dont copy
  11. // ==/UserScript==
  12. let isPredator = true;
  13. function shoot(w) {
  14. input.key_down(1);
  15. setTimeout (() => {
  16. input.key_up(1);
  17. },w);
  18. }
  19.  
  20. let reload = 7;
  21. const predator = [
  22. [50, 500, 1400, 2800], // 0 reload
  23. [50, 500, 1300, 2700], // 1 reload
  24. [50, 400, 1200, 2450], // 2 reload
  25. [50, 300, 1100, 2200], // 3 reload
  26. [50, 300, 1000, 2100], // 4 reload
  27. [50, 300, 900, 1800], // 5 reload
  28. [50, 300, 800, 1700], // 6 reload
  29. [50, 300, 750, 1500], // 7 reload
  30. ]
  31. const hunter = [
  32. [50, 1200], // 0 reload
  33. [50, 1100], // 1 reload
  34. [50, 1000], // 2 reload
  35. [50, 950], // 3 reload
  36. [50, 800], // 4 reload
  37. [50, 725], // 5 reload
  38. [50, 700], // 6 reload
  39. [50, 625], // 7 reload
  40. ]
  41.  
  42. function clump() {
  43. shoot(predator[reload][0]);
  44. setTimeout(() => {
  45. shoot(predator[reload][1]);
  46. },predator[reload][2]);
  47. setTimeout(() => {
  48. input.key_down (69);
  49. input.key_up (69);
  50. },predator[reload][3]);
  51. }
  52. function clump2(){
  53. shoot(hunter[reload][0])
  54. setTimeout(() => {
  55. input.key_down (69);
  56. input.key_up (69);
  57. },hunter[reload][1])
  58. }
  59.  
  60. function increaseReload(){
  61. if(reload != 7){
  62. reload++;
  63. }
  64. }
  65. function decreaseReload(){
  66. if(reload != 0){
  67. reload--;
  68. }
  69. }
  70.  
  71. document.addEventListener ('keydown', e => {
  72. if(!input || !input.should_prevent_unload()){
  73. return;
  74. }
  75. if(e.key == 'j') clump();
  76. if(e.key == 'u') clump2();
  77. if(e.key == ',') decreaseReload();
  78. if(e.key == '.') increaseReload();
  79. });
  80.  
  81. // gui
  82. setTimeout(function(){
  83. const canvas = document.getElementById("canvas");
  84. const context = canvas.getContext("2d");
  85. const themes = [
  86. // dark // light
  87. ['#75ba50', '#aeff82'], // green
  88. ['#2a25fa', '#7d7afa'], // blue
  89. ['#c92233', '#fa6b77'], // red
  90. ['#9a9c43', '#def58c'], // yellow
  91. ]
  92. let buttons = [];
  93.  
  94. function render(){
  95. window.requestAnimationFrame(render)
  96.  
  97. const scale = window.devicePixelRatio
  98.  
  99. buttons.forEach(button => {
  100. let text = button.text;
  101. context.beginPath()
  102. context.strokeStyle = '#4d4c4c'
  103. context.fillStyle = button.style[0]
  104. context.lineWidth = 5 / scale;
  105. context.rect(button.x / scale, button.y / scale, button.width / scale, button.height / scale)
  106. context.fillRect(button.x / scale, button.y / scale + button.height / scale / 2, button.width / scale, button.height / scale / 2)
  107. context.fillStyle = button.style[1]
  108. context.fillRect(button.x / scale, button.y / scale, button.width / scale, button.height / scale / 2)
  109. context.stroke();
  110.  
  111. context.font = 20 / scale + "px arial";
  112. context.strokeStyle = '#000000';
  113. context.fillStyle = '#FFFFFF';
  114.  
  115. if(button.id == 2 || button.id == 3){
  116. text = reload + button.text;
  117. }
  118. context.strokeText(text, (button.x + 5) / scale, button.y / scale + (button.height - 8) / scale)
  119. context.fillText(text, (button.x + 5) / scale, button.y / scale + (button.height - 8) / scale)
  120. });
  121. }
  122. function createButton(x, y, width, height, text, id, callback){
  123. buttons.push(
  124. {
  125. x: x,
  126. y: y,
  127. width: width,
  128. height: height,
  129. text: text,
  130. style: themes[id],
  131. id: id,
  132. }
  133. )
  134.  
  135. }
  136. createButton(450, 20, 100, 35, "Predator [J]", 0, clump)
  137. createButton(570, 20, 100, 35, "Hunter [U]", 1, clump2)
  138. createButton(690, 20, 50, 35, "- [,]", 2, decreaseReload)
  139. createButton(760, 20, 50, 35, "+ [.]", 3, increaseReload)
  140.  
  141. window.requestAnimationFrame(render)
  142. }, 2500)