asdsadijkgh

Server #1

Aug 24th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.90 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 = 'ws://35.240.36.5:8083' // Hostname/IP of the server where the bots are running [Default = localhost (your own pc)]
  121.  
  122. 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]
  123.  
  124. window.EXTENDED_ZOOM = true // Boolean value that indicates whether to extend the zoom or not, possible values are true and false [Default = true]
  125.  
  126. 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]
  127.  
  128. 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]
  129.  
  130. /* END OF USER SETTINGS */
  131.  
  132. class Writer {
  133. constructor(size) {
  134. this.dataView = new DataView(new ArrayBuffer(size))
  135. this.byteOffset = 0
  136. }
  137. writeUint8(value) {
  138. this.dataView.setUint8(this.byteOffset++, value)
  139. }
  140. writeInt32(value) {
  141. this.dataView.setInt32(this.byteOffset, value, true)
  142. this.byteOffset += 4
  143. }
  144. writeUint32(value) {
  145. this.dataView.setUint32(this.byteOffset, value, true)
  146. this.byteOffset += 4
  147. }
  148. writeString(string) {
  149. for (let i = 0; i < string.length; i++) this.writeUint8(string.charCodeAt(i))
  150. this.writeUint8(0)
  151. }
  152. }
  153.  
  154. window.buffers = {
  155. startBots(url, protocolVersion, clientVersion, userStatus, botsName, botsAmount) {
  156. const writer = new Writer(13 + url.length + botsName.length)
  157. writer.writeUint8(0)
  158. writer.writeString(url)
  159. writer.writeUint32(protocolVersion)
  160. writer.writeUint32(clientVersion)
  161. writer.writeUint8(Number(userStatus))
  162. writer.writeString(botsName)
  163. writer.writeUint8(botsAmount)
  164. return writer.dataView.buffer
  165. },
  166. mousePosition(x, y) {
  167. const writer = new Writer(9)
  168. writer.writeUint8(6)
  169. writer.writeInt32(x)
  170. writer.writeInt32(y)
  171. return writer.dataView.buffer
  172. }
  173. }
  174.  
  175. window.connection = {
  176. ws: null,
  177. connect() {
  178. this.ws = new WebSocket(`${window.SERVER_HOST}`)
  179. this.ws.binaryType = 'arraybuffer'
  180. this.ws.onopen = this.onopen.bind(this)
  181. this.ws.onmessage = this.onmessage.bind(this)
  182. this.ws.onclose = this.onclose.bind(this)
  183. },
  184. send(buffer) {
  185. if (this.ws && this.ws.readyState === WebSocket.OPEN) this.ws.send(buffer)
  186. },
  187. onopen() {
  188. document.getElementById('userStatus').style.color = '#00C02E'
  189. document.getElementById('userStatus').innerText = 'Connected'
  190. document.getElementById('connect').disabled = true
  191. document.getElementById('startBots').disabled = false
  192. document.getElementById('stopBots').disabled = false
  193. },
  194. onmessage(message) {
  195. const dataView = new DataView(message.data)
  196. switch (dataView.getUint8(0)) {
  197. case 0:
  198. document.getElementById('startBots').disabled = true
  199. document.getElementById('stopBots').disabled = false
  200. document.getElementById('startBots').style.display = 'none'
  201. document.getElementById('stopBots').style.display = 'inline'
  202. document.getElementById('stopBots').innerText = 'Stop Bots'
  203. window.user.startedBots = true
  204. break
  205. case 1:
  206. document.getElementById('stopBots').disabled = true
  207. document.getElementById('stopBots').innerText = 'Stopping Bots...'
  208. break
  209. case 2:
  210. document.getElementById('botsAI').style.color = '#DA0A00'
  211. document.getElementById('botsAI').innerText = 'Disabled'
  212. document.getElementById('startBots').disabled = false
  213. document.getElementById('stopBots').disabled = true
  214. document.getElementById('startBots').style.display = 'inline'
  215. document.getElementById('stopBots').style.display = 'none'
  216. document.getElementById('stopBots').innerText = 'Stop Bots'
  217. window.user.startedBots = false
  218. window.bots.ai = false
  219. break
  220. case 3:
  221. 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')
  222. break
  223. case 4:
  224. //Connected Bot count = getUint8(1)
  225. //Spawned Bot count = getUint8(2)
  226. //Server player amount = getUint8(3)
  227. $('#botCount').html(`${dataView.getUint8(1)}/${dataView.getUint8(2)}/${window.bots.amount}`)
  228. $('#slots').html(dataView.getUint8(3) + "/200")
  229. break;
  230. }
  231. },
  232. onclose() {
  233. document.getElementById('userStatus').style.color = '#DA0A00'
  234. document.getElementById('userStatus').innerText = 'Disconnected'
  235. document.getElementById('botsAI').style.color = '#DA0A00'
  236. document.getElementById('botsAI').innerText = 'Disabled'
  237. document.getElementById('connect').disabled = false
  238. document.getElementById('startBots').disabled = true
  239. document.getElementById('stopBots').disabled = true
  240. document.getElementById('startBots').style.display = 'inline'
  241. document.getElementById('stopBots').style.display = 'none'
  242. window.user.startedBots = false
  243. window.bots.ai = false
  244. }
  245. }
  246.  
  247. window.game = {
  248. url: '',
  249. protocolVersion: 0,
  250. clientVersion: 0
  251. }
  252.  
  253. window.user = {
  254. startedBots: false,
  255. isAlive: false,
  256. mouseX: 0,
  257. mouseY: 0,
  258. offsetX: 0,
  259. offsetY: 0,
  260. macroFeedInterval: null
  261. }
  262.  
  263. window.bots = {
  264. name: '',
  265. amount: 0,
  266. ai: false
  267. }
  268.  
  269. function modifyCore(core) {
  270. return core
  271. .replace(/if\(\w+\.MC&&\w+\.MC\.onPlayerSpawn\)/, `
  272. $&
  273. window.user.isAlive = true
  274. if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  275. `)
  276. .replace(/if\(\w+\.MC&&\w+\.MC\.onPlayerDeath\)/, `
  277. $&
  278. window.user.isAlive = false
  279. if(window.user.startedBots) window.connection.send(new Uint8Array([5, Number(window.user.isAlive)]).buffer)
  280. `)
  281. .replace(/new\s+WebSocket\((\w+\(\w+\))\)/, `
  282. $&
  283. if(window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  284. window.game.url = $1
  285. window.user.isAlive = false
  286. window.user.macroFeedInterval = null
  287. `).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+\)/, `
  288. $&
  289. window.user.mouseX = $1 - window.user.offsetX
  290. window.user.mouseY = $2 - window.user.offsetY
  291. if(window.user.startedBots && window.user.isAlive) window.connection.send(window.buffers.mousePosition(window.user.mouseX, window.user.mouseY))
  292. `)
  293. .replace(/\w+\[\w+\+272>>3]=(\w+);\w+\[\w+\+280>>3]=(\w+);\w+\[\w+\+288>>3]=(\w+);\w+\[\w+\+296>>3]=(\w+)/, `
  294. $&
  295. if(~~($3 - $1) === 14142 && ~~($4 - $2) === 14142){
  296. window.user.offsetX = ($1 + $3) / 2
  297. window.user.offsetY = ($2 + $4) / 2
  298. }
  299. `)
  300. .replace(/\(\.9,/, '(window.ZOOM_SPEED,')
  301. .replace(/;if\((\w+)<1\.0\)/, ';if($1 < (!getOption("EXTENDED_ZOOM")))')
  302. .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)/, `
  303. $1
  304. if(window.getOption("DRAW_MAP_GRID")) $2
  305. $3
  306. if(window.getOption("DRAW_MAP_GRID")) $4
  307. `)
  308. .replace(/while\(0\);(\w+)=\(\w+\|0\)!=\(\w+\|0\);/, `
  309. $&
  310. if(window.getOption("SHOW_ALL_PLAYERS_MASS")) $1 = true
  311. `)
  312. }
  313.  
  314. function setKeysEvents() {
  315. document.addEventListener('keydown', e => {
  316. if (!document.getElementById('overlays')) {
  317. switch (e.keyCode) {
  318. case options.hotkeys["BOTS_SPLIT_KEY"].keycode:
  319. if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([2]).buffer)
  320. break
  321. case options.hotkeys["BOTS_FEED_KEY"].keycode:
  322. if (window.user.startedBots && window.user.isAlive) window.connection.send(new Uint8Array([3]).buffer)
  323. break
  324. case options.hotkeys["BOTS_AI_KEY"].keycode:
  325. if (window.user.startedBots && window.user.isAlive) {
  326. if (!window.bots.ai) {
  327. document.getElementById('botsAI').style.color = '#00C02E'
  328. document.getElementById('botsAI').innerText = 'Enabled'
  329. window.bots.ai = true
  330. window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  331. } else {
  332. document.getElementById('botsAI').style.color = '#DA0A00'
  333. document.getElementById('botsAI').innerText = 'Disabled'
  334. window.bots.ai = false
  335. window.connection.send(new Uint8Array([4, Number(window.bots.ai)]).buffer)
  336. }
  337. }
  338. break
  339. case options.hotkeys["MACRO_FEED_KEY"].keycode:
  340. if (!window.user.macroFeedInterval) {
  341. window.core.eject()
  342. window.user.macroFeedInterval = setInterval(window.core.eject, 80)
  343. }
  344. break
  345. case options.hotkeys["DOUBLE_SPLIT_KEY"].keycode:
  346. window.core.split()
  347. setTimeout(window.core.split, 40)
  348. break
  349. case options.hotkeys["SIXTEEN_SPLIT_KEY"].keycode:
  350. window.core.split()
  351. setTimeout(window.core.split, 40)
  352. setTimeout(window.core.split, 80)
  353. setTimeout(window.core.split, 120)
  354. break
  355. }
  356. }
  357. })
  358. document.addEventListener('keyup', e => {
  359. if (!document.getElementById('overlays') && e.keyCode === options.hotkeys["MACRO_FEED_KEY"].keycode && window.user.macroFeedInterval) {
  360. clearInterval(window.user.macroFeedInterval)
  361. window.user.macroFeedInterval = null
  362. }
  363. })
  364. }
  365.  
  366. function setGUI() {
  367. let menuhtml = `<div id="inputs" class="menu-panel" >
  368. <div class="inputs-tab-bar">
  369. <span id="settingsbutton"class="inputs-tab active" target="#settings"><i class="fa fa-keyboard-o"></i> <span>Settings</span></span>
  370. <span id="hotkeysbutton" class="inputs-tab" target="#hotkeys"><i class="fa fa-keyboard-o"></i> <span>Hotkeys</span></span>
  371. <span class="inputs-tab close" target="#close">X</span>
  372. </div>
  373. <div class="inputs-menu-container">
  374. <div id="settings" class="inputs-menu active"></div>
  375. <div id="hotkeys" style="display:none;" class="inputs-menu ps ps--theme_default">
  376. </div>
  377. </div>`
  378. $("#mainui-play").append(menuhtml);
  379. document.getElementById('advertisement').innerHTML = `
  380. <button id="botsPanel">Options</button>
  381. <h2 id="botsInfo">
  382. <a href="https://discord.gg/SDMNEcJ" target="_blank">Free Agar.io Bots</a>
  383. </h2>
  384. <h5 id="botsAuthor">
  385. Developed by <a href="https://www.youtube.com/channel/UCZo9WmnFPWw38q65Llu5Lug" target="_blank">Nel</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. <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.  
  408. window.setUpHotkeys();
  409. window.setUpOptions();
  410. }
  411.  
  412. function setGUIStyle() {
  413. document.getElementsByTagName('head')[0].innerHTML += `
  414. <style type="text/css">
  415. .menu-panel {
  416. z-index: 1;
  417. border-radius: 5px;
  418. background: rgba(255, 255, 255, 0.95);
  419. }
  420. #hotkeys .row, #settings .row{
  421. padding: 10px;
  422. background: #f8f8f8;
  423. border-bottom: 1px solid #000;
  424. }
  425. #hotkeys .row .title, #settings .row .title{
  426. font-family: Arial;
  427. text-transform: uppercase;
  428. font-weight: 600;
  429. font-size: 13px;
  430. }
  431. #hotkeys .row .key, #settings .row .key {
  432. float: right;
  433. margin-right: 6px;
  434. font-family: Arial;
  435. background: #111;
  436. padding: 2px 5px;
  437. border: 2px solid #444;
  438. box-shadow: 0px 0px 2px #000;
  439. color: #8e8e8e;
  440. transform: translateY(-3px);
  441. text-align: center;
  442. width: 55px;
  443. font-weight: 700;
  444. cursor: pointer;
  445. }
  446. #settings .row .checkbox {
  447. float: right;
  448. margin-right: 6px;
  449. font-family: Arial;
  450. padding: 2px 5px;
  451. color: #8e8e8e;
  452. transform: translateY(3px);
  453. text-align: center;
  454. width: 55px;
  455. font-weight: 700;
  456. cursor: pointer;
  457. }
  458. #inputs {
  459. display: none;
  460. width: 400px;
  461. height: 500px;
  462. position: absolute;
  463. left: 50%;
  464. top: 50%;
  465. transform: translate(-50%, -50%);
  466. }
  467. .input-hidden {
  468. color: transparent !important;
  469. }
  470. .input-hidden::selection {
  471. background: #777 !important;
  472. color: transparent !important;
  473. }
  474. .inputs-tab {
  475. cursor: pointer;
  476. background: #fff;
  477. padding: 6px 10px;
  478. border-radius: 4px 4px 0px 0px;
  479. }
  480. .inputs-tab.active {
  481. background: #fff;
  482. }
  483. .inputs-tab-bar {
  484. color: #000;
  485. font-size: 14px;
  486. font-family: Arial;
  487. height: 22px;
  488. }
  489. .inputs-menu-container {
  490. width: 100%;
  491. height: 478px;
  492. background: rgba(51, 51, 51, 0.5);
  493. border-radius: 0px 0px 4px 4px;
  494. }
  495. .inputs-menu {
  496. width: 100%;
  497. position: absolute;
  498. height: 478px;
  499. display: none;
  500. color: #000;
  501. }
  502. .inputs-menu.active {
  503. display: block;
  504. }
  505. .inputs-tab.close {
  506. float: right;
  507. margin-right: 5px;
  508. margin-top: -5px;
  509. border-radius: 50%;
  510. }
  511. #mainui-ads {
  512. height: 400px !important;
  513. }
  514. #botsInfo > a, #botsAuthor > a {
  515. color: #3894F8;
  516. text-decoration: none;
  517. }
  518. #botsAuthor {
  519. margin-top: -15px;
  520. letter-spacing: 1px;
  521. }
  522. #statusText, #aiText {
  523. font-weight: bold;
  524. }
  525. #userStatus, #botsAI {
  526. color: #DA0A00;
  527. }
  528. #botsName, #botsAmount {
  529. margin-top: 15px;
  530. width: 144px;
  531. border: 1px solid black;
  532. border-radius: 5px;
  533. padding: 8px;
  534. font-size: 14.5px;
  535. outline: none;
  536. }
  537. #botsName:focus, #botsAmount:focus {
  538. border-color: #7D7D7D;
  539. }
  540. #connect, #startBots, #stopBots, #botsPanel {
  541. color: white;
  542. border: none;
  543. border-radius: 5px;
  544. padding: 7px;
  545. width: 160px;
  546. font-size: 18px;
  547. outline: none;
  548. margin-top: 15px;
  549. letter-spacing: 1px;
  550. }
  551. #connect {
  552. display: inline;
  553. margin-left: 5px;
  554. background-color: #0074C0;
  555. }
  556. #startBots {
  557. display: inline;
  558. background-color: #00C02E;
  559. }
  560. #botsPanel {
  561. display: inline;
  562. background-color: #222;
  563. }
  564. #stopBots {
  565. display: none;
  566. background-color: #DA0A00;
  567. }
  568. #connect:active {
  569. background-color: #004E82;
  570. }
  571. #startBots:active {
  572. background-color: #009A25;
  573. }
  574. #stopBots:active {
  575. background-color: #9A1B00;
  576. }
  577. </style>
  578. `
  579. }
  580.  
  581. function setGUIEvents() {
  582. $("#botsPanel").click(() => {
  583. $("#inputs").show();
  584. });
  585. $(".close").click(() => {
  586. $("#inputs").hide();
  587. });
  588. $("#hotkeysbutton").click(() => {
  589. $("#settings").hide();
  590. $("#hotkeys").show();
  591. });
  592. $("#settingsbutton").click(() => {
  593. $("#hotkeys").hide();
  594. $("#settings").show();
  595. });
  596. document.getElementById('botsAmount').addEventListener('keypress', e => {
  597. e.preventDefault()
  598. })
  599. document.getElementById('botsName').addEventListener('change', function() {
  600. window.bots.name = this.value
  601. localStorage.setItem('localStoredBotsName', window.bots.name)
  602. })
  603. document.getElementById('botsAmount').addEventListener('change', function() {
  604. window.bots.amount = Number(this.value)
  605. localStorage.setItem('localStoredBotsAmount', window.bots.amount)
  606. })
  607. document.getElementById('connect').addEventListener('click', () => {
  608. if (!window.connection.ws || window.connection.ws.readyState !== WebSocket.OPEN) window.connection.connect()
  609. })
  610. document.getElementById('startBots').addEventListener('click', () => {
  611. if (window.game.url && window.game.protocolVersion && window.game.clientVersion && !window.user.startedBots) {
  612. 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))
  613. 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')
  614. }
  615. })
  616. document.getElementById('stopBots').addEventListener('click', () => {
  617. if (window.user.startedBots) window.connection.send(new Uint8Array([1]).buffer)
  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. }
  637.  
  638. new MutationObserver(mutations => {
  639. mutations.forEach(({
  640. addedNodes
  641. }) => {
  642. addedNodes.forEach(node => {
  643. if (node.nodeType === 1 && node.tagName === 'SCRIPT' && node.src && node.src.includes('agario.core.js')) {
  644. node.type = 'javascript/blocked'
  645. node.parentElement.removeChild(node)
  646. fetch(node.src)
  647. .then(res => res.text())
  648. .then(core => {
  649. Function(modifyCore(core))()
  650. setKeysEvents()
  651. setTimeout(() => {
  652. setGUI()
  653. setGUIStyle()
  654. setGUIEvents()
  655. loadUI()
  656. }, 3500)
  657. })
  658. }
  659. })
  660. })
  661. }).observe(document.documentElement, {
  662. childList: true,
  663. subtree: true
Add Comment
Please, Sign In to add comment