Free Agar.io Bots (Vanilla Version) - THESE BOTS ARE REAL

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

目前为 2019-10-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Free Agar.io Bots (Vanilla Version) - THESE BOTS ARE REAL
  3. // @namespace Free and Real agario bots
  4. // @version 1.0.5
  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/YkyS8zd" target="_blank">Free Agar.io Bots</a>
  382. </h3>
  383. <h5 id="botsAuthor">
  384. Developed by <a href="https://www.youtube.com/channel/UCZo9WmnFPWw38q65Llu5Lug" target="_blank">Nel, </a><a href="http://legendmod.ml/" target="_blank">Jimboy3100</a>
  385. <br><a href="https://github.com/jimboy3100/jimboy3100.github.io/blob/master/ExampleScripts/agario-bots2/agario-bots-proxies/readme.md" target="_blank">Proxy Bots</a>
  386. </h5>
  387. <span id="statusText">Status: <b id="userStatus">Disconnected</b></span>
  388. <br>
  389. <br>
  390. <span id="aiText">Bots AI: <b id="botsAI">Disabled</b></span>
  391. <br>
  392. <input type="text" id="botsName" placeholder="Bots Name" maxlength="15" spellcheck="false">
  393. <input type="number" id="botsAmount" placeholder="Bots Amount" min="10" max="199" spellcheck="false">
  394. <input type="text" id="botsRemoteIP" placeholder="ws://localhost:8083" maxlength="100" spellcheck="false">
  395. <button id="connect">Connect</button>
  396. <br>
  397. <button id="startBots" disabled>Start Bots</button>
  398. <button id="stopBots">Stop Bots</button>
  399. `
  400. if (localStorage.getItem('localStoredBotsName') !== null) {
  401. window.bots.name = localStorage.getItem('localStoredBotsName')
  402. document.getElementById('botsName').value = window.bots.name
  403. }
  404. if (localStorage.getItem('localStoredBotsAmount') !== null) {
  405. window.bots.amount = JSON.parse(localStorage.getItem('localStoredBotsAmount'))
  406. document.getElementById('botsAmount').value = String(window.bots.amount)
  407. }
  408. var storedbotsRemoteIP = localStorage.getItem("localstoredBotsRemoteIP");
  409. if (storedbotsRemoteIP==null || storedbotsRemoteIP==""){
  410. storedbotsRemoteIP = "ws://localhost:8083";
  411. }
  412. window.bots.remoteIP = storedbotsRemoteIP;
  413. window.SERVER_HOST = storedbotsRemoteIP;
  414. $('#botsRemoteIP').val(storedbotsRemoteIP)
  415. window.setUpHotkeys();
  416. window.setUpOptions();
  417. }
  418.  
  419. function setGUIStyle() {
  420. document.getElementsByTagName('head')[0].innerHTML += `
  421. <style type="text/css">
  422. .menu-panel {
  423. z-index: 1;
  424. border-radius: 5px;
  425. background: rgba(255, 255, 255, 0.95);
  426. }
  427. #hotkeys .row, #settings .row{
  428. padding: 10px;
  429. background: #f8f8f8;
  430. border-bottom: 1px solid #000;
  431. }
  432. #hotkeys .row .title, #settings .row .title{
  433. font-family: Arial;
  434. text-transform: uppercase;
  435. font-weight: 600;
  436. font-size: 13px;
  437. }
  438. #hotkeys .row .key, #settings .row .key {
  439. float: right;
  440. margin-right: 6px;
  441. font-family: Arial;
  442. background: #111;
  443. padding: 2px 5px;
  444. border: 2px solid #444;
  445. box-shadow: 0px 0px 2px #000;
  446. color: #8e8e8e;
  447. transform: translateY(-3px);
  448. text-align: center;
  449. width: 55px;
  450. font-weight: 700;
  451. cursor: pointer;
  452. }
  453. #settings .row .checkbox {
  454. float: right;
  455. margin-right: 6px;
  456. font-family: Arial;
  457. padding: 2px 5px;
  458. color: #8e8e8e;
  459. transform: translateY(3px);
  460. text-align: center;
  461. width: 55px;
  462. font-weight: 700;
  463. cursor: pointer;
  464. }
  465. #inputs {
  466. display: none;
  467. width: 400px;
  468. height: 500px;
  469. position: absolute;
  470. left: 50%;
  471. top: 50%;
  472. transform: translate(-50%, -50%);
  473. }
  474. .input-hidden {
  475. color: transparent !important;
  476. }
  477. .input-hidden::selection {
  478. background: #777 !important;
  479. color: transparent !important;
  480. }
  481. .inputs-tab {
  482. cursor: pointer;
  483. background: #fff;
  484. padding: 6px 10px;
  485. border-radius: 4px 4px 0px 0px;
  486. }
  487. .inputs-tab.active {
  488. background: #fff;
  489. }
  490. .inputs-tab-bar {
  491. color: #000;
  492. font-size: 14px;
  493. font-family: Arial;
  494. height: 22px;
  495. }
  496. .inputs-menu-container {
  497. width: 100%;
  498. height: 478px;
  499. background: rgba(51, 51, 51, 0.5);
  500. border-radius: 0px 0px 4px 4px;
  501. }
  502. .inputs-menu {
  503. width: 100%;
  504. position: absolute;
  505. height: 478px;
  506. display: none;
  507. color: #000;
  508. }
  509. .inputs-menu.active {
  510. display: block;
  511. }
  512. .inputs-tab.close {
  513. float: right;
  514. margin-right: 5px;
  515. margin-top: -5px;
  516. border-radius: 50%;
  517. }
  518. #mainui-ads {
  519. height: 400px !important;
  520. }
  521. #botsInfo > a, #botsAuthor > a {
  522. color: #3894F8;
  523. text-decoration: none;
  524. }
  525. #botsAuthor {
  526. margin-top: -15px;
  527. letter-spacing: 1px;
  528. }
  529. #statusText, #aiText {
  530. font-weight: bold;
  531. }
  532. #userStatus, #botsAI {
  533. color: #DA0A00;
  534. }
  535. #botsName, #botsAmount, #botsRemoteIP {
  536. margin-top: 5px;
  537. width: 144px;
  538. border: 1px solid black;
  539. border-radius: 5px;
  540. padding: 8px;
  541. font-size: 14.5px;
  542. outline: none;
  543. }
  544. #botsName:focus, #botsAmount:focus {
  545. border-color: #7D7D7D;
  546. }
  547. #connect, #startBots, #stopBots, #botsPanel {
  548. color: white;
  549. border: none;
  550. border-radius: 5px;
  551. padding: 7px;
  552. width: 160px;
  553. font-size: 18px;
  554. outline: none;
  555. margin-top: 5px;
  556. letter-spacing: 1px;
  557. }
  558. #connect {
  559. display: inline;
  560. margin-left: 5px;
  561. background-color: #0074C0;
  562. }
  563. #startBots {
  564. display: inline;
  565. background-color: #00C02E;
  566. }
  567. #botsPanel {
  568. display: inline;
  569. background-color: #222;
  570. }
  571. #stopBots {
  572. display: none;
  573. background-color: #DA0A00;
  574. }
  575. #connect:active {
  576. background-color: #004E82;
  577. }
  578. #startBots:active {
  579. background-color: #009A25;
  580. }
  581. #stopBots:active {
  582. background-color: #9A1B00;
  583. }
  584. </style>
  585. `
  586. }
  587.  
  588. function setGUIEvents() {
  589. $("#botsPanel").click(() => {
  590. $("#inputs").show();
  591. });
  592. $(".close").click(() => {
  593. $("#inputs").hide();
  594. });
  595. $("#hotkeysbutton").click(() => {
  596. $("#settings").hide();
  597. $("#hotkeys").show();
  598. });
  599. $("#settingsbutton").click(() => {
  600. $("#hotkeys").hide();
  601. $("#settings").show();
  602. });
  603. document.getElementById('botsAmount').addEventListener('keypress', e => {
  604. e.preventDefault()
  605. })
  606. document.getElementById('botsName').addEventListener('change', function() {
  607. window.bots.name = this.value
  608. localStorage.setItem('localStoredBotsName', window.bots.name)
  609. })
  610. document.getElementById('botsAmount').addEventListener('change', function() {
  611. window.bots.amount = Number(this.value)
  612. localStorage.setItem('localStoredBotsAmount', window.bots.amount)
  613. })
  614. document.getElementById('connect').addEventListener('click', () => {
  615. if (!window.connection.ws || window.connection.ws.readyState !== WebSocket.OPEN) window.connection.connect()
  616. })
  617. document.getElementById('startBots').addEventListener('click', () => {
  618. if (window.game.url && window.game.protocolVersion && window.game.clientVersion && !window.user.startedBots) {
  619. this.partytoken = MC.getPartyToken()
  620. if (this.partytoken!="" && this.partytoken!=null){
  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.unescape(window.encodeURIComponent(window.bots.name)), window.bots.amount))
  622. //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))
  623. 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')
  624. }
  625. else{
  626. alert('Bots are designed for party')
  627. }
  628. }
  629. })
  630. document.getElementById('stopBots').addEventListener('click', () => {
  631. if (window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  632. })
  633. document.getElementById('botsRemoteIP').addEventListener('change', function(){
  634. window.bots.remoteIP = this.value
  635. localStorage.setItem('localstoredBotsRemoteIP', window.bots.remoteIP)
  636. window.SERVER_HOST = window.bots.remoteIP
  637. })
  638. }
  639.  
  640. function loadUI(){
  641. $('body').append(`
  642. <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);">
  643. <div><b>Bot Count</b>: <span id="botCount" class="label label-info pull-right">Waiting</span></div>
  644. <b><div><b>ServerSlots</b>: <span id="slots" class="label label-info pull-right">Waiting</span></div>
  645. </div>`);
  646.  
  647. }
  648.  
  649. WebSocket.prototype.storedSend = WebSocket.prototype.send
  650. WebSocket.prototype.send = function(buffer) {
  651. this.storedSend(buffer)
  652. const dataView = new DataView(new Uint8Array(buffer).buffer)
  653. if (!window.game.protocolVersion && dataView.getUint8(0) === 254) window.game.protocolVersion = dataView.getUint32(1, true)
  654. else if (!window.game.clientVersion && dataView.getUint8(0) === 255) window.game.clientVersion = dataView.getUint32(1, true)
  655. }
  656.  
  657. new MutationObserver(mutations => {
  658. mutations.forEach(({
  659. addedNodes
  660. }) => {
  661. addedNodes.forEach(node => {
  662. if (node.nodeType === 1 && node.tagName === 'SCRIPT' && node.src && node.src.includes('agario.core.js')) {
  663. node.type = 'javascript/blocked'
  664. node.parentElement.removeChild(node)
  665. fetch(node.src)
  666. .then(res => res.text())
  667. .then(core => {
  668. Function(modifyCore(core))()
  669. setKeysEvents()
  670. setTimeout(() => {
  671. setGUI()
  672. setGUIStyle()
  673. setGUIEvents()
  674. loadUI()
  675. }, 3500)
  676. })
  677. }
  678. })
  679. })
  680. }).observe(document.documentElement, {
  681. childList: true,
  682. subtree: true
  683. })