Guest User

Untitled

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