Advertisement
Guest User

Untitled

a guest
Jan 26th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.70 KB | None | 0 0
  1. // ==UserScript==
  2. // @name BotMega Client Script
  3. // @namespace BotMe.ga
  4. // @version 3.1.2
  5. // @description BETA of BotMega 3.0
  6. // @author Mason Burdette
  7. // @match http://agar.io/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  9. // @require http://pastebin.com/raw/QrMULMQV
  10. // @run-at document-start
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. document.title = "BotMega";
  15. ipOfUser = "couldn't verify...";
  16. port = 1100;
  17. botServerIP = "173.81.204.233";
  18. connected = 0;
  19. cBserver = 0;
  20. isAdmin = "h7nthjmf7h35tj3nmdfh78hm78MGH7MHN67H,87mg67mh8,GM^&h^&gH8MQ7";
  21. window.onload = function() {
  22. var f = document.querySelector("#fps");
  23. function gameLoop(){
  24. setTimeout(gameLoop, 1000/60);
  25. f.innerHTML = fps.getFPS();
  26. }
  27. window.onload = gameLoop;
  28.  
  29. var nickOfPlayer = localStorage.getItem('nick');
  30. var nick = $("#nick").val(nickOfPlayer);
  31.  
  32. $.get("http://ipinfo.io", function(response) {
  33. getIP(response.ip);
  34. }, "jsonp");
  35.  
  36. function getIP(ip) {
  37. ipOfUser = ip;
  38. }
  39.  
  40.  
  41. function refresh() {
  42. timeOut = 500;
  43. var nick = $("#nick").val();
  44. localStorage.setItem('nick', nick);
  45. setTimeout(refresh,timeOut);
  46. }
  47. refresh();
  48.  
  49. botServer = "ws://" +botServerIP +":"+port;
  50.  
  51. setDarkTheme(true);
  52. setShowMass(true);
  53.  
  54. $("small.text-muted").remove();
  55. $("span.text-muted").remove();
  56. $("hr").remove();
  57. $("h2").replaceWith('<h2 class="title">BotMega!</h2>');
  58. $('.agario-promo').remove();
  59.  
  60. nickname = "no_new";
  61. eject = "no";
  62. split = "no";
  63. authkey = "sent";
  64. discon = "no";
  65. ipaddress = "sent";
  66. serverkey = "sent";
  67. init_key = "sent";
  68. function reconnect(server) {
  69. ws = new WebSocket(server);
  70. console.log('Reconnecting to bot server: ' +server);
  71. getInit();
  72. ws.onerror = function() {
  73. alert('Bot Server is Down!');
  74. ws.close();
  75. connected = 0;
  76. };
  77. ws.onclose = function(e) {
  78. //alert('Server has Shutdown!');
  79. ws.close();
  80. connected = 0;
  81. };
  82. }
  83. function getInit() {
  84. getInitBotServer = 'ws://173.81.204.233:1111';
  85. console.log('Requesting up-to-date init_key...');
  86. var getinit_init_key = "jN*&gbhh*&G8ihae8rwgh78g&*G&*G&GFUibg&GB*&GVBWG";
  87. var getINITKey = JSON.stringify({ init: getinit_init_key, userip: ipOfUser });
  88.  
  89. var ws = new WebSocket(getInitBotServer);
  90. setTimeout(function() {
  91. ws.send(getINITKey);
  92. }, 1000);
  93. ws.onmessage = function(msg) {
  94. d = JSON.parse(msg.data);
  95. console.log('Server returned init_key!');
  96. init_key = d.init;
  97. ws.close();
  98. setTimeout(function() {
  99. connected = 1;
  100. cBserver = 1;
  101. alert('Connected to ' +getInitBotServer +', got updated init_key!');
  102. ws.close();
  103. }, 1000);
  104. };
  105. ws.onerror = function(error) {
  106. alert('Bot Server is Down!');
  107. connected = 0;
  108. };
  109. }
  110. (function() {
  111. var amount = 1;
  112. var duration = 50;
  113.  
  114. var overwriting = function(evt) {
  115. if (evt.keyCode === 81) {
  116. for (var i = 0; i < amount; ++i) {
  117. setTimeout(function() {
  118. window.onkeydown({
  119. keyCode: 87
  120. });
  121. window.onkeyup({
  122. keyCode: 87
  123. });
  124. }, i * duration);
  125. }
  126. }
  127. };
  128.  
  129. window.addEventListener('keydown', overwriting);
  130. })();
  131. document.addEventListener('keydown',function(e){
  132. var key = e.keyCode || e.which;
  133. if(key == 82){
  134. if(cBserver === 1) {
  135. ejectMass();
  136. } else {
  137. connected = 0;
  138. alert('You have attempted to make the bots Eject Mass before hitting "U"!');
  139. }
  140. }
  141. if(key == 85){
  142. reconnect(botServer);
  143. }
  144. if(key == 83) {
  145. if(cBserver === 1) {
  146. send();
  147. } else {
  148. connected = 0;
  149. alert('You have attempted to make the bots Connect before hitting "U"!');
  150. }
  151. }
  152. if(key == 68){
  153. if(cBserver === 1) {
  154. disconct();
  155. } else {
  156. connected = 0;
  157. alert('You have attempted to make the bots Disconnect before hitting "U"!');
  158. }
  159.  
  160. }
  161. if(key == 69){
  162. if(cBserver === 1) {
  163. splitBots();
  164. } else {
  165. connected = 0;
  166. alert('You have attempted to make the bots Split before hitting "U"!');
  167. }
  168. }
  169. if (key == 90) {
  170. if (tgl == "on") {
  171. ToggleON();
  172. } else {
  173. ToggleOFF();
  174. }
  175. }
  176. if (key == 77) {
  177. if (tgl9 == "on") {
  178. ToggleON9();
  179. } else {
  180. ToggleOFF9();
  181. }
  182. }
  183. if (key == 67) {
  184. closeWebsocket();
  185. connected = 0;
  186. }
  187. if(key == 84){
  188. command();
  189. }
  190. if (key == 71) {
  191. if (tgl2 == "on") {
  192. ToggleON2();
  193. } else {
  194. ToggleOFF2();
  195. }
  196. }
  197. if(key == 76){
  198. allcells = window.agar.allCells;
  199. h = window.agar.myCells;
  200. console.log(h);
  201. leaderboard = window.agar.top;
  202. var a = [];
  203. for(var i=0; i<leaderboard.length; i++)
  204. a.push(leaderboard[i].name);
  205. if(a[0] == "") {
  206. a[0] = "An unnamed Cell";
  207. } else if (a[1] == "") {
  208. a[1] = "An unnamed Cell";
  209. } else if (a[2] == "") {
  210. a[2] = "An unnamed Cell";
  211. } else if (a[3] == "") {
  212. a[3] = "An Unnamed Cell";
  213. } else if (a[4] == "") {
  214. a[4] = "An Unnamed Cell";
  215. } else if (a[5] == "") {
  216. a[5] = "An Unnamed Cell";
  217. } else if (a[6] == "") {
  218. a[6] = "An Unnamed Cell";
  219. } else if (a[7] == "") {
  220. a[7] = "An Unnamed Cell";
  221. } else if (a[8] == "") {
  222. a[8] = "An Unnamed Cell";
  223. } else if (a[9] == "") {
  224. a[9] = "An Unnamed Cell";
  225. }
  226. alert('leaders:\n' +
  227. '1. '+a[0] +
  228. '\n2. '+a[1] +
  229. '\n3. '+a[2] +
  230. '\n4. '+a[3] +
  231. '\n5. '+a[4] +
  232. '\n6. '+a[5] +
  233. '\n7. '+a[6] +
  234. '\n8. '+a[7] +
  235. '\n9. '+a[8] +
  236. '\n10. '+a[9]);
  237. }
  238. });
  239.  
  240.  
  241. tgl = "off";
  242.  
  243. function ToggleON() {
  244. tgl = "off";
  245. window.agar.minScale = 1;
  246. window.agar.scale = 1;
  247. console.log('Turned Off Extra Zoom Alert');
  248. }
  249.  
  250. function ToggleOFF() {
  251. tgl = "on";
  252. window.agar.minScale = -30;
  253. console.log('Turned On Extra Zoom Alert');
  254. }
  255.  
  256.  
  257.  
  258.  
  259. tgl9 = "on";
  260. function ToggleON9() {
  261. tgl9 = "off";
  262. window.agar.hooks.drawCellMass = function(cell, old_draw) {
  263. if (old_draw) return old_draw;
  264. if(cell.size > 20) {
  265. return cell;
  266. }
  267. return null;
  268. };
  269. }
  270. function ToggleOFF9() {
  271. tgl9 = "on";
  272.  
  273. window.agar.hooks.drawCellMass = function(cell, old_draw) {
  274. if (old_draw) return old_draw;
  275. return old_draw;
  276. return null;
  277. };
  278.  
  279. }
  280. tgl2 = "off";
  281. function ToggleON2() {
  282. tgl2 = "off";
  283. window.agar.drawGrid = true;
  284. console.log('Turned On Grid');
  285. }
  286. function ToggleOFF2() {
  287. tgl2 = "on";
  288. window.agar.drawGrid = false;
  289. console.log('Turned Off Grid');
  290. }
  291. function send() {
  292. // disconct();
  293. ipaddress = window.agar.ws;
  294. console.log("Sent ip: " +ipaddress +" to server");
  295. }
  296. function splitBots() {
  297. split = "yes";
  298. }
  299. function ejectMass() {
  300. console.log('eject!');
  301. eject = "yes";
  302. }
  303. function closeWebsocket() {
  304. if (connected === 1 && connected !== 0) {
  305. ws.close();
  306. console.log("Connection to botServer Closed!");
  307. } else {
  308. }
  309. }
  310. function changeBotServer() {
  311. var botServer = prompt('Enter new BotServer IP and Port: ');
  312. disconct();
  313. reconnect(botServer);
  314. }
  315. function disconct() {
  316. console.log('disconnect!');
  317. discon = "yes";
  318. }
  319. function login() {
  320. var user = prompt("Enter Your Admin Login Username or Donator Password:", "-Uname Here-");
  321. var pswd = prompt("Enter Your Admin Login Password or Donator Password:", "-Psswd Here-");
  322. var password_init_key = "nob&GFhf67GH&*Ghfn8b&G78";
  323. var account = JSON.stringify({ init: password_init_key, user: user, pass: pswd, userip: ipOfUser });
  324. var ws = new WebSocket('ws://173.81.204.233:1111');
  325. setTimeout(function() {
  326. ws.send(account);
  327. }, 1000);
  328. ws.onmessage = function(msg) {
  329. d = JSON.parse(msg.data);
  330. var isCorrect = d.isCorrect;
  331. if (isCorrect === true) {
  332. var usersName = d.userName;
  333. alert('Welcome Back, ' +usersName);
  334. var _0x6ea9=["\x68\x37\x6E\x74\x68\x6A\x6D\x66\x37\x68\x33\x35\x74\x6A\x33\x6E\x6D\x64\x66\x68\x37\x38\x68\x6D\x37\x38\x4D\x47\x48\x37\x4D\x48\x4E\x36\x37\x48\x2C\x38\x37\x6D\x67\x36\x37\x6D\x68\x38\x2C\x47\x4D\x5E\x26\x68\x5E\x26\x67\x48\x38\x4D\x51\x37"];isAdmin=_0x6ea9[0];
  335. } else if (isCorrect !== true) {
  336. alert("Server returned: Invalid Password or Username!");
  337. isAdmin = 'no';
  338. }
  339.  
  340. };
  341. ws.onerror = function(error) {
  342. alert('Auth Servers Are Down, Sorry!');
  343. };
  344. }
  345. function changeNick() {
  346. nickname = prompt("What Would You Like Your Bots Nick To Be?", "RSAgarBotz.tk") || "RSAgarToolz.tk";
  347. console.log("Changing Bot Nick too" + nick);
  348. }
  349. function help() {
  350. alert('Help:\n' +
  351. '1. help -- opens this help menu\n' +
  352. '2. help_2 -- opens help for other things.\n' +
  353. '3. keybinds -- opens the keybind list\n' +
  354. '4. login -- Login as an Administrator.\n');
  355. }
  356. function helpAdmin() {
  357. alert('Help:\n' +
  358. '1. help -- opens this help menu\n' +
  359. '2. help_2 -- opens help for other things.\n' +
  360. '3. keybinds -- opens the keybind list\n' +
  361. '4. nick -- Opens the changeNick menu.\n' +
  362. '5. logout -- Logs Out of Admin.' +
  363. '6. changeserver -- change the bot server. Include the WS://.');
  364. }
  365. function command() {
  366. if (isAdmin == "no" && isAdmin !== "h7nthjmf7h35tj3nmdfh78hm78MGH7MHN67H,87mg67mh8,GM^&h^&gH8MQ7") {
  367. var commandEntered = prompt("Type A command", "help");
  368. if (commandEntered == "help") {
  369. console.log('opening help');
  370. help();
  371. } else if (commandEntered == "keybinds") {
  372. alert('Keybinds:\n' +
  373. '"U" --> Updates connection with BotServer\n' +
  374. '"C" --> Closes connection with Bot Server\n' +
  375. '"E" --> Splits bots\n' +
  376. '"R" --> Makes bots Eject Mass\n' +
  377. '"D" --> Disconnects bots from current server\n' +
  378. '"S" --> Disconnects bots from old server, then connects them to the new server. Used for server switching.\n' +
  379. '"T" --> Opens the Command Menu\n' +
  380. '"G" --> Disables the Grid.\n' +
  381. '"Z" --> Enables or Disables and Resets extra zoom.\n' +
  382. '"M" --> Show other players mass.');
  383. } else if (commandEntered == "help_2") {
  384. alert('Help:\n' +
  385. 'Look at keybinds for a list of keys you can use to do various things.\n' +
  386. 'If you want to switch servers, join the new server and hit "S"\n' +
  387. 'To start the bots at first (when you just loaded the page) hit the "U" key to connect to the BotServer then "S" to send all of the data to the server.\n' +
  388. '\n' );
  389. } else if (commandEntered == "login") {
  390. login();
  391. }
  392. } else if (isAdmin == "h7nthjmf7h35tj3nmdfh78hm78MGH7MHN67H,87mg67mh8,GM^&h^&gH8MQ7" && isAdmin !== "no") {
  393. var commandEntered = prompt("Type A command", "help");
  394. if (commandEntered == "nick") {
  395. changeNick();
  396. } else if (commandEntered == "help") {
  397. console.log('opening help');
  398. helpAdmin();
  399. } else if (commandEntered == "keybinds") {
  400. alert('Keybinds:\n' +
  401. '"U" --> Updates connection with BotServer\n' +
  402. '"C" --> Closes connection with Bot Server\n' +
  403. '"E" --> Splits bots\n' +
  404. '"R" --> Makes bots Eject Mass\n' +
  405. '"D" --> Disconnects bots from current server\n' +
  406. '"S" --> Disconnects bots from old server, then connects them to the new server. Used for server switching.\n' +
  407. '"T" --> Opens the Command Menu\n' +
  408. '"G" --> Disables the Grid.\n' +
  409. '"Z" --> Enables or Disables and Resets extra zoom.');
  410. } else if (commandEntered == "help_2") {
  411. alert('Help:\n' +
  412. 'Look at keybinds for a list of keys you can use to do various things.\n' +
  413. 'If you want to switch servers, join the new server and hit "S"\n' +
  414. 'To start the bots at first (when you just loaded the page) hit the "U" key to connect to the BotServer then "S" to send all of the data to the server.\n' +
  415. '\n' );
  416. } else if (commandEntered == "logout") {
  417. alert("Logged Out of Admin");
  418. isAdmin = "no";
  419. } else if (commandEntered == "changeserver") {
  420. changeBotServer();
  421. } else {
  422. alert('enter valid command!');
  423. }
  424. }
  425. }
  426. function refreshData() {
  427. timeOut = 100;
  428. x = window.agar.rawViewport.x;
  429. y = window.agar.rawViewport.y;
  430. if (connected === 1 && connected !== 0) {
  431. playerData = JSON.stringify({ x: x, y: y, eject: eject, split: split, auth: authkey, nick: nickname, ip: ipaddress, token: serverkey, discon: discon, init: init_key, userip: ipOfUser });
  432. ws.send(playerData);
  433. nickname = "no_new";
  434. eject = "no";
  435. split = "no";
  436. authkey = "sent";
  437. discon = "no";
  438. ipaddress = "sent";
  439. serverkey = "sent";
  440. init_key = "sent";
  441. } else {
  442. }
  443. setTimeout(refreshData, timeOut);
  444. }
  445. refreshData();
  446. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement