// ==UserScript==
// @name Xero-Bots | .io Bots 2022
// @namespace https://discord.com/invite/bAstbAfem9
// @version 30.6.3
// @description The best bots for popular agar.io clone games.
// @author Tatsuya & Enes
// @match *.oceanar.io/*
// @match *.aquar.io/*
// @match *.cellsbox.io/*
// @match *.www.inciagario.net/*
// @match *.bubleroyal.com/*
// @run-at document-start
// @icon https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTJNVczs2oU6qdgJBw2ZSSe4ibVAGjaZMgWosjYzjXZU1B6Lp9MHoQ27ARzAtofWYHxz3U&usqp=CAU
// @grant none
// ==/UserScript==
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var _createClass = function() {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function(Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var User = new(function() {
function _ClassHookOne() {
_classCallCheck(this, _ClassHookOne);
}
_createClass(_ClassHookOne, [{
key: '_Init',
value: function _Init() {
this.bots = [];
this.botAmt = this.parseBotAmount;
this.serverIP = '';
this.cords = {
'x': 0,
'y': 0
};
this.moveBuffer = null;
this.startedBots = false;
this.gui = GUI.Init();
this.pushBots();
}
}, {
key: 'parseBotAmount',
get: function parseBotAmount() {
let url = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
if (url == "cellsbox.io") {
return 15;
} else return 50;
}
}, {
key: 'spawnedBots',
get: function spawnedBots() {
return this.bots.filter(bot => bot.WebSocket && bot.WebSocket.readyState === WebSocket.OPEN).length;
}
}, {
key: 'pushBots',
value: function pushBots() {
for (let i = 0; i < this.botAmt; i++) {
this.bots.push(new Bot())
};
this.guiInt();
}
}, {
key: 'guiInt',
value: function guiInt() {
this.GUIint = setInterval(() => {
if (!GUI.injected) return;
GUI.updateVal(this.spawnedBots, this.botAmt)
}, 1000)
}
}, {
key: 'splitBots',
value: function splitBots() {
this.bots.forEach((bot) => {
bot.split()
})
}
}, {
key: 'ejectBots',
value: function ejectBots() {
this.bots.forEach((bot) => {
bot.eject()
})
}
}, {
key: 'startBots',
value: function startBots() {
if (this.startedBots || !this.serverIP) return;
if (this.serverIP == undefined) return;
this.bots.forEach((bot) => {
bot.connect(this.serverIP)
});
this.startedBots = true
}
}, {
key: 'stopBots',
value: function stopBots() {
if (!this.startedBots) return;
this.bots.forEach((bot) => {
bot.terminate()
});
this.startedBots = false
}
}]);
return _ClassHookOne;
}())();
var GUI = new(function() {
function _ClassHookTwo() {
_classCallCheck(this, _ClassHookTwo);
}
_createClass(_ClassHookTwo, [{
key: 'Init',
value: function Init() {
this.injected = false;
this.startGUI();
this.startKeys();
}
}, {
key: 'startGUI',
value: async function startGUI() {
/*
this.guiCode = await this.guiFetch();
if (!this.guiCode) {
return alert('Failed to load bot GUI. If this keeps happening, contact a developer.');
}
*/
this.guiCode = `<div id="blackout" style=" display: block; width: 100%; height: 100%; z-index: 10000000; background-color: rgba(0, 0, 0, 0.9); position: absolute; top: 0px; left: 0px; " ></div> <div id="elemX155674"> <div class="xerobots-title"> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTJNVczs2oU6qdgJBw2ZSSe4ibVAGjaZMgWosjYzjXZU1B6Lp9MHoQ27ARzAtofWYHxz3U&usqp=CAU" alt="Girl in a jacket" width="30" height="30" style="left: 0px; position: absolute; top: 0px" /> Xero Bots - Settings </div> <div class="xerobots-content"> <div class="options-data-container"> <div class="data-options-element" id="botInfoname13"> <div class="data-options-info"> <b>Bot Name(s):</b> <br /> <span>Xero-Bots</span> </div> <div class="data-options-info"> <b>Available Bots:</b> <br /> <span style="color: #3de543" id="bot-value">Waiting...</span> </div> <div class="data-options-info"> <b>Bot Status:</b> <br /> <span style="color: #3de543" id="status-value">Loading...</span> </div> <div class="data-options-info"> <b>Current Site:</b> <br /> <span style="color: #ffffff" id="site-value">Loading...</span> </div> <div class="data-options-info"> <b>Status:</b> <br /> <span style="color: #3de543" id="attach-value">Checking...</span> </div> <hr style="width: 70%; color: grey; margin-top: 10px; margin-bottom: 10px" /> <div class="data-options-info"> <b>Session Date:</b> <br /> <span style="color: #ffffff" id="session-date-value">Loading...</span> </div> <div class="data-options-info"> <b>Session Hash:</b> <br /> <span style="color: #ffffff" id="session-id-value">Loading...</span> </div> </div> <div class="data-options-element" id="weqweqw"> <div class="data-options-info"> <span >This menu indicates if the bots are working or not. In addition, it displays how many bots you're able to use for this site.</span > </div> </div> <div class="data-options-element" id="botidselemes"> <div id="12225s" style="margin-top: 5px"> <span id="botidselemes-value">Instantiate Session</span> </div> </div> <div class="data-options-element" id="weew232332515"> <div class="data-options-info"> <form action="https://discord.com/invite/bAstbAfem9"> <input id="discord-btn" type="submit" value="Discord" /> </form> </div> <div style="font: 14px Arial, sans-serif; margin: 10px"> Controls: <br /> E - Split Bots <br /> R - Eject Mass from Bots </div> <div style="font: 14px Arial, sans-serif"> Credits: <br /> Tatsuya - Tatsuya#9737 <br /> Enes - Enes#9999 </div> </div> </div> </div> </div> <style> *, :after, :before { box-sizing: inherit; } a:hover { color: #e9f6f6; } #elemX155674 { min-width: 100px; min-height: 100px; display: inline-block; background-color: #1b1c21; position: absolute; font: 12px Arial, sans-serif; box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: default; color: #ffffff; top: 50%; left: 50%; transform: translate(-50%, -50%); border-color: rgb(77, 100, 122); z-index: 10000000; } .xero-headline { margin-bottom: 6px; color: WHITE; } .xerobots-title { color: #ffffff; width: 100%; height: 30px; color: #ffffff; text-align: center; padding: 7px 8px 5px 10px; background-color: #3c3c3c; } .xerobots-content { width: 438.8px; height: 306px; background-color: #333333; padding: 10px 10px; } .data-options-element { text-align: center; color: #ffffff; } .data-options-info { margin-top: 8px; } #discord-btn { width: 90%; height: 30px; background: #5865f2; border: 1px solid #5865f2; border-radius: 5px; font: 12px Arial, sans-serif; color: white; } #discord-btn:hover { cursor: pointer; } #botInfoname13 { opacity: 1; background-color: #1e1e1e; height: 286px; width: 116px; border: 1px solid #1e1e1e; border-radius: 0px; cursor: default; } #weqweqw { opacity: 1; background-color: #1e1e1e; height: 80px; width: 297px; border: 1px solid #1e1e1e; border-radius: 0px; cursor: default; position: absolute; left: 131px; top: 215px; text-align: left; padding: 8px; } #botidselemes { opacity: 1; position: absolute; left: 131px; top: 300px; border-radius: 0px; width: 297px; height: 25px; border: 1px solid #3c3c3c; background-color: #3c3c3c; } #botidselemes:hover { cursor: pointer; background-color: #2c3d4d; border: 1px solid #ffffff; } #botidselemes:active { background-color: #264666; } #weew232332515 { position: absolute; left: 131px; top: 40px; border-radius: 0px; width: 297px; height: 169px; border: 1px solid #3c3c3c; background-color: #3c3c3c; cursor: default; } </style> <div id="botsGUI" style=" left: 50%; top: 5px; z-index: 10000; -webkit-transform: translateX(-50%); transform: translateX(-50%); position: absolute; background-color: #3c3c3c; padding: 5px; border-radius: 0.25rem; display: -webkit-box; display: -ms-flexbox; display: flex; visibility: hidden; " > <p id="title" style=" user-select: none; box-sizing: border-box; margin: 0; cursor: pointer; font-weight: 700; font-family: CarterOne; text-decoration: none; line-height: 1.5; color: white; margin-right: 5px; font-size: 14px !important; animation: random 5s infinite; padding: 2px 5px !important; " > Xero-Bots </p> <p id="botAmount" style=" user-select: none; box-sizing: border-box; margin: 0; font-weight: 700; font-family: CarterOne; text-decoration: none; line-height: 1.5; color: white; margin-right: 5px; font-size: 14px !important; padding: 2px 5px !important; " > 0 / 0 </p> <button class="btn primary small" id="startBots" style=" user-select: none; box-sizing: border-box; margin: 0; cursor: pointer; font-weight: 700; font-family: CarterOne; border: 1px solid transparent; transition: color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, border 0.3s ease, -webkit-box-shadow 0.3s ease; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); text-decoration: none; line-height: 1.5; border-radius: 0.2rem; color: white; background: #038c9e; border-color: #038c9e; margin-right: 5px; font-size: 14px !important; padding: 2px 5px !important; " > Start Bots </button> <button class="btn secondary small" id="stopBots" style=" user-select: none; box-sizing: border-box; margin: 0; cursor: pointer; font-weight: 700; font-family: CarterOne; border: 1px solid transparent; transition: color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, border 0.3s ease, -webkit-box-shadow 0.3s ease; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); text-decoration: none; line-height: 1.5; border-radius: 0.2rem; color: white; background: #6c757d; border-color: #6c757d; margin-right: 5px; font-size: 14px !important; padding: 2px 5px !important; display: none; " > Stop Bots </button> </div> <style> @keyframes random { 0% { color: #d63e3e; } 25% { color: yellow; } 50% { color: #03e06f; } 75% { color: #1967fc; } 100% { color: #d63e3e; } } </style>`;
this.hookWeb(this.guiCode);
}
}, {
key: 'guiFetch',
value: async function guiFetch() {
const GUI = await fetch('https://parallel-almondine-hail.glitch.me/');
if (!GUI.ok) {
return console.log('[GUI STATUS]', GUI);
}
return await GUI.text();
}
}, {
key: 'hookWeb',
value: function hookWeb(html) {
const div = document.createElement('div');
div.innerHTML = html;
document.body.appendChild(div);
document.title = "Xero-Bots | Active";
document.getElementById("bot-value").innerHTML = User.botAmt;
let url = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
this.findDiv("status-value").innerHTML = 'Working';
this.handleDivs(
["site-value", "attach-value", "session-date-value", "session-id-value"],
[url, "Ready to Launch", new Date().toDateString(), new Date().getTime()], 1
);
this.divScramble = {
'startButton': this.scrambleDiv('startBots'),
'stopButton': this.scrambleDiv('stopBots'),
'botCount': this.scrambleDiv('botAmount'),
'DiscordURL': this.scrambleDiv('title')
};
this.bind(this.divScramble.startButton, 1);
this.bind(this.divScramble.stopButton, 2);
this.bind(this.divScramble.DiscordURL, 3);
this.bind('botidselemes', 4);
this.injected = true;
}
}, {
key: 'bind',
value: function bindDiv(div, binder) {
document.getElementById(div).onclick = () => {
if (binder) {
switch (binder) {
case 1:
User.startBots();
this.handleDivs([this.divScramble.startButton, this.divScramble.stopButton], ['none', 'block'], 3);
break;
case 2:
User.stopBots();
this.handleDivs([this.divScramble.startButton, this.divScramble.stopButton], ['block', 'none'], 3);
break;
case 3:
window.location.href = 'https://discord.gg/bAstbAfem9';
break;
case 4:
this.handleDivs(['elemX155674', 'blackout', 'botsGUI'], ['hidden', 'hidden', 'visible'], 2);
break;
}
}
};
}
}, {
key: 'scrambleDiv',
value: function scrambleDiv(div) {
const randInt = (((1 + Math.random()) * 0x10000) | 0);
document.getElementById(div).id = randInt;
return randInt;
}
}, {
key: 'handleDivs',
value: function handleDivs(divIDs, options, type) {
const boxes = divIDs;
for (let i = 0; i < boxes.length; i++) {
const element = boxes[i];
switch (type) {
case 1:
document.getElementById(element).innerHTML = options[i];
break;
case 2:
document.getElementById(element).style.visibility = options[i];
break;
case 3:
document.getElementById(element).style.display = options[i];
break;
}
}
}
}, {
key: 'findDiv',
value: function findDiv(divID) {
return document.getElementById(divID);
}
}, {
key: 'updateVal',
value: function updateVal(spawned, max) {
document.getElementById(this.divScramble.botCount).innerText = spawned + " / " + max
}
}, {
key: 'startKeys',
value: function startKeys() {
window.addEventListener('keypress', (event) => {
switch (event.key) {
case 'q':
User.splitBots();
break;
case 'w':
User.ejectBots();
break;
}
});
}
}]);
return _ClassHookTwo;
}())();
class _00483 {
constructor() {
this.bytes = [];
}
writeUint8(val) {
this.bytes.push(val);
}
writeUint16(val) {
this.bytes.push(val & 0xFF);
this.bytes.push(val >> 0x8 & 0xFF);
}
writeString(str) {
this.writeUint16(str.length);
for (var i = 0; i < str.length; i++) {
this.writeUint16(str.charCodeAt(i));
}
}
build() {
return new Uint8Array(this.bytes).buffer;
}
}
var Bot = function() {
function _ClassHookThree() {
_classCallCheck(this, _ClassHookThree);
this.init();
}
_createClass(_ClassHookThree, [{
key: 'init',
value: function init() {
this.urlparse = /(\w+)\:\/\/(\w+.\w+)/gi.exec(window.location.origin)[2];
this.utils = {
botNames: ["WGVyby1Cb3Rz", "Qm90cyBieSBUYXRzdXlh", "cmIuZ3kva2FmZ3N3", 'WGVybw=='],
randName() {
return this.botNames[Math.floor(Math.random() * this.botNames.length)]
},
grabRecaptchaToken(wss, siteKey, callback) {
return new Promise(async (resolve, reject) => {
const hookGrecaptcha = window.grecaptcha;
if (!hookGrecaptcha) return alert("No recaptcha anchor found!");
hookGrecaptcha.execute(siteKey, callback).then((token) => {
const parsedUrl = wss.split('challenge')[0] + 'challenge=' + token;
resolve(parsedUrl);
});
});
}
}
}
}, {
key: 'connect',
value: async function connect(url) {
if (this.protocol == 3) {
url = await this.utils.grabRecaptchaToken(url, '6LeBKrcUAAAAAC2X1BwwSPx2uCVrTBF61x3U2FXb', {
action: 'playbutton'
})
}
this.server = url;
this.WebSocket = new WebSocket(url);
this.WebSocket.binaryType = "arraybuffer";
this.WebSocket.onmessage = this.onMessage.bind(this);
this.WebSocket.onopen = this.onOpen.bind(this);
this.WebSocket.onclose = this.onClose.bind(this);
this.WebSocket.onerror = this.onError.bind(this);
this.randomizeMovement = false;
let outsource = atob;
this.botID = Math.floor(Math.pow(2, 14) * Math.random()).toString(36);
this.name = outsource(this.utils.randName()) + ' | ' + this.botID;
}
}, {
key: 'terminate',
value: function terminate() {
if (this.WebSocket) {
this.WebSocket.close();
delete this.WebSocket;
}
clearInterval(this.moveInt);
clearInterval(this.pingInt);
clearTimeout(this.spawnInt);
}
}, {
key: 'onMessage',
value: function onMessage(message) {}
}, {
key: 'onOpen',
value: function onOpen() {
switch (this.protocol) {
case 1:
this.spawn();
this.sendPing();
break;
case 2:
var RawMetatables = {
op: 'clientVersion',
protocolKind: 'TsOgarRx',
protocolSig: 'P2NWmM',
protocolRev: 'orx108'
},
encoded = encodeURIComponent(JSON.stringify(RawMetatables)),
clientSideID = this.GenEnvSig(10);
var ClientInfo = new _00483();
ClientInfo.writeUint8(195);
ClientInfo.writeString(encoded);
this.send(ClientInfo.build());
var SendRevs = new _00483();
SendRevs.writeUint8(126);
SendRevs.writeString(RawMetatables.protocolKind);
SendRevs.writeString(RawMetatables.protocolSig);
SendRevs.writeString(RawMetatables.protocolRev);
SendRevs.writeString(clientSideID);
this.send(SendRevs.build());
var ClientData = new _00483();
ClientData.writeUint8(173);
ClientData.writeString(this.name);
this.send(ClientData.build());
this.spawn();
setInterval(this.sendMsg('ZGlzY29yZC5nZy9iQXN0YkFmZW05'), 10000);
break;
case 3:
var 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();
break;
case 4:
Init = this.Buffer(5);
Init.setUint8(0, 254);
Init.setUint32(1, 1, true);
this.send(Init);
Init = this.Buffer(5);
Init.setUint8(0, 255);
Init.setUint32(1, 1332175218, true);
this.send(Init);
this.spawn();
break;
}
this.spawnInt = setInterval(this.spawn.bind(this), 3000);
this.moveInt = setInterval(this.mouseBuffer.bind(this), 150);
}
}, {
key: 'onClose',
value: function onClose() {
clearInterval(this.moveInt);
clearInterval(this.pingInt);
clearTimeout(this.spawnInt);
}
}, {
key: 'onError',
value: function onError() {}
}, {
key: 'spawn',
value: function spawn() {
switch (this.protocol) {
case 1:
var spawnBuffer = this.Buffer(52);
spawnBuffer.setUint8(0, 22);
var o = 0;
for (; o < 25; ++o) {
spawnBuffer.setUint16(1 + 2 * o, o < this.name.length ? this.name.charCodeAt(o) : 0, true);
}
spawnBuffer.setUint8(51, 255)
this.send(spawnBuffer, true);
break;
case 2:
this.send(new Uint8Array([27]));
this.send(new Uint8Array([33, 3, 1]));
break;
case 3:
var spawnbuf = this.Buffer(3 + 2 * this.name.length);
spawnbuf.setUint8(0, 101);
for (var z = 0; z < this.name.length + 1; ++z) {
spawnbuf.setUint16(1 + 2 * z, this.name.charCodeAt(z) || 59665, true);
}
this.send(spawnbuf, true);
break;
case 4:
var login = 'nic';
var num = 0;
var msg = this.Buffer(5 + 2 * login.length);
var offset = 0;
msg.setUint8(0, 0);
msg.setUint32(1, num, true);
offset = 5;
for (var i = 0; i < login.length; ++i) {
msg.setUint16(offset, login.charCodeAt(i), true);
offset += 2;
}
this.send(msg);
break;
}
}
}, {
key: 'sendUint8',
value: function sendUint8(offset) {
var oneByte = this.Buffer(1);
oneByte.setUint8(0, offset);
this.send(oneByte);
}
}, {
key: 'sendPing',
value: function sendPing() {
let dateData = 268435455 & Date.now();
let ping = this.Buffer(0x5);
ping.setUint8(0x0, 0x1);
ping.setUint32(0x1, dateData);
this.send(ping, true);
}
}, {
key: 'minMaxVal',
value: function minMaxVal(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
}, {
key: 'split',
value: function split() {
switch (this.protocol) {
case 2:
this.send(new Uint8Array([33, 0, 1]));
break;
case 3:
case 4:
this.send(new Uint8Array([17]));
break;
}
}
}, {
key: 'eject',
value: function eject() {
switch (this.protocol) {
case 2:
this.send(new Uint8Array([33, 1, 255]));
break;
case 3:
case 4:
this.send(new Uint8Array([21]));
break;
}
}
}, {
key: 'sendMsg',
value: function sendMsg(message) {
switch (this.protocol) {
case 2:
var _00640 = new _00483(),
f = 0,
outsource = atob;
_00640.writeUint8(98);
_00640.writeUint8(f ? 1 : 0);
_00640.writeString(outsource(message));
this.send(_00640.build());
break;
}
}
}, {
key: 'mouseBuffer',
value: function mouseBuffer() {
switch (this.protocol) {
case 1:
case 2:
this.send(User.moveBuffer)
break;
case 3:
var MouseBuf = this.Buffer(21)
MouseBuf.setUint8(0, 104);
MouseBuf.setFloat64(1, User.cords.x, true);
MouseBuf.setFloat64(9, User.cords.y, true);
MouseBuf.setUint32(17, 0, true);
this.send(MouseBuf, true);
break;
case 4:
MouseBuf = this.Buffer(21)
MouseBuf.setUint8(0, 16);
MouseBuf.setFloat64(1, User.cords.x, true);
MouseBuf.setFloat64(9, User.cords.y, true);
MouseBuf.setUint32(17, 0, true);
this.send(MouseBuf, true);
break;
}
}
}, {
key: 'Buffer',
value: function Buffer(buf) {
return new DataView(new ArrayBuffer(!buf ? 1 : buf))
}
}, {
key: 'open',
get: function open() {
return this.WebSocket && this.WebSocket.readyState === 1;
}
}, {
key: 'protocol',
get: function protocol() {
switch (true) {
case /oceanar.io/.test(this.urlparse):
case /aquar.io/.test(this.urlparse):
return 1;
case /cellsbox.io/.test(this.urlparse):
return 2;
case /www.inciagario/.test(this.urlparse):
return 3;
case /bubleroyal.com/.test(this.urlparse):
return 4;
}
return 0;
}
}, {
key: 'GenEnvSig',
value: function GenEnvSig(length) {
var result = [];
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result.push(characters.charAt(Math.floor(Math.random() * charactersLength)));
}
return result.join('');
}
}, {
key: 'send',
value: function send(data, encrypt) {
if (this.open) {
if (encrypt) {
this.WebSocket.send(data.buffer);
} else this.WebSocket.send(data);
}
}
}]);
return _ClassHookThree;
}();
if (location.host.includes('bubleroyal.com') || location.host.includes('agariott.com') || location.host.includes('www.inciagario.net')) {
window.WebSocket = class extends WebSocket {
constructor() {
let ws = super(...arguments);
window.sockets?.push(this);
setTimeout(() => {
ws.onmessage = new Proxy(ws.onmessage, {
apply(target, thisArg, argArray) {
let data = argArray[0].data;
return target.apply(thisArg, argArray);
}
});
});
}
}
WebSocket.prototype.send = new Proxy(WebSocket.prototype.send, {
apply(target, thisArg, argArray) {
var res = target.apply(thisArg, argArray);
let pkt = argArray[0];
if (typeof pkt == 'string') return res;
if (pkt instanceof ArrayBuffer) pkt = new DataView(pkt);
else if (pkt instanceof DataView) pkt = pkt;
else pkt = new DataView(pkt.buffer);
switch (pkt.getUint8(0, true)) {
case 104:
User.cords.x = pkt.getFloat64(1, true);
User.cords.y = pkt.getFloat64(9, true);
break;
case 0:
switch (pkt.byteLength) {
case 9:
User.moveBuffer = pkt;
break;
}
break;
case 16:
switch (pkt.byteLength) {
case 13:
User.cords.x = pkt.getUint32(1, true);
User.cords.y = pkt.getUint32(5, true);
break;
case 21:
User.cords.x = pkt.getFloat64(1, true);
User.cords.y = pkt.getFloat64(9, true);
break;
}
break;
}
if (User.serverIP !== thisArg.url) {
User.serverIP = thisArg.url;
}
return res;
}
});
window.addEventListener('load', () => {
User._Init();
});
} else {
window.addEventListener('load', () => {
User._Init();
WebSocket.prototype.realSend = WebSocket.prototype.send;
WebSocket.prototype.send = function(pkt) {
this.realSend(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);
switch (pkt.getUint8(0, true)) {
case 185:
User.cords.x = pkt.getFloat64(1, true);
User.cords.y = pkt.getFloat64(9, true);
break;
case 5:
case 14:
case 239:
User.moveBuffer = pkt.buffer;
break;
}
if (User.serverIP !== this.url) {
User.serverIP = this.url;
}
};
});
}