Advertisement
ImNotSpam

Untitled

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