Advertisement
JOOTAA

Untitled

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