Guest User

Server #1

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