Advertisement
Guest User

test1231

a guest
Dec 7th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.76 KB | None | 0 0
  1. alert("Don't Forget to Subscribe For N1ce And use Zenmate Vpn becouse more bots");
  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. BotMega.localBotsAlive[a] = b;
  13. var c = BotMega.serverBots;
  14. var d = 1 + BotMega.serverBots;
  15. var e = 0;
  16. for (;e < 2;e++) {
  17. if (BotMega.localBotsAlive[e]) {
  18. c++;
  19. }
  20. }
  21. if (0 == c) {
  22. $("#botCount").html('<font color="#7FFF00">1 / ' + d + "</font>");
  23. } else {
  24. $("#botCount").html('<font color="#7FFF00">' + c + " / " + d + "</font>");
  25. }
  26. }
  27. function startLocalBots() {
  28. var a$$0 = 0;
  29. for (;a$$0 < BotMega.startBotAmount;a$$0++) {
  30. BotMega.localBotsAlive[a$$0] = false;
  31. BotMega.localBots[a$$0] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  32. type : "text/javascript"
  33. })));
  34. BotMega.localBots[a$$0].onmessage = function(a) {
  35. var b = a.data;
  36. switch(b.name) {
  37. case "add":
  38. updateBotCount(b.botID, true);
  39. addBallToMinimap(true, "bot" + b.botID, b.botName, b.x, b.y, "#FF00FF", true);
  40. break;
  41. case "remove":
  42. updateBotCount(b.botID, false);
  43. removeBallFromMinimap("bot" + b.botID);
  44. break;
  45. case "position":
  46. moveBallOnMinimap("bot" + b.botID, b.x, b.y);
  47. break;
  48. default:
  49. console.log("Unknown command received from bot");
  50. }
  51. };
  52. BotMega.localBots[a$$0].postMessage({
  53. name : "botID",
  54. botID : a$$0
  55. });
  56. }
  57. updateBotNames();
  58. }
  59. function startRemoteBots() {
  60. var a = 0;
  61. for (;a < 3;a++) {
  62. BotMega.remoteBots[a] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  63. type : "text/javascript"
  64. })));
  65. }
  66. }
  67. function sendLocalBotsMessage(a) {
  68. for (i in BotMega.localBots) {
  69. BotMega.localBots[i].postMessage(a);
  70. }
  71. }
  72. function sendRemoteBotsMessage(a) {
  73. for (i in BotMega.remoteBots) {
  74. BotMega.remoteBots[i].postMessage(a);
  75. }
  76. }
  77. function insertCore() {
  78. var f = new XMLHttpRequest;
  79. f.open("GET", "/agario.core.js", true);
  80. f.onload = function() {
  81. var script = f.responseText;
  82. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerSpawn)", "BotMega.playerSpawned();if(h.MC&&h.MC.onPlayerSpawn)");
  83. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerDeath)", "BotMega.playerDied();if(h.MC&&h.MC.onPlayerDeath)");
  84. script = replaceNormalFile(script, "if(h.MC&&h.MC.onAgarioCoreLoaded)", "BotMega.onAgarioCoreLoaded();if(h.MC&&h.MC.onAgarioCoreLoaded)");
  85. script = replaceNormalFile(script, "if(h.MC&&h.MC.onDisconnect)", "BotMega.playerDisconnected();if(h.MC&&h.MC.onDisconnect)");
  86. script = replaceNormalFile(script, "connect:function(a){", "connect:function(a){BotMega.playerConnected(a);");
  87. script = replaceNormalFile(script, "sendSpectate:function(){", "sendSpectate:function(){BotMega.playerSpectated();");
  88. script = replaceNormalFile(script, "sendNick:function(a){", "sendNick:function(a){BotMega.updateNickname(a);");
  89. script = replaceNormalFile(script, "setTarget:function(a,b){", "setTarget:function(a,b){if(BotMega.stopMovement){a = $('#canvas').width() / 2; b = $('#canvas').height() / 2;}");
  90. 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(BotMega.setMapCoords){BotMega.setMapCoords($3,$5,$7,$9,$2,$8);}");
  91. 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 BotMega.playerX=$4; BotMega.playerY=$5;");
  92. script = replaceRegexFile(script, /if\((\+\w\[\w>>3\])<1\.0\){/i, "if($1 < BotMega.zoomResetValue){");
  93. 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");
  94. script = replaceRegexFile(script, /(\w)(=\+\w\[\w>>3\]\*\+\w\()(.\d)(,\+\w\);)/i, "$1$2 (BotMega.zoomSpeedValue||0.9) $4 BotMega.zoomValue=$1;");
  95. script = replaceRegexFile(script, /(\w=\w\[\w>>2\]\|0;)((\w\[\w>>3\])=(\w);)(\w\[\w>>0\]=a\[\w>>0\];)/i, "$1 if(!BotMega.autoZoom){$3 = BotMega.zoomValue;}else{$2}$5");
  96. script = replaceRegexFile(script, /((\w)=(\+\(\(\w\[\w\+\d+>>\d.*;)(\w)=(\+\(\(\w\[.*\/2\|\d\)\|0\)\/\w\+\s\+\w\[\w\+\d+>>3\];).*\4=\4<\w\?\w:\w;)/, "BotMega.mouseX = $3 BotMega.mouseY = $5 $1");
  97. eval(script);
  98. };
  99. f.send();
  100. }
  101. function MinimapBall(a, b, c, d, e, f) {
  102. this.isDefault = a;
  103. this.name = b;
  104. this.x = c;
  105. this.y = d;
  106. this.lastX = c;
  107. this.lastY = d;
  108. this.color = e;
  109. this.visible = f;
  110. }
  111. function drawMinimap() {
  112. 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)), BotMega.mapOffsetFixed && BotMega.drawMinimap) {
  113. minimapCtx.globalAlpha = 0.5;
  114. minimapCtx.fillStyle = "#000000";
  115. minimapCtx.fillRect(0, 0, miniMap.width, miniMap.height);
  116. var a = 200 / BotMega.mapSize;
  117. var b = 200 / BotMega.mapSize;
  118. minimapCtx.globalAlpha = 1;
  119. for (ball in minimapBalls) {
  120. minimapBalls[ball].draw(minimapCtx, a, b);
  121. }
  122. }
  123. }
  124. function resetMinimap() {
  125. for (ball in minimapBalls) {
  126. if (!minimapBalls[ball].isDefault) {
  127. delete minimapBalls[ball];
  128. }
  129. }
  130. }
  131. function addBallToMinimap(a, b, c, d, e, f, g) {
  132. minimapBalls[b] = new MinimapBall(a, c, d, e, f, g);
  133. }
  134. function removeBallFromMinimap(a) {
  135. if (minimapBalls[a]) {
  136. delete minimapBalls[a];
  137. }
  138. }
  139. function moveBallOnMinimap(a, b, c) {
  140. if (minimapBalls[a]) {
  141. minimapBalls[a].x = b;
  142. minimapBalls[a].y = c;
  143. }
  144. }
  145. function setBallVisible(a, b) {
  146. if (minimapBalls[a]) {
  147. minimapBalls[a].visible = b;
  148. }
  149. }
  150. function changeNicknameOnBall(a, b) {
  151. if (minimapBalls[a]) {
  152. minimapBalls[a].name = b;
  153. }
  154. }
  155. function replaceRegexFile(a, b, c) {
  156. var d = new RegExp(b);
  157. return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  158. }
  159. function replaceNormalFile(a, b, c) {
  160. return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  161. }
  162. function sendCommand(a) {
  163. if (null != socket) {
  164. if (socket.connected) {
  165. socket.emit("command", a);
  166. }
  167. }
  168. }
  169. function connectToBotMegaServer() {
  170. socket = io.connect("ws://165.228.137.60:8003", {
  171. reconnection : true,
  172. query : "key=" + client_uuid
  173. });
  174.  
  175. socket.on("message", function(msg) {
  176. alert(msg);
  177. });
  178.  
  179. socket.on("force-uuid", function(data) {
  180. socket.emit("uuid", client_uuid)
  181. });
  182.  
  183. socket.on("command", function(a) {
  184. if (void 0 === a.name) {
  185. return void console.log("Recieved a command with no name.");
  186. }
  187. switch(a.name) {
  188. case "force-update":
  189. resetMinimap();
  190. transmit_current_server(true);
  191. if (BotMega.isAlive) {
  192. sendCommand({
  193. name : "alive",
  194. playerName : BotMega.playerName
  195. });
  196. }
  197. break;
  198. case "add":
  199. addBallToMinimap(false, a.socketID, a.playerName, a.x, a.y, "#FFFFFF", true);
  200. break;
  201. case "remove":
  202. removeBallFromMinimap(a.socketID);
  203. break;
  204. case "position":
  205. moveBallOnMinimap(a.socketID, a.x, a.y);
  206. break;
  207. case "count":
  208. BotMega.serverBots = a.count;
  209. break;
  210. case "auth":
  211. BotMega.isAuthorized = true;
  212. console.log("Your client is authorized for use of more bots.");
  213. break;
  214. default:
  215. return void console.log("Received a command with an unknown name: " + a.name);
  216. }
  217. });
  218. socket.on("bots", function(a) {
  219. if ("server" == a.name) {
  220. BotMega.remoteBotsServer = a.server;
  221. }
  222. sendRemoteBotsMessage(a);
  223. });
  224. socket.on("disconnect", function() {
  225. resetMinimap();
  226. sendRemoteBotsMessage({
  227. name : "disconnect"
  228. });
  229. });
  230. }
  231. function updateBotNames() {
  232. sendLocalBotsMessage({
  233. name : "names",
  234. botNames : BotMega.botNames
  235. });
  236. if (BotMega.isAuthorized) {
  237. sendCommand({
  238. name : "names",
  239. botNames : BotMega.botNames
  240. });
  241. }
  242. }
  243. function validateNames(a) {
  244. if (void 0 === a) {
  245. return null;
  246. }
  247. if (a.indexOf(",") > -1) {
  248. var b = a.split(",");
  249. for (name in b) {
  250. if (b[name].length <= 0 || b[name].length > 15) {
  251. return null;
  252. }
  253. }
  254. return b;
  255. }
  256. return a.length > 0 && a.length <= 15 ? [a] : null;
  257. }
  258. function emitSplit() {
  259. if (BotMega.isAuthorized) {
  260. sendCommand({
  261. name : "split"
  262. });
  263. }
  264. sendLocalBotsMessage({
  265. name : "split"
  266. });
  267. }
  268. function emitMassEject() {
  269. if (BotMega.isAuthorized) {
  270. sendCommand({
  271. name : "eject"
  272. });
  273. }
  274. sendLocalBotsMessage({
  275. name : "eject"
  276. });
  277. }
  278. function emitLocalPosition() {
  279. var a = BotMega.mouseX;
  280. var b = BotMega.mouseY;
  281. if (!BotMega.moveToMouse) {
  282. a = BotMega.playerX;
  283. b = BotMega.playerY;
  284. }
  285. sendLocalBotsMessage({
  286. name : "position",
  287. x : a + BotMega.mapOffsetX,
  288. y : b + BotMega.mapOffsetY
  289. });
  290. }
  291. function emitPosition() {
  292. var a = BotMega.mouseX;
  293. var b = BotMega.mouseY;
  294. if (!BotMega.moveToMouse) {
  295. a = BotMega.playerX;
  296. b = BotMega.playerY;
  297. }
  298. sendCommand({
  299. name : "position",
  300. x : BotMega.realPlayerX,
  301. y : BotMega.realPlayerY,
  302. botX : a + BotMega.mapOffsetX,
  303. botY : b + BotMega.mapOffsetY
  304. });
  305. }
  306. function transmit_current_server(a) {
  307. if (a || last_transmited_game_server != BotMega.server) {
  308. last_transmited_game_server = BotMega.server;
  309. sendCommand({
  310. name : "servers",
  311. server : last_transmited_game_server
  312. });
  313. }
  314. }
  315. function generateBotFunction() {
  316. return function() {
  317. function replaceRegexFile(a, b, c) {
  318. var d = new RegExp(b);
  319. return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  320. }
  321. function replaceNormalFile(a, b, c) {
  322. return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a;
  323. }
  324. function getRandomInt(a, b) {
  325. return Math.floor(Math.random() * (b - a + 1)) + a;
  326. }
  327. function getBotCore() {
  328. var e = new XMLHttpRequest;
  329. e.open("GET", "http://agar.io/agario.core.js", true);
  330. e.onload = function() {
  331. var script = e.responseText;
  332. script = replaceRegexFile(script, /\w+\.location\.hostname/g, '"agar.io"');
  333. script = replaceNormalFile(script, "window", "self");
  334. script = replaceNormalFile(script, "c.setStatus=function(a){console.log(a)};", "c.setStatus=function(a){};");
  335. script = replaceNormalFile(script, 'console.log("postRun");', "");
  336. script = replaceRegexFile(script, /(\w)=\+\(\(\w\[\w\+\d+>>\d.*;(\w)=\+\(\(\w\[.*\/2\|\d\)\|0\)\/\w\+\s\+\w\[\w\+\d+>>3\];/, "$1 = BotMega.newX; $2 = BotMega.newY;");
  337. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerSpawn)", "BotMega.playerSpawned();if(h.MC&&h.MC.onPlayerSpawn)");
  338. script = replaceNormalFile(script, "if(h.MC&&h.MC.onPlayerDeath)", "BotMega.playerDied();if(h.MC&&h.MC.onPlayerDeath)");
  339. script = replaceNormalFile(script, "if(h.MC&&h.MC.onAgarioCoreLoaded)", "BotMega.onAgarioCoreLoaded();if(h.MC&&h.MC.onAgarioCoreLoaded)");
  340. script = replaceNormalFile(script, "if(h.MC&&h.MC.onDisconnect)", "BotMega.playerDisconnected();if(h.MC&&h.MC.onDisconnect)");
  341. script = replaceNormalFile(script, "h.MC&&h.MC.corePendingReload", "BotMega.reloadCore();h.MC&&h.MC.corePendingReload");
  342. 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(BotMega.setMapCoords){BotMega.setMapCoords($3,$5,$7,$9,$2,$8);}");
  343. 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 BotMega.playerX=$4; BotMega.playerY=$5; BotMega.setPath();");
  344. 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){BotMega.recordPellet($5,$6,cellSize);}$4");
  345. eval(script);
  346. };
  347. e.send(null);
  348. }
  349. self.innerWidth = 1;
  350. self.innerHeight = 1;
  351. const window = {};
  352. elementMock = {
  353. getContext : function() {
  354. return{
  355. canvas : {
  356. width : 1,
  357. height : 1
  358. },
  359. clearRect : function() {
  360. },
  361. save : function() {
  362. },
  363. translate : function() {
  364. },
  365. scale : function() {
  366. },
  367. stroke : function() {
  368. },
  369. arc : function() {
  370. },
  371. fill : function() {
  372. },
  373. moveTo : function() {
  374. },
  375. lineTo : function() {
  376. },
  377. closePath : function() {
  378. },
  379. beginPath : function() {
  380. },
  381. restore : function() {
  382. },
  383. fillRect : function() {
  384. },
  385. measureText : function() {
  386. return{};
  387. },
  388. strokeText : function() {
  389. },
  390. fillText : function() {
  391. },
  392. drawImage : function() {
  393. }
  394. };
  395. },
  396. innerText : "",
  397. div : {
  398. appendChild : function() {
  399. }
  400. },
  401. appendChild : function() {
  402. },
  403. style : {}
  404. };
  405. document = {
  406. getElementById : function() {
  407. return elementMock;
  408. },
  409. createElement : function(a) {
  410. return elementMock;
  411. },
  412. body : {
  413. firstChild : {},
  414. insertBefore : function() {
  415. }
  416. }
  417. };
  418. Image = function() {
  419. };
  420. self.BotMega = {
  421. server : null,
  422. botID : 0,
  423. botName : "ΛβĐỮⱢⱢΛḤ鿅👊🆒⛔❕",
  424. playerX : 0,
  425. playerY : 0,
  426. newX : 0,
  427. newY : 0,
  428. realPlayerX : null,
  429. realPlayerY : null,
  430. mapOffset : 7071,
  431. mapOffsetX : 0,
  432. mapOffsetY : 0,
  433. mapOffsetFixed : false,
  434. collectPellets : false,
  435. pelletTargetX : 99999,
  436. pelletTargetY : 99999,
  437. pellets : [],
  438. recordPellet : function(a, b, c) {
  439. this.pellets.push({
  440. x : a,
  441. y : b,
  442. size : c
  443. });
  444. },
  445. setMapCoords : function(a, b, c, d, e, f) {
  446. if (f - e == 24) {
  447. if (c - a > 14E3) {
  448. if (d - b > 14E3) {
  449. this.mapOffsetX = this.mapOffset - c;
  450. this.mapOffsetY = this.mapOffset - d;
  451. this.mapOffsetFixed = true;
  452. }
  453. }
  454. }
  455. },
  456. playerDied : function() {
  457. postMessage({
  458. name : "remove",
  459. botID : BotMega.botID
  460. });
  461. },
  462. playerSpawned : function() {
  463. postMessage({
  464. name : "add",
  465. botID : BotMega.botID,
  466. botName : BotMega.botName,
  467. x : BotMega.realPlayerX,
  468. y : BotMega.realPlayerY
  469. });
  470. },
  471. playerDisconnected : function() {
  472. postMessage({
  473. name : "remove",
  474. botID : BotMega.botID
  475. });
  476. if (self.core) {
  477. if (null != BotMega.server) {
  478. core.connect(BotMega.server);
  479. }
  480. }
  481. },
  482. reloadCore : function() {
  483. if (self.core) {
  484. self.core.destroy();
  485. }
  486. getBotCore();
  487. },
  488. onAgarioCoreLoaded : function() {
  489. if (self.core) {
  490. if (null != BotMega.server) {
  491. core.connect(BotMega.server);
  492. }
  493. }
  494. },
  495. setPath : function() {
  496. var a = -1;
  497. var b = 0;
  498. var c = 0;
  499. for (;c < this.pellets.length;c++) {
  500. var d = this.getDistanceBetweenPositions(this.pellets[c].x, this.pellets[c].y, this.playerX, this.playerY);
  501. if (!(a != -1 && d > b)) {
  502. a = c;
  503. b = d;
  504. }
  505. }
  506. if (a == -1) {
  507. this.pelletTargetX = 99999;
  508. this.pelletTargetY = 99999;
  509. } else {
  510. this.pelletTargetX = this.pellets[a].x;
  511. this.pelletTargetY = this.pellets[a].y;
  512. }
  513. this.pellets = [];
  514. },
  515. getDistanceBetweenPositions : function(a, b, c, d) {
  516. return Math.sqrt(Math.pow(c - a, 2) + Math.pow(b - d, 2));
  517. }
  518. };
  519. onmessage = function(a) {
  520. var b = a.data;
  521. switch(b.name) {
  522. case "botID":
  523. BotMega.botID = b.botID;
  524. break;
  525. case "server":
  526. BotMega.server = b.server;
  527. if (self.core) {
  528. if (null != b.server) {
  529. core.connect(b.server);
  530. }
  531. }
  532. break;
  533. case "position":
  534. if (BotMega.collectPellets && (99999 != BotMega.pelletTargetX && 99999 != BotMega.pelletTargetY)) {
  535. BotMega.newX = BotMega.pelletTargetX;
  536. BotMega.newY = BotMega.pelletTargetY;
  537. } else {
  538. BotMega.newX = b.x - BotMega.mapOffsetX;
  539. BotMega.newY = b.y - BotMega.mapOffsetY;
  540. }
  541. break;
  542. case "split":
  543. if (self.core) {
  544. core.split();
  545. }
  546. break;
  547. case "eject":
  548. if (self.core) {
  549. core.eject();
  550. }
  551. break;
  552. case "names":
  553. if (null == b.botNames) {
  554. BotMega.botName = "ΛβĐỮⱢⱢΛḤ鿅👊🆒⛔❕";
  555. break;
  556. }
  557. BotMega.botName = b.botNames[getRandomInt(0, b.botNames.length - 1)];
  558. break;
  559. case "disconnect":
  560. BotMega.server = null;
  561. if (self.core) {
  562. core.disconnect();
  563. }
  564. break;
  565. case "collectPellets":
  566. BotMega.collectPellets = b.collectPellets;
  567. break;
  568. default:
  569. console.log("Unknown message received.");
  570. }
  571. };
  572. setInterval(function() {
  573. BotMega.realPlayerX = BotMega.mapOffsetX + BotMega.playerX;
  574. BotMega.realPlayerY = BotMega.mapOffsetY + BotMega.playerY;
  575. postMessage({
  576. botID : BotMega.botID,
  577. name : "position",
  578. x : BotMega.realPlayerX,
  579. y : BotMega.realPlayerY
  580. });
  581. if (self.core) {
  582. core.sendNick(BotMega.botName);
  583. }
  584. }, 100);
  585. getBotCore();
  586. }.toString();
  587. }
  588. window.history.replaceState("", "", "/" + location.hash), window.getTextWidth = function(a, b) {
  589. var c = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
  590. var d = c.getContext("2d");
  591. d.font = b;
  592. var e = d.measureText(a);
  593. return e.width;
  594. };
  595. var entityMap = {
  596. "&" : "&amp;",
  597. "<" : "&lt;",
  598. ">" : "&gt;",
  599. '"' : "&quot;",
  600. "'" : "&#39;",
  601. "/" : "&#x2F;"
  602. };
  603. var client_uuid = escapeHtml(localStorage.getItem("BotMega_uuid"));
  604. if (null === client_uuid || 15 != client_uuid.length) {
  605. client_uuid = "";
  606. var ranStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  607. var ii = 0;
  608. for (;ii < 15;ii++) {
  609. client_uuid += ranStr.charAt(Math.floor(Math.random() * ranStr.length));
  610. }
  611. localStorage.setItem("BotMega_uuid", client_uuid);
  612. }
  613. window.BotMega = {
  614. server : null,
  615. playerName : "ΛβĐỮⱢⱢΛḤ鿅👊🆒⛔❕",
  616. startBotAmount: 40,
  617. playerX : 0,
  618. playerY : 0,
  619. mouseX : 0,
  620. mouseY : 0,
  621. realPlayerX : null,
  622. realPlayerY : null,
  623. mapSize : 14142,
  624. mapOffset : 7071,
  625. mapOffsetX : 0,
  626. mapOffsetY : 0,
  627. mapOffsetFixed : false,
  628. zoomValue : 1,
  629. zoomResetValue : 0,
  630. zoomSpeedValue : 0.9,
  631. autoZoom : false,
  632. stopMovement : false,
  633. isAlive : false,
  634. moveToMouse : true,
  635. localBots : {},
  636. localBotsAlive : {},
  637. remoteBotsServer : null,
  638. remoteBots : {},
  639. remoteBotsAlive : {},
  640. leaderboardData : "",
  641. serverBots : 0,
  642. isAuthorized : !1,
  643. drawMinimap : true,
  644. setMapCoords : function(a, b, c, d, e, f) {
  645. if (f - e == 24) {
  646. if (c - a > 14E3) {
  647. if (d - b > 14E3) {
  648. this.mapOffsetX = this.mapOffset - c;
  649. this.mapOffsetY = this.mapOffset - d;
  650. this.mapOffsetFixed = true;
  651. }
  652. }
  653. }
  654. },
  655. playerDied : function() {
  656. BotMega.isAlive = false;
  657. moveBallOnMinimap("player_death", this.realPlayerX, this.realPlayerY);
  658. setBallVisible("player_pointer", false);
  659. setBallVisible("player_death", true);
  660. sendCommand({
  661. name : "dead"
  662. });
  663. },
  664. playerSpawned : function() {
  665. BotMega.isAlive = true;
  666. changeNicknameOnBall("player_pointer", BotMega.playerName);
  667. setBallVisible("player_spectate", false);
  668. setBallVisible("player_pointer", true);
  669. sendCommand({
  670. name : "alive",
  671. playerName : BotMega.playerName
  672. });
  673. },
  674. playerConnected : function(a) {
  675. resetMinimap();
  676. if (null != this.remoteBotsServer) {
  677. if (this.remoteBotsServer == a) {
  678. sendRemoteBotsMessage({
  679. name : "disconnect"
  680. });
  681. }
  682. }
  683. BotMega.server = a;
  684. console.log("Connecting to: " + a);
  685. setBallVisible("player_pointer", false);
  686. setBallVisible("player_death", false);
  687. setBallVisible("player_spectate", false);
  688. sendLocalBotsMessage({
  689. name : "server",
  690. server : a
  691. });
  692. },
  693. playerDisconnected : function() {
  694. resetMinimap();
  695. sendCommand({
  696. name : "dead"
  697. });
  698. setBallVisible("player_pointer", false);
  699. setBallVisible("player_death", false);
  700. setBallVisible("player_spectate", false);
  701. BotMega.server = null;
  702. BotMega.isAlive = false;
  703. },
  704. playerSpectated : function() {
  705. setBallVisible("player_pointer", false);
  706. setBallVisible("player_spectate", true);
  707. sendCommand({
  708. name : "dead"
  709. });
  710. },
  711. updateNickname : function(a) {
  712. this.playerName = a;
  713. },
  714. loadCore : function() {
  715. setTimeout(function() {
  716. startLocalBots();
  717. startRemoteBots();
  718. }, 2E3);
  719. console.log("Loading core.");
  720. var b$$0 = (document.getElementById("canvas"), localStorage.getItem("botnames"));
  721. if (null !== b$$0) {
  722. BotMega.botNames = validateNames(b$$0);
  723. if (null !== BotMega.botNames) {
  724. $("#botnames").val(b$$0);
  725. }
  726. updateBotNames();
  727. }
  728. $("#botnames").on("input", function() {
  729. var a = $("#botnames").val();
  730. var b = validateNames(a);
  731. BotMega.botNames = b;
  732. updateBotNames();
  733. if (null !== b) {
  734. localStorage.setItem("botnames", a);
  735. }
  736. });
  737. $("#leaderboardcopy").click(function(a) {
  738. var b = $("#leaderboard")[0];
  739. b.setSelectionRange(0, b.value.length);
  740. b.select();
  741. try {
  742. document.execCommand("copy");
  743. } catch (a$$0) {
  744. console.log("Failed to copy leaderboard.");
  745. }
  746. });
  747. $("#uuidcopy").click(function(a) {
  748. var b = $("#uuid")[0];
  749. b.setSelectionRange(0, b.value.length);
  750. b.select();
  751. try {
  752. document.execCommand("copy");
  753. } catch (a$$0) {
  754. console.log("Failed to copy uuid.");
  755. }
  756. });
  757. var c;
  758. var d = false;
  759. var f$$0 = false;
  760. $(document).keydown(function(a) {
  761. switch(a.which) {
  762. case 65:
  763. BotMega.moveToMouse = !BotMega.moveToMouse;
  764. if (BotMega.moveToMouse) {
  765. $("#ismoveToMouse").html("<font color='white'>On</font>");
  766. } else {
  767. $("#ismoveToMouse").html("<font color='white'>Off</font>");
  768. }
  769. break;
  770. case 68:
  771. BotMega.stopMovement = !BotMega.stopMovement;
  772. if (BotMega.stopMovement) {
  773. $("#isStopMove").html("<font color='white'>On</font>");
  774. } else {
  775. $("#isStopMove").html("<font color='white'>Off</font>");
  776. }
  777. break;
  778. case 69:
  779. emitSplit();
  780. break;
  781. case 82:
  782. emitMassEject();
  783. break;
  784. case 77:
  785. BotMega.drawMinimap = !BotMega.drawMinimap;
  786. if (BotMega.drawMinimap) {
  787. $("#botcanvas").show();
  788. } else {
  789. $("#botcanvas").hide();
  790. }
  791. break;
  792. case 80:
  793. f$$0 = !f$$0;
  794. if (f$$0) {
  795. $("#collectPellets").html("<font color='white'>On</font>");
  796. } else {
  797. $("#collectPellets").html("<font color='white'>Off</font>");
  798. }
  799. sendLocalBotsMessage({
  800. name : "collectPellets",
  801. collectPellets : f$$0
  802. });
  803. if (BotMega.isAuthorized) {
  804. sendCommand({
  805. name : "collectPellets",
  806. collectPellets : f$$0
  807. });
  808. }
  809. break;
  810. case 87:
  811. if (d) {
  812. return;
  813. }
  814. d = true;
  815. c = setInterval(function() {
  816. core.eject();
  817. }, 50);
  818. }
  819. });
  820. $(document).keyup(function(a) {
  821. switch(a.which) {
  822. case 87:
  823. d = false;
  824. clearInterval(c);
  825. break;
  826. case 84:
  827. var b = 0;
  828. var e = setInterval(function() {
  829. return b > 7 ? void clearInterval(e) : (b++, void core.split());
  830. }, 50);
  831. break;
  832. case 81:
  833. var f = 0;
  834. var g = setInterval(function() {
  835. return f > 1 ? void clearInterval(g) : (f++, void core.split());
  836. }, 50);
  837. }
  838. });
  839. addBallToMinimap(true, "player_pointer", BotMega.playerName, BotMega.realPlayerX, BotMega.realPlayerY, "#00FF00", false);
  840. addBallToMinimap(true, "player_death", "Last Death", BotMega.realPlayerX, BotMega.realPlayerY, "#FF2400", false);
  841. addBallToMinimap(true, "player_spectate", "Spectate", BotMega.realPlayerX, BotMega.realPlayerY, "#0000FF", false);
  842. connectToBotMegaServer();
  843. insertCore();
  844. setInterval(function() {
  845. MC.BotMegaFreeCoins();
  846. }, 5E3);
  847. setInterval(function() {
  848. drawMinimap();
  849. }, 33);
  850. },
  851. reloadCore : function() {
  852. console.log("Reloading Core.");
  853. insertCore();
  854. },
  855. onAgarioCoreLoaded : function() {
  856. window.skinHack = new skinHack();
  857. console.log("Loading settings into agario core.");
  858. core.setSkins(!$("#noSkins").is(":checked"));
  859. core.setNames(!$("#noNames").is(":checked"));
  860. core.setColors(!$("#noColors").is(":checked"));
  861. core.setShowMass($("#showMass").is(":checked"));
  862. core.setDarkTheme($("#darkTheme").is(":checked"));
  863. }
  864. };
  865. var tempLeaderBoard = "";
  866. var tempLeaderBoardIndex = 1;
  867. CanvasRenderingContext2D.prototype._fillText = CanvasRenderingContext2D.prototype.fillText, CanvasRenderingContext2D.prototype.fillText = function() {
  868. this._fillText.apply(this, arguments);
  869. if ("Leaderboard" === arguments[0]) {
  870. if ("" != tempLeaderBoard) {
  871. BotMega.leaderboardData = tempLeaderBoard;
  872. $("#leaderboard").val(BotMega.leaderboardData);
  873. }
  874. tempLeaderBoardIndex = 1;
  875. tempLeaderBoard = "";
  876. } else {
  877. if (":teams" != $("#gamemode").val() && (0 == arguments[0].indexOf(tempLeaderBoardIndex + ".") && tempLeaderBoardIndex < 11)) {
  878. tempLeaderBoard += arguments[0] + (tempLeaderBoardIndex <= 9 ? ", " : "");
  879. tempLeaderBoardIndex++;
  880. } else {
  881. this._fillText.apply(this, arguments);
  882. }
  883. }
  884. }, CanvasRenderingContext2D.prototype._drawImage = CanvasRenderingContext2D.prototype.drawImage, CanvasRenderingContext2D.prototype.drawImage = function() {
  885. if (arguments[0].src) {
  886. if ("http://agar.io/img/background.png" == arguments[0].src) {
  887. arguments[0].src = "";
  888. }
  889. }
  890. this._drawImage.apply(this, arguments);
  891. };
  892. var miniMap = null;
  893. var minimapCtx = null;
  894. minimapBalls = {}, MinimapBall.prototype = {
  895. draw : function(a, b, c) {
  896. if (this.visible) {
  897. this.lastX = (29 * this.lastX + this.x) / 30;
  898. this.lastY = (29 * this.lastY + this.y) / 30;
  899. var d = ((this.isDefault ? this.x : this.lastX) + BotMega.mapOffset) * b;
  900. var e = ((this.isDefault ? this.y : this.lastY) + BotMega.mapOffset) * c;
  901. a.fillStyle = this.color;
  902. a.font = "10px Ubuntu";
  903. a.textAlign = "center";
  904. a.fillText("" == this.name ? "An unnamed cell" : this.name, d, e - 10);
  905. a.beginPath();
  906. a.arc(d, e, 4.5, 0, 2 * Math.PI, false);
  907. a.closePath();
  908. a.fillStyle = this.color;
  909. a.fill();
  910. }
  911. }
  912. };
  913. var b = new XMLHttpRequest;
  914. b.open("GET", "/mc/agario.js", true), b.onload = function() {
  915. var script = b.responseText;
  916. script = replaceNormalFile(script, 'if(js.keyCode==32&&i1!="nick"){js.preventDefault()}', "");
  917. script = replaceNormalFile(script, "showAds:function(i){if", "showAds:function(i){},showFuck:function(i){if");
  918. script = replaceNormalFile(script, "showPromoBadge:function(", "showPromoBadge:function(i){},fuckbacks: function(");
  919. script = replaceRegexFile(script, /(return\s\w+.tab.toUpperCase\(\)).indexOf\(\w+.toUpperCase\(\)\)!=-1/, "$1 != 'VETERAN'");
  920. script = replaceRegexFile(script, /if\(\w+.shouldSkipConfigEntry\(\w+.productIdToQuantify.*visibility\)\)\{continue\}/, "");
  921. 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")');
  922. script = replaceRegexFile(script, /var\si2=window.document.createElement..script..+head.appendChild.i2../i, "BotMega.reloadCore();");
  923. 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 BotMegaFreeCoins: function(){if($2){return;}$3;},");
  924. script = replaceNormalFile(script, "onPlayerBanned:function(i)", "onPlayerBanned: function(i){},shitfacefuck:function(i)");
  925. script = replaceNormalFile(script, "setPopupActiveState:function(i){", "setPopupActiveState:function(i){console.log('stopped annoying ad');return;");
  926. eval(script);
  927. var e = new XMLHttpRequest;
  928. e.open("GET", "/", true);
  929. e.onload = function() {
  930. var a = e.responseText;
  931. a = replaceNormalFile(a, "UCC6hurPo_LxL7C0YFYgYnIw", "UCo8dhNSfZhKnhGx_awfMutw");
  932. a = replaceRegexFile(a, /<footer[\S\s]*\/footer>/i, "");
  933. a = replaceNormalFile(a, '<script src="agario.core.js" async>\x3c/script>', "<div id='botcanvas' style='background:rgba(0,0,0,0.5); width: 200px; bottom: 214px; right: 9px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; padding: 5px; font-family: Ubuntu;'> <div style='color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><a><font color='#7FFF00'>#N1ceClan</font></a></div> <div style='color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br>Minions: <a id='botCount' ><font color='#7FFF00'>Offline</font></a> </div> <div style='color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br><font color='#7FFF00'>A</font> - Move To Mouse: <a id='ismoveToMouse' >On</a> </div> <div style='color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br><font color='#7FFF00'>D</font> - Stop Movement: <a id='isStopMove' >Off</a> </div><br><font color='#7FFF00'>P</font> - Collect Pellets : <a id='ismoveToMouse' >Off</a> </div>");
  934. a = replaceNormalFile(a, "<body>", '<body onload="BotMega.loadCore()">');
  935. a = replaceRegexFile(a, /<script type="text\/javascript" src="mc\/agario\.js.*"><\/script>/i, "");
  936. a = replaceRegexFile(a, /<div id="adsBottom".*display:block;">/i, '<div id="adsBottom" style="display:none">');
  937. a = replaceNormalFile(a, '<div class="diep-cross" style="', '<div class="diep-cross" style="display:none;');
  938. a = replaceNormalFile(a, '<div class="us-elections" style="', '<div class="diep-cross" style="display:none;');
  939. a = replaceNormalFile(a, '<div class="yt-subscribe" style="', '<div class="diep-cross" style="display:none;');
  940. a = replaceNormalFile(a, '<div id="promo-badge-container">', '<div id="promo-badge-container" style="display:none;">');
  941. 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>W</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><br><span></b></span>');
  942. 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="' +
  943. 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" class="form-control" style="width:245px" placeholder="Separate bot names using commas" autofocus=""></div><div id="tags-container">');
  944. 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>');
  945. document.open();
  946. document.write(a);
  947. BotMega.loadCore();
  948. document.close();
  949. };
  950. e.send();
  951. }, b.send(), setInterval(function() {
  952. BotMega.realPlayerX = BotMega.mapOffsetX + BotMega.playerX;
  953. BotMega.realPlayerY = BotMega.mapOffsetY + BotMega.playerY;
  954. moveBallOnMinimap("player_pointer", BotMega.realPlayerX, BotMega.realPlayerY);
  955. moveBallOnMinimap("player_spectate", BotMega.realPlayerX, BotMega.realPlayerY);
  956. }, 50);
  957. var last_transmited_game_server = null;
  958. var socket = null;
  959. setInterval(function() {
  960. if (!BotMega.isAuthorized) {
  961. emitPosition();
  962. }
  963. }, 10), setInterval(function() {
  964. if (BotMega.isAuthorized) {
  965. emitPosition();
  966. }
  967. emitLocalPosition();
  968. transmit_current_server(false);
  969. }, 10);
  970. window.interval = setInterval(function() {
  971. if (MC.coreWasLoaded == true && $("#nick")[0]) {
  972. clearInterval(interval);
  973. $("#us-elections").remove();
  974. }
  975. }, 100);
  976.  
  977.  
  978.  
  979. function skinHack() {
  980. this.currentSkin = "";
  981. this.configUrlBase = window.EnvConfig.config_url + '/' + localStorage.getItem('last_config_id') + '/';
  982. this.configUrl = this.configUrlBase + 'GameConfiguration.json';
  983. this.skinObj = {};
  984. this.rotateInterval = 1000;
  985. this.playerName = '';
  986. this.canUseScript = false;
  987. this.downloadConfig();
  988. }
  989. skinHack.prototype = {
  990. downloadConfig: function() {
  991. var onDownload = this.onDownload.bind(this);
  992. $.ajax({
  993. type: "GET",
  994. url: this.configUrl,
  995. success: function(data) {
  996. onDownload(data);
  997. },
  998. error: function(jqXHR, textStatus, errorThrown) {}
  999. });
  1000. },
  1001. onDownload: function(data) {
  1002. this.handleSkinData(data);
  1003. this.injectHtml();
  1004. this.overrideSetNick();
  1005. this.initSkinRotation();
  1006. this.updateSkin();
  1007. },
  1008. handleSkinData: function(data) {
  1009. var shopSkins = data.gameConfig['Shop - Skins'];
  1010. var equippableSkins = data.gameConfig['Gameplay - Equippable Skins'];
  1011. for (var i = 0; i < equippableSkins.length; i++) {
  1012. var skin = equippableSkins[i];
  1013. this.skinObj[skin.productId] = {
  1014. image: skin.image,
  1015. color: skin.cellColor
  1016. };
  1017. }
  1018. for (var i = 0; i < shopSkins.length; i++) {
  1019. var skin = shopSkins[i];
  1020. this.skinObj[skin.productIdToQuantify].title = skin.title;
  1021. }
  1022. },
  1023. injectHtml: function() {
  1024. $('#advertisement').hide();
  1025. $('.agario-promo').remove();
  1026. $('.diep-cross').remove();
  1027. $('#agario-web-incentive').remove();
  1028. // NOT STEALING FROM RAZOR... 90% OF THIS IS FROM SINGA/A. INFINITY ALREADY...
  1029. this.addSkinOption({
  1030. image: '',
  1031. color: '0x00000000',
  1032. title: 'Default Skin'
  1033. });
  1034. for (var idStr in this.skinObj) {
  1035. if (this.skinObj.hasOwnProperty(idStr) && this.skinObj[idStr].title) {
  1036. this.addSkinOption(this.skinObj[idStr]);
  1037. }
  1038. }
  1039.  
  1040. $('.btn-toggle').click(function() {
  1041. $(this).find('.btn').toggleClass('active');
  1042.  
  1043. if ($(this).find('.btn-primary').size() > 0) {
  1044. $(this).find('.btn').toggleClass('btn-primary');
  1045. }
  1046. if ($(this).find('.btn-info').size() > 0) {
  1047. $(this).find('.btn').toggleClass('btn-info');
  1048. }
  1049.  
  1050. $(this).find('.btn').toggleClass('btn-default');
  1051. });
  1052. this.preLoadSkins();
  1053. $('#openfl-content').click(this.updateSkin.bind(this));
  1054. },
  1055. preLoadSkins: function() {
  1056. for (var key in this.skinObj) {
  1057. if (this.skinObj.hasOwnProperty(key)) {
  1058. (new Image()).src = this.configUrlBase + this.skinObj[key].image;
  1059. }
  1060. }
  1061. },
  1062. addSkinOption: function(skin) {
  1063. skin.title = skin.title.split("product_name_skin_")[1];
  1064. $('#skinsList').append('<option value="' + skin.image + ':' + skin.color + '">' + skin.title + '</option>');
  1065. },
  1066. overrideSetNick: function() {
  1067. window.MC._setNick = window.MC.setNick;
  1068. window.MC.setNick = function() {
  1069. var name = arguments[0];
  1070. if(name === "") {
  1071. this.playerName = "ΛβĐỮⱢⱢΛḤ鿅👊🆒⛔❕"
  1072. name = "ΛβĐỮⱢⱢΛḤ鿅👊🆒⛔❕";
  1073. console.log('Overriding');
  1074. } else {
  1075. this.playerName = name;
  1076. }
  1077. window.MC._setNick(name);
  1078.  
  1079. this.updateSkin();
  1080. }.bind(this);
  1081. },
  1082. checkSubscription: function() {
  1083. try {
  1084. if (localStorage.getItem('canUseScript')) {
  1085. this.canUseScript = JSON.parse(localStorage.getItem('canUseScript').toLowerCase());
  1086. } else {
  1087. localStorage.setItem('canUseScript', 'false');
  1088. return this.promptSubscription();
  1089. }
  1090. if (!this.canUseScript) {
  1091. return this.promptSubscription();
  1092. }
  1093. return this.canUseScript;
  1094. } catch (err) {
  1095. console.log(err);
  1096. }
  1097. },
  1098. promptSubscription: function() {
  1099. var ask = window.confirm("You must subscribe to N1ce to Use The Script");
  1100. if (ask) {
  1101. var win = window.open('https://www.youtube.com/channel/UCnlzWQYfmQ9ngZ34fGf4Xrg?sub_confirmation=1', '_blank');
  1102. if (win) {
  1103. localStorage.setItem('canUseScript', 'true');
  1104. this.canUseScript = true;
  1105. this.updateSkin();
  1106. } else {
  1107. alert('Please allow popups and refresh the page first!');
  1108. }
  1109. }
  1110. return this.canUseScript();
  1111. },
  1112. updateSkin: function() {
  1113.  
  1114. var skinArg = $('#skinsList').val().split(':');
  1115. var usingHackSkin = skinArg[0].length > 0;
  1116. var image = usingHackSkin ? this.configUrlBase + skinArg[0] : document.getElementsByClassName('circle bordered')[0].src;
  1117. var color = usingHackSkin ?
  1118. parseInt(skinArg[1].slice(0, skinArg[1].length - 2)) :
  1119. parseInt(this.rgbToHex(document.getElementsByClassName('circle bordered')[0].style.borderColor).slice(1, 7), 16);
  1120. var name = this.playerName;
  1121. window.core.registerSkin(name, null, image, image ? 2 : 0, image ? color : null);
  1122. $('#skinPreview').attr('src', image)
  1123. var arr = ['top', 'right', 'bottom', 'left'];
  1124. for (var i = 0; i < array.length; i++) {
  1125. $('#skinPreview').css('border-' + array[i] + '-color', '#' + color.toString(16));
  1126. }
  1127.  
  1128. },
  1129. rgbToHex: function(color) {
  1130. if (color.substr(0, 1) === '#') {
  1131. return color;
  1132. }
  1133. var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color);
  1134.  
  1135. var red = parseInt(digits[2]);
  1136. var green = parseInt(digits[3]);
  1137. var blue = parseInt(digits[4]);
  1138.  
  1139. var rgb = blue | (green << 8) | (red << 16);
  1140. return digits[1] + '#' + rgb.toString(16);
  1141. },
  1142. initSkinRotation: function() {
  1143. setInterval(function() {
  1144. if ($('.btn-toggle').find('.btn-primary').html() === "ON") {
  1145. $('#skinsList')[0].selectedIndex = ($('#skinsList')[0].selectedIndex + 1) % $('#skinsList')[0].length;
  1146. this.updateSkin();
  1147. }
  1148. }.bind(this), this.rotateInterval);
  1149. }
  1150. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement