Free Agar.io Bots (Vanilla Version) - NOT Work

Free and Real open source agario bots (tags: ogario, legend mod, vanilla, free bots, unlimited, hacks, infinity, agar.io, cheat, miniclip, agar)

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