Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function escapeHtml(a) {
  2.     return String(a).replace(/[&<>"'\/]/g, function(a) {
  3.         return entityMap[a]
  4.     })
  5. }
  6.  
  7. function updateBotCount(a, b) {
  8.     Singa.localBotsAlive[a] = b;
  9.     for (var c = Singa.serverBots, d = 2 + Singa.serverBots, e = 0; e < 2; e++) Singa.localBotsAlive[e] && c++;
  10.     0 == c ? $("#botCount").html('<font color="red">0 / ' + d + "</font>") : $("#botCount").html('<font color="#7FFF00">' + c + " / " + d + "</font>")
  11. }
  12.  
  13. function startLocalBots() {
  14.     for (var a = 0; a < 2; a++) Singa.localBotsAlive[a] = !1, Singa.localBots[a] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  15.         type: "text/javascript"
  16.     }))), Singa.localBots[a].onmessage = function(a) {
  17.         var b = a.data;
  18.         switch (b.name) {
  19.             case "add":
  20.                 updateBotCount(b.botID, !0), addBallToMinimap(!0, "bot" + b.botID, b.botName, b.x, b.y, "#FF00FF", !0);
  21.                 break;
  22.             case "remove":
  23.                 updateBotCount(b.botID, !1), removeBallFromMinimap("bot" + b.botID);
  24.                 break;
  25.             case "position":
  26.                 moveBallOnMinimap("bot" + b.botID, b.x, b.y);
  27.                 break;
  28.             default:
  29.                 console.log("Unknown command received from bot")
  30.         }
  31.     }, Singa.localBots[a].postMessage({
  32.         name: "botID",
  33.         botID: a
  34.     });
  35.     updateBotNames()
  36. }
  37.  
  38. function startRemoteBots() {
  39.     for (var a = 0; a < 3; a++) Singa.remoteBots[a] = new Worker(URL.createObjectURL(new Blob(["(" + generateBotFunction() + ")()"], {
  40.         type: "text/javascript"
  41.     })))
  42. }
  43.  
  44. function sendLocalBotsMessage(a) {
  45.     for (i in Singa.localBots) Singa.localBots[i].postMessage(a)
  46. }
  47.  
  48. function sendRemoteBotsMessage(a) {
  49.     for (i in Singa.remoteBots) Singa.remoteBots[i].postMessage(a)
  50. }
  51.  
  52. function insertCore() {
  53.     var f = new XMLHttpRequest;
  54.     f.open("GET", "/agario.core.js", !0), f.onload = function() {
  55.         var script = f.responseText;
  56.         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, "connect:function(a){", "connect:function(a){Singa.playerConnected(a);"), script = replaceNormalFile(script, "sendSpectate:function(){", "sendSpectate:function(){Singa.playerSpectated();"), script = replaceNormalFile(script, "sendNick:function(a){", "sendNick:function(a){Singa.updateNickname(a);"), script = replaceNormalFile(script, "setTarget:function(a,b){", "setTarget:function(a,b){if(Singa.stopMovement){a = $('#canvas').width() / 2; b = $('#canvas').height() / 2;}"), 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;"), script = replaceRegexFile(script, /if\((\+\w\[\w>>3\])<1\.0\){/i, "if($1 < Singa.zoomResetValue){"), 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"), script = replaceRegexFile(script, /(\w)(=\+\w\[\w>>3\]\*\+\w\()(.\d)(,\+\w\);)/i, "$1$2 (Singa.zoomSpeedValue||0.9) $4 Singa.zoomValue=$1;"), 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"), 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"), eval(script)
  57.     }, f.send()
  58. }
  59.  
  60. function MinimapBall(a, b, c, d, e, f) {
  61.     this.isDefault = a, this.name = b, this.x = c, this.y = d, this.lastX = c, this.lastY = d, this.color = e, this.visible = f
  62. }
  63.  
  64. function drawMinimap() {
  65.     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) {
  66.         minimapCtx.globalAlpha = .4, minimapCtx.fillStyle = "#000000", minimapCtx.fillRect(0, 0, miniMap.width, miniMap.height);
  67.         var a = 200 / Singa.mapSize,
  68.             b = 200 / Singa.mapSize;
  69.         minimapCtx.globalAlpha = 1;
  70.         for (ball in minimapBalls) minimapBalls[ball].draw(minimapCtx, a, b)
  71.     }
  72. }
  73.  
  74. function resetMinimap() {
  75.     for (ball in minimapBalls) minimapBalls[ball].isDefault || delete minimapBalls[ball]
  76. }
  77.  
  78. function addBallToMinimap(a, b, c, d, e, f, g) {
  79.     minimapBalls[b] = new MinimapBall(a, c, d, e, f, g)
  80. }
  81.  
  82. function removeBallFromMinimap(a) {
  83.     minimapBalls[a] && delete minimapBalls[a]
  84. }
  85.  
  86. function moveBallOnMinimap(a, b, c) {
  87.     minimapBalls[a] && (minimapBalls[a].x = b, minimapBalls[a].y = c)
  88. }
  89.  
  90. function setBallVisible(a, b) {
  91.     minimapBalls[a] && (minimapBalls[a].visible = b)
  92. }
  93.  
  94. function changeNicknameOnBall(a, b) {
  95.     minimapBalls[a] && (minimapBalls[a].name = b)
  96. }
  97.  
  98. function replaceRegexFile(a, b, c) {
  99.     var d = new RegExp(b);
  100.     return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a
  101. }
  102.  
  103. function replaceNormalFile(a, b, c) {
  104.     return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a
  105. }
  106.  
  107. function sendCommand(a) {
  108.     null != socket && socket.connected && socket.emit("command", a)
  109. }
  110.  
  111. function connectToSingaServer() {
  112.     socket = io.connect("ws://127.0.0.1:8081", {
  113.         reconnection: !0,
  114.         query: "key=" + client_uuid
  115.     }), socket.on("command", function(a) {
  116.         if (void 0 === a.name) return void console.log("Recieved a command with no name.");
  117.         switch (a.name) {
  118.             case "force-update":
  119.                 resetMinimap(), transmit_current_server(!0), Singa.isAlive && sendCommand({
  120.                     name: "alive",
  121.                     playerName: Singa.playerName
  122.                 });
  123.                 break;
  124.             case "add":
  125.                 addBallToMinimap(!1, a.socketID, a.playerName, a.x, a.y, "#FFFFFF", !0);
  126.                 break;
  127.             case "remove":
  128.                 removeBallFromMinimap(a.socketID);
  129.                 break;
  130.             case "position":
  131.                 moveBallOnMinimap(a.socketID, a.x, a.y);
  132.                 break;
  133.             case "count":
  134.                 Singa.serverBots = a.count;
  135.                 break;
  136.             case "auth":
  137.                 Singa.isAuthorized = a.auth, console.log("Your client is authorized for use of more bots.");
  138.                 break;
  139.             default:
  140.                 return void console.log("Received a command with an unknown name: " + a.name)
  141.         }
  142.     }), socket.on("bots", function(a) {
  143.         "server" == a.name && (Singa.remoteBotsServer = a.server), sendRemoteBotsMessage(a)
  144.     }), socket.on("disconnect", function() {
  145.         resetMinimap(), sendRemoteBotsMessage({
  146.             name: "disconnect"
  147.         })
  148.     })
  149. }
  150.  
  151. function updateBotNames() {
  152.     sendLocalBotsMessage({
  153.         name: "names",
  154.         botNames: Singa.botNames
  155.     }), Singa.isAuthorized && sendCommand({
  156.         name: "names",
  157.         botNames: Singa.botNames
  158.     })
  159. }
  160.  
  161. function validateNames(a) {
  162.     if (void 0 === a) return null;
  163.     if (a.indexOf(",") > -1) {
  164.         var b = a.split(",");
  165.         for (name in b)
  166.             if (b[name].length <= 0 || b[name].length > 15) return null;
  167.         return b
  168.     }
  169.     return a.length > 0 && a.length <= 15 ? [a] : null
  170. }
  171.  
  172. function emitSplit() {
  173.     Singa.isAuthorized && sendCommand({
  174.         name: "split"
  175.     }), sendLocalBotsMessage({
  176.         name: "split"
  177.     })
  178. }
  179.  
  180. function emitMassEject() {
  181.     Singa.isAuthorized && sendCommand({
  182.         name: "eject"
  183.     }), sendLocalBotsMessage({
  184.         name: "eject"
  185.     })
  186. }
  187.  
  188. function emitLocalPosition() {
  189.     var a = Singa.mouseX,
  190.         b = Singa.mouseY;
  191.     Singa.moveToMouse || (a = Singa.playerX, b = Singa.playerY), sendLocalBotsMessage({
  192.         name: "position",
  193.         x: a + Singa.mapOffsetX,
  194.         y: b + Singa.mapOffsetY
  195.     })
  196. }
  197.  
  198. function emitPosition() {
  199.     var a = Singa.mouseX,
  200.         b = Singa.mouseY;
  201.     Singa.moveToMouse || (a = Singa.playerX, b = Singa.playerY), sendCommand({
  202.         name: "position",
  203.         x: Singa.realPlayerX,
  204.         y: Singa.realPlayerY,
  205.         botX: a + Singa.mapOffsetX,
  206.         botY: b + Singa.mapOffsetY
  207.     })
  208. }
  209.  
  210. function transmit_current_server(a) {
  211.     (a || last_transmited_game_server != Singa.server) && (last_transmited_game_server = Singa.server, sendCommand({
  212.         name: "servers",
  213.         server: last_transmited_game_server
  214.     }))
  215. }
  216.  
  217. function generateBotFunction() {
  218.     return function() {
  219.         function replaceRegexFile(a, b, c) {
  220.             var d = new RegExp(b);
  221.             return d.test(a) ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a
  222.         }
  223.  
  224.         function replaceNormalFile(a, b, c) {
  225.             return a.indexOf(b) != -1 ? a = a.replace(b, c) : console.log("[Failed] to replace: " + b), a
  226.         }
  227.  
  228.         function getRandomInt(a, b) {
  229.             return Math.floor(Math.random() * (b - a + 1)) + a
  230.         }
  231.  
  232.         function getBotCore() {
  233.             var e = new XMLHttpRequest;
  234.             e.open("GET", "http://agar.io/agario.core.js", !0), e.onload = function() {
  235.                 var script = e.responseText;
  236.                 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)
  237.             }, e.send(null)
  238.         }
  239.         self.innerWidth = 1, self.innerHeight = 1;
  240.         const window = {},
  241.             elementMock = {
  242.                 getContext: function() {
  243.                     return {
  244.                         canvas: {
  245.                             width: 1,
  246.                             height: 1
  247.                         },
  248.                         clearRect: function() {},
  249.                         save: function() {},
  250.                         translate: function() {},
  251.                         scale: function() {},
  252.                         stroke: function() {},
  253.                         arc: function() {},
  254.                         fill: function() {},
  255.                         moveTo: function() {},
  256.                         lineTo: function() {},
  257.                         closePath: function() {},
  258.                         beginPath: function() {},
  259.                         restore: function() {},
  260.                         fillRect: function() {},
  261.                         measureText: function() {
  262.                             return {}
  263.                         },
  264.                         strokeText: function() {},
  265.                         fillText: function() {},
  266.                         drawImage: function() {}
  267.                     }
  268.                 },
  269.                 innerText: "",
  270.                 div: {
  271.                     appendChild: function() {}
  272.                 },
  273.                 appendChild: function() {},
  274.                 style: {}
  275.             },
  276.             document = {
  277.                 getElementById: function() {
  278.                     return elementMock
  279.                 },
  280.                 createElement: function(a) {
  281.                     return elementMock
  282.                 },
  283.                 body: {
  284.                     firstChild: {},
  285.                     insertBefore: function() {}
  286.                 }
  287.             },
  288.             Image = function() {};
  289.         self.Singa = {
  290.             server: null,
  291.             botID: 0,
  292.             botName: "SingaClan",
  293.             playerX: 0,
  294.             playerY: 0,
  295.             newX: 0,
  296.             newY: 0,
  297.             realPlayerX: null,
  298.             realPlayerY: null,
  299.             mapOffset: 7071,
  300.             mapOffsetX: 0,
  301.             mapOffsetY: 0,
  302.             mapOffsetFixed: !1,
  303.             collectPellets: !1,
  304.             pelletTargetX: 99999,
  305.             pelletTargetY: 99999,
  306.             pellets: [],
  307.             recordPellet: function(a, b, c) {
  308.                 this.pellets.push({
  309.                     x: a,
  310.                     y: b,
  311.                     size: c
  312.                 })
  313.             },
  314.             setMapCoords: function(a, b, c, d, e, f) {
  315.                 f - e == 24 && c - a > 14e3 && d - b > 14e3 && (this.mapOffsetX = this.mapOffset - c, this.mapOffsetY = this.mapOffset - d, this.mapOffsetFixed = !0)
  316.             },
  317.             playerDied: function() {
  318.                 postMessage({
  319.                     name: "remove",
  320.                     botID: Singa.botID
  321.                 })
  322.             },
  323.             playerSpawned: function() {
  324.                 postMessage({
  325.                     name: "add",
  326.                     botID: Singa.botID,
  327.                     botName: Singa.botName,
  328.                     x: Singa.realPlayerX,
  329.                     y: Singa.realPlayerY
  330.                 })
  331.             },
  332.             playerDisconnected: function() {
  333.                 postMessage({
  334.                     name: "remove",
  335.                     botID: Singa.botID
  336.                 }), self.core && core.connect(Singa.server)
  337.             },
  338.             reloadCore: function() {
  339.                 self.core && self.core.destroy(), getBotCore()
  340.             },
  341.             onAgarioCoreLoaded: function() {
  342.                 null != Singa.server && self.core && core.connect(Singa.server)
  343.             },
  344.             setPath: function() {
  345.                 for (var a = -1, b = 0, c = 0; c < this.pellets.length; c++) {
  346.                     var d = this.getDistanceBetweenPositions(this.pellets[c].x, this.pellets[c].y, this.playerX, this.playerY);
  347.                     a != -1 && d > b || (a = c, b = d)
  348.                 }
  349.                 a == -1 ? (this.pelletTargetX = 99999, this.pelletTargetY = 99999) : (this.pelletTargetX = this.pellets[a].x, this.pelletTargetY = this.pellets[a].y), this.pellets = []
  350.             },
  351.             getDistanceBetweenPositions: function(a, b, c, d) {
  352.                 return Math.sqrt(Math.pow(c - a, 2) + Math.pow(b - d, 2))
  353.             }
  354.         }, onmessage = function(a) {
  355.             var b = a.data;
  356.             switch (b.name) {
  357.                 case "botID":
  358.                     Singa.botID = b.botID;
  359.                     break;
  360.                 case "server":
  361.                     Singa.server = b.server, self.core && core.connect(b.server);
  362.                     break;
  363.                 case "position":
  364.                     Singa.collectPellets && 99999 != Singa.pelletTargetX && 99999 != Singa.pelletTargetY ? (Singa.newX = Singa.pelletTargetX, Singa.newY = Singa.pelletTargetY) : (Singa.newX = b.x - Singa.mapOffsetX, Singa.newY = b.y - Singa.mapOffsetY);
  365.                     break;
  366.                 case "split":
  367.                     core.split();
  368.                     break;
  369.                 case "eject":
  370.                     core.eject();
  371.                     break;
  372.                 case "names":
  373.                     if (null == b.botNames) {
  374.                         Singa.botName = "SingaClan";
  375.                         break
  376.                     }
  377.                     Singa.botName = b.botNames[getRandomInt(0, b.botNames.length - 1)];
  378.                     break;
  379.                 case "disconnect":
  380.                     Singa.server = null, self.core && core.disconnect();
  381.                     break;
  382.                 case "collectPellets":
  383.                     Singa.collectPellets = b.collectPellets;
  384.                     break;
  385.                 default:
  386.                     console.log("Unknown message received.")
  387.             }
  388.         }, setInterval(function() {
  389.             Singa.realPlayerX = Singa.mapOffsetX + Singa.playerX, Singa.realPlayerY = Singa.mapOffsetY + Singa.playerY, postMessage({
  390.                 botID: Singa.botID,
  391.                 name: "position",
  392.                 x: Singa.realPlayerX,
  393.                 y: Singa.realPlayerY
  394.             }), self.core && core.sendNick(Singa.botName)
  395.         }, 100), getBotCore()
  396.     }.toString()
  397. }
  398. window.history.replaceState("", "", "/" + location.hash), window.getTextWidth = function(a, b) {
  399.     var c = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas")),
  400.         d = c.getContext("2d");
  401.     d.font = b;
  402.     var e = d.measureText(a);
  403.     return e.width
  404. };
  405. var entityMap = {
  406.         "&": "&amp;",
  407.         "<": "&lt;",
  408.         ">": "&gt;",
  409.         '"': "&quot;",
  410.         "'": "&#39;",
  411.         "/": "&#x2F;"
  412.     },
  413.     client_uuid = escapeHtml(localStorage.getItem("singa_uuid"));
  414. if (null === client_uuid || 15 != client_uuid.length) {
  415.     client_uuid = "";
  416.     for (var ranStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ii = 0; ii < 15; ii++) client_uuid += ranStr.charAt(Math.floor(Math.random() * ranStr.length));
  417.     localStorage.setItem("singa_uuid", client_uuid)
  418. }
  419. window.Singa = {
  420.     server: null,
  421.     playerName: "",
  422.     playerX: 0,
  423.     playerY: 0,
  424.     mouseX: 0,
  425.     mouseY: 0,
  426.     realPlayerX: null,
  427.     realPlayerY: null,
  428.     mapSize: 14142,
  429.     mapOffset: 7071,
  430.     mapOffsetX: 0,
  431.     mapOffsetY: 0,
  432.     mapOffsetFixed: !1,
  433.     zoomValue: 1,
  434.     zoomResetValue: 0,
  435.     zoomSpeedValue: .9,
  436.     autoZoom: !0,
  437.     stopMovement: !1,
  438.     isAlive: !1,
  439.     moveToMouse: !0,
  440.     localBots: {},
  441.     localBotsAlive: {},
  442.     remoteBotsServer: null,
  443.     remoteBots: {},
  444.     remoteBotsAlive: {},
  445.     leaderboardData: "",
  446.     serverBots: 0,
  447.     isAuthorized: !1,
  448.     drawMinimap: !0,
  449.     setMapCoords: function(a, b, c, d, e, f) {
  450.         f - e == 24 && c - a > 14e3 && d - b > 14e3 && (this.mapOffsetX = this.mapOffset - c, this.mapOffsetY = this.mapOffset - d, this.mapOffsetFixed = !0)
  451.     },
  452.     playerDied: function() {
  453.         Singa.isAlive = !1, moveBallOnMinimap("player_death", this.realPlayerX, this.realPlayerY), setBallVisible("player_pointer", !1), setBallVisible("player_death", !0), sendCommand({
  454.             name: "dead"
  455.         })
  456.     },
  457.     playerSpawned: function() {
  458.         Singa.isAlive = !0, changeNicknameOnBall("player_pointer", Singa.playerName), setBallVisible("player_spectate", !1), setBallVisible("player_pointer", !0), sendCommand({
  459.             name: "alive",
  460.             playerName: Singa.playerName
  461.         })
  462.     },
  463.     playerConnected: function(a) {
  464.         resetMinimap(), null != this.remoteBotsServer && this.remoteBotsServer == a && sendRemoteBotsMessage({
  465.             name: "disconnect"
  466.         }), Singa.server = a, console.log("Connecting to: " + a), setBallVisible("player_pointer", !1), setBallVisible("player_death", !1), setBallVisible("player_spectate", !1), sendLocalBotsMessage({
  467.             name: "server",
  468.             server: a
  469.         })
  470.     },
  471.     playerDisconnected: function() {
  472.         resetMinimap(), sendCommand({
  473.             name: "dead"
  474.         }), setBallVisible("player_pointer", !1), setBallVisible("player_death", !1), setBallVisible("player_spectate", !1), Singa.server = null, Singa.isAlive = !1
  475.     },
  476.     playerSpectated: function() {
  477.         setBallVisible("player_pointer", !1), setBallVisible("player_spectate", !0), sendCommand({
  478.             name: "dead"
  479.         })
  480.     },
  481.     updateNickname: function(a) {
  482.         this.playerName = a
  483.     },
  484.     loadCore: function() {
  485.         setTimeout(function() {
  486.             startLocalBots(), startRemoteBots()
  487.         }, 2e3), console.log("Loading core.");
  488.         var b = (document.getElementById("canvas"), localStorage.getItem("botnames"));
  489.         null !== b && (Singa.botNames = validateNames(b), null !== Singa.botNames && $("#botnames").val(b), updateBotNames()), $("#botnames").on("input", function() {
  490.             var a = $("#botnames").val(),
  491.                 b = validateNames(a);
  492.             Singa.botNames = b, updateBotNames(), null !== b && localStorage.setItem("botnames", a)
  493.         }), $("#leaderboardcopy").click(function(a) {
  494.             var b = $("#leaderboard")[0];
  495.             b.setSelectionRange(0, b.value.length), b.select();
  496.             try {
  497.                 document.execCommand("copy")
  498.             } catch (a) {
  499.                 console.log("Failed to copy leaderboard.")
  500.             }
  501.         }), $("#uuidcopy").click(function(a) {
  502.             var b = $("#uuid")[0];
  503.             b.setSelectionRange(0, b.value.length), b.select();
  504.             try {
  505.                 document.execCommand("copy")
  506.             } catch (a) {
  507.                 console.log("Failed to copy uuid.")
  508.             }
  509.         });
  510.         var c, d = !1,
  511.             f = !1;
  512.         $(document).keydown(function(a) {
  513.             switch (a.which) {
  514.                 case 65:
  515.                     Singa.moveToMouse = !Singa.moveToMouse, Singa.moveToMouse ? $("#ismoveToMouse").html("<font color='#7FFF00'>On</font>") : $("#ismoveToMouse").html("<font color='red'>Off</font>");
  516.                     break;
  517.                 case 68:
  518.                     Singa.stopMovement = !Singa.stopMovement, Singa.stopMovement ? $("#isStopMove").html("<font color='#7FFF00'>On</font>") : $("#isStopMove").html("<font color='red'>Off</font>");
  519.                     break;
  520.                 case 69:
  521.                     emitSplit();
  522.                     break;
  523.                 case 82:
  524.                     emitMassEject();
  525.                     break;
  526.                 case 77:
  527.                     Singa.drawMinimap = !Singa.drawMinimap, Singa.drawMinimap ? $("#botcanvas").show() : $("#botcanvas").hide();
  528.                     break;
  529.                 case 80:
  530.                     f = !f, f ? $("#collectPellets").html("<font color='#7FFF00'>On</font>") : $("#collectPellets").html("<font color='red'>Off</font>"), sendLocalBotsMessage({
  531.                         name: "collectPellets",
  532.                         collectPellets: f
  533.                     }), Singa.isAuthorized && sendCommand({
  534.                         name: "collectPellets",
  535.                         collectPellets: f
  536.                     });
  537.                     break;
  538.                 case 87:
  539.                     if (d) return;
  540.                     d = !0, c = setInterval(function() {
  541.                         core.eject()
  542.                     }, 50)
  543.             }
  544.         }), $(document).keyup(function(a) {
  545.             switch (a.which) {
  546.                 case 87:
  547.                     d = !1, clearInterval(c);
  548.                     break;
  549.                 case 84:
  550.                     var b = 0,
  551.                         e = setInterval(function() {
  552.                             return b > 7 ? void clearInterval(e) : (b++, void core.split())
  553.                         }, 50);
  554.                     break;
  555.                 case 81:
  556.                     var f = 0,
  557.                         g = setInterval(function() {
  558.                             return f > 1 ? void clearInterval(g) : (f++, void core.split())
  559.                         }, 50)
  560.             }
  561.         }), addBallToMinimap(!0, "player_pointer", Singa.playerName, Singa.realPlayerX, Singa.realPlayerY, "#00FF00", !1), addBallToMinimap(!0, "player_death", "Last Death", Singa.realPlayerX, Singa.realPlayerY, "#FF2400", !1), addBallToMinimap(!0, "player_spectate", "Spectate", Singa.realPlayerX, Singa.realPlayerY, "#0000FF", !1), connectToSingaServer(), insertCore(), setInterval(function() {
  562.             MC.singaFreeCoins()
  563.         }, 5e3), setInterval(function() {
  564.             drawMinimap()
  565.         }, 33)
  566.     },
  567.     reloadCore: function() {
  568.         console.log("Reloading Core."), insertCore()
  569.     },
  570.     onAgarioCoreLoaded: function() {
  571.         console.log("Loading settings into agario core."), core.setSkins(!$("#noSkins").is(":checked")), core.setNames(!$("#noNames").is(":checked")), core.setColors(!$("#noColors").is(":checked")), core.setShowMass($("#showMass").is(":checked")), core.setDarkTheme($("#darkTheme").is(":checked"))
  572.     }
  573. };
  574. var tempLeaderBoard = "",
  575.     tempLeaderBoardIndex = 1;
  576. CanvasRenderingContext2D.prototype._fillText = CanvasRenderingContext2D.prototype.fillText, CanvasRenderingContext2D.prototype.fillText = function() {
  577.     this._fillText.apply(this, arguments), "Leaderboard" === arguments[0] ? ("" != tempLeaderBoard && (Singa.leaderboardData = tempLeaderBoard, $("#leaderboard").val(Singa.leaderboardData)), tempLeaderBoardIndex = 1, tempLeaderBoard = "") : ":teams" != $("#gamemode").val() && 0 == arguments[0].indexOf(tempLeaderBoardIndex + ".") && tempLeaderBoardIndex < 11 ? (tempLeaderBoard += arguments[0] + (tempLeaderBoardIndex <= 9 ? ", " : ""), tempLeaderBoardIndex++) : this._fillText.apply(this, arguments)
  578. }, CanvasRenderingContext2D.prototype._drawImage = CanvasRenderingContext2D.prototype.drawImage, CanvasRenderingContext2D.prototype.drawImage = function() {
  579.     arguments[0].src && "http://agar.io/img/background.png" == arguments[0].src && (arguments[0].src = ""), this._drawImage.apply(this, arguments)
  580. };
  581. var miniMap = null,
  582.     minimapCtx = null;
  583. minimapBalls = {}, MinimapBall.prototype = {
  584.     draw: function(a, b, c) {
  585.         if (this.visible) {
  586.             this.lastX = (29 * this.lastX + this.x) / 30, this.lastY = (29 * this.lastY + this.y) / 30;
  587.             var d = ((this.isDefault ? this.x : this.lastX) + Singa.mapOffset) * b,
  588.                 e = ((this.isDefault ? this.y : this.lastY) + Singa.mapOffset) * c;
  589.             a.fillStyle = this.color, a.font = "10px Ubuntu", a.textAlign = "center", a.fillText("" == this.name ? "An unnamed cell" : this.name, d, e - 10), a.beginPath(), a.arc(d, e, 4.5, 0, 2 * Math.PI, !1), a.closePath(), a.fillStyle = this.color, a.fill()
  590.         }
  591.     }
  592. };
  593. var b = new XMLHttpRequest;
  594. b.open("GET", "/mc/agario.js", !0), b.onload = function() {
  595.     var script = b.responseText;
  596.     script = replaceNormalFile(script, 'if(js.keyCode==32&&i1!="nick"){js.preventDefault()}', ""), script = replaceNormalFile(script, "showAds:function(i){if", "showAds:function(i){},showFuck:function(i){if"), script = replaceNormalFile(script, "showPromoBadge:function(", "showPromoBadge:function(i){},fuckbacks: function("), script = replaceRegexFile(script, /(return\s\w+.tab.toUpperCase\(\)).indexOf\(\w+.toUpperCase\(\)\)!=-1/, "$1 != 'VETERAN'"), script = replaceRegexFile(script, /if\(\w+.shouldSkipConfigEntry\(\w+.productIdToQuantify.*visibility\)\)\{continue\}/, ""), 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")'), script = replaceRegexFile(script, /var\si2=window.document.createElement..script..+head.appendChild.i2../i, "Singa.reloadCore();"), 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;},"), script = replaceNormalFile(script, "onPlayerBanned:function(i)", "onPlayerBanned: function(i){},shitfacefuck:function(i)"), script = replaceNormalFile(script, "setPopupActiveState:function(i){", "setPopupActiveState:function(i){console.log('stopped annoying ad');return;"), eval(script);
  597.     var e = new XMLHttpRequest;
  598.     e.open("GET", "/", !0), e.onload = function() {
  599.         var a = e.responseText;
  600.         a = replaceNormalFile(a, "UCC6hurPo_LxL7C0YFYgYnIw", "UCJBjMXZn0p0mo6KndePbImw"), a = replaceRegexFile(a, /<footer[\S\s]*\/footer>/i, ""), a = replaceNormalFile(a, '<script src="agario.core.js" async></script>', "<div id='botcanvas' style='background:rgba(0,0,0,0.4); width: 200px; bottom: 214px; right: 9px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; padding: 5px; font-family: Ubuntu;'> <font color='#7FFF00'>Singa Bots</font><br>Bots: <a id='botCount'><font color='red'>0 / 2</font></a><br><font color='#00BFFF'>A</font> - Move To Mouse: <a id='ismoveToMouse'><font color='#7FFF00'>On</font></a><br><font color='#00BFFF'>P</font> - Collect Pellets: <a id='collectPellets'><font color='red'>Off</font></a><br><font color='#00BFFF'>D</font> - Stop Movement: <a id='isStopMove'><font color='red'>Off</font></a></div>"), a = replaceNormalFile(a, "<body>", '<body onload="Singa.loadCore()">'), a = replaceRegexFile(a, /<script type="text\/javascript" src="mc\/agario\.js.*"><\/script>/i, ""), a = replaceRegexFile(a, /<div id="adsBottom".*display:block;">/i, '<div id="adsBottom" style="display:none">'), a = replaceNormalFile(a, '<div class="diep-cross" style="', '<div class="diep-cross" style="display:none;'), a = replaceNormalFile(a, '<div id="promo-badge-container">', '<div id="promo-badge-container" style="display:none;">'), 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>'), 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="' + 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">'), 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>'), document.open(), document.write(a), document.close()
  601.     }, e.send()
  602. }, b.send(), setInterval(function() {
  603.     Singa.realPlayerX = Singa.mapOffsetX + Singa.playerX, Singa.realPlayerY = Singa.mapOffsetY + Singa.playerY, moveBallOnMinimap("player_pointer", Singa.realPlayerX, Singa.realPlayerY), moveBallOnMinimap("player_spectate", Singa.realPlayerX, Singa.realPlayerY)
  604. }, 50);
  605. var last_transmited_game_server = null,
  606.     socket = null;
  607. setInterval(function() {
  608.     Singa.isAuthorized || emitPosition()
  609. }, 1e3), setInterval(function() {
  610.     Singa.isAuthorized && emitPosition(), emitLocalPosition(), transmit_current_server(!1)
  611. }, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement