Agario Macros

Agar.io macro: W = Auto Eject Mass, T = x16 splits, Q = Double split

  1. // ==UserScript==
  2. // @name Agario Macros
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0
  5. // @description Agar.io macro: W = Auto Eject Mass, T = x16 splits, Q = Double split
  6. // @author Maroc Agar
  7. // @match https://agar.io/*
  8. // @run-at document-end
  9. // @grant none
  10. // @icon https://i.imgur.com/AAlWAp8.png
  11. // ==/UserScript==
  12.  
  13. window.addEventListener('keydown', keydown);
  14. window.addEventListener('keyup', keyup);
  15.  
  16. var EjectDown = false;
  17. var speed = 25; //in ms
  18.  
  19. // Here is the keys and the number assigned, make sure to replace the number for the key you want to use.
  20.  
  21. //A = "65", B = "66", C = "67", D = "68", E = "69", F = "70", G = "71", H = "72", I = "73", J = "74", K = "75", L = "76", M = "77", N = "78", O = "79", P = "80", Q = "81", R = "82", S = "83", T = "84", U = "85", V = "86", W = "87", X = "88", Y = "89", Z = "90"
  22.  
  23. function keydown(event) {
  24. if (event.keyCode == 87 && !EjectDown) { // Macro Feed "W"
  25. EjectDown = true;
  26. setTimeout(eject, speed);
  27. }
  28. if (event.keyCode == 81 || event.keyCode == 50) { // Double "Q"
  29. split();
  30. setTimeout(split, speed);
  31. }
  32. if (event.keyCode == 84) { // X16 splits "T"
  33. split();
  34. setTimeout(split, speed);
  35. setTimeout(split, speed*2);
  36. setTimeout(split, speed*3);
  37. }
  38. if (event.keyCode == 83) { // Stop movement "S"
  39. var X = window.innerWidth / 2;
  40. var Y = window.innerHeight / 2;
  41. $("canvas").trigger($.Event("mousemove", { clientX: X, clientY: Y }));
  42. }
  43. }
  44.  
  45. function keyup(event) {
  46. if (event.keyCode == 87) { // W
  47. EjectDown = false;
  48. }
  49. }
  50.  
  51. function eject() {
  52. if (EjectDown) {
  53. triggerKeyEvent(87); // W
  54. setTimeout(eject, speed);
  55. }
  56. }
  57.  
  58. function split() {
  59. triggerKeyEvent(32); // Space
  60. }
  61.  
  62. function triggerKeyEvent(keyCode) {
  63. $("body").trigger($.Event("keydown", { keyCode }));
  64. $("body").trigger($.Event("keyup", { keyCode }));
  65. }
  66.  
  67. // This text is only informative, changing it does not modify the keys.
  68. function removeDefaultText() {
  69. var instructions = document.getElementById("instructions");
  70. if (instructions) {
  71. instructions.innerHTML = `<center><div style='font-weight: bold; font-size: 16px;'>Key Bindings:</div></center>
  72. <center><div style='margin-top: 10px; padding: 15px; background-color: white; border-radius: 15px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);'>
  73. <div>Press <b style='font-size: 18px;'>W</b> to Auto Eject Mass (Hold)</div>
  74. <div>Press <b style='font-size: 18px;'>Q</b> to Double Split</div>
  75. <div>Press <b style='font-size: 18px;'>T</b> to split x16</div>
  76. </div></center>`;
  77. }
  78. }
  79.  
  80. function removeElement(selector) {
  81. var element = document.querySelector(selector);
  82. if (element) {
  83. element.style.display = "none";
  84. }
  85. }
  86.  
  87. function removeFooterElements() {
  88. removeElement('.tosBox.left');
  89. removeElement('.tosBox.right');
  90. removeElement('.bubble');
  91. removeElement('.agario-promo');
  92. removeElement('.promo-badge-container');
  93. }
  94.  
  95. // Remove an element by its id
  96. function removeElementById(id) {
  97. var element = document.getElementById(id);
  98. if (element) {
  99. element.remove();
  100. }
  101. }
  102.  
  103. removeElementById("agar-io_970x90");
  104. removeElementById("socialButtons");
  105.  
  106. function customizeMainUI() {
  107. var mainUIOffers = document.getElementById('mainui-offers');
  108. if (mainUIOffers) {
  109. var titleElement = mainUIOffers.querySelector('.title');
  110. if (titleElement) {
  111. titleElement.textContent = 'FREE COINS';
  112. }
  113. }
  114. }
  115.  
  116. var observer = new MutationObserver(function(mutations) {
  117. mutations.forEach(function(mutation) {
  118. removeFooterElements();
  119. customizeMainUI();
  120. });
  121. });
  122.  
  123. var config = { childList: true, subtree: true, attributes: true };
  124. observer.observe(document.body, config);
  125.  
  126. window.addEventListener('load', function() {
  127. removeDefaultText();
  128. removeFooterElements();
  129. customizeMainUI();
  130. removeElementById();
  131.  
  132. var style = document.createElement('style');
  133. style.innerHTML = `
  134. :root {
  135. --bottom-banner-height: 1px !important;
  136. }
  137.  
  138. #background,
  139. canvas {
  140. height: calc(100% - var(--bottom-banner-height)) !important;
  141. }
  142.  
  143. .btn-play[data-v-0733aa78] {
  144. position: relative;
  145. top: 25px;
  146. color: #fff !important;
  147. background-color: #2a61d7 !important;
  148. border-color: #2a61d7 !important;
  149. width: 243px;
  150. height: 34px;
  151. font-size: 20px;
  152. line-height: 1.5;
  153. }
  154.  
  155. .mini .potion-slot-animation[data-v-55506716] {
  156. top: 24% !important;
  157. position: absolute !important;
  158. width: 100% !important;
  159. height: 175% !important;
  160. transform-origin: center !important;
  161. z-index: 1 !important;
  162. overflow: hidden !important;
  163. }
  164. .potion-slot-button.green[data-v-55506716] {
  165. }
  166. .party-join[data-v-3152cd5c], .party-play[data-v-3152cd5c] {
  167. background-color: #2a61d7 !important;
  168. border-color: #2a61d7 !important;
  169. width: 77px;
  170. }
  171. .free-coins-button > button[data-v-1791274a] {
  172. width: 285px;
  173. height: 45px;
  174. display: block;
  175. color: #fff;
  176. background-color: #54c800;
  177. border-color: #54c800;
  178. font-size: 14px;
  179. font-weight: 700;
  180. line-height: 1.42857143;
  181. text-align: center;
  182. white-space: nowrap;
  183. touch-action: manipulation;
  184. cursor: pointer;
  185. user-select: none;
  186. background-image: none;
  187. border: 1px solid transparent;
  188. border-radius: 4px;
  189. padding-left: 40px;
  190.  
  191. }
  192. .party-create[data-v-3152cd5c], .party-copy[data-v-3152cd5c] {
  193. background-color: #00d3ff !important;
  194. border-color: #00d3ff !important;
  195. width: 68px;
  196. }
  197. `;
  198. document.head.appendChild(style);
  199. });