Advertisement
NexuzP

EZScript

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