Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bot Client Class
- let currentServer = null;
- class Client {
- constructor(botServerIP) {
- this.botServerIP = botServerIP;
- this._ws = null;
- this.moveInterval = 0;
- this.clientX = 0;
- this.clientY = 0;
- this.currentServer = '';
- this.botMode = 'FEEDER';
- this.token = '';
- this.serverReady = false;
- this.serverInUse = false;
- this.validated = false;
- this.extraZoom = false;
- this.connect();
- this.addListener();
- }
- connect() { // Connect
- this._ws = new WebSocket(this.botServerIP);
- this._ws.binaryType = 'arraybuffer';
- this._ws.onopen = this.onopen.bind(this);
- this._ws.onmessage = this.onmessage.bind(this);
- this._ws.onclose = this.onclose.bind(this);
- this._ws.onerror = this.onerror.bind(this);
- console.log('Client: Connecting to bot server....');
- }
- onopen() {
- console.log('Client: Connected to bot server.');
- $('#botServer').removeClass('label-default');
- $('#botServer').removeClass('label-danger');
- $('#botServer').addClass('label-success');
- $('#botServer').html('Online');
- this.sendToken();
- this.startMoveInterval();
- }
- sendToken() {
- let buf = this.createBuffer(2 + this.token.length);
- buf.setUint8(0, 4);
- for (let i = 0; i < this.token.length; i++) buf.setUint8(1 + i, this.token.charCodeAt(i));
- this.send(buf);
- }
- onmessage(msg) {
- let buf = new DataView(msg.data);
- let offset = 0;
- let opcode = buf.getUint8(offset++);
- switch (opcode) {
- case 0:
- let spawnedAmount = buf.getUint16(offset, true);
- offset += 2;
- let connectedAmount = buf.getUint16(offset, true);
- offset += 2;
- let maxBots = buf.getUint16(offset, true);connectedAmount
- $('#botCount').html(`${spawnedAmount}/${connectedAmount}`);
- if (connectedAmount >= 1) {
- $('#botCount').removeClass('label-default');
- $('#botCount').addClass('label-success');
- } else if (connectedAmount < 1) {
- $('#botCount').addClass('label-default');
- $('#botCount').removeClass('label-success');
- }
- break;
- case 1:
- let serverStatus = buf.getUint8(offset++);
- let classes = 'label-';
- let message = 'Failed to read message';
- switch (serverStatus) {
- case 0:
- this.serverReady = false;
- classes += 'warning';
- message = 'Phantom loading';
- break;
- case 1:
- this.serverReady = true;
- classes += 'success';
- message = 'Ready';
- break;
- case 2:
- this.serverReady = false;
- this.serverInUse = true;
- classes += 'danger';
- message = 'In use';
- break;
- case 3:
- let stat = buf.getUint8(offset++);
- switch (stat) {
- case 0:
- this.serverReady = false;
- classes += 'warning';
- message = 'Getting proxies (0)';
- break;
- case 1:
- this.serverReady = true;
- classes += 'success';
- message = 'Ready';
- break;
- case 2:
- classes += 'warning';
- message = `Getting proxies (${buf.getUint16(offset, true)})`;
- break;
- }
- break;
- case 4:
- let isValid = buf.getUint8(offset++);
- if (isValid) {
- classes += 'success';
- message = 'Validated/Ready';
- this.validated = true;
- } else {
- classes += 'danger';
- message = 'Not validated';
- this.serverInUse = true;
- }
- break;
- case 5:
- classes += 'warning';
- message = 'Waiting for validation';
- break;
- default:
- alert(`Warning: Received unknown server status from bot server: ${serverStatus}`);
- break;
- }
- switch (classes) {
- case 'label-danger':
- $('#serverStatus').removeClass('label-success');
- $('#serverStatus').removeClass('label-warning');
- break;
- case 'label-success':
- $('#serverStatus').removeClass('label-danger')
- $('#serverStatus').removeClass('label-warning');
- break;
- case 'label-warning':
- $('#serverStatus').removeClass('label-success');
- $('#serverStatus').removeClass('label-danger');
- break;
- }
- $('#serverStatus').addClass(classes);
- $('#serverStatus').html(message);
- break;
- case 16:
- if (window.sniffer) {
- buf = this.getRealData(new Buffer(buf.buffer));
- let output = new Buffer(LZ4.encodeBound(buf.byteLength));
- const compressedSize = LZ4.encodeBlock(buf, output);
- output = output.slice(0, compressedSize);
- let packet = new Buffer(5);
- packet.writeUInt8(255, 0);
- packet.writeUInt32LE(compressedSize, 1);
- sniffer.fakeReceiveData(Buffer.concat([packet, output]));
- }
- break;
- default:
- console.log('Got invalid data from bot server');
- break;
- }
- }
- getRealData(buf) {
- let offset = 1;
- let eatQueueLength = buf.readUInt16LE(offset); // Number of eat events
- offset += eatQueueLength * 8 + 2;
- while (true) {
- if (buf.readUInt32LE(offset) === 0) break; // End of cell queue.
- offset += 4;
- let x = buf.readInt32LE(offset); // Cell X position.
- buf.writeInt32LE(x + window.offsetX, offset);
- offset += 4;
- let y = buf.readInt32LE(offset); // Cell Y position.
- buf.writeInt32LE(y + window.offsetY, offset);
- offset += 6;
- let flags = buf.readUInt8(offset++); // Cell flags
- if (flags & 2) { // Cell color in RGB
- offset += 3;
- }
- if (flags & 128) { // Added in protocol v11.
- offset++;
- }
- if (flags & 4) { // Cell skin
- let char = 0;
- while ((char = buf.readUInt8(offset++)) !== 0) {}
- }
- if (flags & 8) { // Cell name
- let char = 0;
- while ((char = buf.readUInt8(offset++)) !== 0) {}
- }
- }
- return buf;
- }
- onclose() {
- console.log('Client: Connection to bot server closed.');
- $('#botServer').addClass('label-danger');
- $('#botServer').removeClass('label-success');
- $('#botCount').addClass('label-default');
- $('#botCount').removeClass('label-success');
- $('#serverStatus').addClass('label-default');
- $('#serverStatus').removeClass('label-success');
- $('#serverStatus').removeClass('label-warning');
- $('#serverStatus').removeClass('label-danger');
- if (!this.serverInUse) $('#serverStatus').html('Waiting...');
- $('#botCount').html('0/0');
- $('#botServer').html('Closed');
- $('#toggleButton').replaceWith(`<button id='toggleButton' onclick='window.client.startBots();' class='btn btn-success'>Start Bots</button>`);
- clearInterval(this.moveInterval);
- this.serverReady = false;
- this.validated = false;
- if (!this.serverInUse) setTimeout(this.connect.bind(this), 500);
- }
- onerror() {
- console.log('Client: Connection to bot server errored.');
- }
- startBots() { //Send startBots
- if (!this.serverReady || !this.validated) return alert('Bot server is not ready for bots to be started yet!');
- this.changeBotMode(this.botMode);
- let botNick = $('#botNick').val();
- let botAmount = $('#botAmount').val();
- let currentServer = this.currentServer;
- $("#serverIP").html(this.currentServer);
- console.log(botNick, currentServer);
- let buf = this.createBuffer(9 + 2 * botNick.length + 2 * currentServer.length);
- let offset = 0;
- buf.setUint8(offset++, 0);
- for (let i = 0; i < botNick.length; i++) {
- buf.setUint16(offset, botNick.charCodeAt(i), true);
- offset += 2;
- }
- buf.setUint16(offset, 0, true);
- offset += 2;
- for (let i = 0; i < currentServer.length; i++) {
- buf.setUint16(offset, currentServer.charCodeAt(i), true);
- offset += 2;
- }
- buf.setUint16(offset, 0, true);
- offset += 2;
- buf.setUint32(offset, botAmount, true);
- this.send(buf);
- }
- sendGetProxies() {
- let buf = this.createBuffer(3);
- buf.setUint8(0, 3);
- buf.setUint16(1, $('#proxyTimeout').val(), true);
- this.send(buf);
- }
- changeBotMode(newMode) {
- let buf = this.createBuffer(3 + newMode.length * 2);
- buf.setUint8(0, 2);
- for (let i = 0; i < newMode.length; i++) buf.setUint16(1 + 2 * i, newMode.charCodeAt(i), true);
- this.send(buf);
- }
- stopBots() { //Send stopBots
- let buf = this.createBuffer(1);
- buf.setUint8(0, 1);
- this.send(buf);
- }
- sendMove(xPos, yPos) { //Send xPos and yPos
- let buf = this.createBuffer(9);
- buf.setUint8(0, 16);
- buf.setInt32(1, xPos, true);
- buf.setInt32(5, yPos, true);
- this.send(buf);
- }
- split() {
- let buf = this.createBuffer(1);
- buf.setUint8(0, 17);
- this.send(buf);
- }
- eject() {
- let buf = this.createBuffer(1);
- buf.setUint8(0, 21);
- this.send(buf);
- }
- startMoveInterval() {
- this.moveInterval = setInterval(() => {
- 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);
- }, 200);
- }
- createBuffer(len) {
- return new DataView(new ArrayBuffer(len));
- }
- send(data) { //Send the data to the BotServer if the WebSocket is connected.
- if (this._ws.readyState !== 1) return;
- this._ws.send(data, {
- binary: true
- });
- }
- addListener() {
- document.addEventListener('mousemove', event => {
- this.clientX = event.clientX;
- this.clientY = event.clientY;
- });
- }
- genToken() {
- const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- let token = '';
- for (let i = 0; i < 1; i++) {
- for (let a = 0; a < 1; a++) token += possible.charAt(Math.floor(Math.random() * possible.length));
- token += '-';
- }
- token = token.substring(0, token.length - 1);
- localStorage.setItem('agarUnlimitedToken', token);
- return token;
- }
- serverIP() {
- if (this.currentServer !== null || this.currentServer !== "") {
- $("#serverIP").html(this.currentServer);
- }
- }
- }
- setInterval(function() {
- document.getElementById("serverIP").value = window.client.currentServer;
- }, 1000)
- class GUITweaker {
- constructor() {
- this.removeStartupBackground();
- this.removeElements();
- this.addBotGUI();
- this.addBotGUI2();
- this.addGUI();
- this.loadCustomCSS();
- }
- removeStartupBackground() {
- const oldEvt = CanvasRenderingContext2D.prototype.drawImage;
- CanvasRenderingContext2D.prototype.drawImage = function(a) {
- if (a.src && a.src == 'http://agar.io/img/background.png') return;
- oldEvt.apply(this, arguments);
- };
- }
- removeElements() {
- $('#advertisement').hide();
- $('#bannerCarousel').remove();
- }
- addBotGUI2() {
- $('.center-container').replaceWith(`
- <div class="agario-panel">
- <div class="form-group clearfix">
- <div style="float: left; margin-left: 20px;"><h2>Agar.io</h2></div>
- <div style="float: right; margin-top: 10px; height: 40px;">
- <div id="agarYoutube">
- <div id="___ytsubscribe_0" style="text-indent: 0px; margin: 0px; padding: 0px; background: transparent; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 111px; height: 24px;"><iframe ng-non-bindable="" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 111px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 24px;" tabindex="0" vspace="0" width="100%" id="I0_1498540482998" name="I0_1498540482998" src="https://www.youtube.com/subscribe_embed?usegapi=1&channelid=UCC6hurPo_LxL7C0YFYgYnIw&layout=default&count=default&hl=en-US&origin=http%3A%2F%2Fagar.io&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.L06ziPgL5F0.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCOnbjS-FskKXErWbZEztXj_N3KVvQ#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh&id=I0_1498540482998&parent=http%3A%2F%2Fagar.io&pfname=&rpctoken=25594004" data-gapiattached="true"></iframe></div>
- </div>
- <div class="clearfix">
- <div class="fb-like pull-right fb_iframe_widget" data-href="https://www.facebook.com/playagar.io" data-layout="button" data-action="like" data-show-faces="true" data-share="true" fb-xfbml-state="rendered" fb-iframe-plugin-query="action=like&app_id=677505792353827&container_width=0&href=https%3A%2F%2Fwww.facebook.com%2Fplayagar.io&layout=button&locale=en_US&sdk=joey&share=true&show_faces=true"><span style="vertical-align: bottom; width: 98px; height: 20px;"><iframe name="f3ba6e67b02fc18" width="1000px" height="1000px" frameborder="0" allowtransparency="true" allowfullscreen="true" scrolling="no" title="fb:like Facebook Social Plugin" src="https://www.facebook.com/v2.8/plugins/like.php?action=like&app_id=677505792353827&channel=http%3A%2F%2Fstaticxx.facebook.com%2Fconnect%2Fxd_arbiter%2Fr%2FXBwzv5Yrm_1.js%3Fversion%3D42%23cb%3Df2c487e8849c4fc%26domain%3Dagar.io%26origin%3Dhttp%253A%252F%252Fagar.io%252Ff26e7984864468c%26relation%3Dparent.parent&container_width=0&href=https%3A%2F%2Fwww.facebook.com%2Fplayagar.io&layout=button&locale=en_US&sdk=joey&share=true&show_faces=true" style="border: none; visibility: visible; width: 98px; height: 20px;" class=""></iframe></span></div>
- <hr>
- </div>
- </div>
- </div>
- <div class="form-group clearfix">
- <input id="nick" class="form-control" placeholder="Nick" maxlength="15" autofocus="">
- <select id="gamemode" class="form-control" required="">
- <option value="" data-itr="page_gamemode_ffa">FFA</option>
- <option value=":teams" data-itr="page_gamemode_teams">Teams</option>
- <option value=":experimental" data-itr="page_gamemode_experimental">Experimental</option>
- <option value=":party" data-itr="page_party">Party Mode</option>
- </select>
- <div class="form-group" id="agario-main-buttons">
- <div class="row">
- <div>
- <select id="region" class="form-control" onchange="MC.setRegion($('#region').val());" required="">
- <option selected="" disabled="" value="" data-itr="page_region_select" style="display: none;"> -- Select a Region -- </option>
- <option value="US-Atlanta" data-itr="page_region_north_america" style="display: block;">North America (4122)</option>
- <option value="BR-Brazil" data-itr="page_region_south_america" style="display: block;">South America (1831)</option>
- <option value="EU-London" data-itr="page_region_europe" style="display: block;">Europe (1946)</option>
- <option value="RU-Russia" data-itr="page_region_russia" style="display: block;">Russia (766)</option>
- <option value="TK-Turkey" data-itr="page_region_turkey" style="display: block;">Turkey (385)</option>
- <option value="JP-Tokyo" data-itr="page_region_east_asia" style="display: block;">East Asia (1685)</option>
- <option value="CN-China" data-itr="page_region_china" style="display: block;">China (382)</option>
- <option value="SG-Singapore" data-itr="page_region_oceania" style="display: block;">Oceania (771)</option>
- </select>
- </div>
- <div>
- <select id="quality" class="form-control" onchange="MC.setQuality($('#quality').val());" required="">
- <option disabled="" value="" data-itr="page_graphics_title">-- Graphics Quality --</option>
- <option value="Retina" selected="" data-itr="page_graphics_retina">Graphics: Retina</option>
- <option value="High" selected="" data-itr="page_graphics_high">Graphics: High</option>
- <option value="Medium" data-itr="page_graphics_medium">Graphics: Medium</option>
- <option value="Low" data-itr="page_graphics_low">Graphics: Low</option>
- <option value="VeryLow" data-itr="page_graphics_very_low">Graphics: Very Low</option>
- </select>
- </div>
- <button type="submit" class="btn btn-play-guest btn-success btn-needs-server" data-itr="page_play_as_guest">Play as guest</button>
- <button type="submit" onclick="toggleSocialLogin(); return false" class="btn btn-warning btn-login-play btn-needs-server" data-itr="page_login_and_play" data-original-title="" title="">Login and play</button>
- <div style="float: left; width: 200px;">
- </div>
- <div id="socialLoginContainer" style="display:none;">
- <div class="row">
- <button onclick="MC.facebookLogin(); return false;" class="btn btn-primary btn-login btn-fb">
- <span class="social social-facebook fb-icon"></span>
- <span class="btn-text" data-itr="page_menu_login_facebook">Sign in with Facebook</span>
- </button>
- </div>
- <div class="row">
- <button id="gplusLogin" class="btn btn-primary btn-login btn-gplus">
- <span class="gplus-icon"></span>
- <span class="btn-text" data-itr="page_menu_login_google">Sign in with Google</span>
- </button>
- </div>
- </div>
- </div>
- <button id="stop-bots" type="submit" style="float: center; margin-left:auto; margin-top: 6px; margin-right:auto; width: 300px; text-decoration: none; color: #fff; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="btn btn-play btn-primary btn-needs-server" data-itr="page_play">Play</button>
- <button id="stop-bots" onclick="logout();" style="float: center; margin-top: 6px; margin-left:auto; margin-right:auto; width: 300px; text-decoration: none; color: #fff; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="btn btn-danger btn-logout">Logout</button>
- <button class="btn btn-warning btn- btn-needs-server" data-itr="page_spectate" style="float: center; margin-left:auto; margin-top: 3px; margin-right:auto; width: 300px; text-decoration: none; color: #fff; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="btn raised btn-danger">Spectate</button>
- </div>
- <div id="settings" style="margin-top: 5px; font-size: 12px; display:flex; flex-wrap: wrap; justify-content: flex-start;">
- <label><input type="checkbox" id="noSkins" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_no_skins">No skins</span></label>
- <label><input type="checkbox" id="noNames" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_no_names">No names</span></label>
- <label><input type="checkbox" id="noColors" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_no_colors">No colors</span></label>
- <label><input type="checkbox" id="showMass" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_show_mass">Show mass</span></label>
- <label><input type="checkbox" id="darkTheme" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_dark_theme">Dark theme</span></label>
- <label><input type="checkbox" id="skipStats" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_skip_stats">Skip stats</span></label>
- <label><input type="checkbox" id="showQuest" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_show_quest">Show Quest</span></label>
- <label style="display:none"><input type="checkbox" id="showOnlineStatus" style="margin-top: 1px;display:block;width:20px;float:left"><span data-itr="page_option_show_online_status">Show Online Status</span></label>
- <label>
- <input checked="" onclick="localStorage.setItem('extraZoom', this.checked);client.extraZoom=this.checked;" type="checkbox" id="extraZoom" style="margin-top: 1px">
- <span data-itr="Extra Zoom">Extra Zoom</span>
- </label></div>
- </div>
- <hr>
- <center><h3>Bot Controls</h3></center>
- <div><left><b style='color: #fff; font-family: arial;'>C - Bots Feed </left></div>
- <div><left><b style='color: #fff; font-family: arial;'>X - Split Bots </left></div>
- <button id="start-bots" onclick="window.client.startBots();" style="margin: 10px; width: 100px; text-decoration: none; color: #fff; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="btn raised btn-success">Start Bots</button>
- <button id="stop-bots" onclick="window.client.stopBots();" style="float: right; margin: 10px; width: 100px; text-decoration: none; color: #fff; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="btn raised btn-danger">Stop Bots</button>
- <br>
- </div>`);
- }
- addBotGUI() {
- const botNick = localStorage.getItem('botNick') || 'CraftBots';
- const botAmount = localStorage.getItem('botAmount') || 750;
- const botMode = localStorage.getItem('botMode');
- $('.agario-promo-container').replaceWith(`
- <div class="agario-panel">
- <center><h3>Bot Settings</h3></center>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">Max Bots(1000)</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>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">Bot Names</span><input onchange="localStorage.setItem('botNick', this.value);" id="botNick" maxlength="15" class="form-control" placeholder="Bot Name" value="${botNick}"></div>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">UUID</span><input style="width:230px" disabled id="agarUnlimitedToken" class="form-control" placeholder="UUID" value="Loading UUID..."></div>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">Server Ip</span><input id="serverIP" disabled class="form-control" placeholder=".." value="Server IP"></div>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">INFO</span><input style="border-radius: 0px;" type="text" value="Agar.io Bots" readonly class="form-control"></div>
- <br><div class="input-group"><span class="input-group-addon" id="basic-addon1" style="border-radius: 0px;">Version</span><input style="border-radius: 0px;" type="text" value="3.1" readonly class="form-control"></div>
- <br>
- <br>
- </div>`);
- }
- addGUI() {
- $('body').append(`
- <div id="botClient" style="position:absolute;top:110px; font-size: 200%; left:0px;padding:0 8px;font-family:Tahoma;color:#800000;z-index:9999;border-radius:15px;min-height:15px;min-width:200px;background-color: ;">
- <div><b>Bot Count</b>: <span id="botCount" style="float: right; margin: 10px; width: 100px; text-decoration: none; color: #800000; font-weight: bold; background- padding: 20px 70px; border: 1px solid white;" class="label label-default pull-right">0/0</span></div>
- <br>
- </div>`);
- $('#options').append(`
- <label>
- <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">
- <span data-itr="Extra Zoom">Extra Zoom</span>
- </label>`);
- }
- loadCustomCSS() {
- $('head').append(`<style type="text/css">.agario-panel, .shop-blocker {background-color:rgba(23,23,23,0.73)!important;color:#fff!important}</style>`);
- }
- }
- let check = setInterval(() => {
- if (document.readyState == "complete") {
- clearInterval(check);
- setTimeout(() => {
- new GUITweaker();
- $('#agarUnlimitedToken').val(client.token);
- }, 1500);
- }
- }, 100);
- class Macro {
- constructor() {
- this.ejectDown = false;
- this.stopped = false;
- this.speed = 15;
- this.addMoveHook();
- this.addKeyHooks();
- }
- addKeyHooks() {
- window.addEventListener('keydown', this.onkeydown.bind(this));
- window.addEventListener('keyup', this.onkeyup.bind(this));
- }
- onkeydown(event) {
- if (!window.MC || !MC.isInGame()) return;
- switch (event.key.toUpperCase()) {
- case 'W':
- this.ejectDown = true;
- setTimeout(this.eject.bind(this), this.speed);
- break;
- case 'X':
- client.split();
- break;
- case 'C':
- client.eject();
- break;
- }
- if (event.keyCode == 16) {
- for (let i = 0; i < 11; i++) setTimeout(window.core.split, this.speed * i);
- }
- }
- onkeyup(event) {
- switch (String.fromCharCode(event.keyCode).toUpperCase()) {
- case 'W':
- this.ejectDown = false;
- break;
- }
- }
- eject() {
- if (this.ejectDown) {
- window.core.eject();
- setTimeout(this.eject.bind(this), this.speed);
- }
- }
- addMoveHook() {
- window.core._setTarget = window.core.setTarget;
- window.core.setTarget = function() {
- if (!this.stopped) window.core._setTarget.apply(this, arguments);
- else window.core._setTarget(window.innerWidth / 2, window.innerHeight / 2);
- }.bind(this);
- }
- }
- window.onload = () => {
- new Macro();
- }
- //Load custom core.
- $.ajax('http://agar.io/agario.core.js', {
- success: core => {
- 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;}');
- 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);');
- core = core.replace(/var (\w)=new WebSocket\((\w\(\w\))\);/, 'window.client.currentServer=$2;var $1=new WebSocket(window.client.currentServer);');
- core = core.replace(/if\((\+\w\[\w>>3\])<1\.0\){/i, 'if($1<!client.extraZoom){');
- core = core.replace(/(if\([\w$]+\[[\w$]+\+\d+\>\>0\]\|0\)\{[\w$]+\=[\w$]+;return\})(if\(\![\w$]+\))/, '$1if(false)$2');
- eval(core);
- },
- dataType: 'text',
- method: 'GET',
- cache: false,
- crossDomain: true
- });
- function isInIncognito(callback) {
- var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
- if (!fs) return callback(false);
- fs(window.TEMPORARY, 100, () => callback(false), () => callback(true));
- }
- isInIncognito(incognito => {
- 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.');
- else runClientLoad();
- });
- function runClientLoad() {
- window.client = new Client('ws://127.0.0.1:4569'); // Bot Server IP.
- client.botMode = localStorage.getItem('botMode') || 'FEEDER'; // Set the bot mode to the stored bot mode.
- client.extraZoom = JSON.parse(localStorage.getItem('extraZoom'));
- client.token = localStorage.getItem('agarUnlimitedToken') || client.genToken();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement