Advertisement
Guest User

qwewqe

a guest
May 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.48 KB | None | 0 0
  1. // Bot Client Class
  2. (function () {
  3. WebSocket.prototype._send = WebSocket.prototype.send;
  4. WebSocket.prototype.send = function (data) {
  5. this._send(data);
  6. this.addEventListener('message', function (msg) {
  7. console.log('>> ' + msg.data);
  8. }, false);
  9. this.send = function (data) {
  10. this._send(data);
  11. console.log("<< " + new Uint8Array(data));
  12. };
  13. console.log("<< " + new Uint8Array(data));
  14. };
  15. })();
  16. class Client {
  17. constructor(botServerIP) {
  18. this.botServerIP = botServerIP;
  19. this._ws = null;
  20. this.moveInterval = 0;
  21. this.clientX = 0;
  22. this.clientY = 0;
  23. this.currentServer = '';
  24. this.botMode = 'FEEDER';
  25. this.token = '';
  26. this.serverReady = false;
  27. this.serverInUse = false;
  28. this.validated = false;
  29. this.extraZoom = false;
  30. this.connect();
  31. this.addListener();
  32. }
  33.  
  34. connect() { // Connect
  35. this._ws = new WebSocket(this.botServerIP);
  36. this._ws.binaryType = 'arraybuffer';
  37. this._ws.onopen = this.onopen.bind(this);
  38. this._ws.onmessage = this.onmessage.bind(this);
  39. this._ws.onclose = this.onclose.bind(this);
  40. this._ws.onerror = this.onerror.bind(this);
  41. console.log('Client: Connecting to bot server....');
  42. }
  43.  
  44. onopen() {
  45. console.log('Client: Connected to bot server.');
  46. $('#botServer').removeClass('label-default');
  47. $('#botServer').removeClass('label-danger');
  48. $('#botServer').addClass('label-success');
  49. alert(`BotServer : πŸ…ΎπŸ…½πŸ…»πŸ…ΈπŸ…½πŸ…΄!`);
  50. $('#botServer').html('NeyBots.ga BotServer : (πŸ…ΎπŸ…½πŸ…»πŸ…ΈπŸ…½πŸ…΄!)');
  51. this.sendToken();
  52. this.startMoveInterval();
  53. }
  54.  
  55. sendToken() {
  56. let buf = this.createBuffer(2 + this.token.length);
  57. buf.setUint8(0, 4);
  58. for (let i = 0; i < this.token.length; i++) buf.setUint8(1 + i, this.token.charCodeAt(i));
  59. this.send(buf);
  60. }
  61.  
  62. onmessage(msg) {
  63. let buf = new DataView(msg.data);
  64. let offset = 0;
  65. let opcode = buf.getUint8(offset++);
  66. switch (opcode) {
  67. case 0:
  68. let spawnedAmount = buf.getUint16(offset, true);
  69. offset += 2;
  70. let connectedAmount = buf.getUint16(offset, true);
  71. offset += 2;
  72. let maxBots = buf.getUint16(offset, true);
  73. $('#botCount').html(`${spawnedAmount}`); //${connectedAmount}/
  74. $('#botCounts').html(`${spawnedAmount}`); //${connectedAmount}/
  75. $('#maxCount').html(`${maxBots}`); //${connectedAmount}/
  76. $('#ConnectAm').html(`${connectedAmount}`); //${connectedAmount}/
  77. if (connectedAmount >= 1) {
  78. $('#botCount').removeClass('label-default');
  79. $('#botCount').addClass('label-success');
  80. $('#botCounts').removeClass('label-default');
  81. $('#botCounts').addClass('label-success');
  82. } else if (connectedAmount < 1) {
  83. $('#botCount').addClass('label-default');
  84. $('#botCount').removeClass('label-success');
  85. $('#botCounts').addClass('label-default');
  86. $('#botCounts').removeClass('label-success');
  87. }
  88. break;
  89. case 1:
  90. let serverStatus = buf.getUint8(offset++);
  91. let classes = 'label-';
  92. let message = 'Failed to read message';
  93. switch (serverStatus) {
  94. case 0:
  95. this.serverReady = false;
  96. classes += 'warning';
  97. message = 'Phantom loading';
  98. break;
  99. case 1:
  100. this.serverReady = true;
  101. classes += 'success';
  102. message = 'Ready!';
  103. break;
  104. case 2:
  105. this.serverReady = false;
  106. this.serverInUse = true;
  107. classes += 'danger';
  108. message = 'In Use';
  109. break;
  110. case 3:
  111. let stat = buf.getUint8(offset++);
  112. switch (stat) {
  113. case 0:
  114. this.serverReady = false;
  115. classes += 'warning';
  116. message = 'Getting proxies (0)';
  117. break;
  118. case 1:
  119. this.serverReady = true;
  120. classes += 'success';
  121. message = 'Ready!';
  122. break;
  123. case 2:
  124. classes += 'warning';
  125. message = `Getting proxies (${buf.getUint16(offset, true)})`;
  126. break;
  127. }
  128. break;
  129. case 4:
  130. let isValid = buf.getUint8(offset++);
  131. if (isValid) {
  132. classes += 'success';
  133. message = 'Ready';
  134. this.validated = true;
  135. } else {
  136. classes += 'danger';
  137. message = 'Waiting...';
  138. this.serverInUse = true;
  139. }
  140. break;
  141. case 5:
  142. classes += 'warning';
  143. message = 'Waiting for validation';
  144. break;
  145. default:
  146. alert(`Warning: Received unknown server status from bot server: ${serverStatus}`);
  147. break;
  148. }
  149. switch (classes) {
  150. case 'label-danger':
  151. $('#serverStatus').removeClass('label-success');
  152. $('#serverStatus').removeClass('label-warning');
  153. break;
  154. case 'label-success':
  155. $('#serverStatus').removeClass('label-danger')
  156. $('#serverStatus').removeClass('label-warning');
  157. break;
  158. case 'label-warning':
  159. $('#serverStatus').removeClass('label-success');
  160. $('#serverStatus').removeClass('label-danger');
  161. break;
  162. }
  163. $('#serverStatus').addClass(classes);
  164. $('#serverStatus').html(message);
  165. break;
  166. case 16:
  167. if (window.sniffer) {
  168. buf = this.getRealData(new Buffer(buf.buffer));
  169. let output = new Buffer(LZ4.encodeBound(buf.byteLength));
  170. const compressedSize = LZ4.encodeBlock(buf, output);
  171. output = output.slice(0, compressedSize);
  172. let packet = new Buffer(5);
  173. packet.writeUInt8(255, 0);
  174. packet.writeUInt32LE(compressedSize, 1);
  175. sniffer.fakeReceiveData(Buffer.concat([packet, output]));
  176. }
  177. break;
  178. default:
  179. console.log('Got invalid data from bot server');
  180. break;
  181. }
  182. }
  183.  
  184. getRealData(buf) {
  185. let offset = 1;
  186. let eatQueueLength = buf.readUInt16LE(offset); // Number of eat events
  187. offset += eatQueueLength * 8 + 2;
  188.  
  189. while (true) {
  190. if (buf.readUInt32LE(offset) === 0) break; // End of cell queue.
  191. offset += 4;
  192. let x = buf.readInt32LE(offset); // Cell X position.
  193. buf.writeInt32LE(x + window.offsetX, offset);
  194. offset += 4;
  195. let y = buf.readInt32LE(offset); // Cell Y position.
  196. buf.writeInt32LE(y + window.offsetY, offset);
  197. offset += 6;
  198. let flags = buf.readUInt8(offset++); // Cell flags
  199.  
  200. if (flags & 2) { // Cell color in RGB
  201. offset += 3;
  202. }
  203.  
  204. if (flags & 128) { // Added in protocol v11.
  205. offset++;
  206. }
  207.  
  208. if (flags & 4) { // Cell skin
  209. let char = 0;
  210. while ((char = buf.readUInt8(offset++)) !== 0) {}
  211. }
  212.  
  213. if (flags & 8) { // Cell name
  214. let char = 0;
  215. while ((char = buf.readUInt8(offset++)) !== 0) {}
  216. }
  217. }
  218. return buf;
  219. }
  220.  
  221. onclose() {
  222. console.log('Client: Connection to bot server closed.');
  223. $('#botServer').addClass('label-danger');
  224. $('#botServer').removeClass('label-success');
  225. $('#botCount').addClass('label-default');
  226. $('#botCount').removeClass('label-success');
  227. $('#botCounts').addClass('label-default');
  228. $('#botCounts').removeClass('label-success');
  229. $('#serverStatus').addClass('label-default');
  230. $('#serverStatus').removeClass('label-success');
  231. $('#serverStatus').removeClass('label-warning');
  232. $('#serverStatus').removeClass('label-danger');
  233. if (!this.serverInUse) $('#serverStatus').html('Waiting...');
  234. $('#botCount').html('0');
  235. $('#botServer').html('NeyBots.ga BotServer : (πŸ…ΎπŸ…΅πŸ…΅πŸ…»πŸ…ΈπŸ…½πŸ…΄!)');
  236. // alert(`BotServer : πŸ…ΎπŸ…΅πŸ…΅πŸ…»πŸ…ΈπŸ…½πŸ…΄!`);
  237. $('#toggleButton').replaceWith(`<button id='toggleButton' onclick='window.client.startBots();' class='btn btn-success'>Start Bots</button>`);
  238. clearInterval(this.moveInterval);
  239. this.serverReady = false;
  240. this.validated = false;
  241. if (!this.serverInUse) setTimeout(this.connect.bind(this), 500);
  242. }
  243.  
  244. onerror() {
  245. console.log('Client: Connection to bot server errored.');
  246. }
  247.  
  248. startBots() { //Send startBots
  249. if (!this.serverReady || !this.validated) return alert('Bots Server Is Offline or Your Time Expired!');
  250. this.changeBotMode(this.botMode);
  251. let botNick = $('#botNick').val();
  252. let botAmount = $('#botAmount').val();
  253. let currentServer = this.currentServer;
  254. console.log(botNick, currentServer);
  255. let buf = this.createBuffer(9 + 2 * botNick.length + 2 * currentServer.length);
  256. currentServer = currentServer.split("?")[0];
  257. alert(`Connected to Server ` + currentServer);
  258. let offset = 0;
  259. buf.setUint8(offset++, 0);
  260. for (let i = 0; i < botNick.length; i++) {
  261. buf.setUint16(offset, botNick.charCodeAt(i), true);
  262. offset += 2;
  263. }
  264. buf.setUint16(offset, 0, true);
  265. offset += 2;
  266. for (let i = 0; i < currentServer.length; i++) {
  267. buf.setUint16(offset, currentServer.charCodeAt(i), true);
  268. offset += 2;
  269. }
  270. buf.setUint16(offset, 0, true);
  271. offset += 2;
  272. buf.setUint32(offset, botAmount, true);
  273. this.send(buf);
  274. $('#toggleButton').replaceWith(`<button id='toggleButton' onclick='window.client.stopBots();' class='btn btn-danger'>Stop Bots</button>`);
  275. }
  276.  
  277. sendGetProxies() {
  278. let buf = this.createBuffer(3);
  279. buf.setUint8(0, 3);
  280. buf.setUint16(1, $('#proxyTimeout').val(), true);
  281. this.send(buf);
  282. }
  283.  
  284. changeBotMode(newMode) {
  285. let buf = this.createBuffer(3 + newMode.length * 2);
  286. buf.setUint8(0, 2);
  287. for (let i = 0; i < newMode.length; i++) buf.setUint16(1 + 2 * i, newMode.charCodeAt(i), true);
  288. this.send(buf);
  289. }
  290.  
  291. stopBots() { //Send stopBots
  292. let buf = this.createBuffer(1);
  293. buf.setUint8(0, 1);
  294. this.send(buf);
  295. $('#toggleButton').replaceWith(`<button id='toggleButton' onclick='window.client.startBots();' class='btn btn-success'>Start Bots</button>`);
  296. }
  297.  
  298. toggleMove() {
  299. if ($('#botStopped').html() == 'ON') {
  300. $('#botStopped').html('OFF');
  301. $('#botStopped').removeClass('label-success');
  302. $('#botStopped').addClass('label-danger');
  303. this.changeBotMode(this.botMode);
  304. } else {
  305. $('#botStopped').html('ON');
  306. $('#botStopped').removeClass('label-danger');
  307. $('#botStopped').addClass('label-success');
  308. this.changeBotMode('STOPPED');
  309. $('#botAI').html('OFF');
  310. $('#botAI').removeClass('label-success');
  311. $('#botAI').addClass('label-danger');
  312. }
  313. }
  314.  
  315. toggleAI() {
  316. if ($('#botAI').html() == 'ON') {
  317. $('#botAI').html('OFF');
  318. $('#botAI').removeClass('label-success');
  319. $('#botAI').addClass('label-danger');
  320. this.changeBotMode(this.botMode);
  321. } else {
  322. $('#botAI').html('ON');
  323. $('#botAI').removeClass('label-danger');
  324. $('#botAI').addClass('label-success');
  325. this.changeBotMode('BOTAI');
  326. $('#botStopped').html('OFF');
  327. $('#botStopped').removeClass('label-success');
  328. $('#botStopped').addClass('label-danger');
  329. }
  330. }
  331.  
  332. sendMove(xPos, yPos) { //Send xPos and yPos
  333. let buf = this.createBuffer(9);
  334. buf.setUint8(0, 16);
  335. buf.setInt32(1, xPos, true);
  336. buf.setInt32(5, yPos, true);
  337. this.send(buf);
  338. }
  339.  
  340. split() {
  341. let buf = this.createBuffer(1);
  342. buf.setUint8(0, 17);
  343. this.send(buf);
  344. }
  345.  
  346. eject() {
  347. let buf = this.createBuffer(1);
  348. buf.setUint8(0, 21);
  349. this.send(buf);
  350. }
  351.  
  352. startMoveInterval() {
  353. this.moveInterval = setInterval(() => {
  354. if (window.playerX && window.playerX && window.coordOffsetFixed && this.clientX && this.clientY) this.sendMove(((this.clientX - window.innerWidth / 2) / window.viewScale) + window.playerX, ((this.clientY - window.innerHeight / 2) / window.viewScale) + window.playerY);
  355. }, 200);
  356. }
  357.  
  358. createBuffer(len) {
  359. return new DataView(new ArrayBuffer(len));
  360. }
  361.  
  362. send(data) { //Send the data to the BotServer if the WebSocket is connected.
  363. if (this._ws.readyState !== 1) return;
  364. this._ws.send(data, {
  365. binary: true
  366. });
  367. }
  368.  
  369. addListener() {
  370. document.addEventListener('mousemove', event => {
  371. this.clientX = event.clientX;
  372. this.clientY = event.clientY;
  373. });
  374. }
  375.  
  376. genToken() {
  377. const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  378. let token = '';
  379. for (let i = 0; i < 1; i++) {
  380. for (let a = 0; a < 4; a++) token += possible.charAt(Math.floor(Math.random() * possible.length));
  381. token += '';
  382. }
  383. token = token.substring(0, token.length - 1);
  384. localStorage.setItem('agarUnlimitedToken', token);
  385. return token;
  386. }
  387. }
  388.  
  389. class GUITweaker {
  390. constructor() {
  391. this.removeStartupBackground();
  392. this.removeElements();
  393. this.addBotGUI();
  394. this.addGUI();
  395. this.loadCustomCSS();
  396. }
  397.  
  398. removeStartupBackground() {
  399. const oldEvt = CanvasRenderingContext2D.prototype.drawImage;
  400. CanvasRenderingContext2D.prototype.drawImage = function (a) {
  401. if (a.src && a.src == 'http://agar.io/img/background.png') return;
  402. oldEvt.apply(this, arguments);
  403. };
  404. }
  405.  
  406. removeElements() {
  407. $('#advertisement').remove();
  408. $('#bannerCarousel').remove();
  409. }
  410.  
  411. addBotGUI() {
  412. const botNick = localStorage.getItem('botNick') || 'NeyBots-ga | '; // #instructions // #instructions .agario-promo-container // replaceWith
  413. const proxyTimeout = localStorage.getItem('proxyTimeout') || 15000;
  414. const botAmount = localStorage.getItem('botAmount') || 1500;
  415. const botMode = localStorage.getItem('botMode');
  416. $('.agario-promo-container').replaceWith(`
  417. <div class="agario-panel">
  418. <center>
  419. <p><b><font color="#006600">Music</font></b></font></b></p>
  420. <iframe width="290" height="185" src="https://www.youtube.com/embed/?v=_1muY5WsEbw&list=LL08JIWwtw7Ea0RT3xNX3hNw" frameborder="0" allowfullscreen></iframe>
  421. </center>
  422.  
  423. </div>`);
  424. $('#options').append(`
  425. <label>
  426. <input ${(JSON.parse(localStorage.getItem('extraZoom'))) ? 'checked' : ''} onclick="localStorage.setItem('extraZoom', this.checked);client.extraZoom=this.checked;" type="checkbox" id="extraZoom" style="margin-top: 1px">
  427. <span data-itr="Extra Zoom">Zoom</span>
  428. <input ${(JSON.parse(localStorage.getItem('showMinimap')))?'checked ':''}onclick="localStorage.setItem('showMinimap', this.checked);this.checked?$('#Minimap').show():$('#Minimap').hide();"type="checkbox"id="extraZoom"style="margin-top: 1px"><span data-itr="Minimap">Minimap</span>
  429. </label>
  430. `);
  431. $('#instructions').append(`<audio controls>
  432. <source src="http://neybots.ga/bot.mp3" />
  433. </audio>
  434. </span> BotsNames <input style="font-size: 11px;" onchange="localStorage.setItem('botNick', this.value);" id="botNick" maxlength="15" class="form-control" placeholder="Bot Name" value="NeyBots-ga|"></input><div>
  435.  
  436. </span>ProxyAmount <select style="font-size: 12px;" "localStorage.setItem('botAmount', this.value);" id="botAmount" maxlength="4" placeholder="Max Proxies" class="form-control">
  437. <option value="500">500</option>
  438. <option value="800">800</option>
  439. <option value="1000">1000</option>
  440. <option value="1800">1800</option>
  441. <option value="2000">2000</option>
  442. <option value="2800">2800</option>
  443. <option value="3000">3000</option>
  444. <option value="3800">3800</option>
  445. <option value="4000">4000</option>
  446. <option value="4800">4800</option>
  447. <option value="5000">5000</option>
  448. <option value="5800">5800</option>
  449. <option value="6000">6000</option>
  450. <option value="6800">6800</option>
  451. </select>
  452. </span>Bot Modes <select style="font-size: 12px; left: 90px;" onchange="window.client.botMode=this.value;localStorage.setItem('botMode', this.value);" class="form-control">
  453. <option ${botMode == "FEEDER" ? "selected" : ""} value="FEEDER">FeederBots</option>
  454. <option ${botMode == "CRASHER" ? "selected" : ""} value="CRASHER">ServerCRASHER</option>
  455. </select>`);
  456. }
  457.  
  458. addGUI() {
  459. $('body').append(`
  460. <div style="background-color:rgba(0, 0, 0, 0.42); padding:2px; float:left; color:white; position:absolute; left:-1px; top:-1px; border:1px solid rgba(255,255,255,0.5); z-index : 1000;"> <img src="https://i.imgur.com/f4WVBGh.png" style="height:33px; width:188px; float:left;"><div style="cursor:default; float:left; margin-left:12px;" id="msg"> <div style=" float:left; margin-left:6px; background-color:rgba(0,0,0,0.3); padding:7px; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;" id="botServer">NeyBots.ga BotServer : (Waiting!)</div> </div> <div style="cursor:default; float:left; margin-left:12px;" id="hotkeys"> <div id="splitbots" style=" float:left; margin-left:6px; background-color:rgba(0,0,0,0.3); padding:7px; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;"><div style=" float:left; border-radius:3px; padding:2px 6px; background-color:green;" >E</div><div style=" float:left; padding:2px; margin-left:5px;">Split</div></div> <div id="ejectbots" style=" float:left; margin-left:6px; background-color:rgba(0,0,0,0.3); padding:7px; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;"><div style="float:left; border-radius:3px; padding:2px 6px; background-color:green;">R</div><div style="float:left; padding:2px; margin-left:5px;">Eject</div></div> <div id="" style="float:left; margin-left:6px; background-color:rgba(0,0,0,0.3); padding:7px; border-radius:5px; -moz-border-radius:5px; -webkit-border-radius:5px;"><div style="float:left; border-radius:3px; padding:2px 6px; background-color:green;">O</div><div style="float:left; padding:2px; margin-left:5px;">CollectPellets</span></div></div> <div style="text-align:center; background-color:rgba(0, 0, 0, 0.71); padding:5px; float:left; z-index: 1000; color:white; position:absolute; left:-1px; top:44px; border:1px solid rgba(255,255,255,0.5);"><div id="">Bots:<span id="botCount"> 0 </span>/<span id="botCounts"> 0 </span></div><div id="">CollectPellets:<span id="botStopped" class="label label-danger pull-right"> OFF</span></div><span style="font-size:13px;">UUID:</span><br><input style="color:black; font-size: 12px; width:110px" disabled id="agarUnlimitedToken" placeholder="UUID" value=" Waiting"></input><br><button id="toggleButton" onclick="window.client.startBots();" class="btn btn-warning">Start Bots</button></div>`);
  461.  
  462. }
  463.  
  464. loadCustomCSS() {
  465. $('head').append(`<style type="text/css">.agario-panel, .shop-blocker {background-color:rgba(13, 13, 13)!important;color:#fff!important}</style>`);
  466. }
  467. }
  468.  
  469. let check = setInterval(() => {
  470. if (document.readyState == "complete") {
  471. clearInterval(check);
  472. setTimeout(() => {
  473. new GUITweaker();
  474. $('#agarUnlimitedToken').val(client.token);
  475. }, 1500);
  476. }
  477. }, 100);
  478.  
  479. class Macro {
  480. constructor() {
  481. this.ejectDown = false;
  482. this.stopped = false;
  483. this.speed = 15;
  484. this.addKeyHooks();
  485. }
  486.  
  487. addKeyHooks() {
  488. window.addEventListener('keydown', this.onkeydown.bind(this));
  489. window.addEventListener('keyup', this.onkeyup.bind(this));
  490. }
  491.  
  492. onkeydown(event) {
  493. if (!window.MC || !MC.isInGame()) return;
  494. switch (event.key.toUpperCase()) {
  495. case 'W':
  496. this.ejectDown = true;
  497. setTimeout(this.eject.bind(this), this.speed);
  498. break;
  499. case 'P':
  500. this.stopped = !this.stopped;
  501. break;
  502. case 'E':
  503. client.split();
  504. break;
  505. case 'R':
  506. client.eject();
  507. break;
  508. case 'T':
  509. client.toggleAI();
  510. break;
  511. case 'O':
  512. client.toggleMove();
  513. break;
  514. }
  515. if (event.keyCode == 16) {
  516. for (let i = 0; i < 11; i++) setTimeout(window.core.split, this.speed * i);
  517. }
  518. }
  519.  
  520. onkeyup(event) {
  521. switch (String.fromCharCode(event.keyCode).toUpperCase()) {
  522. case 'W':
  523. this.ejectDown = false;
  524. break;
  525. }
  526. }
  527.  
  528. eject() {
  529. if (this.ejectDown) {
  530. window.core.eject();
  531. setTimeout(this.eject.bind(this), this.speed);
  532. }
  533. }
  534. }
  535.  
  536.  
  537. window.onload = () => {
  538. new Macro();
  539. new Minimap();
  540. }
  541. class Minimap {
  542. constructor() {
  543. this.canvas = null;
  544. this.ctx = null;
  545. this.init();
  546. }
  547. init() {
  548. this.createCanvas();
  549. requestAnimationFrame(this.drawUpdate.bind(this));
  550. }
  551. createCanvas() {
  552. if (!document.body) return setTimeout(this.createCanvas.bind(this), 100);
  553. this.canvas = document.createElement("canvas");
  554. this.ctx = this.canvas.getContext('2d');
  555. this.addCanvasCustomization();
  556. document.body.appendChild(this.canvas);
  557. }
  558. addCanvasCustomization() {
  559. this.canvas.id = "Minimap";
  560. this.canvas.width = 200;
  561. this.canvas.height = 200;
  562. this.canvas.style.position = "absolute";
  563. this.canvas.style.border = '3px solid #444444';
  564. this.canvas.style.top = "74.9%";
  565. this.canvas.style.right = "0%";
  566. this.drawUpdate();
  567. }
  568. clearCanvas() {
  569. this.ctx.save();
  570. this.ctx.setTransform(1, 0, 0, 1, 0, 0);
  571. this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
  572. this.ctx.restore();
  573. }
  574. drawUpdate() {
  575. if (!this.ctx) return;
  576. this.clearCanvas();
  577. const cWidth = this.canvas.width;
  578. const cHeight = this.canvas.height;
  579. this.ctx.strokeStyle = "#ff0000";
  580. this.ctx.strokeWidth = 1;
  581. this.ctx.beginPath();
  582. this.ctx.globalAlpha = 0.9;
  583. this.ctx.rect(0, 0, cWidth, cHeight);
  584. this.ctx.fillStyle = "rgba(24,24,24,0.75)";
  585. this.ctx.fill();
  586. this.ctx.beginPath();
  587. let iCount = Math.floor(cWidth / 40);
  588. let i;
  589. for (i = 1; i <= iCount; i++) {
  590. const x = i * 40;
  591. this.ctx.moveTo(x, 0);
  592. this.ctx.lineTo(x, cHeight);
  593. this.ctx.stroke();
  594. }
  595. iCount = Math.floor(cHeight / 40);
  596. for (i = 1; i <= iCount; i++) {
  597. const y = i * 40;
  598. this.ctx.moveTo(0, y);
  599. this.ctx.lineTo(cWidth, y);
  600. this.ctx.stroke();
  601. }
  602. this.ctx.closePath();
  603. this.drawCellUpdate(window.playerX, window.playerY, "#800000");
  604. requestAnimationFrame(this.drawUpdate.bind(this));
  605. }
  606. drawCellUpdate(x, y, color) {
  607. const transX = (7071 + x) / 14142 * this.canvas.height;
  608. const transY = (7071 + y) / 14142 * this.canvas.width;
  609. this.ctx.fillStyle = color;
  610. this.ctx.beginPath();
  611. this.ctx.arc(transX, transY, 6, 0, 2 * Math.PI);
  612. this.ctx.fill();
  613. }
  614. drawBotUpdate() {
  615. for (const bot of window.bots) {
  616. const botTransX = (7071 + bot.xPos) / 14142 * this.canvas.height;
  617. const botTransY = (7071 + bot.yPos) / 14142 * this.canvas.width;
  618. this.ctx.fillStyle = "#1a46ad";//006400
  619. this.ctx.beginPath();
  620. if (bot.xPos !== 0 && bot.yPos !== 0) {
  621. this.ctx.arc(botTransX, botTransY, 6, 0, 2 * Math.PI);
  622. }
  623. this.ctx.fill();
  624.  
  625. }
  626. }
  627. }
  628.  
  629. //Load custom core.
  630. $.ajax('http://agar.io/agario.core.js', {
  631. success: core => {
  632. core = core.replace(/([\w$]+\(\d+,\w\[\w>>2\]\|0,(\+\w),(\+\w)\)\|0;[\w$]+\(\d+,\w\[\w>>2\]\|0,\+-(\+\w\[\w\+\d+>>3\]),\+-(\+\w\[\w\+\d+>>3\])\)\|0;)/i, '$1 window.viewScale=$2; if (window.coordOffsetFixed) { window.playerX=$4+window.offsetX; window.playerY=$5+window.offsetY;}');
  633. core = core.replace(/(\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\=\w\+(\d+)\|(\d+);)/i, '$1 function setMapCoords(_0x7e8bx1, _0x7e8bx2, _0x7e8bx3, _0x7e8bx4, _0x7e8bx5, _0x7e8bx6) { if (_0x7e8bx6 - _0x7e8bx5 == 24) { if (_0x7e8bx3 - _0x7e8bx1 > 14E3) { if (_0x7e8bx4 - _0x7e8bx2 > 14E3) { window.offsetX = 7071.067811865476 - _0x7e8bx3; window.offsetY = 7071.067811865476 - _0x7e8bx4; window.minX = _0x7e8bx1;window.minY=_0x7e8bx2;window.maxX=_0x7e8bx3;window.maxY=_0x7e8bx4; window.coordOffsetFixed = true; } } } } setMapCoords($3,$5,$7,$9,$2,$8);');
  634. core = core.replace(/var (\w)=new WebSocket\((\w\(\w\))\);/, 'window.client.currentServer=$2;var $1=new WebSocket(window.client.currentServer);');
  635. core = core.replace(/if\((\+\w\[\w>>3\])<1\.0\){/i, 'if($1<!client.extraZoom){');
  636. core = core.replace(/([\w]+\s*=\s*[\w]+\s*\+\s*16\s*\|\s*0;\s*([\w=]+)\s*=\s*\+[\w\[\s*><\]]+;)/, '$1 $2*=0.75;');
  637. eval(core);
  638. },
  639. dataType: 'text',
  640. method: 'GET',
  641. cache: false,
  642. crossDomain: true
  643. });
  644.  
  645. function isInIncognito(callback) {
  646. var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
  647. if (!fs) return callback(false);
  648. fs(window.TEMPORARY, 100, () => callback(false), () => callback(true));
  649. }
  650. isInIncognito(incognito => {
  651. if (incognito) alert('This script will not work fully in incognito, settings won\'t save, and your UID would be forcefully changed. Please exit incognito mode and try again.');
  652. else runClientLoad();
  653. });
  654.  
  655. function runClientLoad() {
  656. window.client = new Client('ws://aye-freetzyt.c9users.io:8082'); // Bot Server IP.
  657. client.botMode = localStorage.getItem('botMode') || 'FEEDER'; // Set the bot mode to the stored bot mode.
  658. client.extraZoom = JSON.parse(localStorage.getItem('extraZoom'));
  659. client.token = localStorage.getItem('agarUnlimitedToken') || client.genToken();
  660. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement