Advertisement
Guest User

Untitled

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