// ==UserScript== // @name Agar.io clone bots! And .io Bots 2021! // @namespace Bots // @version v.18 // @description The best bots for agario clones! NOW OPEN SOURCED! // @author Tatsuya & Raze // @match *.es.agar.live/* // @match *.aquar.io/* // @match *.agarz.com/* // @match *.oceanar.io/* // @match *.agarabi.net/* // @match *.agarblack.com/* // @match *.tr.agar.live/* // @match *.agar-io.live/* // @match *.agars.live/* // @match *.www.inciagario.net/* // @match *.agariott.com/* // @match *.agarr.live/* // @match *.agar.live/* // @match *.agario.zafer2.com/* // @match *.agario.work/* // @match *.agario.network/* // @match *.agar.rip/* // @match *.agar.chat/* // @match *.agario.nl/* // @match *.agariomoddedserver.com/* // @match *.agario.in/* // @match *.agario.id/* // @match *.agarplay.club/* // @match *.agariomodded.com/* // @match *.bestagario.org/* // @match *.agarprivateserver.com/* // @match *.agariohub.cc/* // @match *.agarr.live/* // @match *.agarprivateservers.org/* // @match *.agar.cc/* // @match *.agario.one/* // @match *.agar.team/* // @match *.agar.club/* // @match *.agarprivateservers.net/* // @match *.agario.tube/* // @match *.agarprivateserver.com/* // @match *.agario.cc/* // @match *.easyagario.icu/* // @match *.agario.red/* // @run-at document-end // @icon https://static.wikia.nocookie.net/jacksepticeye/images/2/2e/Agar.io_logo.png/revision/latest?cb=20190228055524 // @grant none // @downloadURL none // ==/UserScript== class User { constructor() { this.BotAmount = 0; this.botamt = 0; window.started = false; this.verify(); } verify() { // Removed verify code. this.addEssentials(); } powerlineinject() { // removed. } addEssentials() { var parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2]; this.inject(); this.HookInfo(); if(parseOrigin == "oceanar.io") { this.addOceanarUI(); } else if(parseOrigin == "aquar.io") { this.addAquarUI(); } else { this.addUI(); } } addAquarUI() { let cssStyles = document.createElement('head'); let ui = document.createElement('div'); ui.id = 'botcanvas'; ui.style.background = 'rgba(0, 0, 0, 0.7)'; ui.style.top = '-8px'; ui.style.left = '-8px'; ui.style.display = 'block'; ui.style.position = 'absolute'; ui.style['text-align'] = 'center'; ui.style['font-size'] = '15px'; ui.style.color = '#FFFFFF'; ui.style.padding = '12px'; ui.style['padding-right'] = '12px'; ui.style['padding-top'] = '9px'; ui.style['padding-bottom'] = '9px'; ui.style.margin = '1%'; ui.style['z-index'] = '1000000'; ui.style['.sides'] = '12px'; ui.style.border = '2px solid #ffffff'; cssStyles.innerHTML += ''; ui.innerHTML += '
.io Bots!
Discord.gg/bAstbAfem9
Loading...
'; document.body.appendChild(ui); var styles = ` #fname { padding: 4px 0px; margin: 0 0 5px; width: 120px; } #u2ub1eqe { margin: 0 0 5px; font-family: Ubuntu; font-weight: bold; font-size: 15px; margin-top: 0px; color: #00ff00; } #u2ub1 { margin: 1px 0 5px; font-family: Ubuntu; font-weight: bold; font-size: 13px; COLOR: #afafb6; cursor: pointer; } #tzfst { font-family: Ubuntu; font-weight: bold; font-size: 15px; COLOR: WHITE; } #Startbots { margin: 1px 0 5px; border: none; padding: 1px 16px; border-radius: 4px; background-color: #4CAF50; color: white; cursor: pointer; } #Stopbots { margin: 1px 0 5px; border: none; padding: 1px 16px; border-radius: 4px; background-color: #DA2600; color: white; cursor: pointer; } ` var styleSheet = document.createElement("style") styleSheet.type = "text/css" styleSheet.innerText = styles document.head.appendChild(styleSheet); document.getElementById('Startbots').onclick = () => { if(!window.started) { startBots(); } }; document.getElementById('Stopbots').onclick = () => { if(window.started == true) { stopBots(); } }; document.getElementById('u2ub1').onclick = () => { location.href = 'https://discord.gg/bAstbAfem9'; }; setInterval(() => { document.getElementById('u2ub1eqe').innerText = `${this.botamt}/${this.BotAmount}`; }, 1000); } addOceanarUI() { let cssStyles = document.createElement('head'); let ui = document.createElement('div'); ui.id = 'botcanvas'; ui.style.background = 'rgba(0, 0, 0, 0.7)'; ui.style.top = '-8px'; ui.style.left = '-8px'; ui.style.display = 'block'; ui.style.position = 'absolute'; ui.style['text-align'] = 'center'; ui.style['font-size'] = '15px'; ui.style.color = '#FFFFFF'; ui.style.padding = '12px'; ui.style['padding-right'] = '12px'; ui.style['padding-top'] = '9px'; ui.style['padding-bottom'] = '9px'; ui.style.margin = '1%'; ui.style['z-index'] = '1000000'; ui.style['.sides'] = '12px'; ui.style.border = '2px solid #ffffff'; cssStyles.innerHTML += ''; ui.innerHTML += '
.io Bots!
Discord.gg/bAstbAfem9
Loading...

'; document.body.appendChild(ui); var styles = ` #fname { padding: 4px 0px; margin: 0 0 5px; width: 120px; } #u2ub1eqe { margin: 0 0 5px; font-family: Ubuntu; font-weight: bold; font-size: 15px; margin-top: 0px; color: #00ff00; } #u2ub1 { margin: 1px 0 5px; font-family: Ubuntu; font-weight: bold; font-size: 13px; COLOR: #afafb6; cursor: pointer; } #tzfst { font-family: Ubuntu; font-weight: bold; font-size: 15px; COLOR: WHITE; } #Startbots { margin: 1px 0 5px; border: none; padding: 1px 16px; border-radius: 4px; background-color: #4CAF50; color: white; cursor: pointer; } #Stopbots { margin: 1px 0 5px; border: none; padding: 1px 16px; border-radius: 4px; background-color: #DA2600; color: white; cursor: pointer; } ` var styleSheet = document.createElement("style") styleSheet.type = "text/css" styleSheet.innerText = styles document.head.appendChild(styleSheet); document.getElementById('Startbots').onclick = () => { if(!window.started) { startBots(); } }; document.getElementById('Stopbots').onclick = () => { if(window.started == true) { stopBots(); } }; document.getElementById('u2ub1').onclick = () => { location.href = 'https://discord.gg/bAstbAfem9'; }; setInterval(() => { document.getElementById('u2ub1eqe').innerText = `${this.botamt}/${this.BotAmount}`; }, 1000); } addUI() { let cssStyles = document.createElement('head'); let ui = document.createElement('div'); ui.id = 'botcanvas'; ui.style.background = 'rgba(0, 0, 0, 0.7)'; ui.style.top = '-8px'; ui.style['border-radius'] = '3px'; ui.style.left = '-8px'; ui.style.display = 'block'; ui.style.position = 'absolute'; ui.style['text-align'] = 'center'; ui.style['font-size'] = '15px'; ui.style.color = '#FFFFFF'; ui.style.padding = '7px'; ui.style['padding-right'] = '7px'; ui.style['padding-top'] = '7px'; ui.style['padding-bottom'] = '7px'; ui.style.margin = '1%'; ui.style['z-index'] = '1000000'; ui.style['.sides'] = '12px'; ui.style.border = '2px solid #ffffff'; cssStyles.innerHTML += ''; ui.innerHTML += '
Clone Bots
Discord.gg/bAstbAfem9
Loading...

'; document.body.appendChild(ui); var styles = ` #fname { color: #808080; border: 2px solid WHITE; border-radius: 4px; box-sizing: border-box; padding: 0px 0px; margin: 0 0 5px; width: 120px; } #u2ub1eqe { margin: 0 0 4px; font-family: Ubuntu; font-weight: bold; font-size: 15px; margin-top: 0px; color: #00ff00; } #u2ub1 { margin: -8px 0px 0px; font-family: Ubuntu; font-weight: bold; font-size: 13px; COLOR: rgb(182, 186, 183); cursor: pointer; } #tzfst { margin: -5px 0px 0px; font-family: Ubuntu; font-weight: bold; font-size: 15px; COLOR: WHITE; } #Startbots { margin: 1px 0 -7px; border: none; padding: 1px 22px; border-radius: 3px; background-color: #4CAF50; color: white; cursor: pointer; } #Stopbots { margin: 1px 0 -7px; border: none; padding: 1px 22px; border-radius: 3px; background-color: #DA2600; color: white; cursor: pointer; } ` var styleSheet = document.createElement("style") styleSheet.type = "text/css" styleSheet.innerText = styles document.head.appendChild(styleSheet); document.getElementById('Startbots').onclick = () => { if(!window.started) { startBots(); } }; document.getElementById('Stopbots').onclick = () => { if(window.started == true) { stopBots(); } }; document.getElementById('u2ub1').onclick = () => { location.href = 'https://discord.gg/bAstbAfem9'; }; setInterval(() => { document.getElementById('u2ub1eqe').innerText = `${this.botamt}/${this.BotAmount}`; }, 1000); } HookInfo() { window.addEventListener('keypress', (event) => { switch(event.key) { case 'e': window.split(); break; case 'r': window.eject(); break; case 'm': //window.chat(); break; } }); let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2]; if(parseOrigin == 'tr.agar' || parseOrigin == 'agars.live' || parseOrigin == 'agarr.live' || parseOrigin == 'agarplay.club' || parseOrigin == 'es.agar' || parseOrigin == 'agar.live' || parseOrigin == 'agar-io') { this.BotAmount = 65; } else if(parseOrigin == "www.inciagario" || parseOrigin == "agariott.com") { this.BotAmount = 10; } else if(parseOrigin == "oceanar.io" || parseOrigin == "aquar.io") { this.BotAmount = 100; } else if(parseOrigin == "agario.zafer2") { this.BotAmount = 70; } else { this.BotAmount = 60; } } inject() { let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2]; if(parseOrigin == "aquar.io") { WebSocket.prototype.reaSend = WebSocket.prototype.send; WebSocket.prototype.send = function(pkt) { this.reaSend(pkt); if(typeof pkt == 'string') return; if(this.url.includes('localhost')) return; if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt); else if(pkt instanceof DataView) pkt = pkt; else pkt = new DataView(pkt.buffer); let offset = 0; switch(pkt.getUint8(0, true)) { case 14: window.mousepos = pkt.buffer; break; } window.CurrentWs = this.url; } } else if(parseOrigin == "www.inciagario" || parseOrigin == "agariott.com") { WebSocket.prototype.reaSend = WebSocket.prototype.send; WebSocket.prototype.send = function(pkt) { this.reaSend(pkt); if(typeof pkt == 'string') return; if(this.url.includes('localhost')) return; if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt); else if(pkt instanceof DataView) pkt = pkt; else pkt = new DataView(pkt.buffer); let offset = 0; switch(pkt.getUint8(0, true)) { case 104: window.xpos = pkt.getFloat64(1, true); window.ypos = pkt.getFloat64(9, true); break; } window.CurrentWs = this.url; } } else if(parseOrigin == "oceanar.io") { WebSocket.prototype.reaSend = WebSocket.prototype.send; WebSocket.prototype.send = function(pkt) { this.reaSend(pkt); if(typeof pkt == 'string') return; if(this.url.includes('localhost')) return; if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt); else if(pkt instanceof DataView) pkt = pkt; else pkt = new DataView(pkt.buffer); let offset = 0; switch(pkt.getUint8(0, true)) { case 5: window.mousepos = pkt.buffer; break; } window.CurrentWs = this.url; } } else { console.log("Using default inject."); WebSocket.prototype.reaSend = WebSocket.prototype.send; WebSocket.prototype.send = function(pkt) { this.reaSend(pkt); if(typeof pkt == 'string') return; if(this.url.includes('localhost')) return; if(pkt instanceof ArrayBuffer) pkt = new DataView(pkt); else if(pkt instanceof DataView) pkt = pkt; else pkt = new DataView(pkt.buffer); let offset = 0; switch(pkt.getUint8(0, true)) { case 16: window.xpos = pkt.getFloat64(1, true); window.ypos = pkt.getFloat64(9, true); break; } window.CurrentWs = this.url; } } } } function startBots() { if(window.started == false) { window.bots = []; console.log("Starting Bots..."); let parseOrigin = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2]; console.log(parseOrigin); if(parseOrigin == 'tr.agar' || parseOrigin == 'agars.live' || parseOrigin == 'agarr.live' || parseOrigin == 'agarplay.club' || parseOrigin == 'es.agar' || parseOrigin == 'agar.live' || parseOrigin == 'agar-io') { setInterval(() => { this.bots.push(new AgarLive()); }, 4000); window.started = true; } else if(parseOrigin == 'www.inciagario' || parseOrigin == "agariott.com") { for(let i = 0; i < usr.BotAmount; i++) { this.bots.push(new Inci()); } window.started = true; } else if(parseOrigin == 'agarz.com') { for(let i = 0; i < usr.BotAmount; i++) { this.bots.push(new Agarz()); } window.started = true; } else if(parseOrigin == "oceanar.io") { for(let i = 0; i < usr.BotAmount; i++) { this.bots.push(new Oceanar()); } window.started = true; } else if(parseOrigin == "aquar.io") { for(let i = 0; i < usr.BotAmount; i++) { this.bots.push(new Aquar()); } window.started = true; } else { console.log("Using Default Protocol") for(let i = 0; i < usr.BotAmount; i++) { this.bots.push(new Proto5()); } window.started = true; } } } window.eject = function() { if(window.started == true) { this.bots.forEach(bot => { bot.eject(); }); } } window.chat = function() { let msg = prompt('What do you want the bots to say?', 'Type here then press ok or enter'); if(window.started = true) { this.bots.forEach(bot => { if(msg) bot.sendchat(msg); }); } } window.split = function() { if(window.started == true) { this.bots.forEach(bot => { bot.split(); }); } } function stopBots() { if(window.started = true) { console.log("Stopping Bots..."); this.bots.forEach(bot => { bot.ws.close() }); window.bots.length = 0; window.started = false; } } const usr = new User(); class Oceanar { constructor() { usr.botamt++ this.ws = null; this.connect(); } connect() { this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { this.spawn(); this.ping(); this.sendmouse(); setInterval(() => { this.sendmouse(); }, 200); } sendchat(msg) {} sendmouse() { this.send(window.mousepos); } ping() { let time = 268435455 & Date.now(); var n = new ArrayBuffer(5); var i = new DataView(n); i.setUint8(0, 1) i.setUint32(1, time, true) this.send(n); } split() {} eject() {} spawn() { let name = document.getElementById("fname").value; let appearance = 255; var n = new ArrayBuffer(52); var i = new DataView(n); i.setUint8(0, 22); var o = 0; for(; o < 25; ++o) { i.setUint16(1 + 2 * o, o < name.length ? name.charCodeAt(o) : 0, true); } i.setUint8(51, appearance) this.send(n); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { usr.botamt-- console.log("Disconnected"); } onerror(e) {} } class Inci { constructor() { this.connect(); usr.botamt++ this.ws = null; } async GetWebSocketCaptcha() { return new Promise(resolve => { grecaptcha.execute('6LcnrKQUAAAAADohV5Cksikz89WSP-ZPHNA7ViZm', { action: 'playbutton' }).then(function(token) { if(token) { var CurrentWs = window.CurrentWs.substr(0, 34) var sCodes = SCodes_Original; var chal = "&challenge="; var precd = '?SCode='; var scodesprefix = CurrentWs + precd + sCodes + chal; let WebsocketCaptcha = scodesprefix + token; resolve(WebsocketCaptcha) } }); }); } async connect() { const result = await this.GetWebSocketCaptcha(); window.CurrentWs = result; this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { let init = this.Buffer(5); init.setUint8(0, 87); init.setUint32(1, 1, true); this.send(init); init = this.Buffer(5); init.setUint8(0, 100); init.setUint32(1, 1332175218, true); this.send(init) this.spawn(); setInterval(() => { this.sendmouse(); }, 100); setInterval(() => { this.spawn(); }, 5000); } sendchat(msg) { var spawnbuf = this.Buffer(2 + 2 * msg.length); var zz = 0; var gg = 0; gg = 1; spawnbuf.setUint8(zz++, 99); spawnbuf.setUint8(zz++, 0); for(var i = 0; i < msg.length; ++i) { spawnbuf.setUint16(zz, msg.charCodeAt(i), 1); zz += 2; }; this.send(spawnbuf); } sendmouse() { let movebuf = this.Buffer(21); movebuf.setUint8(0, 104); movebuf.setFloat64(1, window.xpos, true); movebuf.setFloat64(9, window.ypos, true); movebuf.setUint32(17, 0, true); this.send(movebuf); } split() { this.send(new Uint8Array([17])); } eject() { this.send(new Uint8Array([21])); } spawn() { let name = document.getElementById("fname").value; var spawnbuf = this.Buffer(1 + 2 * name.length); spawnbuf.setUint8(0, 101); for(var i = 0; i < name.length; ++i) { spawnbuf.setUint16(1 + 2 * i, name.charCodeAt(i), 1); }; this.send(spawnbuf); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { usr.botamt-- console.log("Disconnected"); } onerror(e) {} } class Agarz { constructor() { usr.botamt++ this.connect(); } connect() { this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { let init = this.Buffer(5); init.setUint8(0, 255); init.setUint32(1, 1000, true); this.send(init); this.spawn(); let mouseinterval = setInterval(() => { this.sendmouse(); }, 100); let spawninterval = setInterval(() => { this.spawn(); }, 10000); } sendchat(msg) { var spawnbuf = this.Buffer(2 + 2 * msg.length); var zz = 0; var gg = 0; gg = 1; spawnbuf.setUint8(zz++, 206); spawnbuf.setUint8(zz++, gg); for(var i = 0; i < msg.length; ++i) { spawnbuf.setUint16(zz, msg.charCodeAt(i), true); zz += 2; }; this.send(spawnbuf); } sendmouse() { let movebuf = this.Buffer(21); movebuf.setUint8(0, 16); movebuf.setFloat64(1, window.xpos, true); movebuf.setFloat64(9, window.ypos, true); movebuf.setUint32(17, 0, true); this.send(movebuf); } split() { this.send(new Uint8Array([17])); } eject() { this.send(new Uint8Array([21])); } spawn() { let name = document.getElementById("fname").value; var buffer = this.Buffer(1 + 2 * name.length); buffer.setUint8(0, 9); for(var e = 0; e < name.length; ++e) { buffer.setUint16(1 + 2 * e, name.charCodeAt(e), true); }; this.send(buffer); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { console.log("Disconnected"); usr.botamt-- } onerror(e) {} } class Proto5 { constructor() { usr.botamt++ this.connect(); } connect() { this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { let init = this.Buffer(5); init.setUint8(0, 254); init.setUint32(1, 5, true); this.send(init); init = this.Buffer(5); init.setUint8(0, 255); init.setUint32(1, 123456789, true); this.send(init) this.spawn(); let mouseinterval = setInterval(() => { this.sendmouse(); }, 100); let spawninterval = setInterval(() => { this.spawn(); }, 10000); } sendchat(msg) { var spawnbuf = this.Buffer(2 + 2 * msg.length); var zz = 0; var gg = 0; gg = 1; spawnbuf.setUint8(zz++, 206); spawnbuf.setUint8(zz++, gg); for(var i = 0; i < msg.length; ++i) { spawnbuf.setUint16(zz, msg.charCodeAt(i), true); zz += 2; }; this.send(spawnbuf); } sendmouse() { let movebuf = this.Buffer(21); movebuf.setUint8(0, 16); movebuf.setFloat64(1, window.xpos, true); movebuf.setFloat64(9, window.ypos, true); movebuf.setUint32(17, 0, true); this.send(movebuf); } split() { this.send(new Uint8Array([17])); } eject() { this.send(new Uint8Array([21])); } spawn() { let name = document.getElementById("fname").value; var skins = ['26', '30', '32', '40', '60', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23' ]; var skin = skins[~~(Math.random() * skins.length)]; name = `{${skin}}` + name; var spawnbuf = this.Buffer(1 + 2 * name.length); spawnbuf.setUint8(0, 192); for(var i = 0; i < name.length; ++i) { spawnbuf.setUint16(1 + 2 * i, name.charCodeAt(i), true); }; this.send(spawnbuf); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { console.log("Disconnected"); usr.botamt-- } onerror(e) {} } class AgarLive { constructor() { this.connect(); usr.botamt++ this.ws = null; } async GetWebSocketCaptcha() { return new Promise(resolve => { // grecaptcha.execute('6LcnrKQUAAAAADohV5Cksikz89WSP-ZPHNA7ViZm', { // action: 'playbutton' //}).then(function(token) { // if (token) { var CurrentWs = window.CurrentWs.substr(0, 31) + "?SCode=" var WS = CurrentWs + SCodes_Original; console.log(WS); resolve(WS) //} //}); }); } async connect() { //connect() { const result = await this.GetWebSocketCaptcha(); window.CurrentWs = result; this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { let init = this.Buffer(5); init.setUint8(0, 254); init.setUint32(1, 5, true); this.send(init); init = this.Buffer(5); init.setUint8(0, 255); init.setUint32(1, 154669603, true); this.send(init) this.spawn(); setInterval(() => { this.sendmouse(); }, 100); setInterval(() => { this.spawn(); }, 10000); } sendchat(msg) { var spawnbuf = this.Buffer(2 + 2 * msg.length); var zz = 0; var gg = 0; gg = 1; spawnbuf.setUint8(zz++, 99); spawnbuf.setUint8(zz++, 0); for(var i = 0; i < msg.length; ++i) { spawnbuf.setUint16(zz, msg.charCodeAt(i), 1); zz += 2; }; this.send(spawnbuf); } sendmouse() { let movebuf = this.Buffer(21); movebuf.setUint8(0, 16); movebuf.setFloat64(1, window.xpos, true); movebuf.setFloat64(9, window.ypos, true); movebuf.setUint32(17, 0, true); this.send(movebuf); } split() { this.send(new Uint8Array([17])); } eject() { this.send(new Uint8Array([21])); } spawn() { let name = document.getElementById("fname").value; var spawnbuf = this.Buffer(1 + 2 * name.length); spawnbuf.setUint8(0, 0); for(var i = 0; i < name.length; ++i) { spawnbuf.setUint16(1 + 2 * i, name.charCodeAt(i), 1); }; this.send(spawnbuf); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { usr.botamt-- console.log("Disconnected"); } onerror(e) {} } class Aquar { constructor() { usr.botamt++ this.ws = null; this.connect(); } connect() { this.ws = new WebSocket(window.CurrentWs); this.ws.binaryType = "arraybuffer"; this.ws.onopen = this.onopen.bind(this); this.ws.onmessage = this.onmessage.bind(this); this.ws.onerror = this.onerror.bind(this); this.ws.onclose = this.onclose.bind(this); } Buffer(arr) { return new DataView(new ArrayBuffer(arr)); } onopen() { this.spawn(); this.ping(); this.sendmouse(); setInterval(() => { this.sendmouse(); }, 200); } sendchat(msg) {} sendmouse() { this.send(window.mousepos); } ping() { let time = 268435455 & Date.now(); var n = new ArrayBuffer(5); var i = new DataView(n); i.setUint8(0, 1) i.setUint32(1, time, true) this.send(n); } split() {} eject() {} spawn() { let name = "test"; let appearance = 255; var n = new ArrayBuffer(52); var i = new DataView(n); i.setUint8(0, 22); var o = 0; for(; o < 25; ++o) { i.setUint16(1 + 2 * o, o < name.length ? name.charCodeAt(o) : 0, true); } i.setUint8(51, appearance) this.send(n); } send(msg) { if(this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(msg); } onmessage(msg) {} onclose(e) { usr.botamt-- console.log("Disconnected"); } onerror(e) {} }