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