Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.07 KB | None | 0 0
  1. alert("Don't Forget to Subscribe For FreeTz YT");
  2. window.MC = {};
  3.  
  4. function escapeHtml(a) {
  5. return String(a).replace(/[&<>"'\/]/g, function(a) {
  6. return entityMap[a];
  7. });
  8. }
  9.  
  10.  
  11. function updateBotCount(a, b) {
  12. NeyBots.localBotsAlive[a] = b;
  13. var c = NeyBots.serverBots;
  14. var d = 2 + NeyBots.serverBots;
  15. var e = 0;
  16. for (; e < 2; e++) {
  17. if (NeyBots.localBotsAlive[e]) {
  18. c++;
  19. }
  20. }
  21. if (0 == c) {
  22. $("#botCount").html('<font color="red">0 / ' + d + "</font>");
  23. } else {
  24. $("#botCount").html('<font color="#7FFF00">' + c + " / " + d + "</font>");
  25. }
  26. }
  27.  
  28. function startLocalBots() {
  29. var a$$0 = 0;
  30. for (; a$$0 < NeyBots.startBotAmount; a$$0++) {
  31. NeyBots.localBotsAlive[a$$0] = false;
  32. NeyBots.localBots[a$$0] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  33. type: "text/javascript"
  34. })));
  35. NeyBots.localBots[a$$0].onmessage = function(a) {
  36. var b = a.data;
  37. switch (b.name) {
  38. case "add":
  39. updateBotCount(b.botID, true);
  40. addBallToMinimap(true, "bot" + b.botID, b.botName, b.x, b.y, "#FF00FF", true);
  41. break;
  42. case "remove":
  43. updateBotCount(b.botID, false);
  44. removeBallFromMinimap("bot" + b.botID);
  45. break;
  46. case "position":
  47. moveBallOnMinimap("bot" + b.botID, b.x, b.y);
  48. break;
  49. default:
  50. console.log("Unknown command received from bot");
  51. }
  52. };
  53. NeyBots.localBots[a$$0].postMessage({
  54. name: "botID",
  55. botID: a$$0
  56. });
  57. }
  58. updateBotNames();
  59. }
  60.  
  61. function startRemoteBots() {
  62. var a = 0;
  63. for (; a < 2; a++) {
  64. NeyBots.remoteBots[a] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  65. type: "text/javascript"
  66. })));
  67. }
  68. }
  69.  
  70. function sendLocalBotsMessage(a) {
  71. for (i in NeyBots.localBots) {
  72. NeyBots.localBots[i].postMessage(a);
  73. }
  74. }
  75.  
  76. function sendRemoteBotsMessage(a) {
  77. for (i in NeyBots.remoteBots) {
  78. NeyBots.remoteBots[i].postMessage(a);
  79. }
  80. }
  81.  
  82. function insertCore() {
  83. var f = new XMLHttpRequest;
  84. f.open("GET", "/agario.core.js", true);
  85. f.onload = function() {
  86. var script = f.responseText;
  87. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerSpawn)", "NeyBots.playerSpawned();if(h.MC&&h.MC.onPlayerSpawn)");
  88. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerDeath)", "NeyBots.playerDied();if(h.MC&&h.MC.onPlayerDeath)");
  89. script = replaceNormalFile(script, "if(h.MC&&h.MC.onAgarioCoreLoaded)", "NeyBots.onAgarioCoreLoaded();if(h.MC&&h.MC.onAgarioCoreLoaded)");
  90. script = replaceNormalFile(script, "if(h.MC&&h.MC.onDisconnect)", "NeyBots.playerDisconnected();if(h.MC&&h.MC.onDisconnect)");
  91. script = replaceNormalFile(script, "connect:function(a){", "connect:function(a){NeyBots.playerConnected(a);");
  92. script = replaceNormalFile(script, "sendSpectate:function(){", "sendSpectate:function(){NeyBots.playerSpectated();");
  93. script = replaceNormalFile(script, "sendNick:function(a){", "sendNick:function(a){NeyBots.updateNickname(a);");
  94. script = replaceNormalFile(script, "setTarget:function(a,b){", "setTarget:function(a,b){if(NeyBots.stopMovement){a = $('#canvas').width() / 2; b = $('#canvas').height() / 2;}");
  95. script = replaceRegexFile(script, /(\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);)/i, "$1 if(NeyBots.setMapCoords){NeyBots.setMapCoords($3,$5,$7,$9,$2,$8);}");
  96. script = replaceRegexFile(script, /([\w$]+\(\d+,\w\[\w>>2\]\|0,(\+\w),(\+\w)\)\|0;[\w$]+\(\d+,\w\[\w>>2\]\|0,\+-(\+\w\[\w\+\d+>>3\]),\+-(\+\w\[\w\+\d+>>3\])\)\|0;)/i, "$1 NeyBots.playerX=$4; NeyBots.playerY=$5;");
  97. script = replaceRegexFile(script, /if\((\+\w\[\w>>3\])<1\.0\){/i, "if($1 < NeyBots.zoomResetValue){");
  98. script = replaceRegexFile(script, /(if\(\w<=)(20\.0)(\){\w=\w;return})(if\(!\w\){if\(\(\w\[\d+\]\|0\)!=\(\w\[\d+\]\|0\)\){\w=\w;return}if\(\(\w\[\w\+\d+>>0\]\|0\)!=0\?\(\w\[\w>>0\]\|0\)==0:0\){\w=\w;return}})/i, "$140.0$3");
  99. script = replaceRegexFile(script, /(\w)(=\+\w\[\w>>3\]\*\+\w\()(.\d)(,\+\w\);)/i, "$1$2 (NeyBots.zoomSpeedValue||0.9) $4 NeyBots.zoomValue=$1;");
  100. script = replaceRegexFile(script, /(\w=\w\[\w>>2\]\|0;)((\w\[\w>>3\])=(\w);)(\w\[\w>>0\]=a\[\w>>0\];)/i, "$1 if(!NeyBots.autoZoom){$3 = NeyBots.zoomValue;}else{$2}$5");
  101. script = replaceRegexFile(script, /((\w)=(\+\(\(\w\[\w\+\d+>>\d.*;)(\w)=(\+\(\(\w\[.*\/2\|\d\)\|0\)\/\w\+\s\+\w\[\w\+\d+>>3\];).*\4=\4<\w\?\w:\w;)/, "NeyBots.mouseX = $3 NeyBots.mouseY = $5 $1");
  102. eval(script);
  103. };
  104. f.send();
  105. }
  106.  
  107. function MinimapBall(a, b, c, d, e, f) {
  108. this.isDefault = a;
  109. this.name = b;
  110. this.x = c;
  111. this.y = d;
  112. this.lastX = c;
  113. this.lastY = d;
  114. this.color = e;
  115. this.visible = f;
  116. }
  117.  
  118. function drawMinimap() {
  119. if (null != miniMap ? minimapCtx.clearRect(0, 0, 200, 200) : (miniMap = document.getElementById("minimap"), minimapCtx = miniMap.getContext("2d"), miniMap.width = 400, miniMap.height = 400, miniMap.style.width = "200px", miniMap.style.height = "200px", minimapCtx.scale(2, 2)), NeyBots.mapOffsetFixed && NeyBots.drawMinimap) {
  120. minimapCtx.globalAlpha = 0.4;
  121. minimapCtx.fillStyle = "#000000";
  122. minimapCtx.fillRect(0, 0, miniMap.width, miniMap.height);
  123. var a = 200 / NeyBots.mapSize;
  124. var b = 200 / NeyBots.mapSize;
  125. minimapCtx.globalAlpha = 1;
  126. for (ball in minimapBalls) {
  127. minimapBalls[ball].draw(minimapCtx, a, b);
  128. }
  129. }
  130. }
  131.  
  132. function resetMinimap() {
  133. for (ball in minimapBalls) {
  134. if (!minimapBalls[ball].isDefault) {
  135. delete minimapBalls[ball];
  136. }
  137. }
  138. }
  139.  
  140. function addBallToMinimap(a, b, c, d, e, f, g) {
  141. minimapBalls[b] = new MinimapBall(a, c, d, e, f, g);
  142. }
  143.  
  144. function removeBallFromMinimap(a) {
  145. if (minimapBalls[a]) {
  146. delete minimapBalls[a];
  147. }
  148. }
  149.  
  150. function moveBallOnMinimap(a, b, c) {
  151. if (minimapBalls[a]) {
  152. minimapBalls[a].x = b;
  153. minimapBalls[a].y = c;
  154. }
  155. }
  156.  
  157. function setBallVisible(a, b) {
  158. if (minimapBalls[a]) {
  159. minimapBalls[a].visible = b;
  160. }
  161. }
  162.  
  163. function changeNicknameOnBall(a, b) {
  164. if (minimapBalls[a]) {
  165. minimapBalls[a].name = b;
  166. }
  167. }
  168.  
  169. function replaceRegexFile(a, b, c) {
  170. var d = new RegExp(b);
  171. return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  172. }
  173.  
  174. function replaceNormalFile(a, b, c) {
  175. return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  176. }
  177.  
  178. function sendCommand(a) {
  179. if (null != socket) {
  180. if (socket.connected) {
  181. socket.emit("command", a);
  182. }
  183. }
  184. }
  185.  
  186. function connectToNeyBotsServer() {
  187. socket = io.connect("ws://158.69.212.39:8001", {
  188. reconnection: true,
  189. query: "key=" + client_uuid
  190. });
  191.  
  192. socket.on("message", function(msg) {
  193. alert(msg);
  194. });
  195.  
  196. socket.on("force-uuid", function(data) {
  197. socket.emit("uuid", client_uuid)
  198. });
  199.  
  200. socket.on("command", function(a) {
  201. if (void 0 === a.name) {
  202. return void console.log("Recieved a command with no name.");
  203. }
  204. switch (a.name) {
  205. case "force-update":
  206. resetMinimap();
  207. transmit_current_server(true);
  208. if (NeyBots.isAlive) {
  209. sendCommand({
  210. name: "alive",
  211. playerName: NeyBots.playerName
  212. });
  213. }
  214. break;
  215. case "add":
  216. addBallToMinimap(false, a.socketID, a.playerName, a.x, a.y, "#FFFFFF", true);
  217. break;
  218. case "remove":
  219. removeBallFromMinimap(a.socketID);
  220. break;
  221. case "position":
  222. moveBallOnMinimap(a.socketID, a.x, a.y);
  223. break;
  224. case "count":
  225. NeyBots.serverBots = a.count;
  226. break;
  227. case "auth":
  228. NeyBots.isAuthorized = true;
  229. console.log("Your client is authorized for use of more bots.");
  230. break;
  231. default:
  232. return void console.log("Received a command with an unknown name: " + a.name);
  233. }
  234. });
  235. socket.on("bots", function(a) {
  236. if ("server" == a.name) {
  237. NeyBots.remoteBotsServer = a.server;
  238. }
  239. sendRemoteBotsMessage(a);
  240. });
  241. socket.on("disconnect", function() {
  242. resetMinimap();
  243. sendRemoteBotsMessage({
  244. name: "disconnect"
  245. });
  246. });
  247. }
  248.  
  249. function updateBotNames() {
  250. sendLocalBotsMessage({
  251. name: "names",
  252. botNames: NeyBots.botNames
  253. });
  254. if (NeyBots.isAuthorized) {
  255. sendCommand({
  256. name: "names",
  257. botNames: NeyBots.botNames
  258. });
  259. }
  260. }
  261.  
  262. function validateNames(a) {
  263. if (void 0 === a) {
  264. return null;
  265. }
  266. if (a.indexOf(",") > -1) {
  267. var b = a.split(",");
  268. for (name in b) {
  269. if (b[name].length <= 0 || b[name].length > 15) {
  270. return null;
  271. }
  272. }
  273. return b;
  274. }
  275. return a.length > 0 && a.length <= 15 ? [a] : null;
  276. }
  277.  
  278. function emitSplit() {
  279. if (NeyBots.isAuthorized) {
  280. sendCommand({
  281. name: "split"
  282. });
  283. }
  284. sendLocalBotsMessage({
  285. name: "split"
  286. });
  287. }
  288.  
  289. function emitMassEject() {
  290. if (NeyBots.isAuthorized) {
  291. sendCommand({
  292. name: "eject"
  293. });
  294. }
  295. sendLocalBotsMessage({
  296. name: "eject"
  297. });
  298. }
  299.  
  300. function emitLocalPosition() {
  301. var a = NeyBots.mouseX;
  302. var b = NeyBots.mouseY;
  303. if (!NeyBots.moveToMouse) {
  304. a = NeyBots.playerX;
  305. b = NeyBots.playerY;
  306. }
  307. sendLocalBotsMessage({
  308. name: "position",
  309. x: a + NeyBots.mapOffsetX,
  310. y: b + NeyBots.mapOffsetY
  311. });
  312. }
  313.  
  314. function emitPosition() {
  315. var a = NeyBots.mouseX;
  316. var b = NeyBots.mouseY;
  317. if (!NeyBots.moveToMouse) {
  318. a = NeyBots.playerX;
  319. b = NeyBots.playerY;
  320. }
  321. sendCommand({
  322. name: "position",
  323. x: NeyBots.realPlayerX,
  324. y: NeyBots.realPlayerY,
  325. botX: a + NeyBots.mapOffsetX,
  326. botY: b + NeyBots.mapOffsetY
  327. });
  328. }
  329.  
  330. function transmit_current_server(a) {
  331. if (a || last_transmited_game_server != NeyBots.server) {
  332. last_transmited_game_server = NeyBots.server;
  333. sendCommand({
  334. name: "servers",
  335. server: last_transmited_game_server
  336. });
  337. }
  338. }
  339.  
  340. function generateBotFunction() {
  341. return function() {
  342. function replaceRegexFile(a, b, c) {
  343. var d = new RegExp(b);
  344. return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  345. }
  346.  
  347. function replaceNormalFile(a, b, c) {
  348. return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  349. }
  350.  
  351. function getRandomInt(a, b) {
  352. return Math.floor(Math.random() * (b - a + 1)) + a;
  353. }
  354.  
  355. function getBotCore() {
  356. var e = new XMLHttpRequest;
  357. e.open("GET", "http://agar.io/agario.core.js", true);
  358. e.onload = function() {
  359. var script = e.responseText;
  360. script = replaceRegexFile(script, /\w+\.location\.hostname/g, '"agar.io"');
  361. script = replaceNormalFile(script, "window", "self");
  362. script = replaceNormalFile(script, "c.setStatus=function(a){console.log(a)};", "c.setStatus=function(a){};");
  363. script = replaceNormalFile(script, 'console.log("postRun");', "");
  364. script = replaceRegexFile(script, /(\w)=\+\(\(\w\[\w\+\d+>>\d.*;(\w)=\+\(\(\w\[.*\/2\|\d\)\|0\)\/\w\+\s\+\w\[\w\+\d+>>3\];/, "$1 = NeyBots.newX; $2 = NeyBots.newY;");
  365. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerSpawn)", "NeyBots.playerSpawned();if(h.MC&&h.MC.onPlayerSpawn)");
  366. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerDeath)", "NeyBots.playerDied();if(h.MC&&h.MC.onPlayerDeath)");
  367. script = replaceNormalFile(script, "if(h.MC&&h.MC.onAgarioCoreLoaded)", "NeyBots.onAgarioCoreLoaded();if(h.MC&&h.MC.onAgarioCoreLoaded)");
  368. script = replaceNormalFile(script, "if(h.MC&&h.MC.onDisconnect)", "NeyBots.playerDisconnected();if(h.MC&&h.MC.onDisconnect)");
  369. script = replaceNormalFile(script, "h.MC&&h.MC.corePendingReload", "NeyBots.reloadCore();h.MC&&h.MC.corePendingReload");
  370. script = replaceRegexFile(script, /(\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);\w\[\w\+(\d+)>>3]=(\w);)/i, "$1 if(NeyBots.setMapCoords){NeyBots.setMapCoords($3,$5,$7,$9,$2,$8);}");
  371. script = replaceRegexFile(script, /([\w$]+\(\d+,\w\[\w>>2\]\|0,(\+\w),(\+\w)\)\|0;[\w$]+\(\d+,\w\[\w>>2\]\|0,\+-(\+\w\[\w\+\d+>>3\]),\+-(\+\w\[\w\+\d+>>3\])\)\|0;)/i, "$1 NeyBots.playerX=$4; NeyBots.playerY=$5; NeyBots.setPath();");
  372. script = replaceRegexFile(script, /(do\sif\(\w\){)((\w)=!\(\+\w\[\w>>2]<=20.0\);)(.+,\w\[\w>>2\]\|0,(\+\(\+\w\[\w>>2\]\)),(\+\(\+\w\[\w>>2\]\)),\+\((\+\w\[\w>>2\]))/, "$1var cellSize=$7;$2if(!$3){NeyBots.recordPellet($5,$6,cellSize);}$4");
  373. eval(script);
  374. };
  375. e.send(null);
  376. }
  377. self.innerWidth = 1;
  378. self.innerHeight = 1;
  379. const window = {};
  380. elementMock = {
  381. getContext: function() {
  382. return {
  383. canvas: {
  384. width: 1,
  385. height: 1
  386. },
  387. clearRect: function() {},
  388. save: function() {},
  389. translate: function() {},
  390. scale: function() {},
  391. stroke: function() {},
  392. arc: function() {},
  393. fill: function() {},
  394. moveTo: function() {},
  395. lineTo: function() {},
  396. closePath: function() {},
  397. beginPath: function() {},
  398. restore: function() {},
  399. fillRect: function() {},
  400. measureText: function() {
  401. return {};
  402. },
  403. strokeText: function() {},
  404. fillText: function() {},
  405. drawImage: function() {}
  406. };
  407. },
  408. innerText: "",
  409. div: {
  410. appendChild: function() {}
  411. },
  412. appendChild: function() {},
  413. style: {}
  414. };
  415. document = {
  416. getElementById: function() {
  417. return elementMock;
  418. },
  419. createElement: function(a) {
  420. return elementMock;
  421. },
  422. body: {
  423. firstChild: {},
  424. insertBefore: function() {}
  425. }
  426. };
  427. Image = function() {};
  428. self.NeyBots = {
  429. server: null,
  430. botID: 0,
  431. botName: "ηєувσтs.тк",
  432. playerX: 0,
  433. playerY: 0,
  434. newX: 0,
  435. newY: 0,
  436. realPlayerX: null,
  437. realPlayerY: null,
  438. mapOffset: 7071,
  439. mapOffsetX: 0,
  440. mapOffsetY: 0,
  441. mapOffsetFixed: false,
  442. collectPellets: false,
  443. pelletTargetX: 99999,
  444. pelletTargetY: 99999,
  445. pellets: [],
  446. recordPellet: function(a, b, c) {
  447. this.pellets.push({
  448. x: a,
  449. y: b,
  450. size: c
  451. });
  452. },
  453. setMapCoords: function(a, b, c, d, e, f) {
  454. if (f - e == 24) {
  455. if (c - a > 14E3) {
  456. if (d - b > 14E3) {
  457. this.mapOffsetX = this.mapOffset - c;
  458. this.mapOffsetY = this.mapOffset - d;
  459. this.mapOffsetFixed = true;
  460. }
  461. }
  462. }
  463. },
  464. playerDied: function() {
  465. postMessage({
  466. name: "remove",
  467. botID: NeyBots.botID
  468. });
  469. },
  470. playerSpawned: function() {
  471. postMessage({
  472. name: "add",
  473. botID: NeyBots.botID,
  474. botName: NeyBots.botName,
  475. x: NeyBots.realPlayerX,
  476. y: NeyBots.realPlayerY
  477. });
  478. },
  479. playerDisconnected: function() {
  480. postMessage({
  481. name: "remove",
  482. botID: NeyBots.botID
  483. });
  484. if (self.core) {
  485. if (null != NeyBots.server) {
  486. core.connect(NeyBots.server);
  487. }
  488. }
  489. },
  490. reloadCore: function() {
  491. if (self.core) {
  492. self.core.destroy();
  493. }
  494. getBotCore();
  495. },
  496. onAgarioCoreLoaded: function() {
  497. if (self.core) {
  498. if (null != NeyBots.server) {
  499. core.connect(NeyBots.server);
  500. }
  501. }
  502. },
  503. setPath: function() {
  504. var a = -1;
  505. var b = 0;
  506. var c = 0;
  507. for (; c < this.pellets.length; c++) {
  508. var d = this.getDistanceBetweenPositions(this.pellets[c].x, this.pellets[c].y, this.playerX, this.playerY);
  509. if (!(a != -1 && d > b)) {
  510. a = c;
  511. b = d;
  512. }
  513. }
  514. if (a == -1) {
  515. this.pelletTargetX = 99999;
  516. this.pelletTargetY = 99999;
  517. } else {
  518. this.pelletTargetX = this.pellets[a].x;
  519. this.pelletTargetY = this.pellets[a].y;
  520. }
  521. this.pellets = [];
  522. },
  523. getDistanceBetweenPositions: function(a, b, c, d) {
  524. return Math.sqrt(Math.pow(c - a, 2) + Math.pow(b - d, 2));
  525. }
  526. };
  527. onmessage = function(a) {
  528. var b = a.data;
  529. switch (b.name) {
  530. case "botID":
  531. NeyBots.botID = b.botID;
  532. break;
  533. case "server":
  534. NeyBots.server = b.server;
  535. if (self.core) {
  536. if (null != b.server) {
  537. core.connect(b.server);
  538. }
  539. }
  540. break;
  541. case "position":
  542. if (NeyBots.collectPellets && (99999 != NeyBots.pelletTargetX && 99999 != NeyBots.pelletTargetY)) {
  543. NeyBots.newX = NeyBots.pelletTargetX;
  544. NeyBots.newY = NeyBots.pelletTargetY;
  545. } else {
  546. NeyBots.newX = b.x - NeyBots.mapOffsetX;
  547. NeyBots.newY = b.y - NeyBots.mapOffsetY;
  548. }
  549. break;
  550. case "split":
  551. if (self.core) {
  552. core.split();
  553. }
  554. break;
  555. case "eject":
  556. if (self.core) {
  557. core.eject();
  558. }
  559. break;
  560. case "names":
  561. if (null == b.botNames) {
  562. NeyBots.botName = "Hola Badgal";
  563. break;
  564. }
  565. NeyBots.botName = b.botNames[getRandomInt(0, b.botNames.length - 1)];
  566. break;
  567. case "disconnect":
  568. NeyBots.server = null;
  569. if (self.core) {
  570. core.disconnect();
  571. }
  572. break;
  573. case "collectPellets":
  574. NeyBots.collectPellets = b.collectPellets;
  575. break;
  576. default:
  577. console.log("Unknown message received.");
  578. }
  579. };
  580. setInterval(function() {
  581. NeyBots.realPlayerX = NeyBots.mapOffsetX + NeyBots.playerX;
  582. NeyBots.realPlayerY = NeyBots.mapOffsetY + NeyBots.playerY;
  583. postMessage({
  584. botID: NeyBots.botID,
  585. name: "position",
  586. x: NeyBots.realPlayerX,
  587. y: NeyBots.realPlayerY
  588. });
  589. if (self.core) {
  590. core.sendNick(NeyBots.botName);
  591. }
  592. }, 100);
  593. getBotCore();
  594. }.toString();
  595. }
  596. window.history.replaceState("", "", "/" + location.hash), window.getTextWidth = function(a, b) {
  597. var c = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
  598. var d = c.getContext("2d");
  599. d.font = b;
  600. var e = d.measureText(a);
  601. return e.width;
  602. };
  603. var entityMap = {
  604. "&": "&amp;",
  605. "<": "&lt;",
  606. ">": "&gt;",
  607. '"': "&quot;",
  608. "'": "&#39;",
  609. "/": "&#x2F;"
  610. };
  611. var client_uuid = escapeHtml(localStorage.getItem("NeyBots_uuid"));
  612. if (null === client_uuid || 15 != client_uuid.length) {
  613. client_uuid = "";
  614. var ranStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  615. var ii = 0;
  616. for (; ii < 15; ii++) {
  617. client_uuid += ranStr.charAt(Math.floor(Math.random() * ranStr.length));
  618. }
  619. localStorage.setItem("NeyBots_uuid", client_uuid);
  620. }
  621. window.NeyBots = {
  622. server: null,
  623. playerName: "ηєувσтs.тк",
  624. startBotAmount: 2,
  625. playerX: 0,
  626. playerY: 0,
  627. mouseX: 0,
  628. mouseY: 0,
  629. realPlayerX: null,
  630. realPlayerY: null,
  631. mapSize: 14142,
  632. mapOffset: 7071,
  633. mapOffsetX: 0,
  634. mapOffsetY: 0,
  635. mapOffsetFixed: false,
  636. zoomValue: 1,
  637. zoomResetValue: 0,
  638. zoomSpeedValue: 0.9,
  639. autoZoom: true,
  640. stopMovement: false,
  641. isAlive: false,
  642. moveToMouse: true,
  643. localBots: {},
  644. localBotsAlive: {},
  645. remoteBotsServer: null,
  646. remoteBots: {},
  647. remoteBotsAlive: {},
  648. leaderboardData: "",
  649. serverBots: 0,
  650. isAuthorized: !1,
  651. drawMinimap: true,
  652. setMapCoords: function(a, b, c, d, e, f) {
  653. if (f - e == 24) {
  654. if (c - a > 14E3) {
  655. if (d - b > 14E3) {
  656. this.mapOffsetX = this.mapOffset - c;
  657. this.mapOffsetY = this.mapOffset - d;
  658. this.mapOffsetFixed = true;
  659. }
  660. }
  661. }
  662. },
  663. playerDied: function() {
  664. NeyBots.isAlive = false;
  665. moveBallOnMinimap("player_death", this.realPlayerX, this.realPlayerY);
  666. setBallVisible("player_pointer", false);
  667. setBallVisible("player_death", true);
  668. sendCommand({
  669. name: "dead"
  670. });
  671. },
  672. playerSpawned: function() {
  673. NeyBots.isAlive = true;
  674. changeNicknameOnBall("player_pointer", NeyBots.playerName);
  675. setBallVisible("player_spectate", false);
  676. setBallVisible("player_pointer", true);
  677. sendCommand({
  678. name: "alive",
  679. playerName: NeyBots.playerName
  680. });
  681. },
  682. playerConnected: function(a) {
  683. resetMinimap();
  684. if (null != this.remoteBotsServer) {
  685. if (this.remoteBotsServer == a) {
  686. sendRemoteBotsMessage({
  687. name: "disconnect"
  688. });
  689. }
  690. }
  691. NeyBots.server = a;
  692. console.log("Connecting to: " + a);
  693. setBallVisible("player_pointer", false);
  694. setBallVisible("player_death", false);
  695. setBallVisible("player_spectate", false);
  696. sendLocalBotsMessage({
  697. name: "server",
  698. server: a
  699. });
  700. },
  701. playerDisconnected: function() {
  702. resetMinimap();
  703. sendCommand({
  704. name: "dead"
  705. });
  706. setBallVisible("player_pointer", false);
  707. setBallVisible("player_death", false);
  708. setBallVisible("player_spectate", false);
  709. NeyBots.server = null;
  710. NeyBots.isAlive = false;
  711. },
  712. playerSpectated: function() {
  713. setBallVisible("player_pointer", false);
  714. setBallVisible("player_spectate", true);
  715. sendCommand({
  716. name: "dead"
  717. });
  718. },
  719. updateNickname: function(a) {
  720. this.playerName = a;
  721. },
  722. loadCore: function() {
  723. setTimeout(function() {
  724. startLocalBots();
  725. startRemoteBots();
  726. }, 2E3);
  727. console.log("Loading core.");
  728. var b$$0 = (document.getElementById("canvas"), localStorage.getItem("botnames"));
  729. if (null !== b$$0) {
  730. NeyBots.botNames = validateNames(b$$0);
  731. if (null !== NeyBots.botNames) {
  732. $("#botnames").val(b$$0);
  733. }
  734. updateBotNames();
  735. }
  736. $("#botnames").on("input", function() {
  737. var a = $("#botnames").val();
  738. var b = validateNames(a);
  739. NeyBots.botNames = b;
  740. updateBotNames();
  741. if (null !== b) {
  742. localStorage.setItem("botnames", a);
  743. }
  744. });
  745. $("#leaderboardcopy").click(function(a) {
  746. var b = $("#leaderboard")[0];
  747. b.setSelectionRange(0, b.value.length);
  748. b.select();
  749. try {
  750. document.execCommand("copy");
  751. } catch (a$$0) {
  752. console.log("Failed to copy leaderboard.");
  753. }
  754. });
  755. $("#uuidcopy").click(function(a) {
  756. var b = $("#uuid")[0];
  757. b.setSelectionRange(0, b.value.length);
  758. b.select();
  759. try {
  760. document.execCommand("copy");
  761. } catch (a$$0) {
  762. console.log("Failed to copy uuid.");
  763. }
  764. });
  765. var c;
  766. var d = false;
  767. var f$$0 = false;
  768. $(document).keydown(function(a) {
  769. switch (a.which) {
  770. case 192:
  771. core.disconnect();
  772. core.connect();
  773. break;
  774. case 70:
  775. emitSplit();
  776. emitSplit();
  777. emitSplit();
  778. emitSplit();
  779. break;
  780. case 65:
  781. NeyBots.moveToMouse = !NeyBots.moveToMouse;
  782. if (NeyBots.moveToMouse) {
  783. $("#ismoveToMouse").html("<font color='#7FFF00'>On</font>");
  784. } else {
  785. $("#ismoveToMouse").html("<font color='red'>Off</font>");
  786. }
  787. break;
  788. case 68:
  789. NeyBots.stopMovement = !NeyBots.stopMovement;
  790. if (NeyBots.stopMovement) {
  791. $("#isStopMove").html("<font color='#7FFF00'>On</font>");
  792. } else {
  793. $("#isStopMove").html("<font color='red'>Off</font>");
  794. }
  795. break;
  796. case 69:
  797. emitSplit();
  798. break;
  799. case 82:
  800. emitMassEject();
  801. break;
  802. case 77:
  803. NeyBots.drawMinimap = !NeyBots.drawMinimap;
  804. if (NeyBots.drawMinimap) {
  805. $("#botcanvas").show();
  806. } else {
  807. $("#botcanvas").hide();
  808. }
  809. break;
  810. case 80:
  811. f$$0 = !f$$0;
  812. if (f$$0) {
  813. $("#collectPellets").html("<font color='#7FFF00'>On</font>");
  814. } else {
  815. $("#collectPellets").html("<font color='red'>Off</font>");
  816. }
  817. sendLocalBotsMessage({
  818. name: "collectPellets",
  819. collectPellets: f$$0
  820. });
  821. if (NeyBots.isAuthorized) {
  822. sendCommand({
  823. name: "collectPellets",
  824. collectPellets: f$$0
  825. });
  826. }
  827. break;
  828. case 83:
  829. if (d) {
  830. return;
  831. }
  832. d = true;
  833. c = setInterval(function() {
  834. core.eject();
  835. }, 50);
  836. }
  837. });
  838. $(document).keyup(function(a) {
  839. switch (a.which) {
  840. case 83:
  841. d = false;
  842. clearInterval(c);
  843. break;
  844. case 84:
  845. var b = 0;
  846. var e = setInterval(function() {
  847. return b > 7 ? void clearInterval(e) : (b++, void core.split());
  848. }, 50);
  849. break;
  850. case 81:
  851. var f = 0;
  852. var g = setInterval(function() {
  853. return f > 1 ? void clearInterval(g) : (f++, void core.split());
  854. }, 50);
  855. }
  856. });
  857. addBallToMinimap(true, "player_pointer", NeyBots.playerName, NeyBots.realPlayerX, NeyBots.realPlayerY, "#00FF00", false);
  858. addBallToMinimap(true, "player_death", "Last Death", NeyBots.realPlayerX, NeyBots.realPlayerY, "#FF2400", false);
  859. addBallToMinimap(true, "player_spectate", "Spectate", NeyBots.realPlayerX, NeyBots.realPlayerY, "#0000FF", false);
  860. connectToNeyBotsServer();
  861. insertCore();
  862. setInterval(function() {
  863. MC.NeyBotsFreeCoins();
  864. }, 5E3);
  865. setInterval(function() {
  866. drawMinimap();
  867. }, 33);
  868. },
  869. reloadCore: function() {
  870. console.log("Reloading Core.");
  871. insertCore();
  872. },
  873. onAgarioCoreLoaded: function() {
  874. console.log("Loading settings into agario core.");
  875. core.setSkins(!$("#noSkins").is(":checked"));
  876. core.setNames(!$("#noNames").is(":checked"));
  877. core.setColors(!$("#noColors").is(":checked"));
  878. core.setShowMass($("#showMass").is(":checked"));
  879. core.setDarkTheme($("#darkTheme").is(":checked"));
  880. }
  881. };
  882. var tempLeaderBoard = "";
  883. var tempLeaderBoardIndex = 1;
  884. CanvasRenderingContext2D.prototype._fillText = CanvasRenderingContext2D.prototype.fillText, CanvasRenderingContext2D.prototype.fillText = function() {
  885. this._fillText.apply(this, arguments);
  886. if ("Leaderboard" === arguments[0]) {
  887. if ("" != tempLeaderBoard) {
  888. NeyBots.leaderboardData = tempLeaderBoard;
  889. $("#leaderboard").val(NeyBots.leaderboardData);
  890. }
  891. tempLeaderBoardIndex = 1;
  892. tempLeaderBoard = "";
  893. } else {
  894. if (":teams" != $("#gamemode").val() && (0 == arguments[0].indexOf(tempLeaderBoardIndex + ".") && tempLeaderBoardIndex < 11)) {
  895. tempLeaderBoard += arguments[0] + (tempLeaderBoardIndex <= 9 ? ", " : "");
  896. tempLeaderBoardIndex++;
  897. } else {
  898. this._fillText.apply(this, arguments);
  899. }
  900. }
  901. }, CanvasRenderingContext2D.prototype._drawImage = CanvasRenderingContext2D.prototype.drawImage, CanvasRenderingContext2D.prototype.drawImage = function() {
  902. if (arguments[0].src) {
  903. if ("http://agar.io/img/background.png" == arguments[0].src) {
  904. arguments[0].src = "";
  905. }
  906. }
  907. this._drawImage.apply(this, arguments);
  908. };
  909. var miniMap = null;
  910. var minimapCtx = null;
  911. minimapBalls = {}, MinimapBall.prototype = {
  912. draw: function(a, b, c) {
  913. if (this.visible) {
  914. this.lastX = (29 * this.lastX + this.x) / 30;
  915. this.lastY = (29 * this.lastY + this.y) / 30;
  916. var d = ((this.isDefault ? this.x : this.lastX) + NeyBots.mapOffset) * b;
  917. var e = ((this.isDefault ? this.y : this.lastY) + NeyBots.mapOffset) * c;
  918. a.fillStyle = this.color;
  919. a.font = "10px Ubuntu";
  920. a.textAlign = "center";
  921. a.fillText("" == this.name ? "An unnamed cell" : this.name, d, e - 10);
  922. a.beginPath();
  923. a.arc(d, e, 4.5, 0, 2 * Math.PI, false);
  924. a.closePath();
  925. a.fillStyle = this.color;
  926. a.fill();
  927. }
  928. }
  929. };
  930. var b = new XMLHttpRequest;
  931. b.open("GET", "/mc/agario.js", true), b.onload = function() {
  932. var script = b.responseText;
  933. script = replaceNormalFile(script, 'if(js.keyCode==32&&i1!="nick"){js.preventDefault()}', "");
  934. script = replaceNormalFile(script, "showAds:function(i){if", "showAds:function(i){},showFuck:function(i){if");
  935. script = replaceNormalFile(script, "showPromoBadge:function(", "showPromoBadge:function(i){},fuckbacks: function(");
  936. script = replaceRegexFile(script, /(return\s\w+.tab.toUpperCase\(\)).indexOf\(\w+.toUpperCase\(\)\)!=-1/, "$1 != 'VETERAN'");
  937. script = replaceRegexFile(script, /if\(\w+.shouldSkipConfigEntry\(\w+.productIdToQuantify.*visibility\)\)\{continue\}/, "");
  938. script = replaceNormalFile(script, "if(this.getSkinsByCategory(i1.tabDescription).length>0", 'if (this.getSkinsByCategory(i1.tabDescription).length > 0 && (i1.tabDescription.toUpperCase() == "PREMIUM" || i1.tabDescription.toUpperCase() == "VETERAN" || i1.tabDescription.toUpperCase() == "OWNED")');
  939. script = replaceRegexFile(script, /var\si2=window.document.createElement..script..+head.appendChild.i2../i, "NeyBots.reloadCore();");
  940. script = replaceRegexFile(script, /(showFreeCoins:function\(\)\{var.*showContainer\(\);if\(([a-zA-Z0-9]+[a-zA-Z0-9]+.user.userInfo==null).*false\);([a-zA-Z0-9]+[a-zA-Z0-9]+.triggerFreeCoins\(\)).*this.onShopClose\)\)\}},)/, "$1 NeyBotsFreeCoins: function(){if($2){return;}$3;},");
  941. script = replaceNormalFile(script, "onPlayerBanned:function(i)", "onPlayerBanned: function(i){},shitfacefuck:function(i)");
  942. script = replaceNormalFile(script, "setPopupActiveState:function(i){", "setPopupActiveState:function(i){console.log('stopped annoying ad');return;");
  943. eval(script);
  944. var e = new XMLHttpRequest;
  945. e.open("GET", "/", true);
  946. e.onload = function() {
  947. var a = e.responseText;
  948. a = replaceNormalFile(a, "UCC6hurPo_LxL7C0YFYgYnIw", "UC08JIWwtw7Ea0RT3xNX3hNw");
  949. a = replaceRegexFile(a, /<footer[\S\s]*\/footer>/i, "");
  950. a = replaceNormalFile(a, '<script src="agario.core.js" async>\x3c/script>', "<div id='botcanvas' style='background:rgba(0,0,0,0.4); width: 200px; top: 5px; left: 9px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; padding: 5px; font-family: Ubuntu;'> <font color='#7FFF00'>Hola Badgal</font><br>Bots: <a id='botCount'><font color='red'>0 / 2</font></a><br><font color='#FFFFFF'>A</font> - Move To Mouse: <a id='ismoveToMouse'><font color='#7FFF00'>On</font></a><br><font color='#FFFFFF'>P</font> - Collect Pellets: <a id='collectPellets'><font color='red'>Off</font></a><br><font color='#FFFFFF'>D</font> - Stop Movement: <a id='isStopMove'><font color='red'>Off</font></a></div>");
  951. a = replaceNormalFile(a, "<body>", '<body onload="NeyBots.loadCore()">');
  952. a = replaceRegexFile(a, /<script type="text\/javascript" src="mc\/agario\.js.*"><\/script>/i, "");
  953. a = replaceRegexFile(a, /<div id="adsBottom".*display:block;">/i, '<div id="adsBottom" style="display:none">');
  954. a = replaceNormalFile(a, '<div class="diep-cross" style="', '<div class="diep-cross" style="display:none;');
  955. a = replaceNormalFile(a, '<div id="promo-badge-container">', '<div id="promo-badge-container" style="display:none;">');
  956. a = replaceNormalFile(a, '<span data-itr="page_instructions_w"></span><br/>', '<span data-itr="page_instructions_w"></span><br/><span>Press <b>Q</b> to double split</span><br><span>Hold <b>S</b> to rapid fire mass</span><br><span>Press <b>M</b> to hide/show the minimap</span><br><span>Press <b>E</b> to split bots</span><br><span>Press <b>R</b> to eject some bots mass</span><br><span>Press <b>P</b> to make bots collect pellets</span>');
  957. a = replaceNormalFile(a, '<div id="tags-container">', '<div id="leaders" class="input-group" style="margin-top: 6px;"><span class="input-group-addon" style="width:75px"id="basic-addon1">BOARD</span><input id="leaderboard" type="text" value="" style="width:185px" readonly class="form-control"><button id="leaderboardcopy" class="btn btn-primary" style="float: right; width: 60px; border-radius: 0px 4px 4px 0px;" data-original-title="" title="">Copy</button></div><div class="input-group" style="margin-top: 6px;"><span class="input-group-addon" style="width:75px"id="basic-addon1">UUID</span><input id="uuid" type="text" value="' +
  958. client_uuid + '" style="width:185px" readonly class="form-control"><button id="uuidcopy" class="btn btn-primary" style="float: right; width: 60px; border-radius: 0px 4px 4px 0px;" data-original-title="" title="">Copy</button></div><div class="input-group" style="margin-top: 6px;"><span class="input-group-addon" style="width:75px" id="basic-addon1">NAMES</span><input id="botnames" type="text" placeholder="Hola Badgal" disabled value="Hola Badgal :)" class="form-control" style="width:245px" autofocus=""></div><div id="tags-container">');
  959. a = replaceNormalFile(a, "</body>", '<div style="display:block;position:absolute;z-index:100;pointer-events:none;right:9px;bottom:9px;"><canvas id="minimap"></div></body>');
  960. document.open();
  961. document.write(a);
  962. NeyBots.loadCore();
  963. document.close();
  964. };
  965. e.send();
  966. }, b.send(), setInterval(function() {
  967. NeyBots.realPlayerX = NeyBots.mapOffsetX + NeyBots.playerX;
  968. NeyBots.realPlayerY = NeyBots.mapOffsetY + NeyBots.playerY;
  969. moveBallOnMinimap("player_pointer", NeyBots.realPlayerX, NeyBots.realPlayerY);
  970. moveBallOnMinimap("player_spectate", NeyBots.realPlayerX, NeyBots.realPlayerY);
  971. }, 50);
  972. var last_transmited_game_server = null;
  973. var socket = null;
  974. setInterval(function() {
  975. if (!NeyBots.isAuthorized) {
  976. emitPosition();
  977. }
  978. }, 10), setInterval(function() {
  979. if (NeyBots.isAuthorized) {
  980. emitPosition();
  981. }
  982. emitLocalPosition();
  983. transmit_current_server(false);
  984. }, 10);
  985. window.interval = setInterval(function() {
  986. if (MC.coreWasLoaded == true && $("#nick")[0]) {
  987. clearInterval(interval);
  988. $("#agarTwitter").remove();
  989. $("h2").replaceWith("<h2>>Hola Badgal<</h2>");
  990. }
  991. }, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement