Advertisement
Guest User

Blob.io Bots by Kali

a guest
May 21st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Blob.io Bots
  3. // @namespace https://youtube.com/Lemons1337
  4. // @version 1
  5. // @description Blob.io bots!
  6. // @author Lemons
  7. // @match *://client.blobgame.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. window.addEventListener("load", () => {
  13. let ui = document.createElement('div');
  14. ui.id = 'botcanvas';
  15. ui.style['background'] = 'rgba(0,0,0,0.4)';
  16. ui.style['top'] = '250px';
  17. ui.style['left'] = '17px';
  18. ui.style['display'] = 'block';
  19. ui.style['position'] = 'absolute';
  20. ui.style['text-align'] = 'center';
  21. ui.style['font-size'] = '15px';
  22. ui.style['color'] = '#FFFFFF';
  23. ui.style['padding'] = '7px';
  24. ui.style['z-index'] = '1000000';
  25. ui.innerHTML += 'Agar API Bots';
  26. let count = document.createElement('span');
  27. ui.appendChild(count);
  28. document.body.appendChild(ui);
  29. html.onScriptDownloaded(function () {
  30. class User {
  31. constructor() {
  32. this.wsIp = 'ws://184.105.169.63:8080';
  33. this.started = false;
  34. this.x = this.y = 0;
  35. this.mouseInt = -1;
  36. this.byteLen = 0;
  37. this.server = '';
  38. this.mouse = 0;
  39. this.ws = null;
  40. this.connect();
  41. }
  42.  
  43. connect() {
  44. this.ws = new WebSocket(this.wsIp);
  45. this.ws.onmessage = this.onmessage.bind(this);
  46. this.ws.onerror = this.onerror.bind(this);
  47. this.ws.onclose = this.onclose.bind(this);
  48. this.ws.onopen = this.onopen.bind(this);
  49. }
  50.  
  51. onopen() {
  52. this.startMouseInt();
  53. this.started = false;
  54. }
  55.  
  56. startMouseInt() {
  57.  
  58. this.mouseInt = setInterval(() => {
  59.  
  60. let json = {};
  61.  
  62. json.type = "mouse";
  63. json.packet = this.mouse;
  64. //json.x = this.x;
  65. //json.y = this.y;
  66.  
  67. this.send(json);
  68.  
  69. }, 100);
  70.  
  71. }
  72.  
  73. onmessage(message) {}
  74.  
  75. onclose() {
  76. setTimeout(this.connect(), 1500);
  77. clearInterval(this.mouseInt);
  78. }
  79.  
  80. startBots() {
  81. let json = {};
  82.  
  83. json.type = "start";
  84. json.ip = client.server;
  85.  
  86. this.send(json);
  87. }
  88.  
  89. stopBots() {
  90. this.send({
  91. type: 'stop'
  92. });
  93. }
  94.  
  95. onerror() { }
  96.  
  97. send(message) {
  98. if (this.ws && this.ws.readyState == 1) this.ws.send(JSON.stringify(message));
  99. }
  100.  
  101. get isTyping() {
  102. return document.querySelectorAll('input:focus').length;
  103. }
  104.  
  105. keyDown(event) {
  106. if (this.isTyping || !event.key) return;
  107. switch (event.key.toLowerCase()) {
  108. case 'e':
  109. this.send({
  110. type: 'split'
  111. });
  112. break;
  113.  
  114. case 'r':
  115. this.send({
  116. type: 'eject'
  117. });
  118. break;
  119.  
  120. }
  121. }
  122.  
  123. }
  124. window.client = new User();
  125. window.started = false;
  126. document.addEventListener('keydown', window.client.keyDown.bind(window.client));
  127. (function () {
  128. WebSocket.prototype._send = WebSocket.prototype.send;
  129. WebSocket.prototype.send = function (data) {
  130. this._send(data);
  131. var buf = new Uint8Array(data.buffer ? data.buffer : data);
  132. switch (buf[0]) {
  133. case 16:
  134. window.client.mouse = [...buf];
  135. break;
  136.  
  137. case 255:
  138. if (!window.started) client.startBots();
  139. window.started = true;
  140. break;
  141.  
  142. case 22:
  143. client.send({
  144. type: 'split'
  145. });
  146. break;
  147.  
  148. case 23:
  149. this.send({
  150. type: 'eject'
  151. });
  152. break;
  153. }
  154. window.client.server = this.url;
  155. };
  156. })();
  157. }.toString().split('\n').slice(1, -1).join('\n'));
  158. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement