SHARE
TWEET

SERENITY1

Kochou Oct 23rd, 2019 (edited) 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* START OF USER SETTINGS */
  2. window.options = {
  3.     settings: {
  4.         "EXTENDED_ZOOM": {
  5.            "text": "Extended Zoom",
  6.           "type": "checkbox",
  7.           "value": true
  8.         },
  9.         "DRAW_MAP_GRID": {
  10.            "text": "Grid",
  11.           "type": "checkbox",
  12.           "value": false
  13.         },
  14.         "SHOW_ALL_PLAYERS_MASS": {
  15.            "text": "Show Mass (All players)",
  16.           "type": "checkbox",
  17.           "value": true
  18.         },
  19.     },
  20.     hotkeys: {
  21.         "BOTS_SPLIT_KEY": {
  22.             "text": "Bot Split Key",
  23.             "key": "T",
  24.             "keycode": 84,
  25.         },
  26.         "BOTS_FEED_KEY": {
  27.             "text": "Bot Feed Key",
  28.             "key": "A",
  29.             "keycode": 65,
  30.         },
  31.         "BOTS_AI_KEY": {
  32.             "text": "Bot AI Key",
  33.             "key": "F",
  34.             "keycode": 70,
  35.         },
  36.         "MACRO_FEED_KEY": {
  37.             "text": "Macro Feed Key",
  38.             "key": "E",
  39.             "keycode": 69,
  40.         },
  41.         "DOUBLE_SPLIT_KEY": {
  42.             "text": "Double Split Key",
  43.             "key": "Q",
  44.             "keycode": 81,
  45.         },
  46.         "SIXTEEN_SPLIT_KEY": {
  47.             "text": "Sixteen Split Key",
  48.             "key": "R",
  49.             "keycode": 82,
  50.         },
  51.     }
  52. }
  53. if(localStorage.getItem('nebula-hotkeys')) window.options.hotkeys =JSON.parse(localStorage.getItem('nebula-hotkeys'));
  54. if(localStorage.getItem('nebula-settings')) window.options.settings =JSON.parse(localStorage.getItem('nebula-settings'));
  55. window.changeKey = (name, event) => {
  56.     event.preventDefault();
  57.     $(`#${name}`).val(event.key.toLocaleUpperCase())
  58.     let key = window.options.hotkeys[name];
  59.     key["key"] = event.key.toLocaleUpperCase();
  60.     key["keycode"] = event.keyCode;
  61.     checkDuplicates(name, event.keyCode);
  62.     localStorage.setItem('nebula-hotkeys', JSON.stringify(window.options.hotkeys));
  63. }
  64. window.checkboxChange = (name) => {
  65.     let setting = window.options.settings[name];
  66.     setting["value"] = document.getElementById(name).checked;
  67.     localStorage.setItem('nebula-settings', JSON.stringify(window.options.settings));
  68. };
  69. window.checkDuplicates = (keyname, keycode) => {
  70. for (var name in window.options.hotkeys) {
  71.         var key = window.options.hotkeys[name];
  72.         if(name == keyname) continue;
  73.     if(keycode == key.keycode) key.keycode = 0, key.key = "", $(`#${name}`).val("");
  74.     }
  75. }
  76. window.setUpHotkeys = () => {
  77.     let coo = 0;
  78.     for (var name in window.options.hotkeys) {
  79.         if (coo > 2) break;
  80.         coo++;
  81.         var key = window.options.hotkeys[name];
  82.         let html =
  83.             `<div class="row" name="${name}">
  84.                         <span class="title">${key.text}</span>
  85.                         <input id="${name}" onkeydown="changeKey('${name}', event)" class="key" value="${key.key.toLocaleUpperCase()}">
  86.                     </div>`
  87.         $("#hotkeys").append(html);
  88.     }
  89. }
  90. window.getOption = (name) => {
  91.     if(document.getElementById(name))return document.getElementById(name).checked
  92.     else return false
  93. }
  94. window.setUpOptions = () => {
  95.     return
  96.     for (var name in window.options.settings) {
  97.         var option = window.options.settings[name];
  98.         let html =
  99.             `<div class="row" name="${name}">
  100.                         <span class="title">${option.text}</span>
  101.                         <input id=${name} onchange="checkboxChange('${name}')" class="checkbox" type="checkbox">
  102.                     </div>
  103. `
  104.         $("#settings").append(html);
  105.         if(option["value"] == true) $(`#${name}`).click();
  106.     }
  107. }
  108.  
  109. window.SERVER_HOST = 'ws://localhost:8083' // Hostname/IP of the server where the bots are running [Default = localhost (your own pc)]
  110.  
  111. window.ZOOM_SPEED = 0.85 // Numerical value that indicates the speed of the mouse wheel when zooming, value must be between 0.01-0.99 [Default = 0.85]
  112.  
  113. window.EXTENDED_ZOOM = true // Boolean value that indicates whether to extend the zoom or not, possible values are true and false [Default = true]
  114.  
  115. window.DRAW_MAP_GRID = false // Boolean value that indicates whether to draw the map grid or not, possible values are true and false [Default = false]
  116.  
  117. window.SHOW_ALL_PLAYERS_MASS = true // Boolean value that indicates whether to show all players mass or not, possible values are true and false [Default = true]
  118.  
  119. /* END OF USER SETTINGS */
  120.  
  121. class Writer {
  122.     constructor(size) {
  123.         this.dataView = new DataView(new ArrayBuffer(size))
  124.         this.byteOffset = 0
  125.     }
  126.     writeUint8(value) {
  127.         this.dataView.setUint8(this.byteOffset++, value)
  128.     }
  129.     writeInt32(value) {
  130.         this.dataView.setInt32(this.byteOffset, value, true)
  131.         this.byteOffset += 4
  132.     }
  133.     writeUint32(value) {
  134.         this.dataView.setUint32(this.byteOffset, value, true)
  135.         this.byteOffset += 4
  136.     }
  137.     writeString(string) {
  138.         for (let i = 0; i < string.length; i++) this.writeUint8(string.charCodeAt(i))
  139.         this.writeUint8(0)
  140.     }
  141. }
  142.  
  143. window.buffers = {
  144.     startBots(url, protocolVersion, clientVersion, userStatus, botsName, botsAmount) {
  145.             const writer = new Writer(13 + url.length + botsName.length)
  146.             writer.writeUint8(0)
  147.             writer.writeString(url)
  148.             writer.writeUint32(protocolVersion)
  149.             writer.writeUint32(clientVersion)
  150.             writer.writeUint8(Number(userStatus))
  151.             writer.writeString(botsName)
  152.             writer.writeUint8(botsAmount)
  153.             return writer.dataView.buffer
  154.         },
  155.         mousePosition(x, y) {
  156.             const writer = new Writer(9)
  157.             writer.writeUint8(6)
  158.             writer.writeInt32(x)
  159.             writer.writeInt32(y)
  160.             return writer.dataView.buffer
  161.         }
  162. }
  163.  
  164. window.checkPlayer = function() {
  165.     if (window.target != window.game.url) {
  166.         if(window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  167.         window.game.url = window.target;
  168.         window.user.isAlive = false
  169.         window.user.macroFeedInterval = null
  170.     }
  171.     if (!window.playerCells) return;
  172.     if (window.playerCells[0].size + window.playerCells[1].size == 0) {
  173.         window.user.isAlive = false;
  174.         if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  175.     } else {
  176.         window.user.isAlive = true;
  177.         if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  178.     }
  179. }
  180. window.sendMouse = setInterval(() => {
  181.     let buf = window.buffers.mousePosition(window.playerPos.x, window.playerPos.y);
  182.     if (window.user.startedBots && window.user.isAlive) window.connection.send(buf);
  183.     window.checkPlayer();
  184. }, 50);
  185.  
  186. window.connection = {
  187.     ws: null,
  188.     connect() {
  189.         this.ws = new WebSocket(`${window.SERVER_HOST}`)
  190.         this.ws.binaryType = 'arraybuffer'
  191.         this.ws.onopen = this.onopen.bind(this)
  192.         this.ws.onmessage = this.onmessage.bind(this)
  193.         this.ws.onclose = this.onclose.bind(this)
  194.     },
  195.     send(buffer) {
  196.         if (this.ws && this.ws.readyState === 1) this.ws.send(buffer)
  197.     },
  198.     onopen() {
  199.         document.getElementById('userStatus').style.color = '#00C02E'
  200.         document.getElementById('userStatus').innerText = 'Connected'
  201.         document.getElementById('connect').disabled = true
  202.         document.getElementById('startBots').disabled = false
  203.         document.getElementById('stopBots').disabled = false
  204.     },
  205.     onmessage(message) {
  206.         const dataView = new DataView(message.data)
  207.         switch (dataView.getUint8(0)) {
  208.             case 0:
  209.                 document.getElementById('startBots').disabled = true
  210.                 document.getElementById('stopBots').disabled = false
  211.                 document.getElementById('startBots').style.display = 'none'
  212.                 document.getElementById('stopBots').style.display = 'inline'
  213.                 document.getElementById('stopBots').innerText = 'Stop Bots'
  214.                 window.user.startedBots = true
  215.                 break
  216.             case 1:
  217.                 document.getElementById('stopBots').disabled = true
  218.                 document.getElementById('stopBots').innerText = 'Stopping Bots...'
  219.                 break
  220.             case 2:
  221.                 document.getElementById('botsAI').style.color = '#DA0A00'
  222.                 document.getElementById('botsAI').innerText = 'Disabled'
  223.                 document.getElementById('startBots').disabled = false
  224.                 document.getElementById('stopBots').disabled = true
  225.                 document.getElementById('startBots').style.display = 'inline'
  226.                 document.getElementById('stopBots').style.display = 'none'
  227.                 document.getElementById('stopBots').innerText = 'Stop Bots'
  228.                 window.user.startedBots = false
  229.                 window.bots.ai = false
  230.                 break
  231.             case 3:
  232.                 alert('Your IP has captcha and bots are unable to spawn, change your ip with a VPN or something to one that doesn\'t has captcha in order to use the bots')
  233.                 break
  234.              case 4:
  235.                  //Connected Bot count = getUint8(1)
  236.                 //Spawned Bot count = getUint8(2)
  237.                 //Server player amount = getUint8(3)
  238.                 $('#botCount').html(`${dataView.getUint8(1)}/${dataView.getUint8(2)}/${window.bots.amount}`)
  239.                // $('#slots').html(dataView.getUint8(3) + "/200")
  240.                 break;
  241.             case 5:
  242.                 $('#slots').html(dataView.getUint8(1) + "/200")
  243.                 break;
  244.         }
  245.     },
  246.     onclose() {
  247.         document.getElementById('userStatus').style.color = '#DA0A00'
  248.         document.getElementById('userStatus').innerText = 'Disconnected'
  249.         document.getElementById('botsAI').style.color = '#DA0A00'
  250.         document.getElementById('botsAI').innerText = 'Disabled'
  251.         document.getElementById('connect').disabled = false
  252.         document.getElementById('startBots').disabled = true
  253.         document.getElementById('stopBots').disabled = true
  254.         document.getElementById('startBots').style.display = 'inline'
  255.         document.getElementById('stopBots').style.display = 'none'
  256.         window.user.startedBots = false
  257.         window.bots.ai = false
  258.     }
  259. }
  260.  
  261. window.game = {
  262.     url: '',
  263.     protocolVersion: 0,
  264.     clientVersion: 0
  265. }
  266.  
  267. window.user = {
  268.     startedBots: false,
  269.     isAlive: false,
  270.     mouseX: 0,
  271.     mouseY: 0,
  272.     offsetX: 0,
  273.     offsetY: 0,
  274.     macroFeedInterval: null
  275. }
  276.  
  277. window.bots = {
  278.     name: '',
  279.     amount: 0,
  280.     ai: false
  281. }
  282.  
  283. function setKeysEvents() {
  284.     document.addEventListener('keydown', e => {
  285.         if (!document.getElementById('overlays')) {
  286.             switch (e.keyCode) {
  287.                 case options.hotkeys["BOTS_SPLIT_KEY"].keycode:
  288.                     if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([2]).buffer)
  289.                     break
  290.                 case options.hotkeys["BOTS_FEED_KEY"].keycode:
  291.                     if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([3]).buffer)
  292.                     break
  293.                 case options.hotkeys["BOTS_AI_KEY"].keycode:
  294.                     if (window.user.startedBots && window.user.isAlive) {
  295.                         if (!window.bots.ai) {
  296.                             document.getElementById('botsAI').style.color = '#00C02E'
  297.                             document.getElementById('botsAI').innerText = 'Enabled'
  298.                             window.bots.ai = true
  299.                             window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  300.                         } else {
  301.                             document.getElementById('botsAI').style.color = '#DA0A00'
  302.                             document.getElementById('botsAI').innerText = 'Disabled'
  303.                             window.bots.ai = false
  304.                             window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  305.                         }
  306.                     }
  307.                     break
  308.                 case options.hotkeys["MACRO_FEED_KEY"].keycode:
  309.                     if (!window.user.macroFeedInterval) {
  310.                         //window.core.eject()
  311.                         //window.user.macroFeedInterval = setInterval(window.core.eject, 80)
  312.                     }
  313.                     break
  314.                 case options.hotkeys["DOUBLE_SPLIT_KEY"].keycode:
  315.                     //window.core.split()
  316.                     //setTimeout(window.core.split, 40)
  317.                     break
  318.                 case options.hotkeys["SIXTEEN_SPLIT_KEY"].keycode:
  319.                     /*window.core.split()
  320.                     setTimeout(window.core.split, 40)
  321.                     setTimeout(window.core.split, 80)
  322.                     setTimeout(window.core.split, 120)*/
  323.                     break
  324.             }
  325.         }
  326.     })
  327.     document.addEventListener('keyup', e => {
  328.         if (!document.getElementById('overlays') && e.keyCode === options.hotkeys["MACRO_FEED_KEY"].keycode && window.user.macroFeedInterval) {
  329.             clearInterval(window.user.macroFeedInterval)
  330.             window.user.macroFeedInterval = null
  331.         }
  332.     })
  333. }
  334.  
  335. function setGUI() {
  336.     setKeysEvents();
  337.     console.log(123);
  338.     $('.navigation').append(`<div class="tab material-button" onclick='setTimeout(()=>{document.getElementById("botSettings").classList.add("active")}, 100);' category="botSettings" style="position: relative; overflow: hidden;"><i class="material-icons">android</i> Bots</div>`);
  339. $('.options-list').append(`
  340. <div id="botSettings" category="bots">
  341.     <div class="inputs-tab-bar">
  342.  
  343.     <span id="hotkeysbutton" class="inputs-tab" target="#hotkeys"><i class="fa fa-keyboard-o"></i> <span>Hotkeys</span></span>
  344.     <span class="inputs-tab close" target="#close">X</span>
  345.     </div>
  346.     <div class="inputs-menu-container">
  347.     <div id="settings" class="inputs-menu"></div>
  348.     <div id="hotkeys" style="display:none;" class="inputs-menu ps ps--theme_default"></div>
  349.     <div id="botPanel"></div>
  350. </div>`)
  351.        /* let menuhtml = `<div id="inputs" class="menu-panel" >
  352.             <div class="inputs-tab-bar">
  353. <span  id="settingsbutton"class="inputs-tab active" target="#settings"><i class="fa fa-keyboard-o"></i> <span>Settings</span></span>
  354.                 <span id="hotkeysbutton" class="inputs-tab" target="#hotkeys"><i class="fa fa-keyboard-o"></i> <span>Hotkeys</span></span>
  355.                 <span class="inputs-tab close" target="#close">X</span>
  356.             </div>
  357.             <div class="inputs-menu-container">
  358. <div id="settings" class="inputs-menu active"></div>
  359.                 <div id="hotkeys" style="display:none;" class="inputs-menu ps ps--theme_default">
  360.                           </div>
  361.         </div>`
  362.     $("#mainui-play").append(menuhtml);*/
  363.    
  364.     document.getElementById('botPanel').innerHTML = `
  365. <button id="botsPanel">Options</button>
  366.         <h3 id="botsInfo"> </h3>
  367.         <span id="statusText">Status: <b id="userStatus">Disconnected</b></span>
  368.         <br>
  369.         <br>
  370.         <span id="aiText">Bots AI: <b id="botsAI">Disabled</b></span>
  371.         <br>
  372.         <input type="text" id="botsName" placeholder="Bots Name" maxlength="30" spellcheck="false">
  373.         <input type="number" id="botsAmount" placeholder="Bots Amount" min="100" max="500" spellcheck="false">
  374.         <input type="text" id="botsRemoteIP" placeholder="ws://localhost:8083" maxlength="200" spellcheck="false">
  375.         <button id="connect">Connect</button>
  376.         <br>
  377.         <button id="startBots" disabled>Start Bots</button>
  378.         <button id="stopBots">Stop Bots</button>
  379.     `
  380.     if (localStorage.getItem('localStoredBotsName') !== null) {
  381.         window.bots.name = localStorage.getItem('localStoredBotsName')
  382.         document.getElementById('botsName').value = window.bots.name
  383.     }
  384.     if (localStorage.getItem('localStoredBotsAmount') !== null) {
  385.         window.bots.amount = JSON.parse(localStorage.getItem('localStoredBotsAmount'))
  386.         document.getElementById('botsAmount').value = String(window.bots.amount)
  387.     }
  388.     var storedbotsRemoteIP = localStorage.getItem("localstoredBotsRemoteIP");
  389.     if (storedbotsRemoteIP==null || storedbotsRemoteIP==""){
  390.     storedbotsRemoteIP = "ws://localhost:8083";
  391.     }
  392.     window.bots.remoteIP = storedbotsRemoteIP;
  393.     window.SERVER_HOST = storedbotsRemoteIP;
  394.     $('#botsRemoteIP').val(storedbotsRemoteIP)
  395.     window.setUpHotkeys();
  396.     window.setUpOptions();
  397. }
  398.  
  399. function setGUIStyle() {
  400.     document.getElementsByTagName('head')[0].innerHTML += `
  401.         <style type="text/css">
  402. .menu-panel {
  403.     z-index: 1;
  404.     border-radius: 5px;
  405.     background: rgba(255, 255, 255, 0.95);
  406. }
  407. #hotkeys .row, #settings .row{
  408.     padding: 10px;
  409.     background: #f8f8f8;
  410.     border-bottom: 1px solid #000;
  411. }
  412. #hotkeys .row .title,  #settings .row .title{
  413.     font-family: Arial;
  414.     text-transform: uppercase;
  415.     font-weight: 600;
  416.     font-size: 13px;
  417. }
  418. #hotkeys .row .key, #settings .row .key {
  419.     float: right;
  420.     margin-right: 6px;
  421.     font-family: Arial;
  422.     background: #111;
  423.     padding: 2px 5px;
  424.     border: 2px solid #444;
  425.     box-shadow: 0px 0px 2px #000;
  426.     color: #8e8e8e;
  427.     transform: translateY(-3px);
  428.     text-align: center;
  429.     width: 55px;
  430.     font-weight: 700;
  431.     cursor: pointer;
  432. }
  433. #settings .row .checkbox {
  434.     float: right;
  435.     margin-right: 6px;
  436.     font-family: Arial;
  437.     padding: 2px 5px;
  438.     color: #8e8e8e;
  439.     transform: translateY(3px);
  440.     text-align: center;
  441.     width: 55px;
  442.     font-weight: 700;
  443.     cursor: pointer;
  444. }
  445. #inputs {
  446.     display: none;
  447.     width: 400px;
  448.     height: 500px;
  449.     position: absolute;
  450.     left: 50%;
  451.     top: 50%;
  452.     transform: translate(-50%, -50%);
  453. }
  454. .input-hidden {
  455.     color: transparent !important;
  456. }
  457. .input-hidden::selection {
  458.     background: #777 !important;
  459.     color: transparent !important;
  460. }
  461. .inputs-tab {
  462.     cursor: pointer;
  463.     background: #fff;
  464.     padding: 6px 10px;
  465.     border-radius: 4px 4px 0px 0px;
  466. }
  467. .inputs-tab.active {
  468.     background: #fff;
  469. }
  470. .inputs-tab-bar {
  471.     color: #000;
  472.     font-size: 14px;
  473.     font-family: Arial;
  474.     height: 22px;
  475. }
  476. .inputs-menu-container {
  477.     width: 100%;
  478.     height: 478px;
  479.     background: rgba(51, 51, 51, 0.5);
  480.     border-radius: 0px 0px 4px 4px;
  481. }
  482. .inputs-menu {
  483.     width: 100%;
  484.     position: absolute;
  485.     height: 478px;
  486.     display: none;
  487.     color: #000;
  488. }
  489. .inputs-menu.active {
  490.     display: block;
  491. }
  492. .inputs-tab.close {
  493.     float: right;
  494.     margin-right: 5px;
  495.     margin-top: -5px;
  496.     border-radius: 50%;
  497. }
  498.             #mainui-ads {
  499.                 height: 400px !important;
  500.             }
  501.             #botsInfo > a, #botsAuthor > a {
  502.                 color: #3894F8;
  503.                 text-decoration: none;
  504.             }
  505.             #botsAuthor {
  506.                 margin-top: -15px;
  507.                 letter-spacing: 1px;
  508.             }
  509.             #statusText, #aiText {
  510.                 font-weight: bold;
  511.             }
  512.             #userStatus, #botsAI {
  513.                 color: #DA0A00;
  514.             }
  515.             #botsName, #botsAmount, #botsRemoteIP {
  516.                 margin-top: 5px;
  517.                 width: 144px;
  518.                 border: 1px solid black;
  519.                 border-radius: 5px;
  520.                 padding: 8px;
  521.                 font-size: 14.5px;
  522.                 outline: none;
  523.             }
  524.             #botsName:focus, #botsAmount:focus {
  525.                 border-color: #7D7D7D;
  526.             }
  527.             #connect, #startBots, #stopBots, #botsPanel {
  528.                 color: white;
  529.                 border: none;
  530.                 border-radius: 5px;
  531.                 padding: 7px;
  532.                 width: 160px;
  533.                 font-size: 18px;
  534.                 outline: none;
  535.                 margin-top: 5px;
  536.                 letter-spacing: 1px;
  537.             }
  538.             #connect {
  539.                 display: inline;
  540.                 margin-left: 5px;
  541.                 background-color: #0074C0;
  542.             }
  543.             #startBots {
  544.                 display: inline;
  545.                 background-color: #00C02E;
  546.             }
  547. #botsPanel {
  548.                 display: inline;
  549.                 background-color: #222;
  550.             }
  551.             #stopBots {
  552.                 display: none;
  553.                 background-color: #DA0A00;
  554.             }
  555.             #connect:active {
  556.                 background-color: #004E82;
  557.             }
  558.             #startBots:active {
  559.                 background-color: #009A25;
  560.             }
  561.             #stopBots:active {
  562.                 background-color: #9A1B00;
  563.             }
  564.         </style>
  565.     `
  566. }
  567.  
  568. function setGUIEvents() {
  569.     $("#botsPanel").click(() => {
  570.         $("#inputs").show();
  571.     });
  572.     $(".close").click(() => {
  573.         document.getElementById("hotkeys").style = "display:none;"
  574.         //$("#inputs").hide();
  575.     });
  576.     $("#hotkeysbutton").click(() => {
  577.         $("#settings").hide();
  578.          $("#hotkeys").show();
  579.     });
  580.     $("#settingsbutton").click(() => {
  581.         $("#hotkeys").hide();
  582.          $("#settings").show();
  583.     });
  584.     document.getElementById('botsAmount').addEventListener('keypress', e => {
  585.         e.preventDefault()
  586.     })
  587.     document.getElementById('botsName').addEventListener('change', function() {
  588.         window.bots.name = this.value
  589.         localStorage.setItem('localStoredBotsName', window.bots.name)
  590.     })
  591.     document.getElementById('botsAmount').addEventListener('change', function() {
  592.         window.bots.amount = Number(this.value)
  593.         localStorage.setItem('localStoredBotsAmount', window.bots.amount)
  594.     })
  595.     document.getElementById('connect').addEventListener('click', () => {
  596.         if (!window.connection.ws || window.connection.ws.readyState !== WebSocket.OPEN) window.connection.connect()
  597.     })
  598.     document.getElementById('startBots').addEventListener('click', () => {
  599.         if (window.game.url && window.game.protocolVersion && window.game.clientVersion && !window.user.startedBots) {
  600.             this.partytoken = window.target.split("party_id=")[1];
  601.             if (this.partytoken!="" && this.partytoken!=null){
  602.                 if (window.bots.name && window.bots.amount && !document.getElementById('socialLoginContainer')) window.connection.send(window.buffers.startBots(window.target, window.game.protocolVersion, window.game.clientVersion, window.user.isAlive, window.unescape(window.encodeURIComponent(window.bots.name)), window.bots.amount))
  603.                 //if (window.bots.name && window.bots.amount && !document.getElementById('socialLoginContainer')) window.connection.send(window.buffers.startBots(window.game.url.split('?')[0], window.game.protocolVersion, window.game.clientVersion, window.user.isAlive, window.bots.name, window.bots.amount))
  604.                 else alert('Bots name and amount are required before starting the bots, also you need to be logged in to your agar.io account in order to start the bots')
  605.             }
  606.             else{
  607.                 alert('Bots are designed for party')
  608.             }
  609.         }
  610.     })
  611.     document.getElementById('stopBots').addEventListener('click', () => {
  612.         if (window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  613.     })
  614.     document.getElementById('botsRemoteIP').addEventListener('change', function(){
  615.         window.bots.remoteIP = this.value
  616.         localStorage.setItem('localstoredBotsRemoteIP', window.bots.remoteIP)
  617.         window.SERVER_HOST = window.bots.remoteIP
  618.     })
  619. }
  620.  
  621. function loadUI(){
  622.  $('body').append(`
  623. <div id="botClient" style="position: absolute; top: 92%; left: 85%; padding: 0px 8px; font-family: Tahoma; color: rgb(255, 255, 255); z-index: 9999; border-radius: 5px; min-height: 16px; min-width: 200px; background-color: rgba(2, 0, 0, 0.4);">
  624. <div><b>Bot Count</b>: <span id="botCount" class="label label-info pull-right">Waiting</span></div>
  625. <b><div><b>ServerSlots</b>: <span id="slots" class="label label-info pull-right">Waiting</span></div>
  626. </div>`);
  627.  
  628. }
  629.  
  630. WebSocket.prototype.storedSend = WebSocket.prototype.send
  631. WebSocket.prototype.send = function(buffer) {
  632.     this.storedSend(buffer)
  633.     const dataView = new DataView(new Uint8Array(buffer).buffer)
  634.     if (!window.game.protocolVersion && dataView.getUint8(0) === 254) window.game.protocolVersion = dataView.getUint32(1, true)
  635.     else if (!window.game.clientVersion && dataView.getUint8(0) === 255) window.game.clientVersion = dataView.getUint32(1, true)
  636. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top