Advertisement
Guest User

penny is gayyy lellele rarwrwwr

a guest
May 23rd, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var playerName, playerClassIndex, playerType, healthBarWidth, playerNameInput = document.getElementById("playerNameInput"),
  2.     classInput = document.getElementById("classSelect"),
  3.     socket, reason, animLoopHandle, mobile = !1,
  4.     room, delta = 0,
  5.     horizontalDT = 0,
  6.     verticalDT = 0,
  7.     roomNum = 0,
  8.     currentTime, oldTime = Date.now(),
  9.     FRAME_STEP = 1E3 / 60,
  10.     count = -1,
  11.     clientPrediction = !0,
  12.     inputNumber = 0,
  13.     clientSpeed = 12,
  14.     temp = 1,
  15.     thisInput = [],
  16.     keyd = 1,
  17.     tabbed = 0,
  18.     timeSinceLastUpdate = 0,
  19.     timeOfLastUpdate = 0,
  20.     tiny, port;
  21. zip.workerScriptsPath = "../js/lib/";
  22. /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) && (mobile = !0, hideMenuUI(), hideUI(!0), document.getElementById("startMenuWrapper").style.display = "none", document.getElementById("mobileMessage").innerHTML = "Mobile Version Coming Soon.");
  23. Number.prototype.round = function(a) {
  24.     return +this.toFixed(a)
  25. };
  26. var previousClass = 0,
  27.     previousHat = 0,
  28.     previousSpray = 0,
  29.     startingGame = !1,
  30.     changingLobby = !1,
  31.     waitingForLoad = !0;
  32.  
  33. function startGame(a) {
  34.     startingGame || changingLobby || waitingForLoad || (startingGame = !0, playerName = playerNameInput.value.replace(/(<([^>]+)>)/ig, "").substring(0, 25), enterGame(a))
  35. }
  36. var inMainMenu = !0,
  37.     devTest = !1;
  38.  
  39. function enterGame(a) {
  40.     startSoundTrack(2);
  41.     playerClassIndex = currentClassID;
  42.     playerType = a;
  43.     screenWidth = window.innerWidth;
  44.     screenHeight = window.innerHeight;
  45.     document.getElementById("startMenuWrapper").style.display = "none";
  46.     room || socket.emit("create");
  47.     socket.emit("respawn");
  48.     hideMenuUI();
  49.     animateOverlay = !0;
  50.     updateGameLoop()
  51. }
  52.  
  53. function validNick() {
  54.     return null !== /^\w*$/.exec(playerNameInput.value)
  55. }
  56. var createClanButton = document.getElementById("createClanButton"),
  57.     joinClanButton = document.getElementById("joinClanButton"),
  58.     clanNameInput = document.getElementById("clanNameInput"),
  59.     clanKeyInput = document.getElementById("clanKeyInput"),
  60.     clanDBMessage = document.getElementById("clanDBMessage"),
  61.     clanStats = document.getElementById("clanStats"),
  62.     clanSignUp = document.getElementById("clanSignUp"),
  63.     clanHeader = document.getElementById("clanHeader"),
  64.     clanAdminPanel = document.getElementById("clanAdminPanel"),
  65.     clanInviteInput =
  66.     document.getElementById("clanInviteInput"),
  67.     inviteClanButton = document.getElementById("inviteClanButton"),
  68.     kickClanButton = document.getElementById("kickClanButton"),
  69.     leaveClanButton = document.getElementById("leaveClanButton"),
  70.     clanInvMessage = document.getElementById("clanInvMessage"),
  71.     loginWrapper = document.getElementById("loginWrapper"),
  72.     loggedInWrapper = document.getElementById("loggedInWrapper"),
  73.     loginButton = document.getElementById("loginButton"),
  74.     registerButton = document.getElementById("registerButton"),
  75.     logoutButton =
  76.     document.getElementById("logoutButton"),
  77.     loginMessage = document.getElementById("loginMessage"),
  78.     recoverButton = document.getElementById("recoverButton"),
  79.     userNameInput = document.getElementById("usernameInput"),
  80.     userEmailInput = document.getElementById("emailInput"),
  81.     userPassInput = document.getElementById("passwordInput"),
  82.     waitingForServer = !1,
  83.     loginUserNm = "",
  84.     loginUserPs = "",
  85.     settingsMenu = document.getElementById("settingsButton"),
  86.     settings = document.getElementById("settings"),
  87.     howToMenu = document.getElementById("instructionButton"),
  88.     howTo = document.getElementById("instructions"),
  89.     leaderboardButton = document.getElementById("leaderButton"),
  90.     leaderboardMenu = document.getElementById("leaderboardWrapper"),
  91.     btn = document.getElementById("startButton"),
  92.     btnMod = document.getElementById("texturePackButton"),
  93.     modURL = document.getElementById("textureModInput"),
  94.     lobbyInput = document.getElementById("lobbyKey"),
  95.     lobbyMessage = document.getElementById("lobbyMessage"),
  96.     lobbyButton = document.getElementById("joinLobbyButton");
  97. window.onload = function() {
  98.     if (!mobile) {
  99.         document.documentElement.style.overflow = "hidden";
  100.         document.body.scroll = "no";
  101.         document.getElementById("gameAreaWrapper").style.opacity = 1;
  102.         drawMenuBackground();
  103.         settingsMenu.onclick = function() {
  104.             "200px" == settings.style.maxHeight ? settings.style.maxHeight = "0px" : (settings.style.maxHeight = "200px", howTo.style.maxHeight = "0px", leaderboardMenu.style.maxHeight = "0px")
  105.         };
  106.         howToMenu.onclick = function() {
  107.             "200px" == howTo.style.maxHeight ? howTo.style.maxHeight = "0px" : (howTo.style.maxHeight =
  108.                 "200px", settings.style.maxHeight = "0px", leaderboardMenu.style.maxHeight = "0px")
  109.         };
  110.         leaderboardButton.onclick = function() {
  111.             "190px" == leaderboardMenu.style.maxHeight ? leaderboardMenu.style.maxHeight = "0px" : (leaderboardMenu.style.maxHeight = "190px", settings.style.maxHeight = "0px", howTo.style.maxHeight = "0px")
  112.         };
  113.         $.get("/getIP", function(a) {
  114.             port = a.port;
  115.             socket || (socket = io.connect("http://" + (devTest ? "localhost" : a.ip) + ":" + a.port, {
  116.                 reconnection: !1,
  117.                 forceNew: !0
  118.             }), setupSocket(socket));
  119.             btn.onclick = function() {
  120.                 startGame("player")
  121.             };
  122.             playerNameInput.addEventListener("keypress", function(a) {
  123.                 13 === (a.which || a.keyCode) && startGame("player")
  124.             });
  125.             btnMod.onclick = function() {
  126.                 loadModPack(modURL.value, !1)
  127.             };
  128.             registerButton.onclick = function() {
  129.                 waitingForServer || (socket.emit("dbReg", {
  130.                     userName: userNameInput.value,
  131.                     userEmail: userEmailInput.value,
  132.                     userPass: userPassInput.value
  133.                 }), loginUserNm = userNameInput.value, loginUserPs = userPassInput.value, loginMessage.style.display = "block", loginMessage.innerHTML = "Registering...", waitingForLoad = waitingForServer = !0)
  134.             };
  135.             loginButton.onclick = function() {
  136.                 waitingForServer || (socket.emit("dbLogin", {
  137.                     userName: userNameInput.value,
  138.                     userPass: userPassInput.value
  139.                 }), loginUserNm = userNameInput.value, loginUserPs = userPassInput.value, loginMessage.style.display = "block", loginMessage.innerHTML = "Please Wait...", waitingForLoad = waitingForServer = !0)
  140.             };
  141.             logoutButton.onclick = function() {
  142.                 loggedInWrapper.style.display = "none";
  143.                 loginWrapper.style.display = "block";
  144.                 loginMessage.innerHTML = "";
  145.                 setCookie("userName", "");
  146.                 setCookie("userPass", "");
  147.                 socket.emit("dbLogout")
  148.             };
  149.             recoverButton.onclick = function() {
  150.                 waitingForServer || (socket.emit("dbRecov", {
  151.                     userMail: userEmailInput.value
  152.                 }), loginMessage.style.display = "block", loginMessage.innerHTML = "Please Wait...", waitingForServer = !0)
  153.             };
  154.             createClanButton.onclick = function() {
  155.                 waitingForServer || (socket.emit("dbClanCreate", {
  156.                     clanName: clanNameInput.value
  157.                 }), clanDBMessage.style.display = "block", clanDBMessage.innerHTML = "Please Wait...", waitingForServer = !0)
  158.             };
  159.             joinClanButton.onclick = function() {
  160.                 waitingForServer || (socket.emit("dbClanJoin", {
  161.                         clanKey: clanKeyInput.value
  162.                     }),
  163.                     clanDBMessage.style.display = "block", clanDBMessage.innerHTML = "Please Wait...", waitingForServer = !0)
  164.             };
  165.             inviteClanButton.onclick = function() {
  166.                 waitingForServer || (socket.emit("dbClanInvite", {
  167.                     userName: clanInviteInput.value
  168.                 }), clanInvMessage.style.display = "block", clanInvMessage.innerHTML = "Please Wait...", waitingForServer = !0)
  169.             };
  170.             kickClanButton.onclick = function() {
  171.                 waitingForServer || (socket.emit("dbClanKick", {
  172.                         userName: clanInviteInput.value
  173.                     }), clanInvMessage.style.display = "block", clanInvMessage.innerHTML = "Please Wait...",
  174.                     waitingForServer = !0)
  175.             };
  176.             leaveClanButton.onclick = function() {
  177.                 waitingForServer || (socket.emit("dbClanLeave"), waitingForServer = !0)
  178.             };
  179.             a = getCookie("userName");
  180.             var b = getCookie("userPass");
  181.             a && "" != b ? (socket.emit("dbLogin", {
  182.                 userName: a,
  183.                 userPass: b
  184.             }), loginUserNm = a, loginUserPs = b, loginMessage.style.display = "block", loginMessage.innerHTML = "Logging in...", waitingForServer = !0) : waitingForLoad = waitingForServer = !1;
  185.             lobbyButton.onclick = function() {
  186.                 changingLobby || waitingForServer || (lobbyMessage.style.display = "inline-block", lobbyMessage.innerHTML =
  187.                     "Please wait...", socket.emit("checkIP", lobbyInput.value.split("/")[0]), changingLobby = !0)
  188.             }
  189.         });
  190.         hideUI(!0);
  191.         try {
  192.             setTimeout(function() {
  193.                 var a = document.querySelector("ins.adsbygoogle");
  194.                 a && 0 == a.innerHTML.replace(/\s/g, "").length && (document.getElementById("noAdText").innerHTML = "<b>Could not be Loaded</b>")
  195.             }, 2E3), hideBannerAd()
  196.         } catch (a) {}
  197.         $(".noRightClick").bind("contextmenu", function(a) {
  198.             return !1
  199.         });
  200.         resize()
  201.     }
  202. };
  203. var accStatKills = document.getElementById("accStatKills"),
  204.     accStatDeaths = document.getElementById("accStatDeaths"),
  205.     accStatLikes = document.getElementById("accStatLikes"),
  206.     accStatKD = document.getElementById("accStatKD"),
  207.     accStatRank = document.getElementById("accStatRank"),
  208.     accStatRankProg = document.getElementById("rankProgress"),
  209.     accStatWorldRank = document.getElementById("accStatWorldRank"),
  210.     clanStats = document.getElementById("clanStats"),
  211.     clanSignUp = document.getElementById("clanSignUp"),
  212.     clanHeader = document.getElementById("clanHeader"),
  213.     leaveClanButton = document.getElementById("leaveClanButton"),
  214.     clanAdminPanel = document.getElementById("clanAdminPanel");
  215.  
  216. function updateAccountPage(a) {
  217.     player.account = a;
  218.     accStatRank.innerHTML = "<b>Rank:  </b>" + a.rank;
  219.     accStatRankProg.style.width = a.rankPercent + "%";
  220.     accStatKills.innerHTML = "<b>Kills:  </b>" + a.kills;
  221.     accStatDeaths.innerHTML = "<b>Deaths:  </b>" + a.deaths;
  222.     accStatKD.innerHTML = "<b>KD:  </b>" + a.kd;
  223.     accStatWorldRank.innerHTML = "<b>World Rank:  </b>" + a.worldRank;
  224.     accStatLikes.innerHTML = "<b>Likes:  </b>" + a.likes;
  225.     clanAdminPanel.style.display = "none";
  226.     leaveClanButton.style.display = "none";
  227.     "" != a.clan ? (clanSignUp.style.display =
  228.         "none", clanStats.style.display = "block", leaveClanButton.style.display = "inline-block", leaveClanButton.innerHTML = "Leave Clan", clanHeader.innerHTML = "[" + a.clan + "] Clan:", "1" == a.clan_owner && (clanAdminPanel.style.display = "block", leaveClanButton.innerHTML = "Delete Clan")) : (clanSignUp.style.display = "block", clanStats.style.display = "none", clanHeader.innerHTML = "Clans")
  229. }
  230. var clanStatRank = document.getElementById("clanStatRank"),
  231.     clanStatFounder = document.getElementById("clanStatFounder"),
  232.     clanStatMembers = document.getElementById("clanStatMembers"),
  233.     clanStatKD = document.getElementById("clanStatKD");
  234.  
  235. function updateClanPage(a) {
  236.     clanStatRank.innerHTML = "<b>Rank:  </b>" + a.level;
  237.     clanStatKD.innerHTML = "<b>Avg KD:  </b>" + a.kd;
  238.     clanStatFounder.innerHTML = "<b>Founder:  </b>" + a.founder;
  239.     clanStatMembers.innerHTML = "<b>Roster:</b>" + a.members
  240. }
  241. var leaderboardWrapper = document.getElementById("leaderboardWrapper");
  242.  
  243. function updateGlobalLeaderboard(a) {
  244.     leaderboardWrapper.innerHTML = a
  245. }
  246. var screenWidth = window.innerWidth,
  247.     screenHeight = window.innerHeight,
  248.     gameWidth = 0,
  249.     gameHeight = 0,
  250.     mouseX = 0,
  251.     mouseY = 0,
  252.     maxScreenWidth = 1920,
  253.     originalScreenWidth = maxScreenWidth,
  254.     maxScreenHeight = 1080,
  255.     originalScreenHeight = maxScreenHeight,
  256.     viewMult = 1,
  257.     uiScale = 1;
  258. calculateUIScale();
  259. var gameStart = !1,
  260.     gameOver = !1,
  261.     gameOverFade = !1,
  262.     disconnected = !1,
  263.     kicked = !1,
  264.     killTxt = "",
  265.     continuity = !1,
  266.     startPingTime = 0,
  267.     textSizeMult = .55,
  268.     bigTextSize = maxScreenHeight / 7.7 * textSizeMult,
  269.     medTextSize = .85 * bigTextSize,
  270.     textGap = 1.2 * bigTextSize,
  271.     bigTextY = maxScreenHeight / 4.3,
  272.     startX = 0,
  273.     startY = 0,
  274.     gameMode = null,
  275.     playerConfig = {
  276.         border: 6,
  277.         textColor: "#efefef",
  278.         textBorder: "#3a3a3a",
  279.         textBorderSize: 3,
  280.         defaultSize: 30
  281.     },
  282.     player = {
  283.         firstReceive: !0,
  284.         dead: !0,
  285.         deltaX: 0,
  286.         deltaY: 0
  287.     },
  288.     target = {
  289.         f: 0,
  290.         d: 0,
  291.         dOffset: 0
  292.     },
  293.     gameObjects = [],
  294.     bullets = [],
  295.     gameMap = null,
  296.     mapTileScale = 0,
  297.     leaderboard = [],
  298.     keys = {
  299.         u: 0,
  300.         d: 0,
  301.         l: 0,
  302.         r: 0,
  303.         lm: 0,
  304.         s: 0,
  305.         rl: 0
  306.     },
  307.     mathABS = Math.abs,
  308.     mathRound = Math.round,
  309.     mathFloor = Math.floor,
  310.     mathSQRT = Math.sqrt,
  311.     mathPOW = Math.pow,
  312.     mathMIN = Math.min,
  313.     mathCOS = Math.cos,
  314.     mathSIN = Math.sin,
  315.     mathPI = Math.PI,
  316.     mathMax = Math.max,
  317.     mathATAN2 = Math.atan2,
  318.     reenviar = !0,
  319.     directionLock = !1,
  320.     directions = [],
  321.     zipFileCloser, c = document.getElementById("cvs");
  322. c.width = screenWidth;
  323. c.height = screenHeight;
  324. c.addEventListener("mousemove", gameInput, !1);
  325. c.addEventListener("mousedown", mouseDown, !1);
  326. c.addEventListener("mouseup", mouseUp, !1);
  327. var lastAngle = 0,
  328.     lastDist = 0,
  329.     targetChanged = !0;
  330.  
  331. function gameInput(a) {
  332.     if (void 0 != getCurrentWeapon(player)) {
  333.         a.preventDefault();
  334.         a.stopPropagation();
  335.         mouseX = a.clientX;
  336.         mouseY = a.clientY;
  337.         lastAngle = target.f;
  338.         lastDist = target.d;
  339.         target.d = mathSQRT(mathPOW(mouseY - (screenHeight / 2 - getCurrentWeapon(player).yOffset / 2), 2) + mathPOW(mouseX - screenWidth / 2, 2));
  340.         target.d *= mathMIN(maxScreenWidth / screenWidth, maxScreenHeight / screenHeight);
  341.         target.f = mathATAN2(screenHeight / 2 - getCurrentWeapon(player).yOffset / 2 - mouseY, screenWidth / 2 - mouseX);
  342.         target.f = target.f.round(2);
  343.         target.d = target.d.round(2);
  344.         target.dOffset = (target.d / 4).round(1);
  345.         if (lastAngle != target.f || lastDist != target.d) targetChanged = !0;
  346.         lastTarget = target.f
  347.     }
  348. }
  349.  
  350. function mouseDown(a) {
  351.     keys.lm = 1
  352. }
  353.  
  354. function mouseUp(a) {
  355.     keys.lm = 0
  356. }
  357. c.addEventListener ? (c.addEventListener("mousewheel", gameScroll, !1), c.addEventListener("DOMMouseScroll", gameScroll, !1)) : c.attachEvent("onmousewheel", gameScroll);
  358. var userScroll = 0;
  359.  
  360. function gameScroll(a) {
  361.     a = window.event || a;
  362.     userScroll = -1 * Math.max(-1, Math.min(1, a.wheelDelta || -a.detail))
  363. }
  364. var keyMap = [],
  365.     showingScoreBoard = !1;
  366. c.addEventListener("keydown", keyDown, !1);
  367.  
  368. function keyDown(a) {
  369.     a = a || event;
  370.     a.preventDefault();
  371.     keyMap[a.keyCode] = "keydown" == a.type;
  372.     !keyMap[87] && !keyMap[38] || keys.u || (keys.u = 1, keys.d = 0, keyMap[83] = !1, keyMap[40] = !1);
  373.     !keyMap[83] && !keyMap[40] || keys.d || (keys.d = 1, keys.u = 0, keyMap[87] = !1, keyMap[38] = !1);
  374.     !keyMap[65] && !keyMap[37] || keys.l || (keys.l = 1, keys.r = 0, keyMap[68] = !1, keyMap[39] = !1);
  375.     !keyMap[68] && !keyMap[39] || keys.r || (keys.r = 1, keys.l = 0, keyMap[65] = !1, keyMap[37] = !1);
  376.     keyMap[32] && !keys.s && (keys.s = 1);
  377.     keyMap[82] && !keys.rl && (keys.rl = 1);
  378.     13 === a.keyCode && document.getElementById("chatInput").focus();
  379.     !keyMap[16] || !gameStart || showingScoreBoard || player.dead || gameOver || (showingScoreBoard = !0, showStatTable(getUsersList(), null, null, !0, !0, !0))
  380. }
  381. c.addEventListener("keyup", keyUp, !1);
  382.  
  383. function keyUp(a) {
  384.     a = a || event;
  385.     a.preventDefault();
  386.     keyMap[a.keyCode] = "keydown" == a.type;
  387.     if (87 == a.keyCode || 38 == a.keyCode) keys.u = 0;
  388.     if (83 == a.keyCode || 40 == a.keyCode) keys.d = 0;
  389.     if (65 == a.keyCode || 37 == a.keyCode) keys.l = 0;
  390.     if (68 == a.keyCode || 39 == a.keyCode) keys.r = 0;
  391.     32 == a.keyCode && (keys.s = 0);
  392.     82 == a.keyCode && (keys.rl = 0);
  393.     69 == a.keyCode && playerSwapWeapon(findUserByIndex(player.index), 1);
  394.     81 == a.keyCode && playerSwapWeapon(findUserByIndex(player.index), -1);
  395.     70 == a.keyCode && sendSpray();
  396.     16 != a.keyCode || !showingScoreBoard || player.dead ||
  397.         gameOver || gameOver || hideStatTable()
  398. }
  399.  
  400. function ChatManager() {
  401.     this.commands = {};
  402.     var a = document.getElementById("chatInput");
  403.     a.addEventListener("keypress", this.sendChat.bind(this));
  404.     a.addEventListener("keyup", function(b) {
  405.         a = document.getElementById("chatInput");
  406.         b = b.which || b.keyCode;
  407.         27 === b && (a.value = "", c.focus())
  408.     })
  409. }
  410. var chatTypeIndex = 0,
  411.     chatTypes = ["ALL", "TEAM"],
  412.     currentChatType = chatTypes[0];
  413. ChatManager.prototype.sendChat = function(a) {
  414.     var b = document.getElementById("chatInput");
  415.     a = a.which || a.keyCode;
  416.     13 === a && (a = b.value.replace(/(<([^>]+)>)/ig, ""), "" !== a && (socket.emit("cht", a.substring(0, 50), currentChatType), this.addChatLine(player.name, ("TEAM" == currentChatType ? "(TEAM) " : "") + a, !0, player.team), b.value = "", c.focus()))
  417. };
  418.  
  419. function toggleTeamChat() {
  420.     chatTypeIndex++;
  421.     chatTypeIndex >= chatTypes.length && (chatTypeIndex = 0);
  422.     currentChatType = chatTypes[chatTypeIndex];
  423.     document.getElementById("chatType").innerHTML = currentChatType;
  424.     c.focus()
  425. }
  426. var profanityList = "cunt whore shit fuck faggot nigger nigga dick vagina minge cock rape cum sex tits gay dumb".split(" "),
  427.     tmpString = "";
  428.  
  429. function checkProfanityString(a) {
  430.     if (showProfanity)
  431.         for (var b = 0; b < profanityList.length; ++b)
  432.             if (-1 < a.indexOf(profanityList[b])) {
  433.                 tmpString = "";
  434.                 for (var d = 0; d < profanityList[b].length; ++d) tmpString += "*";
  435.                 a = a.replace(new RegExp(profanityList[b], "g"), tmpString)
  436.             }
  437.     return a
  438. }
  439. ChatManager.prototype.addChatLine = function(a, b, d, e) {
  440.     if (!mobile) {
  441.         b = checkProfanityString(b);
  442.         var f = document.createElement("li"),
  443.             h = "me";
  444.         d || "system" == e ? "system" == e && (h = "system") : h = player.team == e ? "blue" : "red";
  445.         f.className = h;
  446.         f.innerHTML = "system" == h ? "<span>" + b + "</span>" : "<span>" + (d ? "YOU" : a) + ": </span>" + b;
  447.         this.appendMessage(f)
  448.     }
  449. };
  450. ChatManager.prototype.appendMessage = function(a) {
  451.     if (!mobile) {
  452.         for (var b = document.getElementById("chatbox"), d = document.getElementById("chatList"); 260 < b.clientHeight;) d.removeChild(d.childNodes[0]);
  453.         d.appendChild(a)
  454.     }
  455. };
  456. var chat = new ChatManager,
  457.     tmpChatUser = null;
  458.  
  459. function messageFromServer(a) {
  460.     try {
  461.         tmpChatUser = findUserByIndex(a[0]), null != tmpChatUser ? chat.addChatLine(tmpChatUser.name, a[1], tmpChatUser.index == player.index, tmpChatUser.team) : 0 > a[0] && (chatList.removeChild(chatList.childNodes[chatList.childNodes.length - 1]), chat.addChatLine("", a[1], !1, "system"))
  462.     } catch (b) {
  463.         console.log(b)
  464.     }
  465. }
  466. var context = c.getContext("2d"),
  467.     osCanvas = document.createElement("canvas"),
  468.     graph = osCanvas.getContext("2d"),
  469.     mapCanvas = document.getElementById("mapc"),
  470.     mapContext = mapCanvas.getContext("2d");
  471. mapCanvas.width = 200;
  472. mapCanvas.height = 200;
  473. mapContext.imageSmoothingEnabled = !1;
  474. mapContext.webkitImageSmoothingEnabled = !1;
  475. mapContext.mozImageSmoothingEnabled = !1;
  476.  
  477. function setCookie(a, b) {
  478.     document.cookie = a + "=" + b
  479. }
  480.  
  481. function getCookie(a) {
  482.     a += "=";
  483.     for (var b = document.cookie.split(";"), d = 0; d < b.length; d++) {
  484.         for (var e = b[d];
  485.             " " == e.charAt(0);) e = e.substring(1);
  486.         if (0 == e.indexOf(a)) return e.substring(a.length, e.length)
  487.     }
  488.     return ""
  489. }
  490. "false" != getCookie("showNames") && (document.getElementById("showNames").checked || document.getElementById("showNames").click());
  491. var showNames = document.getElementById("showNames").checked;
  492.  
  493. function settingShowNames(a) {
  494.     showNames = a.checked;
  495.     setCookie("showNames", showNames ? "true" : "false")
  496. }
  497. "false" != getCookie("showParticles") && (document.getElementById("showParticles").checked || document.getElementById("showParticles").click());
  498. var showParticles = document.getElementById("showParticles").checked;
  499.  
  500. function settingShowParticles(a) {
  501.     showParticles = a.checked;
  502.     setCookie("showParticles", showParticles ? "true" : "false")
  503. }
  504. "false" != getCookie("showSprays") && (document.getElementById("showSprays").checked || document.getElementById("showSprays").click());
  505. var showSprays = document.getElementById("showSprays").checked;
  506.  
  507. function settingShowSprays(a) {
  508.     showSprays = a.checked;
  509.     setCookie("showSprays", showSprays ? "true" : "false")
  510. }
  511. "true" == getCookie("showProfanity") && document.getElementById("showProfanity").checked && document.getElementById("showProfanity").click();
  512. var showProfanity = document.getElementById("showProfanity").checked;
  513.  
  514. function settingProfanity(a) {
  515.     showProfanity = a.checked;
  516.     setCookie("showProfanity", showProfanity ? "true" : "false")
  517. }
  518. "false" != getCookie("showFade") && (document.getElementById("showFade").checked || document.getElementById("showFade").click());
  519. var showUIFade = document.getElementById("showFade").checked;
  520.  
  521. function settingShowFade(a) {
  522.     showUIFade = a.checked;
  523.     setCookie("showFade", showUIFade ? "true" : "false")
  524. }
  525. "false" != getCookie("showShadows") && (document.getElementById("showShadows").checked || document.getElementById("showShadows").click());
  526. var showShadows = document.getElementById("showShadows").checked;
  527.  
  528. function settingShowShadows(a) {
  529.     showShadows = a.checked;
  530.     setCookie("showShadows", showShadows ? "true" : "false")
  531. }
  532. "false" != getCookie("showChat") && (document.getElementById("showChat").checked || document.getElementById("showChat").click());
  533. var showChat = document.getElementById("showChat").checked;
  534.  
  535. function settingShowChat(a) {
  536.     showChat = a.checked;
  537.     showChat ? gameStart && (document.getElementById("chatbox").style.display = "block") : document.getElementById("chatbox").style.display = "none";
  538.     setCookie("showChat", showChat ? "true" : "false")
  539. }
  540. "false" != getCookie("showLeader") && (document.getElementById("showLeader").checked || document.getElementById("showLeader").click());
  541. var showLeader = document.getElementById("showLeader").checked;
  542.  
  543. function settingShowLeader(a) {
  544.     showLeader = a.checked;
  545.     showLeader ? gameStart && (document.getElementById("status").style.display = "block") : document.getElementById("status").style.display = "none";
  546.     setCookie("showLeader", showLeader ? "true" : "false")
  547. }
  548. var targetFPS = 30;
  549. if ("" != getCookie("targetFPS")) {
  550.     targetFPS = getCookie("targetFPS");
  551.     try {
  552.         targetFPS *= 1
  553.     } catch (a) {
  554.         targetFPS = 30
  555.     }
  556. }
  557.  
  558. function pickedFps(a) {
  559.     targetFPS = a.options[a.selectedIndex].value;
  560.     try {
  561.         targetFPS *= 1
  562.     } catch (b) {
  563.         targetFPS = 30
  564.     }
  565.     setCookie("targetFPS", targetFPS)
  566. }
  567.  
  568. function changeMenuTab(a, b) {
  569.     var d, e, f;
  570.     e = document.getElementsByClassName("tabcontent");
  571.     for (d = 0; d < e.length; d++) e[d].style.display = "none";
  572.     f = document.getElementsByClassName("tablinks");
  573.     for (d = 0; d < e.length; d++) f[d].className = f[d].className.replace(" active", "");
  574.     document.getElementById(b).style.display = "block";
  575.     a.currentTarget.className += " active"
  576. }
  577. var sponsorList = document.getElementById("donatorsList");
  578.  
  579. function loadSponsorsList() {
  580.     var a = new XMLHttpRequest;
  581.     a.open("GET", "./sponsors.txt", !1);
  582.     a.onreadystatechange = function() {
  583.         4 !== a.readyState || 200 !== a.status && 0 != a.status || (sponsorList.innerHTML = a.responseText)
  584.     };
  585.     a.send(null)
  586. }
  587. loadSponsorsList();
  588.  
  589. function kickPlayer(a) {
  590.     hideStatTable();
  591.     hideUI(!0);
  592.     hideMenuUI();
  593.     document.getElementById("startMenuWrapper").style.display = "none";
  594.     gameOver = disconnected = !0;
  595.     void 0 == reason && (reason = a);
  596.     kicked = !0;
  597.     socket.close();
  598.     updateGameLoop();
  599.     stopAllSounds()
  600. }
  601. var classSelector = document.getElementById("classSelector"),
  602.     spraySelector = document.getElementById("spraySelector"),
  603.     hatSelector = document.getElementById("hatSelector"),
  604.     lobbySelector = document.getElementById("lobbySelector"),
  605.     lobbyCSelector = document.getElementById("lobbyCSelector"),
  606.     charSelectorCont = document.getElementById("charSelectorCont"),
  607.     lobbySelectorCont = document.getElementById("lobbySelectorCont");
  608.  
  609. function showLobbySelector() {
  610.     charSelectorCont.style.display = "none";
  611.     lobbySelectorCont.style.display = "none";
  612.     classSelector.style.display = "none";
  613.     lobbyCSelector.style.display = "none";
  614.     lobbySelector.style.display = "block"
  615. }
  616.  
  617. function hideLobbySelector() {
  618.     charSelectorCont.style.display = "block";
  619.     lobbySelectorCont.style.display = "block";
  620.     lobbySelector.style.display = "none"
  621. }
  622.  
  623. function showLobbyCSelector() {
  624.     charSelectorCont.style.display = "none";
  625.     lobbySelectorCont.style.display = "none";
  626.     classSelector.style.display = "none";
  627.     lobbySelector.style.display = "none";
  628.     lobbyCSelector.style.display = "block"
  629. }
  630.  
  631. function hideLobbyCSelector() {
  632.     charSelectorCont.style.display = "block";
  633.     lobbySelectorCont.style.display = "block";
  634.     lobbyCSelector.style.display = "none"
  635. }
  636. var timeOutCheck = null,
  637.     tmpPingTimer = null,
  638.     pingText = document.getElementById("pingText");
  639.  
  640. function receivePing(a) {
  641.     socket.connected && (0 != a && (pingText.innerHTML = "PING " + a), null != timeOutCheck && clearTimeout(timeOutCheck), tmpPingTimer = setTimeout(function() {
  642.         timeOutCheck = setTimeout(function() {
  643.             changingLobby || kickPlayer("your connection timed out")
  644.         }, 6E3);
  645.         socket.emit("test1")
  646.     }, 2E3))
  647. }
  648. var manuallyDisconnected = !1;
  649.  
  650. function setupSocket(a) {
  651.     a.on("test2", receivePing);
  652.     a.emit("test1");
  653.     null != timeOutCheck && clearTimeout(timeOutCheck);
  654.     null != tmpPingTimer && clearTimeout(tmpPingTimer);
  655.     a.on("yourRoom", function(b) {
  656.         room = b;
  657.         document.getElementById("lobbyKeyCurrent").innerHTML = "<b>Key: </b>Getting Key...";
  658.         a.emit("fetchTiny")
  659.     });
  660.     a.on("getTiny", function(a) {
  661.         document.getElementById("lobbyKeyCurrent").innerHTML = "<b>Key: </b>" + a
  662.     });
  663.     a.on("connect_failed", function() {
  664.         kickPlayer("Disconnected. The Server may have Restarted for an Update")
  665.     });
  666.     a.on("disconnect", function() {
  667.         manuallyDisconnected || kickPlayer("Disconnected. The Server may have Restarted for an Update")
  668.     });
  669.     a.on("welcome", function(b, d) {
  670.         player.id = b.id;
  671.         player.room = b.room;
  672.         player.name = playerName;
  673.         player.classIndex = playerClassIndex;
  674.         b.name = player.name;
  675.         b.room = player.room;
  676.         b.classIndex = playerClassIndex;
  677.         a.emit("gotit", b, d, Date.now());
  678.         d ? (player.dead = !0, deactiveAllAnimTexts(), gameStart = !1, hideUI(!1), document.getElementById("startMenuWrapper").style.display = "block") : (gameStart = !0, showUI(), document.getElementById("cvs").focus());
  679.         gameOver && (document.getElementById("gameStatWrapper").style.display = "none");
  680.         gameOverFade = gameOver = !1;
  681.         hideBannerAd();
  682.         mobile && (hideMenuUI(), hideUI(!0), document.getElementById("startMenuWrapper").style.display = "none");
  683.         resize()
  684.     });
  685.     a.on("regRes", function(a, d) {
  686.         d ? (loginMessage.innerHTML = a, setCookie("userName", loginUserNm), setCookie("userPass", loginUserPs)) : (loginMessage.style.display = "block", loginMessage.innerHTML = a);
  687.         waitingForServer = !1
  688.     });
  689.     a.on("logRes", function(a, d) {
  690.         d ? (loginMessage.style.display = "none", loginMessage.innerHTML =
  691.             "", loginWrapper.style.display = "none", loggedInWrapper.style.display = "block", document.getElementById("playerNameInput").value = loginUserNm, setCookie("userName", loginUserNm), setCookie("userPass", loginUserPs)) : (loginMessage.style.display = "block", loginMessage.innerHTML = a);
  692.         waitingForServer = waitingForLoad = !1
  693.     });
  694.     a.on("recovRes", function(b, d) {
  695.         loginMessage.style.display = "block";
  696.         loginMessage.innerHTML = b;
  697.         waitingForServer = !1;
  698.         if (d) {
  699.             document.getElementById("recoverForm").style.display = "block";
  700.             var e = document.getElementById("chngPassKey"),
  701.                 f = document.getElementById("chngPassPass");
  702.             document.getElementById("chngPassButton").onclick = function() {
  703.                 loginMessage.style.display = "block";
  704.                 loginMessage.innerHTML = "Please Wait...";
  705.                 waitingForServer = !0;
  706.                 a.emit("dbCngPass", {
  707.                     passKey: e.value,
  708.                     newPass: f.value
  709.                 });
  710.                 a.on("cngPassRes", function(a, b) {
  711.                     loginMessage.style.display = "block";
  712.                     loginMessage.innerHTML = a;
  713.                     b && (document.getElementById("recoverForm").style.display = "none");
  714.                     waitingForServer = !1
  715.                 })
  716.             }
  717.         }
  718.     });
  719.     a.on("dbClanCreateR", function(a, d) {
  720.         d ? (clanSignUp.style.display = "none",
  721.             clanStats.style.display = "block", clanHeader.innerHTML = "[" + a + "] Clan:", clanAdminPanel.style.display = "block", leaveClanButton.style.display = "inline-block", leaveClanButton.innerHTML = "Delete Clan") : (clanDBMessage.style.display = "block", clanDBMessage.innerHTML = a);
  722.         waitingForServer = !1
  723.     });
  724.     a.on("dbClanJoinR", function(a, d) {
  725.         d ? (clanSignUp.style.display = "none", clanStats.style.display = "block", clanHeader.innerHTML = "[" + a + "] Clan:", leaveClanButton.style.display = "inline-block", leaveClanButton.innerHTML = "Leave Clan") : (clanDBMessage.style.display =
  726.             "block", clanDBMessage.innerHTML = a);
  727.         waitingForServer = !1
  728.     });
  729.     a.on("dbClanInvR", function(a, d) {
  730.         clanInvMessage.style.display = "block";
  731.         clanInvMessage.innerHTML = a;
  732.         waitingForServer = !1
  733.     });
  734.     a.on("dbKickInvR", function(a, d) {
  735.         clanInvMessage.style.display = "block";
  736.         clanInvMessage.innerHTML = a;
  737.         waitingForServer = !1
  738.     });
  739.     a.on("dbClanLevR", function(a, d) {
  740.         d && (clanSignUp.style.display = "block", clanStats.style.display = "none", clanHeader.innerHTML = "Clans", clanDBMessage.style.display = "block", clanDBMessage.innerHTML = a, leaveClanButton.style.display =
  741.             "none");
  742.         waitingForServer = !1
  743.     });
  744.     a.on("dbClanStats", function(a) {
  745.         updateClanPage(a)
  746.     });
  747.     a.on("updAccStat", function(a) {
  748.         updateAccountPage(a)
  749.     });
  750.     a.on("dbLeaderboard", function(a) {
  751.         updateGlobalLeaderboard(a)
  752.     });
  753.     a.on("replyIP", function(a) {
  754.         var d = io.connect("http://" + a + ":" + port, {
  755.             reconnection: !1,
  756.             forceNew: !0
  757.         });
  758.         d.on("connect", function() {
  759.             d.emit("create", {
  760.                 room: lobbyInput.value.split("/")[1],
  761.                 user: loginUserNm,
  762.                 pass: loginUserPs
  763.             });
  764.             d.on("lobbyRes", function(a, b) {
  765.                 lobbyMessage.innerHTML = a;
  766.                 b ? (manuallyDisconnected = !0, socket.on("disconnect",
  767.                     function() {
  768.                         changingLobby = manuallyDisconnected = !1;
  769.                         socket = d;
  770.                         setupSocket(socket)
  771.                     }), socket.disconnect()) : (changingLobby = !1, d.disconnect())
  772.             })
  773.         });
  774.         d.on("connect_error", function(a) {
  775.             lobbyMessage.innerHTML = "No Lobby Found.";
  776.             changingLobby = !1;
  777.             d.disconnect()
  778.         })
  779.     });
  780.     a.on("gameSetup", function(a, d) {
  781.         if (d) {
  782.             gameWidth = a.gameWidth;
  783.             gameHeight = a.gameHeight;
  784.             gameMap = a.roomMap;
  785.             cachedMiniMap = null;
  786.             mapTileScale = a.tileScale;
  787.             gameObjects = a.usersInRoom;
  788.             for (var e = 0; e < gameObjects.length; ++e) gameObjects[e].type = "player";
  789.             "blue" == a.you.team ?
  790.                 document.getElementById("gameModeText").innerHTML = a.gameMode.desc2 : document.getElementById("gameModeText").innerHTML = a.gameMode.desc1;
  791.             gameMode = a.gameMode;
  792.             for (var f, e = 0; e < gameMap.flags.length; ++e) f = gameMap.flags[e], f.type = "flag", gameObjects.push(f);
  793.             for (e = 0; e < gameMap.clutter.length; ++e) f = gameMap.clutter[e], f.type = "clutter", gameObjects.push(f);
  794.             deactivateSprays();
  795.             for (e = 0; 100 > e; ++e) bullets.push(new Projectile)
  796.         }
  797.         maxScreenHeight = a.maxScreenHeight * a.viewMult;
  798.         maxScreenWidth = a.maxScreenWidth * a.viewMult;
  799.         viewMult =
  800.             a.viewMult;
  801.         a.you.type = "player";
  802.         player = a.you;
  803.         e = findUserByIndex(a.you.index);
  804.         null != e ? gameObjects[gameObjects.indexOf(e)] = a.you : gameObjects.push(a.you);
  805.         updateWeaponUI(player, !0);
  806.         startingGame = inMainMenu = !1;
  807.         resize()
  808.     });
  809.     a.on("lb", updateLeaderboard);
  810.     a.on("ts", updateTeamScores);
  811.     a.on("rsd", receiveServerData);
  812.     a.on("upd", updateUserValue);
  813.     a.on("vt", updateVoteStats);
  814.     a.on("add", addUser);
  815.     a.on("updHt", updateHatList);
  816.     a.on("updSprs", updateSpraysList);
  817.     a.on("crtSpr", createSpray);
  818.     a.on("rem", removeUser);
  819.     a.on("cht", messageFromServer);
  820.     a.on("kick", function(a) {
  821.         kickPlayer(a)
  822.     });
  823.     a.on("1", function(a) {
  824.         var d = findUserByIndex(a.gID),
  825.             e = mathABS(a.amount);
  826.         (a.dID != player.index || a.gID == player.index) && 0 >= a.amount && a.gID == player.index && 0 != e && screenShake(e / 2, a.dir);
  827.         null != a.dID && a.dID == player.index && null != d && 0 < e && d.onScreen && (0 > a.amount ? startMovingAnimText(e + "", d.x - d.width / 2, d.y - d.height, "#d95151", e / 10) : startMovingAnimText(e + "", d.x - d.width / 2, d.y - d.height, "#5ed951", e / 10));
  828.         null != a.bi && (e = findServerBullet(a.bi), void 0 != e && e.owner.index != player.index &&
  829.             (d.onScreen && 0 > a.amount && (particleCone(12, d.x, d.y - d.height / 2 - d.jumpY, e.dir + mathPI, mathPI / randomInt(5, 7), .5, 16, 0, !0), createLiquid(d.x, d.y, e.dir, 4)), e.active = !1));
  830.         null != d && (d.health = a.h, d.index == player.index && (updatePlayerInfo(d), updateUiStats(d)))
  831.     });
  832.     a.on("2", someoneShot);
  833.     a.on("jum", otherJump);
  834.     a.on("ex", createExplosion);
  835.     a.on("r", function(a) {
  836.         var d = findUserByIndex(player.index);
  837.         null != d && (0 == a && 1 < d.weapons[a].maxAmmo && showNotification("Ammo Full"), d.weapons[a].reloadTime = 0, d.weapons[a].ammo = d.weapons[a].maxAmmo,
  838.             setCooldownAnimation(a, d.weapons[a].reloadTime, !1), updateUiStats(d))
  839.     });
  840.     a.on("3", function(a) {
  841.         var d = findUserByIndex(a.gID),
  842.             e = findUserByIndex(a.dID);
  843.         d.dead = !0;
  844.         if (a.kB && a.gID != player.index) a.dID == player.index ? startBigAnimText("BOSS SLAIN", a.sS + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.25) : showNotification(e.name + " slayed the boss");
  845.         else if (a.dID == player.index) {
  846.             if (a.gID != player.index) {
  847.                 showNotification("Eliminated " + d.name);
  848.                 var f = "";
  849.                 d.team != e.team ? (a.sS = "+" + a.sS, f = 1 == a.kd ? "Enemy Killed" : 2 == a.kd ? "Double Kill" :
  850.                     3 == a.kd ? "Triple Kill" : 4 == a.kd ? "Multi Kill" : 5 == a.kd ? "Ultra Kill" : 6 == a.kd ? "No Way!" : 7 == a.kd ? "Stop!" : "Godlike!") : (f = "Team Kill", a.sS = "no");
  851.                 startBigAnimText(f, a.sS + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.25)
  852.             }
  853.         } else gameOver || (d.index == e.index ? showNotification(d.name + " Committed suicide") : d.index == player.index ? showNotification("You were killed by " + e.name) : e.index != player.index && showNotification(e.name + " killed " + d.name), playSound("kill1", e.x, e.y));
  854.         a.gID == player.index && (hideStatTable(), gameStart = !1, hideUI(!1),
  855.             player.dead = !0, window.setTimeout(function() {
  856.                 gameOver || (document.getElementById("startMenuWrapper").style.display = "block", document.getElementById("linkBox").style.display = "block")
  857.             }, 1300), playSound("death1", player.x, player.y), startSoundTrack(1))
  858.     });
  859.     a.on("4", function(a, d, e) {
  860.         if (0 == e) null != gameMap && void 0 != a.active && (gameMap.pickups[d].active = a.active);
  861.         else
  862.             for (e = 0; e < gameObjects.length; ++e) "clutter" == gameObjects[e].type && gameObjects[e].indx == d && (void 0 != a.active && (gameObjects[e].active = a.active), void 0 !=
  863.                 a.x && (gameObjects[e].x = a.x), void 0 != a.y && (gameObjects[e].y = a.y))
  864.     });
  865.     a.on("5", function(a) {
  866.         showNotification(a)
  867.     });
  868.     a.on("6", function(a, d, e) {
  869.         startBigAnimText(a, d, 2E3, !0, "#ffffff", "#5151d9", !0, e)
  870.     });
  871.     a.on("7", function(a, d, e, f) {
  872.         try {
  873.             gameOver = !0, document.getElementById("startMenuWrapper").style.display = "none", showStatTable(d, e, a, !1, f, !0), startSoundTrack(1)
  874.         } catch (h) {
  875.             console.log(h)
  876.         }
  877.     });
  878.     a.on("8", function(a) {
  879.         document.getElementById("nextGameTimer").innerHTML = a + ": UNTIL NEXT ROUND"
  880.     })
  881. }
  882.  
  883. function likePlayerStat(a) {
  884.     socket.emit("like", a)
  885. }
  886.  
  887. function updateVoteStats(a) {
  888.     document.getElementById("votesText" + a.i).innerHTML = a.n + ": " + a.v
  889. }
  890.  
  891. function showStatTable(a, b, d, e, f, h) {
  892.     if (h)
  893.         if (hideUI(!1), e) nextGameTimer.innerHTML = "GAME STATS", document.getElementById("winningTeamText").innerHTML = "", document.getElementById("voteModeContainer").innerHTML = "";
  894.         else if (d = player.team == d || player.id == d, f || (d ? (startBigAnimText("Victory", "Well Played!", 2500, !0, "#5151d9", "#ffffff", !1, 2), document.getElementById("winningTeamText").innerHTML = "VICTORY", document.getElementById("winningTeamText").style.color = "#5151d9") : "" != player.team && (startBigAnimText("Defeat",
  895.             "Bad Luck!", 2500, !0, "#d95151", "#ffffff", !1, 2), document.getElementById("winningTeamText").innerHTML = "DEFEAT", document.getElementById("winningTeamText").style.color = "#d95151")), null != b) {
  896.         document.getElementById("voteModeContainer").innerHTML = "";
  897.         for (var g = 0; g < b.length; ++g) d = document.createElement("button"), d.className = "modeVoteButton", d.setAttribute("id", "votesText" + g), d.innerHTML = b[g].name + ": " + b[g].votes, document.getElementById("voteModeContainer").appendChild(d), d.onclick = function(a) {
  898.             return function() {
  899.                 c.focus();
  900.                 socket.emit("modeVote", a.indx)
  901.             }
  902.         }(b[g])
  903.     }
  904.     try {
  905.         document.getElementById("gameStatBoard").innerHTML = "";
  906.         addRowToStatTable([{
  907.             text: "NAME",
  908.             className: "headerL",
  909.             color: "#fff"
  910.         }, {
  911.             text: "SCORE",
  912.             className: "headerC",
  913.             color: "#fff"
  914.         }, {
  915.             text: "KILLS",
  916.             className: "headerC",
  917.             color: "#fff"
  918.         }, {
  919.             text: "DEATHS",
  920.             className: "headerC",
  921.             color: "#fff"
  922.         }, {
  923.             text: "DAMAGE",
  924.             className: "headerC",
  925.             color: "#fff"
  926.         }, {
  927.             text: "HEALING",
  928.             className: "headerC",
  929.             color: "#fff"
  930.         }, {
  931.             text: "REWARD",
  932.             className: "headerC",
  933.             color: "#fff"
  934.         }, {
  935.             text: "",
  936.             className: "headerC",
  937.             color: "#fff"
  938.         }], !0);
  939.         for (g = 0; g < a.length; ++g) "" != a[g].team && addRowToStatTable([{
  940.             text: a[g].index == player.index ? "YOU" : a[g].name,
  941.             className: "contL",
  942.             color: a[g].index == player.index ? "#fff" : a[g].team != player.team ? "#d95151" : "#5151d9",
  943.             id: null,
  944.             userInfo: findUserByIndex(a[g].index)
  945.         }, {
  946.             text: a[g].score || 0,
  947.             className: "contC",
  948.             color: "#fff",
  949.             id: null
  950.         }, {
  951.             text: a[g].kills || 0,
  952.             className: "contC",
  953.             color: "#fff",
  954.             id: null
  955.         }, {
  956.             text: a[g].deaths || 0,
  957.             className: "contC",
  958.             color: "#fff",
  959.             id: null
  960.         }, {
  961.             text: a[g].totalDamage || 0,
  962.             className: "contC",
  963.             color: "#fff",
  964.             id: null
  965.         }, {
  966.             text: a[g].totalHealing ||
  967.                 0,
  968.             className: "contC",
  969.             color: "#fff",
  970.             id: null
  971.         }, {
  972.             text: null != a[g].lastHat ? a[g].lastHat.name : "No Reward",
  973.             className: "rewardText",
  974.             color: null != a[g].lastHat ? getItemRarityColor(a[g].lastHat.chance) : "#fff",
  975.             id: null,
  976.             hoverInfo: a[g].lastHat
  977.         }, {
  978.             text: a[g].likes || 0,
  979.             className: "contC",
  980.             color: "#fff",
  981.             pos: a[g].index,
  982.             id: "likeStat" + a[g].index
  983.         }], !1);
  984.         h && (f ? (overlayAlpha = overlayMaxAlpha, animateOverlay = !1, gameOverFade = !0, deactiveAllAnimTexts(), document.getElementById("gameStatWrapper").style.display = "block", e || showBannerAd()) : (hideStatTable(),
  985.             hideUI(!1), animateOverlay = !0, window.setTimeout(function() {
  986.                 gameOverFade = !0
  987.             }, 2500), window.setTimeout(function() {
  988.                 document.getElementById("gameStatWrapper").style.display = "block";
  989.                 showBannerAd()
  990.             }, 4500)))
  991.     } catch (l) {
  992.         console.log(l)
  993.     }
  994. }
  995.  
  996. function hideStatTable() {
  997.     showUI();
  998.     overlayAlpha = 0;
  999.     showingScoreBoard = !1;
  1000.     animateOverlay = !0;
  1001.     drawOverlay(graph, !1, !0);
  1002.     document.getElementById("gameStatWrapper").style.display = "none";
  1003.     document.getElementById("linkBox").style.display = "none";
  1004.     hideBannerAd()
  1005. }
  1006.  
  1007. function addRowToStatTable(a, b) {
  1008.     for (var d = document.getElementById("gameStatBoard"), e = document.createElement("tr"), f = 0; f < a.length; ++f) {
  1009.         var h = document.createElement("td");
  1010.         if (b || f != a.length - 1) {
  1011.             if (l = document.createTextNode(a[f].text), h.appendChild(l), h.className = a[f].className, h.style.color = a[f].color, void 0 != a[f].hoverInfo) {
  1012.                 var g = document.createElement("div");
  1013.                 g.className = "hoverTooltip";
  1014.                 g.innerHTML = "<image class='itemDisplayImage' src='.././images/hats/" + a[f].hoverInfo.id + "/d.png'></image><div style='color:" +
  1015.                     a[f].color + "; font-size:16px; margin-top:5px;'>" + a[f].hoverInfo.name + "</div><div style='color:#ffd100; font-size:12px; margin-top:0px;'>droprate " + a[f].hoverInfo.chance + "%</div><div style='font-size:8px; color:#d8d8d8; margin-top:1px;'><i>wearable</i></div><div style='font-size:12px; margin-top:5px;'>" + a[f].hoverInfo.desc + "</div><div style='font-size:8px; color:#d8d8d8; margin-top:5px;'><i>Artist: " + a[f].hoverInfo.creator + "</i></div>";
  1016.                 h.appendChild(g)
  1017.             }
  1018.         } else {
  1019.             var g = document.createElement("button"),
  1020.                 l = document.createTextNode(" NICE");
  1021.             g.appendChild(l);
  1022.             g.setAttribute("type", "button");
  1023.             var m = a[f];
  1024.             g.onclick = function() {
  1025.                 c.focus();
  1026.                 likePlayerStat(m.pos)
  1027.             };
  1028.             g.setAttribute("id", "gameStatLikeButton");
  1029.             g.style.display = m.pos == player.index ? "none" : "block";
  1030.             e.appendChild(g);
  1031.             l = document.createElement("div");
  1032.             l.innerHTML = a[f].text;
  1033.             null != a[f].id && l.setAttribute("id", a[f].id);
  1034.             h.appendChild(l);
  1035.             h.className = a[f].className;
  1036.             h.style.color = a[f].color
  1037.         }
  1038.         e.appendChild(h)
  1039.     }
  1040.     d.appendChild(e)
  1041. }
  1042.  
  1043. function addUser(a) {
  1044.     if (a.index != player.index) {
  1045.         a.type = "player";
  1046.         var b = findUserByIndex(a.index);
  1047.         null == b ? gameObjects.push(a) : gameObjects[gameObjects.indexOf(b)] = a
  1048.     }
  1049. }
  1050.  
  1051. function removeUser(a) {
  1052.     a != player.index && (tmpUser = findUserByIndex(a), null != tmpUser && gameObjects.splice(gameObjects.indexOf(tmpUser), 1))
  1053. }
  1054.  
  1055. function updateUiStats(a) {
  1056.     document.getElementById("scoreValue").innerHTML = a.score;
  1057.     document.getElementById("ammoValue").innerHTML = getCurrentWeapon(a).ammo;
  1058.     document.getElementById("healthValue").innerHTML = a.health;
  1059.     10 >= a.health ? document.getElementById("healthValue").style.color = "#e06363" : document.getElementById("healthValue").style.color = "#fff"
  1060. }
  1061.  
  1062. function getItemRarityColor(a) {
  1063.     return 1 >= a ? "#ff8000" : 6 >= a ? "#a335ee" : 18 >= a ? "#0070dd" : 45 >= a ? "#1eff00" : "#9d9d9d"
  1064. }
  1065.  
  1066. function updateUserValue(a) {
  1067.     var b = !1;
  1068.     tmpUser = findUserByIndex(a.i);
  1069.     null != tmpUser ? (void 0 != a.s && (tmpUser.score = a.s, b = !0), void 0 != a.sp && (tmpUser.spawnProtection = a.sp), void 0 != a.wi && a.i != player.index && playerEquipWeapon(tmpUser, a.wi), void 0 != a.l && (tmpUser.likes = a.l, b = !0), void 0 != a.dea && (tmpUser.deaths = a.dea, b = !0), void 0 != a.kil && (tmpUser.kills = a.kil, b = !0), void 0 != a.dmg && (tmpUser.totalDamage = a.dmg, b = !0), void 0 != a.hea && (tmpUser.totalHealing = a.hea, b = !0), tmpUser.index == player.index && (updatePlayerInfo(tmpUser),
  1070.         updateUiStats(tmpUser)), b && (gameOver ? void 0 != a.l && (a = document.createTextNode(tmpUser.likes), document.getElementById("likeStat" + tmpUser.index).innerHTML = "", document.getElementById("likeStat" + tmpUser.index).appendChild(a)) : showStatTable(getUsersList(), null, null, !0, !0, !1))) : fetchUserWithIndex(a.i)
  1071. }
  1072.  
  1073. function fetchUserWithIndex(a) {
  1074.     socket.emit("ftc", a)
  1075. }
  1076. var tmpNowTime = 0;
  1077.  
  1078. function receiveServerData(a) {
  1079.     tmpNowTime = Date.now();
  1080.     timeSinceLastUpdate = tmpNowTime - timeOfLastUpdate;
  1081.     timeOfLastUpdate = tmpNowTime;
  1082.     var b;
  1083.     if (!gameOver)
  1084.         for (var d = 0; d < a.length;) {
  1085.             b = a[0 + d];
  1086.             tmpUser = findUserByIndex(a[1 + d]);
  1087.             if (a[1 + d] == player.index && null != tmpUser) 2 < b && (tmpUser.x = a[2 + d]), 3 < b && (tmpUser.y = a[3 + d]), 4 < b && (tmpUser.angle = a[4 + d]), 5 < b && (tmpUser.isn = a[5 + d]), tmpUser.onScreen = !0;
  1088.             else if (null != tmpUser) {
  1089.                 2 < b && (tmpUser.xSpeed = mathABS(tmpUser.x - a[2 + d]), tmpUser.x = a[2 + d]);
  1090.                 3 < b && (tmpUser.ySpeed = mathABS(tmpUser.y -
  1091.                     a[3 + d]), tmpUser.y = a[3 + d]);
  1092.                 4 < b && (tmpUser.angle = a[4 + d]);
  1093.                 if (void 0 != getCurrentWeapon(tmpUser)) {
  1094.                     var e = 90 * mathRound(tmpUser.angle % 360 / 90);
  1095.                     0 == e || 360 == e ? getCurrentWeapon(tmpUser).front = !0 : 180 == e ? getCurrentWeapon(tmpUser).front = !1 : getCurrentWeapon(tmpUser).front = !0
  1096.                 }
  1097.                 5 < b && (tmpUser.nameYOffset = a[5 + d]);
  1098.                 tmpUser.onScreen = !0
  1099.             } else fetchUserWithIndex(a[1 + d]);
  1100.             d += b
  1101.         }
  1102.     for (d = 0; d < gameObjects.length; d++)
  1103.         if (gameObjects[d].index == player.index) {
  1104.             if (gameObjects[d].dead || gameOver || 80 < thisInput.length) thisInput.length = 0;
  1105.             var f = 0;
  1106.             if (!gameObjects[d].dead) {
  1107.                 for (; f < thisInput.length;) thisInput[f].isn <= gameObjects[d].isn ? thisInput.splice(f, 1) : (a = thisInput[f].hdt, b = thisInput[f].vdt, e = mathSQRT(thisInput[f].hdt * thisInput[f].hdt + thisInput[f].vdt * thisInput[f].vdt), 0 != e && (a /= e, b /= e), gameObjects[d].oldX = gameObjects[d].x, gameObjects[d].oldY = gameObjects[d].y, gameObjects[d].x += a * gameObjects[d].speed * thisInput[f].delta, gameObjects[d].y += b * gameObjects[d].speed * thisInput[f].delta, wallCol(gameObjects[d]), f++);
  1108.                 gameObjects[d].x = mathRound(gameObjects[d].x);
  1109.                 gameObjects[d].y = mathRound(gameObjects[d].y);
  1110.                 updatePlayerInfo(gameObjects[d])
  1111.             }
  1112.         }
  1113. }
  1114.  
  1115. function updatePlayerInfo(a) {
  1116.     player.x = a.x;
  1117.     player.y = a.y;
  1118.     player.dead = a.dead;
  1119.     player.score < a.score && playSound("score", player.x, player.y);
  1120.     player.score = a.score;
  1121.     player.health = a.health
  1122. }
  1123. var currentHat = document.getElementById("currentHat"),
  1124.     hatList = document.getElementById("hatList"),
  1125.     hatHeader = document.getElementById("hatHeader");
  1126.  
  1127. function updateHatList(a, b) {
  1128.     var d = "Select Hat: (" + b.length + "/" + a + ")";
  1129.     hatHeader.innerHTML = d;
  1130.     for (var d = "<div class='hatSelectItem' id='hatItem-1' onclick='changeHat(-1);'>Default</div>", e = 0; e < b.length; ++e) d += "<div class='hatSelectItem' id='hatItem" + b[e].id + "' style='color:" + getItemRarityColor(b[e].chance) + ";' onclick='changeHat(" + b[e].id + ");'>" + b[e].name + "<div class='hoverTooltip'><image class='itemDisplayImage' src='.././images/hats/" + b[e].id + "/d.png'></image><div style='color:" + getItemRarityColor(b[e].chance) +
  1131.         "; font-size:16px; margin-top:5px;'>" + b[e].name + "</div><div style='color:#ffd100; font-size:12px; margin-top:0px;'>droprate " + b[e].chance + "%</div><div style='font-size:8px; color:#d8d8d8; margin-top:1px;'><i>wearable</i></div><div style='font-size:12px; margin-top:5px;'>" + b[e].desc + "</div><div style='font-size:8px; color:#d8d8d8; margin-top:5px;'><i>Artist: " + b[e].creator + "</i></div></div></div>";
  1132.     hatList.innerHTML = d;
  1133.     "" != getCookie("previousHat") && (previousHat = getCookie("previousHat"), changeHat(previousHat))
  1134. }
  1135.  
  1136. function showHatselector() {
  1137.     charSelectorCont.style.display = "none";
  1138.     lobbySelectorCont.style.display = "none";
  1139.     classSelector.style.display = "none";
  1140.     lobbySelector.style.display = "none";
  1141.     lobbyCSelector.style.display = "none";
  1142.     spraySelector.style.display = "none";
  1143.     hatSelector.style.display = "block"
  1144. }
  1145.  
  1146. function changeHat(a) {
  1147.     void 0 != socket && (socket.emit("cHat", a), setCookie("previousHat", a), currentHat.innerHTML = document.getElementById("hatItem" + a).innerHTML, currentHat.style.color = document.getElementById("hatItem" + a).style.color, charSelectorCont.style.display = "block", lobbySelectorCont.style.display = "block", classSelector.style.display = "none", hatSelector.style.display = "none", lobbySelector.style.display = "none", lobbyCSelector.style.display = "none")
  1148. }
  1149. var currentSpray = document.getElementById("currentSpray"),
  1150.     sprayList = document.getElementById("sprayList");
  1151.  
  1152. function updateSpraysList(a) {
  1153.     for (var b = "", d = 0; d < a.length; ++d) b += "<div class='hatSelectItem' id='sprayItem" + (d + 1) + "' onclick='changeSpray(" + (d + 1) + ");'>" + a[d].name + "<div class='hoverTooltip' style='width:90px;height:90px;'><image class='sprayDisplayImage' src='.././images/sprays/" + a[d].id + ".png'></image></div></div>";
  1154.     sprayList.innerHTML = b;
  1155.     "" != getCookie("previousSpray") && (previousSpray = getCookie("previousSpray"), changeSpray(previousSpray))
  1156. }
  1157.  
  1158. function showSprayselector() {
  1159.     charSelectorCont.style.display = "none";
  1160.     lobbySelectorCont.style.display = "none";
  1161.     classSelector.style.display = "none";
  1162.     lobbySelector.style.display = "none";
  1163.     lobbyCSelector.style.display = "none";
  1164.     hatSelector.style.display = "none";
  1165.     spraySelector.style.display = "block"
  1166. }
  1167.  
  1168. function changeSpray(a) {
  1169.     void 0 != socket && (socket.emit("cSpray", a), setCookie("previousSpray", a), currentSpray.innerHTML = document.getElementById("sprayItem" + a).innerHTML, currentSpray.style.color = document.getElementById("sprayItem" + a).style.color, charSelectorCont.style.display = "block", lobbySelectorCont.style.display = "block", classSelector.style.display = "none", hatSelector.style.display = "none", spraySelector.style.display = "none", lobbySelector.style.display = "none", lobbyCSelector.style.display = "none")
  1170. }
  1171.  
  1172. function findUserByIndex(a) {
  1173.     for (var b = 0; b < gameObjects.length; ++b)
  1174.         if (gameObjects[b].index === a) return gameObjects[b];
  1175.     return null
  1176. }
  1177. var tmpUsers = [];
  1178.  
  1179. function getUsersList() {
  1180.     for (var a = tmpUsers.length = 0; a < gameObjects.length; ++a) "player" == gameObjects[a].type && tmpUsers.push(gameObjects[a]);
  1181.     tmpUsers.sort(sortUsersByScore);
  1182.     return tmpUsers
  1183. }
  1184.  
  1185. function sortUsersByScore(a, b) {
  1186.     return b.score == a.score ? a.id < b.id ? -1 : a.id > b.id ? 1 : 0 : a.score > b.score ? -1 : a.score < b.score ? 1 : 0
  1187. }
  1188.  
  1189. function sortUsersByPosition(a, b) {
  1190.     return a.y < b.y ? -1 : a.y > b.y ? 1 : 0
  1191. }
  1192. var tmpPlayer = null;
  1193.  
  1194. function updateLeaderboard(a) {
  1195.     try {
  1196.         for (var b = '<span class="title">LEADERBOARD</span>', d = 1, e = 0; e < a.length; ++e) tmpPlayer = findUserByIndex(a[0 + e]), null != tmpPlayer && (b += "<br />", tmpPlayer.index == player.index ? b += '<span class="me">' + d + ". " + player.name + ("" != player.account.clan ? " [" + player.account.clan + "]" : "") + "</span>" : "" != tmpPlayer.name && (b += '<span class="' + (tmpPlayer.team != player.team ? "red" : "blue") + '">' + d + ". " + tmpPlayer.name + "</span>" + ("" != tmpPlayer.account.clan ? "<span class='me'> [" + tmpPlayer.account.clan +
  1197.             "]</span>" : "")), d++);
  1198.         document.getElementById("status").innerHTML = b
  1199.     } catch (f) {}
  1200. }
  1201.  
  1202. function updateTeamScores(a, b) {
  1203.     var d = document.getElementById("redProgress"),
  1204.         e = document.getElementById("blueText"),
  1205.         f = document.getElementById("blueProgress"),
  1206.         h = document.getElementById("redProgCont");
  1207.     if (void 0 != gameMode) try {
  1208.         gameMode.teams ? (e.innerHTML = "A", h.style.display = "", "red" == player.team ? (d.setAttribute("style", "display:block;width:" + b + "%"), d.style.width = b + "%", f.setAttribute("style", "display:block;width:" + a + "%"), f.style.width = a + "%") : (d.setAttribute("style", "display:block;width:" + a + "%"), d.style.width =
  1209.             a + "%", f.setAttribute("style", "display:block;width:" + b + "%"), f.style.width = b + "%")) : (b = mathRound(player.score / a * 100), f.setAttribute("style", "display:block;width:" + b + "%"), f.style.width = b + "%", e.innerHTML = "YOU", h.style.display = "none")
  1210.     } catch (g) {
  1211.         console.log(g)
  1212.     }
  1213. }
  1214.  
  1215. function showUI() {
  1216.     document.getElementById("status").style.display = "block";
  1217.     document.getElementById("statContainer2").style.display = "block";
  1218.     document.getElementById("actionBar").style.display = "block";
  1219.     document.getElementById("statContainer").style.display = "block";
  1220.     document.getElementById("conStatContainer").style.display = "block";
  1221.     document.getElementById("score").style.display = "block";
  1222.     showChat && (document.getElementById("chatbox").style.display = "block");
  1223.     showLeader || (document.getElementById("status").style.display =
  1224.         "none")
  1225. }
  1226.  
  1227. function hideMenuUI() {
  1228.     document.getElementById("namesBox").style.display = "none";
  1229.     document.getElementById("linkBox").style.display = "none";
  1230.     document.getElementById("devMessage").style.display = "none"
  1231. }
  1232.  
  1233. function hideUI(a) {
  1234.     document.getElementById("status").style.display = "none";
  1235.     document.getElementById("statContainer2").style.display = "none";
  1236.     document.getElementById("actionBar").style.display = "none";
  1237.     document.getElementById("conStatContainer").style.display = "none";
  1238.     document.getElementById("score").style.display = "none";
  1239.     document.getElementById("statContainer").style.display = "none";
  1240.     a && (document.getElementById("chatbox").style.display = "none")
  1241. }
  1242. hideBannerAd();
  1243.  
  1244. function hideBannerAd() {
  1245.     document.getElementById("bannerAdContainer").style.display = "none"
  1246. }
  1247.  
  1248. function showBannerAd() {
  1249.     document.getElementById("bannerAdContainer").style.display = "inline-block"
  1250. }
  1251. $(window).focus(function() {
  1252.     void 0 != socket && socket.emit("5", 1);
  1253.     tabbed = 0
  1254. });
  1255. $(window).blur(function() {
  1256.     void 0 != socket && socket.emit("5", 0);
  1257.     tabbed = 1
  1258. });
  1259. var sendData = null;
  1260.  
  1261. function updateGameLoop() {
  1262.     delta = currentTime - oldTime;
  1263.     oldTime = currentTime;
  1264.     horizontalDT = verticalDT = 0;
  1265.     count++;
  1266.     var a = 0;
  1267.     1 == keys.u && (verticalDT = -1, temp = 0);
  1268.     1 == keys.d && (verticalDT = 1, temp = 0);
  1269.     1 == keys.r && (horizontalDT = 1, temp = 0);
  1270.     1 == keys.l ? (horizontalDT = -1, temp = 0) : keyd = 0;
  1271.     1 == keys.s && (a = 1, temp = 0);
  1272.     var b = horizontalDT,
  1273.         d = verticalDT,
  1274.         e = mathSQRT(horizontalDT * horizontalDT + verticalDT * verticalDT);
  1275.     0 != e && (b /= e, d /= e);
  1276.     if (clientPrediction)
  1277.         for (e = 0; e < gameObjects.length; e++)
  1278.             if ("player" == gameObjects[e].type) {
  1279.                 if (gameObjects[e].index ==
  1280.                     player.index) {
  1281.                     gameObjects[e].oldX = gameObjects[e].x;
  1282.                     gameObjects[e].oldY = gameObjects[e].y;
  1283.                     gameObjects[e].dead || gameOver || (gameObjects[e].x += b * gameObjects[e].speed * delta, gameObjects[e].y += d * gameObjects[e].speed * delta);
  1284.                     wallCol(gameObjects[e]);
  1285.                     gameObjects[e].x = mathRound(gameObjects[e].x);
  1286.                     gameObjects[e].y = mathRound(gameObjects[e].y);
  1287.                     if (void 0 != getCurrentWeapon(gameObjects[e])) {
  1288.                         gameObjects[e].angle = (target.f + 2 * mathPI) % (2 * mathPI) * (180 / mathPI) + 90;
  1289.                         var f = 90 * mathRound(gameObjects[e].angle % 360 / 90);
  1290.                         0 == f || 360 ==
  1291.                             f ? getCurrentWeapon(gameObjects[e]).front = !0 : 180 == f ? getCurrentWeapon(gameObjects[e]).front = !1 : getCurrentWeapon(gameObjects[e]).front = !0
  1292.                     }
  1293.                     0 < gameObjects[e].jumpCountdown && (gameObjects[e].jumpCountdown -= delta);
  1294.                     1 == keys.s && 0 >= gameObjects[e].jumpCountdown && !gameOver && playerJump(gameObjects[e])
  1295.                 }
  1296.                 0 != gameObjects[e].jumpY && (gameObjects[e].jumpDelta -= gameObjects[e].gravityStrength * delta, gameObjects[e].jumpY += gameObjects[e].jumpDelta * delta, 0 < gameObjects[e].jumpY ? gameObjects[e].animIndex = 1 : (gameObjects[e].jumpY =
  1297.                     0, gameObjects[e].jumpDelta = 0, gameObjects[e].jumpCountdown = 250), gameObjects[e].jumpY = mathRound(gameObjects[e].jumpY));
  1298.                 gameObjects[e].index != player.index || gameOver || (sendData = {
  1299.                     hdt: horizontalDT,
  1300.                     vdt: verticalDT,
  1301.                     ts: currentTime,
  1302.                     isn: inputNumber,
  1303.                     s: a
  1304.                 }, inputNumber++, socket.emit("4", sendData), sendData.delta = delta, thisInput.push(sendData), 0 == userScroll || gameOver || (playerSwapWeapon(gameObjects[e], userScroll), userScroll = 0), 1 != keys.rl || gameOver || playerReload(gameObjects[e]), 1 != keys.lm || gameOver || (keyd = 0, currentTime -
  1305.                     getCurrentWeapon(gameObjects[e]).lastShot >= getCurrentWeapon(gameObjects[e]).fireRate && shootBullet(gameObjects[e])));
  1306.                 gameOver ? gameObjects[e].animIndex = 0 : (f = mathABS(b) + mathABS(d), gameObjects[e].index != player.index && (f = mathABS(gameObjects[e].xSpeed) + mathABS(gameObjects[e].ySpeed)), 0 < f ? (gameObjects[e].frameCountdown -= delta / 4, 0 >= gameObjects[e].frameCountdown && (gameObjects[e].animIndex++, 0 == gameObjects[e].jumpY && gameObjects[e].onScreen && !gameObjects[e].dead && stillDustParticle(gameObjects[e].x, gameObjects[e].y, !1), 3 <= gameObjects[e].animIndex ? gameObjects[e].animIndex = 1 : 2 == gameObjects[e].animIndex && 0 >= gameObjects[e].jumpY && playSound("step1", gameObjects[e].x, gameObjects[e].y), gameObjects[e].frameCountdown = 40)) : 0 != gameObjects[e].animIndex && (gameObjects[e].animIndex = 0), 0 < gameObjects[e].jumpY && (gameObjects[e].animIndex = 1))
  1307.             }
  1308.     gameObjects.sort(sortUsersByPosition);
  1309.     gameOver ? (doGame(delta), gameOverFade && showUIFade && drawOverlay(graph, !0, !1)) : player.dead && !inMainMenu ? (doGame(delta), drawOverlay(graph, !0, !1)) : gameStart ?
  1310.         (doGame(delta), drawOverlay(graph, !1, !0), !mobile && targetChanged && (targetChanged = !1, socket.emit("0", target.f))) : kicked || (drawMenuBackground(), drawOverlay(graph, !1, !1), a = renderShadedAnimText("Loading...", 48 * viewMult, "#ffffff", 6, ""), void 0 != a && graph.drawImage(a, maxScreenWidth / 2 - a.width / 2, maxScreenHeight / 2 - a.height / 2, a.width, a.height));
  1311.     if (disconnected || kicked) drawOverlay(graph, !1, !1), a = kicked ? "" !== reason ? renderShadedAnimText(reason, 48 * viewMult, "#ffffff", 6, "") : renderShadedAnimText("You were kicked", 48 *
  1312.         viewMult, "#ffffff", 6, "") : renderShadedAnimText("Disconnected", 48 * viewMult, "#ffffff", 6, ""), void 0 != a && graph.drawImage(a, maxScreenWidth / 2 - a.width / 2, maxScreenHeight / 2 - a.height / 2, a.width, a.height);
  1313.     context.drawImage(osCanvas, 0, 0)
  1314. }
  1315.  
  1316. function wallCol(a) {
  1317.     if (!a.dead) {
  1318.         for (var b = null, d = a.nameYOffset = 0; d < gameMap.tiles.length; ++d) gameMap.tiles[d].wall && gameMap.tiles[d].hasCollision && (b = gameMap.tiles[d], a.x + a.width / 2 >= b.x && a.x - a.width / 2 <= b.x + b.scale && a.y >= b.y && a.y <= b.y + b.scale && (a.oldX <= b.x ? a.x = b.x - a.width / 2 - 1 : a.oldX - a.width / 2 >= b.x + b.scale && (a.x = b.x + b.scale + a.width / 2 + 1), a.oldY <= b.y ? a.y = b.y - 1 : a.oldY >= b.y + b.scale && (a.y = b.y + b.scale + 1)), !b.hardPoint && a.x > b.x && a.x < b.x + b.scale && a.y - a.jumpY - .85 * a.height > b.y - b.scale / 2 && a.y - a.jumpY - .85 * a.height <=
  1319.             b.y && (a.nameYOffset = Math.round(a.y - a.jumpY - .85 * a.height - (b.y - b.scale / 2))));
  1320.         for (d = 0; d < gameObjects.length; ++d) "clutter" == gameObjects[d].type && gameObjects[d].active && (b = gameObjects[d], b.hc && canSee(b.x - startX, b.y - startY, b.w, b.h) && a.x + a.width / 2 >= b.x && a.x - a.width / 2 <= b.x + b.w && a.y >= b.y - b.h * b.tp && a.y <= b.y && (a.oldX + player.width / 2 <= b.x ? a.x = b.x - a.width / 2 - 1 : a.oldX - a.width / 2 >= b.x + b.w && (a.x = b.x + b.w + a.width / 2 + 1), a.oldY >= b.y ? a.y = b.y + 1 : a.oldY <= b.y - b.h * b.tp && (a.y = b.y - b.h * b.tp - 1)));
  1321.         delete b
  1322.     }
  1323. }
  1324.  
  1325. function otherJump(a) {
  1326.     a = findUserByIndex(a);
  1327.     void 0 != a && null != a && playerJump(a)
  1328. }
  1329.  
  1330. function playerJump(a) {
  1331.     0 >= a.jumpY && (playSound("jump1", a.x, a.y), a.jumpDelta = a.jumpStrength, a.jumpY = a.jumpDelta)
  1332. }
  1333. var overlayMaxAlpha = .5,
  1334.     overlayAlpha = overlayMaxAlpha,
  1335.     overlayFadeUp = .01,
  1336.     overlayFadeDown = .04,
  1337.     animateOverlay = !0;
  1338.  
  1339. function drawOverlay(a, b, d) {
  1340.     animateOverlay && (b ? (overlayAlpha += overlayFadeUp, overlayAlpha >= overlayMaxAlpha && (overlayAlpha = overlayMaxAlpha)) : d ? (overlayAlpha -= overlayFadeDown, 0 >= overlayAlpha && (overlayAlpha = 0)) : overlayAlpha = overlayMaxAlpha);
  1341.     0 < overlayAlpha && (a.fillStyle = "#2e3031", a.globalAlpha = overlayAlpha, a.fillRect(0, 0, maxScreenWidth, maxScreenHeight), a.globalAlpha = 1)
  1342. }
  1343.  
  1344. function doGame(a) {
  1345.     updateScreenShake(a);
  1346.     null != target && (startX = player.x - maxScreenWidth / 2 + -screenSkX + target.dOffset * mathCOS(target.f + mathPI), startX = mathFloor(startX), startY = player.y - 20 - maxScreenHeight / 2 + -screenSkY + target.dOffset * mathSIN(target.f + mathPI), startY = mathFloor(startY));
  1347.     drawBackground();
  1348.     drawMap(0);
  1349.     drawMap(1);
  1350.     drawSprays();
  1351.     updateParticles(a, 0);
  1352.     drawGameObjects(a);
  1353.     updateBullets(a);
  1354.     updateParticles(a, 1);
  1355.     drawMap(2);
  1356.     drawPlayerNames();
  1357.     drawEdgeShader();
  1358.     drawUI();
  1359.     drawMiniMap();
  1360.     updateAnimTexts(a);
  1361.     updateNotifications(a)
  1362. }
  1363. window.addEventListener("resize", resize);
  1364.  
  1365. function resize() {
  1366.     screenWidth = mathRound(window.innerWidth);
  1367.     screenHeight = mathRound(window.innerHeight);
  1368.     calculateUIScale();
  1369.     var a = Math.max(screenWidth / maxScreenWidth, screenHeight / maxScreenHeight);
  1370.     c.style.width = screenWidth + "px";
  1371.     c.style.height = screenHeight + "px";
  1372.     c.width = screenWidth;
  1373.     c.height = screenHeight;
  1374.     osCanvas.style.width = screenWidth + "px";
  1375.     osCanvas.style.height = screenHeight + "px";
  1376.     osCanvas.width = screenWidth;
  1377.     osCanvas.height = screenHeight;
  1378.     graph.setTransform(a, 0, 0, a, (screenWidth - maxScreenWidth * a) / 2, (screenHeight -
  1379.         maxScreenHeight * a) / 2);
  1380.     document.getElementById("startMenuWrapper").style.transform = "perspective(1px) translate(-50%, -50%) scale(" + uiScale + ")";
  1381.     document.getElementById("gameStatWrapper").style.transform = "perspective(1px) translate(-50%, -50%) scale(" + uiScale + ")";
  1382.     graph.imageSmoothingEnabled = !1;
  1383.     graph.webkitImageSmoothingEnabled = !1;
  1384.     graph.mozImageSmoothingEnabled = !1;
  1385.     context.imageSmoothingEnabled = !1;
  1386.     context.webkitImageSmoothingEnabled = !1;
  1387.     context.mozImageSmoothingEnabled = !1;
  1388.     drawMenuBackground()
  1389. }
  1390. resize();
  1391. var grd = null;
  1392.  
  1393. function drawEdgeShader() {
  1394.     try {
  1395.         null == grd && (grd = graph.createRadialGradient(player.x - startX, player.y - startY, 0, player.x - startX, player.y - startY, maxScreenWidth / 2), grd.addColorStop(0, "rgba(0,0,0,0.0)"), grd.addColorStop(1, "rgba(0,0,0,0.4)")), graph.fillStyle = grd, graph.fillRect(0, 0, maxScreenWidth, maxScreenHeight)
  1396.     } catch (a) {}
  1397. }
  1398. var mapScale = mapCanvas.width,
  1399.     pingScale = mapScale / 80;
  1400. mapContext.lineWidth = pingScale / 2;
  1401. var pingFade = .085,
  1402.     pingGrow = .4,
  1403.     cachedMiniMap = null;
  1404.  
  1405. function getCachedMiniMap() {
  1406.     if (null == cachedMiniMap && void 0 != gameMap) {
  1407.         var a = document.createElement("canvas"),
  1408.             b = a.getContext("2d");
  1409.         a.width = mapScale;
  1410.         a.height = mapScale;
  1411.         for (var d = 0; d < gameMap.tiles.length; ++d) b.fillStyle = "#fff", gameMap.tiles[d].wall && b.fillRect(gameMap.tiles[d].x / gameWidth * mapScale, gameMap.tiles[d].y / gameHeight * mapScale, 1.08 * mapTileScale / gameWidth * mapScale, 1.08 * mapTileScale / gameWidth * mapScale);
  1412.         cachedMiniMap = a
  1413.     }
  1414.     return cachedMiniMap
  1415. }
  1416.  
  1417. function drawMiniMap() {
  1418.     mapCanvas.width = mapCanvas.width;
  1419.     mapContext.globalAlpha = 1;
  1420.     for (var a = 0; a < gameObjects.length; ++a) "player" == gameObjects[a].type && gameObjects[a].onScreen && (gameObjects[a].index == player.index || gameObjects[a].team == player.team || gameObjects[a].isBoss) && (mapContext.fillStyle = gameObjects[a].index == player.index ? "#fff" : gameObjects[a].isBoss ? "#db4fcd" : "#5151d9", mapContext.beginPath(), mapContext.arc(gameObjects[a].x / gameWidth * mapScale, gameObjects[a].y / gameHeight * mapScale, pingScale, 0, 2 * mathPI, !0), mapContext.closePath(), mapContext.fill());
  1421.     if (null != gameMap) {
  1422.         mapContext.globalAlpha = 1;
  1423.         mapContext.fillStyle = "#ffd100";
  1424.         for (a = 0; a < gameMap.pickups.length; ++a) gameMap.pickups[a].active && "lootcrate" == gameMap.pickups[a].type && (mapContext.beginPath(), mapContext.arc(gameMap.pickups[a].x / gameWidth * mapScale, gameMap.pickups[a].y / gameHeight * mapScale, pingScale, 0, 2 * mathPI, !0), mapContext.closePath(), mapContext.fill());
  1425.         mapContext.globalAlpha = .1;
  1426.         a = getCachedMiniMap();
  1427.         null != a && mapContext.drawImage(a, 0, 0, mapScale,
  1428.             mapScale);
  1429.         delete a
  1430.     }
  1431. }
  1432.  
  1433. function calculateUIScale() {
  1434.     uiScale = (screenHeight + screenWidth) / (originalScreenWidth + originalScreenHeight) * 1.25
  1435. }
  1436.  
  1437. function drawMenuBackground() {}
  1438.  
  1439. function drawUI() {}
  1440. var screenSkX = 0,
  1441.     screenShackeScale = 0,
  1442.     screenSkY = 0,
  1443.     screenSkRed = .5,
  1444.     screenSkDir = 0;
  1445.  
  1446. function screenShake(a, b) {
  1447.     screenShackeScale < a && (screenShackeScale = a, screenSkDir = b)
  1448. }
  1449.  
  1450. function updateScreenShake(a) {
  1451.     0 < screenShackeScale && (screenSkX = screenShackeScale * mathCOS(screenSkDir), screenSkY = screenShackeScale * mathSIN(screenSkDir), screenShackeScale *= screenSkRed, .1 >= screenShackeScale && (screenShackeScale = 0))
  1452. }
  1453. var userSprays = [],
  1454.     sprayMaxScale = 25,
  1455.     tmpSpray = tmpPlayer = null,
  1456.     cachedSprays = [];
  1457.  
  1458. function createSpray(a, b, d) {
  1459.     tmpPlayer = findUserByIndex(a);
  1460.     if (null != tmpPlayer) {
  1461.         tmpSpray = null;
  1462.         for (var e = 0; e < userSprays.length; ++e)
  1463.             if (userSprays[e].owner == a) {
  1464.                 tmpSpray = userSprays[e];
  1465.                 break
  1466.             }
  1467.         if (null == tmpSpray) {
  1468.             var f = new Image;
  1469.             f.owner = a;
  1470.             f.active = !1;
  1471.             f.xPos = 0;
  1472.             f.yPos = 0;
  1473.             f.onload = function() {
  1474.                 cacheSpray(f)
  1475.             };
  1476.             userSprays.push(f);
  1477.             tmpSpray = f
  1478.         }
  1479.         tmpSpray.active = !0;
  1480.         tmpSpray.scale = tmpPlayer.spray.info.scale;
  1481.         tmpSpray.alpha = tmpPlayer.spray.info.alpha;
  1482.         tmpSpray.xPos = b - tmpSpray.scale / 2;
  1483.         tmpSpray.yPos = d - tmpSpray.scale / 2;
  1484.         tmpSpray.src !=
  1485.             tmpPlayer.spray.src && (tmpSpray.src = tmpPlayer.spray.src)
  1486.     }
  1487. }
  1488.  
  1489. function sendSpray() {
  1490.     socket.emit("crtSpr")
  1491. }
  1492.  
  1493. function deactivateSprays() {
  1494.     for (var a = 0; a < userSprays.length; ++a) userSprays[a].active = !1
  1495. }
  1496. var tmpIndex = 0;
  1497.  
  1498. function cacheSpray(a) {
  1499.     tmpIndex = "" + a.src;
  1500.     tmpSpray = cachedSprays[tmpIndex];
  1501.     if (void 0 == tmpSpray && 0 != a.width) {
  1502.         var b = document.createElement("canvas"),
  1503.             d = b.getContext("2d");
  1504.         b.width = sprayMaxScale;
  1505.         b.height = sprayMaxScale;
  1506.         d.drawImage(a, 0, 0, sprayMaxScale, sprayMaxScale);
  1507.         var d = document.createElement("canvas"),
  1508.             e = d.getContext("2d");
  1509.         d.width = a.scale;
  1510.         d.height = a.scale;
  1511.         e.imageSmoothingEnabled = !1;
  1512.         e.webkitImageSmoothingEnabled = !1;
  1513.         e.mozImageSmoothingEnabled = !1;
  1514.         e.globalAlpha = a.alpha;
  1515.         e.drawImage(b, 0, 0, a.scale, a.scale);
  1516.         tmpSpray =
  1517.             d;
  1518.         cachedSprays[tmpIndex] = tmpSpray
  1519.     }
  1520. }
  1521.  
  1522. function drawSprays() {
  1523.     if (showSprays)
  1524.         for (var a = 0; a < userSprays.length; ++a) userSprays[a].active && (tmpSpray = cachedSprays["" + userSprays[a].src], void 0 != tmpSpray && graph.drawImage(tmpSpray, userSprays[a].xPos - startX, userSprays[a].yPos - startY))
  1525. }
  1526. var soundList = [{
  1527.         loc: "weapons/smg",
  1528.         id: "shot0",
  1529.         sound: null,
  1530.         loop: !1
  1531.     }, {
  1532.         loc: "weapons/revolver",
  1533.         id: "shot1",
  1534.         sound: null,
  1535.         loop: !1
  1536.     }, {
  1537.         loc: "weapons/sniper",
  1538.         id: "shot2",
  1539.         sound: null,
  1540.         loop: !1
  1541.     }, {
  1542.         loc: "weapons/toygun",
  1543.         id: "shot3",
  1544.         sound: null,
  1545.         loop: !1
  1546.     }, {
  1547.         loc: "weapons/shotgun",
  1548.         id: "shot4",
  1549.         sound: null,
  1550.         loop: !1
  1551.     }, {
  1552.         loc: "weapons/grenades",
  1553.         id: "shot5",
  1554.         sound: null,
  1555.         loop: !1
  1556.     }, {
  1557.         loc: "weapons/rockets",
  1558.         id: "shot6",
  1559.         sound: null,
  1560.         loop: !1
  1561.     }, {
  1562.         loc: "weapons/pistol",
  1563.         id: "shot7",
  1564.         sound: null,
  1565.         loop: !1
  1566.     }, {
  1567.         loc: "characters/footstep1",
  1568.         id: "step1",
  1569.         sound: null,
  1570.         loop: !1
  1571.     }, {
  1572.         loc: "characters/jump1",
  1573.         id: "jump1",
  1574.         sound: null,
  1575.         loop: !1
  1576.     }, {
  1577.         loc: "characters/death1",
  1578.         id: "death1",
  1579.         sound: null,
  1580.         loop: !1
  1581.     }, {
  1582.         loc: "characters/kill1",
  1583.         id: "kill1",
  1584.         sound: null,
  1585.         loop: !1
  1586.     }, {
  1587.         loc: "special/explosion",
  1588.         id: "explosion",
  1589.         sound: null,
  1590.         loop: !1
  1591.     }, {
  1592.         loc: "special/score",
  1593.         id: "score",
  1594.         sound: null,
  1595.         loop: !1
  1596.     }, {
  1597.         loc: "tracks/track1",
  1598.         id: "track1",
  1599.         sound: null,
  1600.         loop: !0,
  1601.         onload: function() {
  1602.             tmpList.track1.sound.play();
  1603.             !player.dead || startingGame ? tmpList.track1.sound.mute() : currentTrack = 1
  1604.         }
  1605.     }, {
  1606.         loc: "tracks/track2",
  1607.         id: "track2",
  1608.         sound: null,
  1609.         loop: !0,
  1610.         onload: function() {
  1611.             tmpList.track2.sound.play();
  1612.             player.dead || !gameStart || gameOver ? tmpList.track2.sound.mute() : currentTrack = 2
  1613.         }
  1614.     }],
  1615.     tmpSound = null,
  1616.     tmpFormat = null,
  1617.     tmpList = [],
  1618.     doSounds = !1;
  1619.  
  1620. function loadSounds(a) {
  1621.     if (!doSounds) return !1;
  1622.     tmpList = [];
  1623.     for (var b = 0; b < soundList.length; ++b) tmpSound = localStorage.getItem(a + soundList[b].loc + "data"), tmpFormat = localStorage.getItem(a + soundList[b].loc + "format"), loadSound(tmpSound, soundList[b], tmpFormat)
  1624. }
  1625.  
  1626. function loadSound(a, b, d) {
  1627.     void 0 != tmpList[b.id] && null != tmpList[b.id].sound && tmpList[b.id].sound.stop();
  1628.     tmpList[b.id] = b;
  1629.     tmpList[b.id].sound = new Howl({
  1630.         urls: [a],
  1631.         format: [d],
  1632.         loop: b.loop,
  1633.         onload: b.onload || function() {}
  1634.     })
  1635. }
  1636. var currentTrack = 0;
  1637.  
  1638. function startSoundTrack(a) {
  1639.     if (!doSounds) return !1;
  1640.     try {
  1641.         1 == a ? (currentTrack != a && (currentTrack = a, tmpList.track1.sound.fade(0, 1, 1E3)), tmpList.track2.sound.mute()) : (currentTrack != a && (currentTrack = a, tmpList.track2.sound.fade(0, 1, 1E3)), tmpList.track1.sound.mute())
  1642.     } catch (b) {
  1643.         console.log(b)
  1644.     }
  1645. }
  1646. var maxHearDist = 1500,
  1647.     tmpDist = 0;
  1648.  
  1649. function playSound(a, b, d) {
  1650.     if (!kicked && doSounds) try {
  1651.         tmpDist = getDistance(player.x, player.y, b, d), tmpDist <= maxHearDist && (tmpSound = tmpList[a], void 0 != tmpSound && (tmpSound = tmpSound.sound, tmpSound.volume(mathRound(10 * (1 - tmpDist / maxHearDist)) / 10), tmpSound.play()))
  1652.     } catch (e) {
  1653.         console.log(e)
  1654.     }
  1655. }
  1656.  
  1657. function stopAllSounds() {
  1658.     if (!doSounds) return !1;
  1659.     for (var a = 0; a < soundList.length; ++a) tmpList[soundList[a].id].sound.stop()
  1660. }
  1661. var spritesLoaded = !1,
  1662.     spriteIndex = 0,
  1663.     tmpPicture = null;
  1664.  
  1665. function getSprite(a) {
  1666.     var b = new Image;
  1667.     b.index = spriteIndex;
  1668.     b.flipped = !1;
  1669.     b.isLoaded = !1;
  1670.     b.onload = function() {
  1671.         b.isLoaded = !0;
  1672.         b.onload = null
  1673.     };
  1674.     b.onerror = function() {
  1675.         b.isLoaded = !1;
  1676.         console.log("File not Found: " + a + ".png")
  1677.     };
  1678.     try {
  1679.         tmpPicture = localStorage.getItem(a + ".png"), b.src = tmpPicture
  1680.     } catch (d) {
  1681.         console.log(d)
  1682.     }
  1683.     spriteIndex++;
  1684.     return b
  1685. }
  1686.  
  1687. function flipSprite(a, b) {
  1688.     try {
  1689.         var d = document.createElement("canvas"),
  1690.             e = d.getContext("2d");
  1691.         d.width = a.width;
  1692.         d.height = a.height;
  1693.         e.imageSmoothingEnabled = !1;
  1694.         e.webkitImageSmoothingEnabled = !1;
  1695.         e.mozImageSmoothingEnabled = !1;
  1696.         b ? (e.scale(-1, 1), e.drawImage(a, -d.width, 0, d.width, d.height)) : (e.scale(1, -1), e.drawImage(a, 0, -d.height, d.width, d.height));
  1697.         a.src = d.toDataURL();
  1698.         return a
  1699.     } catch (f) {
  1700.         console.log(f)
  1701.     }
  1702. }
  1703. var tmpSprite = null;
  1704.  
  1705. function getWeaponSprite(a, b) {
  1706.     try {
  1707.         var d = weaponSpriteSheet[a];
  1708.         void 0 != d && (90 == b ? tmpSprite = d.leftSprite : 180 == b ? tmpSprite = d.upSprite : 270 == b ? (!d.rightSprite.flipped && d.rightSprite.isLoaded && (d.rightSprite = flipSprite(d.rightSprite, !0), d.rightSprite.flipped = !0), tmpSprite = d.rightSprite) : tmpSprite = d.downSprite);
  1709.         delete d;
  1710.         return tmpSprite
  1711.     } catch (e) {
  1712.         console.log(e)
  1713.     }
  1714. }
  1715.  
  1716. function Projectile() {
  1717.     this.speed = this.width = this.height = this.jumpY = this.yOffset = this.dir = this.cEndY = this.cEndX = this.startY = this.y = this.startX = this.x = 0;
  1718.     this.active = !1;
  1719.     this.speed = this.trailWidth = this.trailMaxLength = this.trailAlpha = this.weaponIndex = this.spriteIndex = 0;
  1720.     this.owner = null;
  1721.     this.dmg = 0;
  1722.     this.serverIndex = this.lastHit = null;
  1723.     this.skipMove = !0;
  1724.     this.startTime = 0;
  1725.     this.maxLifeTime = null;
  1726.     this.bounce = this.explodeOnDeath = !1;
  1727.     var a = 0,
  1728.         b = 0,
  1729.         d = 0,
  1730.         e = 0;
  1731.     this.update = function(f) {
  1732.         if (this.active) {
  1733.             e = currentTime - this.startTime;
  1734.             this.skipMove && (e = 0, this.startTime = currentTime);
  1735.             for (var h = 0; 2 > h; ++h) {
  1736.                 var m = this.speed * f;
  1737.                 if (this.active) {
  1738.                     a = m * mathCOS(this.dir) / 2;
  1739.                     b = m * mathSIN(this.dir) / 2;
  1740.                     this.active && !this.skipMove && 0 < this.speed && (this.x += a, this.y += b, getDistance(this.startX, this.startY, this.x, this.y) >= this.trailMaxLength && (this.startX += a, this.startY += b));
  1741.                     this.cEndX = this.x + (m + this.height) * mathCOS(this.dir) / 2;
  1742.                     this.cEndY = this.y + (m + this.height) * mathSIN(this.dir) / 2;
  1743.                     for (m = 0; m < gameObjects.length; ++m) k = gameObjects[m], this.active && "clutter" ==
  1744.                         k.type && k.active && k.hc && this.canSeeObject(k, k.h) && k.h * k.tp >= this.yOffset && this.lineInRect(k.x, k.y - k.h, k.w, k.h - this.yOffset) && (this.bounce ? this.bounceDir(this.cEndY <= k.y - k.h || this.cEndY >= k.y - this.yOffset) : (this.active = !1, this.hitSomething(!1, 2)));
  1745.                     if (this.active)
  1746.                         for (var k, m = 0; m < gameMap.tiles.length; ++m) this.active && (k = gameMap.tiles[m], k.wall && k.hasCollision && this.canSeeObject(k, k.scale) && (k.bottom ? this.lineInRect(k.x, k.y, k.scale, k.scale) && (this.active = !1) : this.lineInRect(k.x, k.y, k.scale, k.scale - this.owner.height -
  1747.                             this.jumpY) && (this.active = !1), this.active || (this.bounce ? this.bounceDir(!(this.cEndX <= k.x || this.cEndX >= k.x + k.scale)) : this.hitSomething(!(this.cEndX <= k.x || this.cEndX >= k.x + k.scale), 2))));
  1748.                     if (this.active && this.owner.index == player.index)
  1749.                         for (m = 0; m < gameObjects.length && (k = gameObjects[m], k.index == this.owner.index || k.team == this.owner.team || "player" != k.type || !k.onScreen || k.dead || (this.lineInRect(k.x - k.width / 2, k.y - k.height - k.jumpY, k.width, k.height) && 0 >= k.spawnProtection && (this.explodeOnDeath ? this.active = !1 : 0 <
  1750.                                 this.dmg && this.lastHit != k && (this.lastHit = k, particleCone(12, k.x, k.y - k.height / 2 - k.jumpY, this.dir + mathPI, mathPI / randomInt(5, 7), .5, 16, 0, !0), createLiquid(k.x, k.y, this.dir, 4), 0 < this.pierceCount ? this.pierceCount-- : this.active = !1)), this.active)); ++m);
  1751.                     null != this.maxLifeTime && e >= this.maxLifeTime && (this.active = !1)
  1752.                 }
  1753.             }
  1754.             1 == this.spriteIndex && (d -= f, 0 >= d && (stillDustParticle(this.x, this.y, !0), d = 20))
  1755.         } else !this.active && 0 < this.trailAlpha && (this.trailAlpha -= .001 * f, 0 >= this.trailAlpha && (this.trailAlpha = 0));
  1756.         this.skipMove = !1
  1757.     };
  1758.     this.activate = function() {
  1759.         this.skipMove = !0;
  1760.         this.lastHit = null;
  1761.         this.active = !0;
  1762.         playSound("shot" + this.weaponIndex, this.x, this.y)
  1763.     };
  1764.     var f = 0,
  1765.         h = 0;
  1766.     this.canSeeObject = function(a, b) {
  1767.         f = mathABS(this.cEndX - a.x);
  1768.         h = mathABS(this.cEndY - a.y);
  1769.         return f <= 2 * (b + this.height) && h <= 2 * (b + this.height)
  1770.     };
  1771.     this.deactivate = function() {
  1772.         this.active = !1
  1773.     };
  1774.     this.hitSomething = function(a, b) {
  1775.         particleCone(10, this.cEndX, this.cEndY, this.dir + mathPI, mathPI / randomInt(5, 7), .5, 16, b, a)
  1776.     };
  1777.     this.bounceDir = function(a) {
  1778.         this.dir = a ? 2 * mathPI - this.dir : mathPI - this.dir;
  1779.         this.active = !0;
  1780.         this.speed *= .65;
  1781.         this.x = this.cEndX;
  1782.         this.y = this.cEndY
  1783.     };
  1784.     this.lineInRect = function(a, b, d, e) {
  1785.         var f = this.x,
  1786.             h = this.y,
  1787.             p = f,
  1788.             t = this.cEndX;
  1789.         p > t && (p = this.cEndX, t = f);
  1790.         t > a + d && (t = a + d);
  1791.         p < a && (p = a);
  1792.         if (p > t) return !1;
  1793.         var r = h,
  1794.             q = this.cEndY,
  1795.             v = this.cEndX - f;
  1796.         1E-7 < mathABS(v) && (q = (this.cEndY - h) / v, f = h - q * f, r = q * p + f, q = q * t + f);
  1797.         r > q && (p = q, q = r, r = p);
  1798.         q > b + e && (q = b + e);
  1799.         r < b && (r = b);
  1800.         if (r > q) return !1;
  1801.         this.adjustOnCollision(a, b, d, e);
  1802.         return !0
  1803.     };
  1804.     this.dotInRect = function(a, b, d, e, f, h) {
  1805.         return a >= d && a <= d + f && b >= e && b <= e + h
  1806.     };
  1807.     this.adjustOnCollision =
  1808.         function(a, b, d, e) {
  1809.             for (var f = 100, h = this.cEndX, p = this.cEndY; 0 < f;) f--, this.dotInRect(h, p, a, b, d, e) ? f = 0 : (h += 2 * mathCOS(this.dir + mathPI), p += 2 * mathSIN(this.dir + mathPI));
  1810.             for (f = 100; 0 < f;) f--, this.dotInRect(h, p, a, b, d, e) ? (h += 2 * mathCOS(this.dir + mathPI), p += 2 * mathSIN(this.dir + mathPI)) : f = 0;
  1811.             this.cEndX = h;
  1812.             this.cEndY = p;
  1813.             this.x = this.cEndX;
  1814.             this.y = this.cEndY
  1815.         }
  1816. }
  1817. var bulletIndex = 0;
  1818.  
  1819. function getNextBullet() {
  1820.     bulletIndex++;
  1821.     bulletIndex >= bullets.length && (bulletIndex = 0);
  1822.     return bullets[bulletIndex]
  1823. }
  1824.  
  1825. function getCurrentWeapon(a) {
  1826.     return void 0 != a.weapons && void 0 != a.weapons[a.currentWeapon] ? a.weapons[a.currentWeapon] : null
  1827. }
  1828.  
  1829. function playerSwapWeapon(a, b) {
  1830.     null == a || a.dead || (a.currentWeapon += b, 0 > a.currentWeapon && (a.currentWeapon = a.weapons.length - 1), a.currentWeapon >= a.weapons.length && (a.currentWeapon = 0), playerEquipWeapon(a, a.currentWeapon), updateWeaponUI(a, !1), socket.emit("sw", a.currentWeapon))
  1831. }
  1832.  
  1833. function playerEquipWeapon(a, b) {
  1834.     a.currentWeapon = b
  1835. }
  1836. var actionBar = document.getElementById("actionBar"),
  1837.     tmpDiv = null;
  1838.  
  1839. function updateWeaponUI(a, b) {
  1840.     if (void 0 == weaponSpriteSheet[0]) return !1;
  1841.     b && (actionBar.innerHTML = "");
  1842.     if ("" == actionBar.innerHTML)
  1843.         for (var d = 0; d < a.weapons.length; ++d) {
  1844.             var e = document.createElement("div");
  1845.             e.id = "actionContainer" + d;
  1846.             e.className = d == a.currentWeapon ? "actionContainerActive" : "actionContainer";
  1847.             tmpDiv = weaponSpriteSheet[a.weapons[d].weaponIndex].icon;
  1848.             tmpDiv.className = "actionItem";
  1849.             var f = document.createElement("div");
  1850.             f.id = "actionCooldown" + d;
  1851.             f.className = "actionCooldown";
  1852.             e.appendChild(f);
  1853.             e.appendChild(tmpDiv);
  1854.             actionBar.appendChild(e)
  1855.         } else
  1856.             for (d = 0; d < a.weapons.length; ++d) tmpDiv = document.getElementById("actionContainer" + d), tmpDiv.className = d == a.currentWeapon ? "actionContainerActive" : "actionContainer";
  1857.     updateUiStats(a)
  1858. }
  1859.  
  1860. function setCooldownAnimation(a, b, d) {
  1861.     tmpDiv = document.getElementById("actionCooldown" + a);
  1862.     d ? (tmpDiv.style.height = "100%", $("#actionCooldown" + a).animate({
  1863.         height: "0%"
  1864.     }, b)) : tmpDiv.style.height = "0%"
  1865. }
  1866.  
  1867. function shootNextBullet(a, b) {
  1868.     var d = getNextBullet();
  1869.     void 0 != d && (d.serverIndex = a.si, d.x = a.x, d.startX = a.x, d.y = a.y, d.startY = a.y, d.dir = a.d, d.speed = getCurrentWeapon(b).bSpeed, d.width = getCurrentWeapon(b).bWidth, d.trailWidth = .7 * d.width, d.height = getCurrentWeapon(b).bHeight, d.trailMaxLength = mathRound(5 * d.height), d.trailAlpha = getCurrentWeapon(b).bTrail, d.weaponIndex = getCurrentWeapon(b).weaponIndex, d.spriteIndex = getCurrentWeapon(b).bSprite, d.yOffset = getCurrentWeapon(b).yOffset, d.jumpY = b.jumpY, d.owner = b, d.dmg =
  1870.         getCurrentWeapon(b).dmg, d.bounce = getCurrentWeapon(b).bounce, d.startTime = currentTime, d.maxLifeTime = getCurrentWeapon(b).maxLife, b.index == player.index && getCurrentWeapon(b).distBased && (d.maxLifeTime = target.d / d.speed), d.explodeOnDeath = getCurrentWeapon(b).explodeOnDeath, d.pierceCount = getCurrentWeapon(b).pierceCount, d.activate(), console.log(b.x));
  1871.     delete d
  1872. }
  1873.  
  1874. function shootBullet(a) {
  1875.     if (!a.dead && void 0 != getCurrentWeapon(a) && 0 == a.spawnProtection)
  1876.         if (0 <= getCurrentWeapon(a).weaponIndex && 0 >= getCurrentWeapon(a).reloadTime && 0 < getCurrentWeapon(a).ammo) {
  1877.             screenShake(getCurrentWeapon(a).shake, target.f);
  1878.             for (var b = 0; b < getCurrentWeapon(a).bulletsPerShot; ++b) {
  1879.                 getCurrentWeapon(a).spreadIndex++;
  1880.                 getCurrentWeapon(a).spreadIndex >= getCurrentWeapon(a).spread.length && (getCurrentWeapon(a).spreadIndex = 0);
  1881.                 var d = getCurrentWeapon(a).spread[getCurrentWeapon(a).spreadIndex],
  1882.                     d = (target.f +
  1883.                         mathPI + d).round(2),
  1884.                     e = getCurrentWeapon(a).holdDist + getCurrentWeapon(a).bDist,
  1885.                     f = mathRound(a.x + e * mathCOS(d)),
  1886.                     e = mathRound(a.y - getCurrentWeapon(a).yOffset - a.jumpY + e * mathSIN(d));
  1887.                 shootNextBullet({
  1888.                     x: f,
  1889.                     y: e,
  1890.                     d: d,
  1891.                     si: -1
  1892.                 }, a)
  1893.             }
  1894.             socket.emit("1", target.f, target.d, currentTime);
  1895.             getCurrentWeapon(a).lastShot = currentTime;
  1896.             getCurrentWeapon(a).ammo--;
  1897.             0 >= getCurrentWeapon(a).ammo && playerReload(a);
  1898.             updateUiStats(a)
  1899.         } else 0 <= getCurrentWeapon(a).weaponIndex && 0 >= getCurrentWeapon(a).reloadTime && playerReload(a)
  1900. }
  1901.  
  1902. function playerReload(a) {
  1903.     0 >= getCurrentWeapon(a).reloadTime && getCurrentWeapon(a).ammo != getCurrentWeapon(a).maxAmmo && (getCurrentWeapon(a).reloadTime = getCurrentWeapon(a).reloadSpeed, showNotification("Reloading"), socket.emit("r"), setCooldownAnimation(a.currentWeapon, getCurrentWeapon(a).reloadTime, !0))
  1904. }
  1905.  
  1906. function findServerBullet(a) {
  1907.     for (var b = 0; b < bullets.length; ++b)
  1908.         if (bullets[b].serverIndex == a) return bullets[b]
  1909. }
  1910.  
  1911. function someoneShot(a) {
  1912.     a.i != player.index && (tmpPlayer = findUserByIndex(a.i), null != tmpPlayer && shootNextBullet(a, tmpPlayer))
  1913. }
  1914. var trailGrad = null;
  1915.  
  1916. function updateBullets(a) {
  1917.     var b, d;
  1918.     graph.globalAlpha = 1;
  1919.     for (var e, f, h = null, g = 0; g < bullets.length; g++) h = bullets[g], h.update(a), bullets[g].active && (b = h.x - startX, d = h.y - startY, canSee(b, d, h.height, h.height) && (graph.save(), graph.translate(b, d), drawSprite(graph, bulletSprites[h.spriteIndex], -(h.width / 2), 0, h.width, h.height + 8, h.dir - mathPI / 2, !1, 0, 0, 0), graph.restore())), showParticles && 0 < h.trailAlpha && (graph.save(), b = mathRound(h.startX - startX), d = mathRound(h.startY - startY), e = mathRound(h.x - startX), f = mathRound(h.y -
  1920.         startY), trailGrad = graph.createLinearGradient(b, d, e, f), trailGrad.addColorStop(0, "rgba(255, 255, 255, 0)"), trailGrad.addColorStop(1, "rgba(255, 255, 255, " + h.trailAlpha + ")"), graph.strokeStyle = trailGrad, graph.lineWidth = h.trailWidth, graph.beginPath(), graph.moveTo(b, d), graph.lineTo(e, f), graph.closePath(), graph.stroke(), graph.restore());
  1921.     delete h
  1922. }
  1923. var weaponNames = "smg revolver sniper toygun shotgun grenades rockets pistol".split(" "),
  1924.     characterClasses = [{
  1925.         classN: "Triggerman",
  1926.         name: "Tony Cavalaro",
  1927.         weapon: "Machine Gun & Grenades",
  1928.         desc: "Firerate ++<br />Accuracy +",
  1929.         folderName: "triggerman",
  1930.         hasDown: !1
  1931.     }, {
  1932.         classN: "Detective",
  1933.         name: "Valentine",
  1934.         weapon: "Revolver & Grenades",
  1935.         desc: "Damage ++<br />Mobility +",
  1936.         folderName: "detective",
  1937.         hasDown: !1
  1938.     }, {
  1939.         classN: "Hunter",
  1940.         name: "John Nash",
  1941.         weapon: "Sniper & Pistol",
  1942.         desc: "Damage +++<br />Vision ++<br />Health - -",
  1943.         folderName: "hunter",
  1944.         hasDown: !0
  1945.     }, {
  1946.         classN: "Run 'N Gun",
  1947.         name: "Billy the Kid",
  1948.         weapon: "Toy Blaster",
  1949.         desc: "Firerate +++<br />Mobility ++<br />Accuracy - -<br />Damage - -",
  1950.         folderName: "billy",
  1951.         hasDown: !1
  1952.     }, {
  1953.         classN: "Vince",
  1954.         name: "Vincent de Vries",
  1955.         weapon: "Shotgun & Grenades",
  1956.         desc: "Damage +<br />Spread ++",
  1957.         folderName: "vinc",
  1958.         hasDown: !1
  1959.     }, {
  1960.         classN: "Rocketeer",
  1961.         name: "General Weiss",
  1962.         weapon: "Rockets",
  1963.         desc: "Damage +++<br />Health ++<br />Mobility - -",
  1964.         folderName: "rocketeer",
  1965.         hasDown: !1
  1966.     }],
  1967.     specialClasses = [{
  1968.         weapon: "???",
  1969.         name: "???",
  1970.         folderName: "boss1",
  1971.         hasDown: !1
  1972.     }],
  1973.     currentClassID = 0,
  1974.     currentClass = document.getElementById("currentClass"),
  1975.     classList = document.getElementById("classList"),
  1976.     characterWepnDisplay = document.getElementById("charWpn");
  1977.  
  1978. function createClassList() {
  1979.     for (var a = "", b = 0; b < characterClasses.length; ++b) a += "<div class='hatSelectItem' id='classItem" + b + "' onclick='pickedCharacter(" + b + ");'>" + characterClasses[b].classN + "<div class='hoverTooltip' style='width:200px'><div style='font-size:16px; margin-top:5px;'>" + characterClasses[b].name + "</div><div style='color:#ffd100; font-size:12px; margin-top:5px;'>" + characterClasses[b].weapon + "</div><div style='font-size:12px; margin-top:5px; color:#d8d8d8;'>" + characterClasses[b].desc + "</div></div></div>";
  1980.     classList.innerHTML = a
  1981. }
  1982. createClassList();
  1983.  
  1984. function showClassselector() {
  1985.     charSelectorCont.style.display = "none";
  1986.     lobbySelectorCont.style.display = "none";
  1987.     classSelector.style.display = "block"
  1988. }
  1989. "" != getCookie("previousClass") ? (previousClass = getCookie("previousClass"), pickedCharacter(previousClass)) : pickedCharacter(0);
  1990.  
  1991. function pickedCharacter(a) {
  1992.     currentClassID = a;
  1993.     currentClass.innerHTML = document.getElementById("classItem" + a).innerHTML;
  1994.     currentClass.style.color = document.getElementById("classItem" + a).style.color;
  1995.     characterWepnDisplay.innerHTML = "<b>Gear: </b>" + characterClasses[a].weapon;
  1996.     setCookie("previousClass", a);
  1997.     charSelectorCont.style.display = "block";
  1998.     lobbySelectorCont.style.display = "block";
  1999.     classSelector.style.display = "none";
  2000.     lobbySelector.style.display = "none";
  2001.     lobbyCSelector.style.display = "none";
  2002.     hatSelector.style.display =
  2003.         "none";
  2004.     spraySelector.style.display = "none"
  2005. }
  2006. var animLength = 3,
  2007.     tmpSprite = null,
  2008.     tmpIndex = 0,
  2009.     classSpriteSheets = [];
  2010.  
  2011. function loadPlayerSprites(a) {
  2012.     classSpriteSheets = [];
  2013.     loadPlayerSpriteArray(a, characterClasses);
  2014.     loadPlayerSpriteArray(a, specialClasses);
  2015.     resize()
  2016. }
  2017.  
  2018. function loadPlayerSpriteArray(a, b) {
  2019.     for (var d = 0; d < b.length; ++d) {
  2020.         var e = [],
  2021.             f = [],
  2022.             h = [],
  2023.             g = [];
  2024.         e.push(getSprite(a + "characters/" + b[d].folderName + "/up"));
  2025.         f.push(getSprite(a + "characters/" + b[d].folderName + "/down"));
  2026.         h.push(getSprite(a + "characters/" + b[d].folderName + "/left"));
  2027.         g.push(getSprite(a + "characters/" + b[d].folderName + "/left"));
  2028.         for (var l = 0; l < animLength; ++l) tmpIndex = l, e.push(getSprite(a + "characters/" + b[d].folderName + "/up" + (tmpIndex + 1))), tmpSprite = b[d].hasDown ? getSprite(a + "characters/" + b[d].folderName + "/down" +
  2029.             (tmpIndex + 1)) : getSprite(a + "characters/" + b[d].folderName + "/up" + (tmpIndex + 1)), f.push(tmpSprite), 2 <= tmpIndex && (tmpIndex = 0), h.push(getSprite(a + "characters/" + b[d].folderName + "/left" + (tmpIndex + 1))), g.push(getSprite(a + "characters/" + b[d].folderName + "/left" + (tmpIndex + 1)));
  2030.         var l = getSprite(a + "characters/" + b[d].folderName + "/arm"),
  2031.             m = getSprite(a + "characters/" + b[d].folderName + "/hd"),
  2032.             k = getSprite(a + "characters/" + b[d].folderName + "/hu"),
  2033.             u = getSprite(a + "characters/" + b[d].folderName + "/hl"),
  2034.             w = getSprite(a + "characters/" +
  2035.                 b[d].folderName + "/hl");
  2036.         classSpriteSheets.push({
  2037.             upSprites: e,
  2038.             downSprites: f,
  2039.             leftSprites: h,
  2040.             rightSprites: g,
  2041.             arm: l,
  2042.             hD: m,
  2043.             hU: k,
  2044.             hL: u,
  2045.             hR: w
  2046.         })
  2047.     }
  2048. }
  2049. var flagSprites = [],
  2050.     clutterSprites = [],
  2051.     cachedWalls = [],
  2052.     floorSprites = [],
  2053.     cachedFloors = [],
  2054.     sideWalkSprite = null,
  2055.     ambientSprites = [],
  2056.     wallSpritesSeg = [],
  2057.     particleSprites = [],
  2058.     weaponSpriteSheet = [],
  2059.     bulletSprites = [],
  2060.     cachedShadows = [],
  2061.     wallSprite = null,
  2062.     darkFillerSprite = null,
  2063.     healthPackSprite = null,
  2064.     lootCrateSprite = null,
  2065.     weaponWidth = 27,
  2066.     weaponHeight = 54;
  2067.  
  2068. function loadDefaultSprites(a) {
  2069.     cachedShadows = [];
  2070.     flagSprites = [];
  2071.     clutterSprites = [];
  2072.     cachedWalls = [];
  2073.     cachedFloors = [];
  2074.     floorSprites = [];
  2075.     ambientSprites = [];
  2076.     wallSpritesSeg = [];
  2077.     particleSprites = [];
  2078.     flagSprites.push(getSprite(a + "flags/flagw1"));
  2079.     flagSprites.push(getSprite(a + "flags/flagw2"));
  2080.     flagSprites.push(getSprite(a + "flags/flagw3"));
  2081.     clutterSprites.push(getSprite(a + "clutter/crate1"));
  2082.     clutterSprites.push(getSprite(a + "clutter/barrel1"));
  2083.     clutterSprites.push(getSprite(a + "clutter/barrel2"));
  2084.     clutterSprites.push(getSprite(a +
  2085.         "clutter/bottle1"));
  2086.     clutterSprites.push(getSprite(a + "clutter/spike1"));
  2087.     wallSprite = getSprite(a + "wall1");
  2088.     ambientSprites.push(getSprite(a + "ambient1"));
  2089.     darkFillerSprite = getSprite(a + "darkfiller");
  2090.     floorSprites.push(getSprite(a + "ground1"));
  2091.     floorSprites.push(getSprite(a + "ground2"));
  2092.     floorSprites.push(getSprite(a + "ground3"));
  2093.     sideWalkSprite = getSprite(a + "sidewalk1");
  2094.     wallSpritesSeg.push(getSprite(a + "wallSegment1"));
  2095.     wallSpritesSeg.push(getSprite(a + "wallSegment2"));
  2096.     wallSpritesSeg.push(getSprite(a + "wallSegment3"));
  2097.     particleSprites.push(getSprite(a + "particles/blood/blood"));
  2098.     particleSprites.push(getSprite(a + "particles/oil/oil"));
  2099.     particleSprites.push(getSprite(a + "particles/wall"));
  2100.     particleSprites.push(getSprite(a + "particles/hole"));
  2101.     particleSprites.push(getSprite(a + "particles/blood/splatter1"));
  2102.     particleSprites.push(getSprite(a + "particles/blood/splatter2"));
  2103.     particleSprites.push(getSprite(a + "particles/explosion"));
  2104.     healthPackSprite = getSprite(a + "healthpack");
  2105.     lootCrateSprite = getSprite(a + "lootCrate1");
  2106.     weaponSpriteSheet = [];
  2107.     for (var b = 0; b < weaponNames.length; ++b) {
  2108.         var d, e, f, h, g;
  2109.         d = getSprite(a + "weapons/" + weaponNames[b] + "/up");
  2110.         e = getSprite(a + "weapons/" + weaponNames[b] + "/up");
  2111.         f = getSprite(a + "weapons/" + weaponNames[b] + "/left");
  2112.         h = getSprite(a + "weapons/" + weaponNames[b] + "/left");
  2113.         g = getSprite(a + "weapons/" + weaponNames[b] + "/icon");
  2114.         weaponSpriteSheet.push({
  2115.             upSprite: d,
  2116.             downSprite: e,
  2117.             leftSprite: f,
  2118.             rightSprite: h,
  2119.             icon: g
  2120.         })
  2121.     }
  2122.     bulletSprites.push(getSprite(a + "weapons/bullet"));
  2123.     bulletSprites.push(getSprite(a + "weapons/grenade"));
  2124.     resize()
  2125. }
  2126. var mainTitleText = document.getElementById("mainTitleText");
  2127.  
  2128. function updateMenuInfo(a) {
  2129.     mainTitleText.innerHTML = a
  2130. }
  2131. var linkedMod = location.hash.replace("#", "");
  2132. loadModPack(linkedMod, "" == linkedMod);
  2133. var loadingTexturePack = !1,
  2134.     modInfo = document.getElementById("modInfo");
  2135.  
  2136. function setModInfoText(a) {
  2137.     void 0 != modInfo && (modInfo.innerHTML = a)
  2138. }
  2139. var fileFormat = "";
  2140.  
  2141. function loadModPack(a, b) {
  2142.     try {
  2143.         if (!loadingTexturePack) {
  2144.             var d = function() {
  2145.                     this.numFiles;
  2146.                     this.progress;
  2147.                     this.reader;
  2148.                     this.init = function(a, b) {
  2149.                         this.numFiles = b;
  2150.                         this.progress = 0;
  2151.                         this.reader = a
  2152.                     };
  2153.                     this.close = function() {
  2154.                         this.reader ? (this.progress++, this.numFiles === this.progress && (spriteIndex = 0, loadPlayerSprites("sprites/"), loadDefaultSprites("sprites/"), loadSounds("sounds/"), localStorage.clear(), this.reader.close(), this.reader = void 0, loadingTexturePack = !1)) : console.log("reader not valid")
  2155.                     }
  2156.                 },
  2157.                 e = function(a) {
  2158.                     this.typeName =
  2159.                         a;
  2160.                     var b = this;
  2161.                     this.process = function(a) {
  2162.                         try {
  2163.                             if (-1 < b.typeName.indexOf("modinfo")) setModInfoText(a);
  2164.                             else if (-1 < b.typeName.indexOf("cssmod")) {
  2165.                                 var d = document.createElement("style");
  2166.                                 d.type = "text/css";
  2167.                                 d.innerHTML = a;
  2168.                                 document.getElementsByTagName("head")[0].appendChild(d)
  2169.                             } else if (-1 < b.typeName.indexOf("gameinfo")) {
  2170.                                 var e = a.replace(/(\r\n|\n|\r)/gm, ""),
  2171.                                     f = JSON.parse(e);
  2172.                                 updateMenuInfo(f.name)
  2173.                             } else if (-1 < b.typeName.indexOf("charinfo")) {
  2174.                                 var h = a.replace(/(\r\n|\n|\r)/gm, "").split("|");
  2175.                                 characterClasses = [];
  2176.                                 for (a = 0; a <
  2177.                                     h.length; ++a) characterClasses.push(JSON.parse(h[a]));
  2178.                                 createClassList();
  2179.                                 pickedCharacter(currentClassID)
  2180.                             }
  2181.                         } catch (g) {
  2182.                             console.log("Script Read Error: " + g)
  2183.                         }
  2184.                         zipFileCloser.close()
  2185.                     }
  2186.                 },
  2187.                 f = function(a, b) {
  2188.                     this.filename = a;
  2189.                     this.soundAsDataURL = this.tmpLocation = "";
  2190.                     this.format = b;
  2191.                     var d = this;
  2192.                     this.process = function(a) {
  2193.                         if (this.soundAsDataURL = URL.createObjectURL(a)) {
  2194.                             try {
  2195.                                 this.tmpLocation = d.filename, localStorage.setItem(this.tmpLocation + "data", this.soundAsDataURL), localStorage.setItem(this.tmpLocation + "format", d.format)
  2196.                             } catch (b) {
  2197.                                 console.log("Storage failed: " +
  2198.                                     b)
  2199.                             }
  2200.                             zipFileCloser.close()
  2201.                         } else console.log("failed to generate url: " + d.filename)
  2202.                     }
  2203.                 },
  2204.                 h = function(a) {
  2205.                     this.filename = a;
  2206.                     this.imgAsDataURL = this.tmpLocation = "";
  2207.                     var b = this;
  2208.                     this.process = function(a) {
  2209.                         if (this.imgAsDataURL = URL.createObjectURL(a)) {
  2210.                             try {
  2211.                                 this.tmpLocation = b.filename, localStorage.setItem(this.tmpLocation, this.imgAsDataURL)
  2212.                             } catch (d) {
  2213.                                 console.log("Storage failed: " + d)
  2214.                             }
  2215.                             zipFileCloser.close()
  2216.                         } else console.log("failed to generate url: " + b.filename)
  2217.                     }
  2218.                 },
  2219.                 g = "";
  2220.             if (b) doSounds = !1, g = ".././res.zip";
  2221.             else {
  2222.                 if ("" == a) return setModInfoText("Please enter a mod Key"), !1;
  2223.                 a += "/vertixmod.zip";
  2224.                 loadingTexturePack = doSounds = !0;
  2225.                 g = "https://dl.dropboxusercontent.com/s/" + a
  2226.             }
  2227.             b || setModInfoText("Loading...");
  2228.             zipFileCloser || (zipFileCloser = new d);
  2229.             var l = "";
  2230.             zip.createReader(new zip.HttpReader(g), function(a) {
  2231.                 a.getEntries(function(b) {
  2232.                     if (b.length) {
  2233.                         zipFileCloser.init(a, b.length);
  2234.                         for (var d = 0; d < b.length; d++) {
  2235.                             var g = b[d];
  2236.                             g.directory ? zipFileCloser.close() : (g.filename = g.filename.replace("vertixmod/", ""), fileFormat = g.filename.split(".")[g.filename.split(".").length - 1], l = g.filename.split("/")[0],
  2237.                                 "scripts" == l ? g.getData(new zip.TextWriter, (new e(g.filename)).process, function(a, b) {}) : "sprites" == l ? g.getData(new zip.BlobWriter("image/png"), (new h(g.filename)).process, function(a, b) {}) : "sounds" == l ? g.getData(new zip.BlobWriter("audio/" + fileFormat), (new f(g.filename.replace("." + fileFormat, ""), fileFormat)).process, function(a, b) {}) : (loadingTexturePack = !1, setModInfoText("Mod could not be loaded")))
  2238.                         }
  2239.                     }
  2240.                 })
  2241.             }, function(a) {
  2242.                 loadingTexturePack = !1;
  2243.                 console.log(a);
  2244.                 setModInfoText("Mod could not be loaded")
  2245.             })
  2246.         }
  2247.     } catch (m) {
  2248.         console.log(m),
  2249.             loadingTexturePack = !1, setModInfoText("Mod could not be loaded")
  2250.     }
  2251. }
  2252.  
  2253. function getPlayerSprite(a, b, d) {
  2254.     tmpSpriteCollection = classSpriteSheets[a];
  2255.     if (void 0 == tmpSpriteCollection) return null;
  2256.     90 == b ? tmpSprite = tmpSpriteCollection.leftSprites[d] : 180 == b ? tmpSprite = tmpSpriteCollection.upSprites[d] : 270 == b ? (!tmpSpriteCollection.rightSprites[d].flipped && tmpSpriteCollection.rightSprites[d].isLoaded && (tmpSpriteCollection.rightSprites[d] = flipSprite(tmpSpriteCollection.rightSprites[d], !0), tmpSpriteCollection.rightSprites[d].flipped = !0), tmpSprite = tmpSpriteCollection.rightSprites[d]) : tmpSprite =
  2257.         tmpSpriteCollection.downSprites[d];
  2258.     return tmpSprite
  2259. }
  2260. var cachedHats = [],
  2261.     tmpAcc = null;
  2262.  
  2263. function getHatSprite(a, b) {
  2264.     tmpAcc = a.account;
  2265.     if (void 0 != tmpAcc)
  2266.         if (null != tmpAcc.hat)
  2267.             if (tmpSprite = cachedHats[tmpAcc.hat.id], void 0 == tmpSprite) {
  2268.                 var d = {
  2269.                     lS: null,
  2270.                     uS: null,
  2271.                     rS: null,
  2272.                     dS: null,
  2273.                     imgToLoad: 0
  2274.                 };
  2275.                 tmpAcc.hat.left && (d.imgToLoad++, d.lS = new Image, d.lS.index = spriteIndex, spriteIndex++, d.lS.src = ".././images/hats/" + tmpAcc.hat.id + "/l.png", d.lS.onload = function() {
  2276.                         d.imgToLoad--;
  2277.                         d.lS.isLoaded = !0;
  2278.                         d.lS.onload = null
  2279.                     }, d.imgToLoad++, d.rS = new Image, d.rS.index = spriteIndex, spriteIndex++, d.rS.src = ".././images/hats/" + tmpAcc.hat.id +
  2280.                     "/l.png", d.rS.onload = function() {
  2281.                         d.rS = flipSprite(d.rS, !0);
  2282.                         d.imgToLoad--;
  2283.                         d.rS.isLoaded = !0;
  2284.                         d.rS.onload = null
  2285.                     });
  2286.                 tmpAcc.hat.up && (d.imgToLoad++, d.uS = new Image, d.uS.index = spriteIndex, spriteIndex++, d.uS.src = ".././images/hats/" + tmpAcc.hat.id + "/u.png", d.uS.onload = function() {
  2287.                     d.imgToLoad--;
  2288.                     d.uS.isLoaded = !0;
  2289.                     d.uS.onload = null
  2290.                 });
  2291.                 d.imgToLoad++;
  2292.                 d.dS = new Image;
  2293.                 d.dS.index = spriteIndex;
  2294.                 spriteIndex++;
  2295.                 d.dS.src = ".././images/hats/" + tmpAcc.hat.id + "/d.png";
  2296.                 d.dS.onload = function() {
  2297.                     d.imgToLoad--;
  2298.                     d.dS.isLoaded = !0;
  2299.                     d.dS.onload = null
  2300.                 };
  2301.                 cachedHats[tmpAcc.hat.id] = d
  2302.             } else {
  2303.                 if (0 >= tmpSprite.imgToLoad) return tmpAcc.hat.left && 90 == b ? tmpSprite.lS : tmpAcc.hat.up && 180 == b ? tmpSprite.uS : tmpAcc.hat.left && 270 == b ? tmpSprite.rS : tmpSprite.dS
  2304.             }
  2305.     else {
  2306.         tmpSpriteCollection = classSpriteSheets[a.classIndex];
  2307.         if (void 0 == tmpSpriteCollection) return null;
  2308.         90 == b ? tmpSprite = tmpSpriteCollection.hL : 180 == b ? tmpSprite = tmpSpriteCollection.hU : 270 == b ? (!tmpSpriteCollection.hR.flipped && tmpSpriteCollection.hR.isLoaded && (tmpSpriteCollection.hR = flipSprite(tmpSpriteCollection.hR, !0),
  2309.             tmpSpriteCollection.hR.flipped = !0), tmpSprite = tmpSpriteCollection.hR) : tmpSprite = tmpSpriteCollection.hD;
  2310.         return tmpSprite
  2311.     }
  2312.     return null
  2313. }
  2314. var playerCanvas = document.createElement("canvas"),
  2315.     playerContext = playerCanvas.getContext("2d"),
  2316.     initPlayerCanv = !1;
  2317.  
  2318. function drawGameObjects(a) {
  2319.     initPlayerCanv || (playerCanvas.width = mathRound(300), playerCanvas.height = mathRound(500), playerContext.imageSmoothingEnabled = !1, playerContext.webkitImageSmoothingEnabled = !1, playerContext.mozImageSmoothingEnabled = !1, initPlayerCanv = !0);
  2320.     for (var b = null, d = null, e = null, f = null, h, g, l = 0; l < gameObjects.length; l++)
  2321.         if (b = gameObjects[l], "player" == b.type) {
  2322.             if (!b.dead && (b.index == player.index || b.onScreen)) {
  2323.                 void 0 == b.jumpY && (b.jumpY = 0);
  2324.                 playerContext.clearRect(0, 0, playerCanvas.width, playerCanvas.height);
  2325.                 playerContext.save();
  2326.                 playerContext.globalAlpha = .9;
  2327.                 playerContext.translate(playerCanvas.width / 2, playerCanvas.height / 2);
  2328.                 var m = mathPI / 180 * b.angle,
  2329.                     k = 90 * mathRound(b.angle % 360 / 90);
  2330.                 h = b.x - startX;
  2331.                 g = b.y - b.jumpY - startY;
  2332.                 1 == b.animIndex && (g -= 3);
  2333.                 e = getWeaponSprite(getCurrentWeapon(b).weaponIndex, k);
  2334.                 f = classSpriteSheets[b.classIndex];
  2335.                 void 0 != f && (f = f.arm);
  2336.                 getCurrentWeapon(b).front || void 0 == e || (playerContext.save(), playerContext.translate(0, -getCurrentWeapon(b).yOffset), playerContext.rotate(m), playerContext.translate(0,
  2337.                     getCurrentWeapon(b).holdDist), drawSprite(playerContext, e, -(getCurrentWeapon(b).width / 2), 0, getCurrentWeapon(b).width, getCurrentWeapon(b).length, 0, !1, 0, 0, 0), playerContext.translate(0, -getCurrentWeapon(b).holdDist + 6), void 0 != f && null != f && (playerContext.translate(3, -10), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0), playerContext.translate(-16, -8), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0), playerContext.restore()));
  2338.                 d = getPlayerSprite(b.classIndex, k, b.animIndex + 1);
  2339.                 null != d && drawSprite(playerContext,
  2340.                     d, -(b.width / 2), -(.26 * b.height), b.width, .26 * b.height, 0, !0, 1.5 * b.jumpY, .5, 0);
  2341.                 d = getPlayerSprite(b.classIndex, k, 0);
  2342.                 null != d && drawSprite(playerContext, d, -(b.width / 2), -b.height, b.width, .74 * b.height, 0, !0, 1.5 * b.jumpY + .39 * b.height, .5, 0);
  2343.                 d = getHatSprite(b, k);
  2344.                 null != d && drawSprite(playerContext, d, -(b.width / 2), -(1.07 * b.height), b.width, b.width, 0, !0, 1.5 * b.jumpY + .795 * b.height, .5, 0);
  2345.                 playerContext.globalAlpha = .9;
  2346.                 getCurrentWeapon(b).front && void 0 != e && (playerContext.save(), playerContext.translate(0, -getCurrentWeapon(b).yOffset),
  2347.                     playerContext.rotate(m), playerContext.translate(0, getCurrentWeapon(b).holdDist), drawSprite(playerContext, e, -(getCurrentWeapon(b).width / 2), 0, getCurrentWeapon(b).width, getCurrentWeapon(b).length, 0, !1, 0, 0, 0), playerContext.translate(0, -getCurrentWeapon(b).holdDist + 10), void 0 != f && null != f && (270 == k ? (playerContext.restore(), playerContext.save(), playerContext.translate(-4, -getCurrentWeapon(b).yOffset + 8), playerContext.rotate(m), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0)) : 90 == k ? (playerContext.restore(),
  2348.                         playerContext.save(), playerContext.translate(0, -getCurrentWeapon(b).yOffset), playerContext.rotate(m), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0)) : (playerContext.translate(10, -13), playerContext.rotate(.7), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0), playerContext.rotate(-.7), playerContext.translate(-28, -1), playerContext.rotate(-.25), drawSprite(playerContext, f, 0, 0, 8, 32, 0, !1, 0, 0, 0), playerContext.rotate(.25)), playerContext.restore()));
  2349.                 0 < b.spawnProtection && (playerContext.globalCompositeOperation =
  2350.                     "source-atop", playerContext.fillStyle = b.team != player.team ? "rgba(255,179,179,0.5)" : "rgba(179,231,255,0.5)", playerContext.fillRect(-playerCanvas.width / 2, -playerCanvas.height / 2, playerCanvas.width, playerCanvas.height), playerContext.globalCompositeOperation = "source-over");
  2351.                 void 0 != b.hitFlash && 0 < b.hitFlash && (playerContext.globalCompositeOperation = "source-atop", playerContext.fillStyle = "rgba(255, 255, 255, " + b.hitFlash + ")", playerContext.fillRect(-playerCanvas.width / 2, -playerCanvas.height / 2, playerCanvas.width,
  2352.                     playerCanvas.height), playerContext.globalCompositeOperation = "source-over", b.hitFlash -= .01 * a, 0 > b.hitFlash && (b.hitFlash = 0));
  2353.                 drawSprite(graph, playerCanvas, h - playerCanvas.width / 2, g - playerCanvas.height / 2, playerCanvas.width, playerCanvas.height, 0, !1, 0, 0, 0);
  2354.                 playerContext.restore()
  2355.             }
  2356.         } else "flag" == b.type ? (b.ac--, 0 >= b.ac && (b.ac = 5, b.ai++, 2 < b.ai && (b.ai = 0)), drawSprite(graph, flagSprites[b.ai], b.x - b.w / 2 - startX, b.y - b.h - startY, b.w, b.h, 0, !0, 0, .5, 0)) : "clutter" == b.type && b.active && canSee(b.x - startX, b.y - startY, b.w, b.h) &&
  2357.             drawSprite(graph, clutterSprites[b.i], b.x - startX, b.y - b.h - startY, b.w, b.h, 0, b.s, 0, .5, 0);
  2358.     graph.globalAlpha = 1;
  2359.     delete b;
  2360.     delete d;
  2361.     delete e;
  2362.     delete f
  2363. }
  2364.  
  2365. function drawPlayerNames() {
  2366.     var a = null,
  2367.         b, d, e, f, h = null,
  2368.         g;
  2369.     graph.lineWidth = playerConfig.textBorderSize;
  2370.     graph.fillStyle = playerConfig.textColor;
  2371.     graph.miterLimit = 1;
  2372.     graph.lineJoin = "round";
  2373.     graph.globalAlpha = 1;
  2374.     for (var l = 0; l < gameObjects.length; l++) tmpObject = gameObjects[l], "player" != tmpObject.type || tmpObject.dead || tmpObject.index != player.index && !tmpObject.onScreen || (d = tmpObject.height / 3.2, e = mathMIN(200, tmpObject.maxHealth / 100 * 100), shapeX = tmpObject.x - startX, shapeY = tmpObject.y - tmpObject.jumpY - tmpObject.nameYOffset -
  2375.         startY, void 0 != tmpObject.account && null != tmpObject.account.hat && (shapeY -= tmpObject.account.hat.nameY), b = tmpObject.name, f = tmpObject.loggedIn ? tmpObject.account.rank : "", h = graph.measureText(b), g = tmpObject.team != player.team ? "#d95151" : "#5151d9", showNames && (a = renderShadedAnimText(b, d * textSizeMult, "#ffffff", 4, ""), void 0 != a && graph.drawImage(a, shapeX - a.width / 2, shapeY - 1.37 * tmpObject.height - a.height / 2, a.width, a.height), "" != f && (b = renderShadedAnimText(f, 1.6 * d * textSizeMult, "#ffffff", 4, ""), void 0 != b && graph.drawImage(b,
  2376.             shapeX - a.width / 2 - b.width - 5 * textSizeMult, shapeY - 1.35 * tmpObject.height - (b.height - a.height / 2), b.width, b.height)), "" != tmpObject.account.clan && (b = renderShadedAnimText(" [" + tmpObject.account.clan + "]", d * textSizeMult, g, 4, ""), void 0 != b && graph.drawImage(b, shapeX + a.width / 2, shapeY - 1.37 * tmpObject.height - a.height / 2, b.width, a.height))), graph.fillStyle = g, graph.fillRect(shapeX - e / 2 * (tmpObject.health / tmpObject.maxHealth), shapeY - 1.16 * tmpObject.height, tmpObject.health / tmpObject.maxHealth * e, 10));
  2377.     delete h;
  2378.     delete a
  2379. }
  2380.  
  2381. function drawBackground() {
  2382.     drawSprite(graph, darkFillerSprite, 0, 0, maxScreenWidth, maxScreenHeight, 0, !1, 0, 0, 0)
  2383. }
  2384.  
  2385. function getCachedWall(a) {
  2386.     var b = a.left + "" + a.right + "" + a.top + "" + a.bottom + "" + a.topLeft + "" + a.topRight + "" + a.bottomLeft + "" + a.bottomRight + "" + a.edgeTile + "" + a.hasCollision,
  2387.         d = cachedWalls[b];
  2388.     if (void 0 == d && wallSprite.isLoaded) {
  2389.         var d = document.createElement("canvas"),
  2390.             e = d.getContext("2d");
  2391.         e.imageSmoothingEnabled = !1;
  2392.         e.webkitImageSmoothingEnabled = !1;
  2393.         e.mozImageSmoothingEnabled = !1;
  2394.         d.width = a.scale;
  2395.         d.height = a.scale;
  2396.         e.drawImage(wallSprite, 0, 0, a.scale, a.scale);
  2397.         drawSprite(e, darkFillerSprite, 12, 12, a.scale - 24, a.scale - 24, 0, !1, 0, 0, 0);
  2398.         1 == a.left && drawSprite(e, darkFillerSprite, 0, 12, 12, a.scale - 24, 0, !1, 0, 0, 0);
  2399.         1 == a.right && drawSprite(e, darkFillerSprite, a.scale - 12, 12, 12, a.scale - 24, 0, !1, 0, 0, 0);
  2400.         1 == a.top && drawSprite(e, darkFillerSprite, 12, 0, a.scale - 24, 12, 0, !1, 0, 0, 0);
  2401.         1 == a.bottom && drawSprite(e, darkFillerSprite, 12, a.scale - 12, a.scale - 24, 12, 0, !1, 0, 0, 0);
  2402.         (!a.hasCollision || 1 == a.topLeft && 1 == a.top && 1 == a.left) && drawSprite(e, darkFillerSprite, 0, 0, 12, 12, 0, !1, 0, 0, 0);
  2403.         (!a.hasCollision || 1 == a.topRight && 1 == a.top && 1 == a.right) && drawSprite(e, darkFillerSprite,
  2404.             a.scale - 12, 0, 12, 12, 0, !1, 0, 0, 0);
  2405.         (!a.hasCollision || 1 == a.bottomLeft && 1 == a.bottom && 1 == a.left) && drawSprite(e, darkFillerSprite, 0, a.scale - 12, 12, 12, 0, !1, 0, 0, 0);
  2406.         (!a.hasCollision || 1 == a.bottomRight && 1 == a.bottom && 1 == a.right) && drawSprite(e, darkFillerSprite, a.scale - 12, a.scale - 12, 12, 12, 0, !1, 0, 0, 0);
  2407.         cachedWalls[b] = d
  2408.     }
  2409.     return d
  2410. }
  2411. var tilesPerFloorTile = 8;
  2412.  
  2413. function getCachedFloor(a) {
  2414.     var b = a.spriteIndex + "" + a.left + "" + a.right + "" + a.top + "" + a.bottom + "" + a.topLeft + "" + a.topRight,
  2415.         d = cachedFloors[b];
  2416.     if (void 0 == d && null != sideWalkSprite && sideWalkSprite.isLoaded) {
  2417.         var d = document.createElement("canvas"),
  2418.             e = d.getContext("2d");
  2419.         e.imageSmoothingEnabled = !1;
  2420.         e.webkitImageSmoothingEnabled = !1;
  2421.         e.mozImageSmoothingEnabled = !1;
  2422.         d.width = a.scale;
  2423.         d.height = a.scale * (a.bottom ? .51 : 1);
  2424.         e.drawImage(floorSprites[a.spriteIndex], 0, 0, a.scale, a.scale);
  2425.         var f = a.scale / tilesPerFloorTile;
  2426.         1 == a.topLeft &&
  2427.             renderSideWalks(e, 1, f, 0, 0, 0, 0, 0);
  2428.         1 == a.topRight && renderSideWalks(e, 1, f, mathPI, a.scale - f, 0, 0, 0);
  2429.         1 == a.left && (1 == a.top ? (renderSideWalks(e, 2, f, null, 0, 0, 0, f), renderSideWalks(e, tilesPerFloorTile - 2, f, 0, 0, 2 * f, 0, f)) : renderSideWalks(e, tilesPerFloorTile, f, 0, 0, 0, 0, f));
  2430.         1 == a.right && (1 == a.top ? (renderSideWalks(e, 2, f, null, a.scale - f, 2, 0, f), renderSideWalks(e, tilesPerFloorTile - 2, f, mathPI, a.scale - f, 2 * f, 0, f)) : renderSideWalks(e, tilesPerFloorTile, f, mathPI, a.scale - f, 0, 0, f));
  2431.         1 == a.top && renderSideWalks(e, tilesPerFloorTile, f,
  2432.             mathPI / 2, 0, 0, f, 0);
  2433.         1 == a.bottom && renderSideWalks(e, tilesPerFloorTile, f, 0, 0, a.scale - f, f, 0);
  2434.         cachedFloors[b] = d
  2435.     }
  2436.     return d
  2437. }
  2438.  
  2439. function renderSideWalks(a, b, d, e, f, h, g, l) {
  2440.     for (var m = 0; m < b; ++m) a.drawImage(sideWalkSprite, f, h, d, d), null != e && (a.save(), a.translate(f + d / 2, h + d / 2), a.rotate(e), a.drawImage(ambientSprites[0], -(d / 2), -(d / 2), d, d), a.restore()), f += g, h += l
  2441. }
  2442. var tmpTlSprite = null;
  2443.  
  2444. function drawMap(a) {
  2445.     var b;
  2446.     if (null != gameMap) {
  2447.         for (var d = 0; d < gameMap.tiles.length; ++d) b = gameMap.tiles[d], 0 == a ? !b.wall && canSee(b.x - startX, b.y - startY, mapTileScale, mapTileScale) && (tmpTlSprite = getCachedFloor(b), drawSprite(graph, tmpTlSprite, b.x - startX, b.y - startY, tmpTlSprite.width, tmpTlSprite.height, 0, !1, 0, 0, 0)) : 1 == a ? b.wall && !b.bottom && canSee(b.x - startX, b.y - startY + .5 * mapTileScale, mapTileScale, .75 * mapTileScale) && drawSprite(graph, wallSpritesSeg[b.spriteIndex], b.x - startX, b.y + mathRound(mapTileScale / 2) - startY,
  2448.             mapTileScale, mapTileScale / 2, 0, !0, -(b.scale / 2), .5, b.scale) : 2 == a && b.wall && canSee(b.x - startX, b.y - startY - .5 * mapTileScale, mapTileScale, mapTileScale) && drawSprite(graph, getCachedWall(b), b.x - startX, mathRound(b.y - mapTileScale / 2 - startY), mapTileScale, mapTileScale, 0, !1, 0, 0, 0);
  2449.         if (0 == a)
  2450.             for (d = 0; d < gameMap.pickups.length; ++d) b = gameMap.pickups[d], b.active && canSee(b.x - startX, b.y - startY, 0, 0) && ("healthpack" == b.type ? drawSprite(graph, healthPackSprite, b.x - b.scale / 2 - startX, b.y - b.scale / 2 - startY, b.scale, b.scale, 0, !1, 0, 0, 0) :
  2451.                 drawSprite(graph, lootCrateSprite, b.x - b.scale / 2 - startX, b.y - b.scale / 2 - startY, b.scale, b.scale, 0, !0, 0, .5, 0))
  2452.     }
  2453. }
  2454. var tmpShadow = null;
  2455.  
  2456. function drawSprite(a, b, d, e, f, h, g, l, m, k, u) {
  2457.     null != b && void 0 != b && 0 < b.width && (d = mathFloor(d), e = mathFloor(e), f = mathFloor(f), h = mathFloor(h), m = mathFloor(m), a.rotate(g), a.drawImage(b, d, e, f, h), l && showShadows && (a.globalAlpha = 1, a.translate(0, m), tmpShadow = getCachedShadow(b, f, h + u, k), null != tmpShadow && void 0 != tmpShadow && a.drawImage(tmpShadow, d, e + h), a.rotate(-g), a.translate(0, -m)))
  2458. }
  2459. var shadowIntensity = .16;
  2460.  
  2461. function getCachedShadow(a, b, d, e) {
  2462.     var f = cachedShadows[a.index];
  2463.     if (void 0 == f && 0 != b && void 0 != a && a.isLoaded) {
  2464.         var f = document.createElement("canvas"),
  2465.             h = f.getContext("2d");
  2466.         f.width = b;
  2467.         f.height = d;
  2468.         h.globalAlpha = .5 == e ? shadowIntensity : .75 * shadowIntensity;
  2469.         h.scale(1, -e);
  2470.         h.transform(1, 0, 0, 1, 0, 0);
  2471.         h.drawImage(a, 0, -d, b, d);
  2472.         b = h.getImageData(0, 0, f.width, f.height);
  2473.         d = b.data;
  2474.         e = 0;
  2475.         for (var g = d.length; e < g; e += 4) d[e] = 0, d[e + 1] = 0, d[e + 2] = 0, d[e + 3] = d[e + 3];
  2476.         h.putImageData(b, 0, 0);
  2477.         cachedShadows[a.index] = f
  2478.     }
  2479.     return f
  2480. }
  2481.  
  2482. function canSee(a, b, d, e) {
  2483.     return 0 < a + d && 0 < b + e && a < maxScreenWidth && b < maxScreenHeight
  2484. }
  2485. for (var notificationsSize = 80 * textSizeMult, notificationsGap = 1.6 * notificationsSize, notifications = [], i = 0; 3 > i; ++i) notifications.push(new AnimText);
  2486. var notificationIndex = 0;
  2487.  
  2488. function showNotification(a) {
  2489.     a = a.toUpperCase();
  2490.     notificationIndex++;
  2491.     notificationIndex >= notifications.length && (notificationIndex = 0);
  2492.     notifications[notificationIndex].text = a;
  2493.     notifications[notificationIndex].alpha = 1;
  2494.     notifications[notificationIndex].x = maxScreenWidth / 2;
  2495.     notifications[notificationIndex].fadeSpeed = .003;
  2496.     notifications[notificationIndex].fadeDelay = 600;
  2497.     notifications[notificationIndex].fontSize = notificationsSize * viewMult;
  2498.     notifications[notificationIndex].scale = 1;
  2499.     notifications[notificationIndex].scaleSpeed =
  2500.         .005;
  2501.     notifications[notificationIndex].minScale = 1;
  2502.     notifications[notificationIndex].maxScale = 1.5;
  2503.     notifications[notificationIndex].cachedImage = renderShadedAnimText(a, notificationsSize * viewMult, "#ffffff", 7, "Italic ");
  2504.     notifications[notificationIndex].active = !0;
  2505.     positionNotifications()
  2506. }
  2507. var activeNotifications = 0;
  2508.  
  2509. function positionNotifications() {
  2510.     for (var a = activeNotifications = 0; a < notifications.length; ++a) notifications[a].active && activeNotifications++;
  2511.     if (0 < activeNotifications) {
  2512.         notifications.sort(sortByAlpha);
  2513.         for (var b = 0, d = maxScreenHeight - notifications.length * notificationsGap * viewMult - 100, a = 0; a < notifications.length; ++a) notifications[a].active && (notifications[a].y = d + notificationsGap * viewMult * b, b++)
  2514.     }
  2515. }
  2516.  
  2517. function sortByAlpha(a, b) {
  2518.     return a.alpha < b.alpha ? 1 : b.alpha < a.alpha ? -1 : 0
  2519. }
  2520.  
  2521. function updateNotifications(a) {
  2522.     graph.fillStyle = "#fff";
  2523.     for (var b = 0; b < notifications.length; ++b) notifications[b].active && (notifications[b].update(a), notifications[b].draw());
  2524.     graph.globalAlpha = 1
  2525. }
  2526. for (var animTexts = [], i = 0; 20 > i; i++) animTexts.push(new AnimText);
  2527. var shadowOffset = 6,
  2528.     tmpDrawText = null;
  2529.  
  2530. function AnimText() {
  2531.     this.text = "";
  2532.     this.scaleSpeed = this.minScale = this.maxScale = this.fontSize = this.scale = this.ySpeed = this.xSpeed = this.y = this.x = 0;
  2533.     this.active = !1;
  2534.     this.alpha = 1;
  2535.     this.fadeSpeed = 0;
  2536.     this.useStart = !1;
  2537.     this.moveDelay = this.fadeDelay = 0;
  2538.     this.removable = !1;
  2539.     this.textType = "";
  2540.     this.color = "#fff";
  2541.     this.cachedImage = null;
  2542.     this.update = function(a) {
  2543.         this.active && (this.scale += this.scaleSpeed * a, 0 < this.scaleSpeed ? this.scale >= this.maxScale && (this.scale = this.maxScale, this.scaleSpeed *= -1) : this.scale < this.minScale && (this.scale =
  2544.             this.minScale, this.scaleSpeed = 0), 0 < this.moveDelay ? this.moveDelay -= a : (this.x += this.xSpeed * a, this.y += this.ySpeed * a), 0 < this.fadeDelay ? this.fadeDelay -= a : (this.alpha -= this.fadeSpeed * a, 0 >= this.alpha && (this.alpha = 0, this.active = !1)))
  2545.     };
  2546.     this.draw = function() {
  2547.         this.active && (graph.globalAlpha = this.alpha, this.useStart ? void 0 != this.cachedImage && graph.drawImage(this.cachedImage, this.x - startX - this.cachedImage.width / 2 * this.scale, this.y - startY - this.cachedImage.height / 2 * this.scale, this.cachedImage.width * this.scale, this.cachedImage.height *
  2548.             this.scale) : void 0 != this.cachedImage && graph.drawImage(this.cachedImage, this.x - this.cachedImage.width / 2 * this.scale, this.y - this.cachedImage.height / 2 * this.scale, this.cachedImage.width * this.scale, this.cachedImage.height * this.scale))
  2549.     }
  2550. }
  2551.  
  2552. function updateAnimTexts(a) {
  2553.     graph.lineJoin = "round";
  2554.     graph.textAlign = "center";
  2555.     graph.textBaseline = "middle";
  2556.     for (var b = 0; b < animTexts.length; b++) animTexts[b].update(a), animTexts[b].active && animTexts[b].draw();
  2557.     graph.globalAlpha = 1
  2558. }
  2559.  
  2560. function getReadyAnimText() {
  2561.     for (var a = 0; a < animTexts.length; ++a)
  2562.         if (!animTexts[a].active) return animTexts[a];
  2563.     return null
  2564. }
  2565.  
  2566. function startAnimText(a, b, d, e, f, h, g, l, m, k, u, w, p, t, r, q, v) {
  2567.     var n = getReadyAnimText();
  2568.     null != n && (n.text = a.toUpperCase(), n.x = b, n.y = d, n.xSpeed = e, n.ySpeed = f, n.fadeSpeed = h, n.fontSize = g * viewMult, n.scale = 1, n.maxScale = 1.6, n.minScale = 1, n.alpha = 1, n.scaleSpeed = l, n.useStart = m, n.fadeDelay = k, n.removable = u, n.moveDelay = w, n.alpha = t, n.color = r, n.textType = q, n.cachedImage = renderShadedAnimText(n.text, n.fontSize, n.color, v, p), n.active = !0)
  2569. }
  2570.  
  2571. function startBigAnimText(a, b, d, e, f, h, g, l) {
  2572.     deactiveAnimTexts("big") && (0 < a.length && startAnimText(a, maxScreenWidth / 2, bigTextY, 0, -.1, .0025, bigTextSize * l, e ? .005 : 0, !1, d, g, d, "Italic ", 1, f, "big", 8), 0 < b.length && startAnimText(b, maxScreenWidth / 2, bigTextY + textGap * viewMult * l, 0, -.04, .0025, medTextSize / 2 * l, e ? .003 : 0, !1, d, g, d, "Italic ", 1, h, "big", 8))
  2573. }
  2574.  
  2575. function startMovingAnimText(a, b, d, e, f) {
  2576.     b += randomInt(-25, 25);
  2577.     d += randomInt(-20, 5);
  2578.     startAnimText(a, b, d, 0, -.15, .0025, maxScreenHeight / 27 + f, .005, !0, 350, !1, 0, "", 1, e, "moving", 5)
  2579. }
  2580.  
  2581. function deactiveAnimTexts(a) {
  2582.     for (var b = 0; b < animTexts.length; ++b)
  2583.         if (animTexts[b].active)
  2584.             if (animTexts[b].removable) animTexts[b].active = !1;
  2585.             else if (animTexts[b].textType == a) return !1;
  2586.     return !0
  2587. }
  2588.  
  2589. function deactiveAllAnimTexts() {
  2590.     for (var a = 0; a < animTexts.length; ++a) animTexts[a].active = !1
  2591. }
  2592. var cachedTextRenders = [],
  2593.     cachedText = tmpIndex = null;
  2594.  
  2595. function renderShadedAnimText(a, b, d, e, f) {
  2596.     tmpIndex = a + "" + b + "" + d + "" + f;
  2597.     cachedText = cachedTextRenders[tmpIndex];
  2598.     if (void 0 == cachedText) {
  2599.         var h = document.createElement("canvas"),
  2600.             g = h.getContext("2d");
  2601.         g.imageSmoothingEnabled = !1;
  2602.         g.webkitImageSmoothingEnabled = !1;
  2603.         g.mozImageSmoothingEnabled = !1;
  2604.         g.textAlign = "center";
  2605.         g.font = f + b + "px mainFont";
  2606.         h.width = 1.05 * g.measureText(a).width;
  2607.         h.height = 1.8 * b + e;
  2608.         g.fillStyle = shadeColor(d, -18);
  2609.         g.font = f + b + "px mainFont";
  2610.         g.textBaseline = "middle";
  2611.         g.textAlign = "center";
  2612.         for (var l = 1; l < e; ++l) g.fillText(a,
  2613.             h.width / 2, h.height / 2 + l);
  2614.         g.fillStyle = d;
  2615.         g.font = f + b + "px mainFont";
  2616.         g.textBaseline = "middle";
  2617.         g.textAlign = "center";
  2618.         g.fillText(a, h.width / 2, h.height / 2);
  2619.         cachedText = h;
  2620.         cachedTextRenders[tmpIndex] = cachedText
  2621.     }
  2622.     return cachedText
  2623. }
  2624. for (var cachedParticles = [], particleIndex = 0, i = 0; 700 > i; ++i) cachedParticles.push(new Particle);
  2625.  
  2626. function updateParticles(a, b) {
  2627.     for (var d = 0; d < cachedParticles.length; ++d)(showParticles || cachedParticles[d].forceShow) && cachedParticles[d].active && canSee(cachedParticles[d].x - startX, cachedParticles[d].y - startY, cachedParticles[d].scale, cachedParticles[d].scale) ? b == cachedParticles[d].layer && (cachedParticles[d].update(a), cachedParticles[d].draw()) : cachedParticles[d].active = !1;
  2628.     graph.globalAlpha = 1
  2629. }
  2630.  
  2631. function Particle() {
  2632.     this.rotation = this.initScale = this.scale = this.dir = this.initSpeed = this.speed = this.y = this.x = 0;
  2633.     this.active = !1;
  2634.     this.layer = this.spriteIndex = 0;
  2635.     this.alpha = 1;
  2636.     this.fadeSpeed = 0;
  2637.     this.forceShow = this.checkCollisions = !1;
  2638.     this.tmpScale = this.maxDuration = this.duration = 0;
  2639.     this.update = function(a) {
  2640.         this.active && (0 < this.maxDuration && (this.duration += a, this.tmpScale = 1 - this.duration / this.maxDuration, this.tmpScale = 0 > this.tmpScale ? 0 : this.tmpScale, this.scale = this.initScale * this.tmpScale, 1 > this.scale && (this.active = !1), this.speed = this.initSpeed * this.tmpScale, .01 >= this.speed ? this.speed = 0 : (this.x += this.speed * a * mathCOS(this.dir), this.y += this.speed * a * mathSIN(this.dir)), this.duration >= this.maxDuration && (this.active = !1)), 0 < this.alpha && (this.alpha -= this.fadeSpeed * a), 0 >= this.alpha && (this.alpha = 0, this.active = !1), this.checkCollisions && this.checkInWall())
  2641.     };
  2642.     this.draw = function() {
  2643.         this.active && (graph.globalAlpha = this.alpha, 0 != this.rotation ? (graph.save(), graph.translate(this.x - startX, this.y - startY), graph.rotate(this.rotation),
  2644.             graph.drawImage(particleSprites[this.spriteIndex], -(this.scale / 2), -(this.scale / 2), this.scale, this.scale), graph.restore()) : graph.drawImage(particleSprites[this.spriteIndex], this.x - startX - this.scale / 2, this.y - startY - this.scale / 2, this.scale, this.scale))
  2645.     };
  2646.     this.checkInWall = function() {
  2647.         for (var a = 0; a < gameMap.tiles.length; ++a) gameMap.tiles[a].wall && gameMap.tiles[a].hasCollision && (tmpTl = gameMap.tiles[a], this.x >= tmpTl.x && this.x <= tmpTl.x + tmpTl.scale && this.y > tmpTl.y && this.y < tmpTl.y + tmpTl.scale - player.height && (this.active = !1))
  2648.     }
  2649. }
  2650.  
  2651. function getReadyParticle() {
  2652.     particleIndex++;
  2653.     particleIndex >= cachedParticles.length && (particleIndex = 0);
  2654.     return cachedParticles[particleIndex]
  2655. }
  2656. var tmpParticle = null;
  2657.  
  2658. function particleCone(a, b, d, e, f, h, g, l, m) {
  2659.     if (showParticles)
  2660.         for (var k = 0; k < a; ++k) tmpParticle = getReadyParticle(), tmpParticle.forceShow = !1, tmpParticle.checkCollisions = !1, tmpParticle.x = b, tmpParticle.y = d, tmpParticle.rotation = 0, tmpParticle.alpha = 1, tmpParticle.speed = 0, tmpParticle.fadeSpeed = 0, tmpParticle.initSpeed = 0, tmpParticle.initScale = randomFloat(3, 9), tmpParticle.spriteIndex = 0, tmpParticle.maxDuration = -1, tmpParticle.duration = 0, 0 == k && 2 == l && m ? (tmpParticle.spriteIndex = 3, tmpParticle.layer = 0) : (tmpParticle.dir =
  2661.             e + randomFloat(-f, f), tmpParticle.initScale = g * randomFloat(1.3, 1.7), tmpParticle.initSpeed = h * randomFloat(.4, 1.6), tmpParticle.maxDuration = 320 * randomFloat(.8, 1.1), tmpParticle.spriteIndex = l, tmpParticle.layer = randomInt(0, 1)), tmpParticle.scale = tmpParticle.initScale, tmpParticle.active = !0
  2662. }
  2663. var liquidSpread = 35;
  2664.  
  2665. function createLiquid(a, b, d, e) {
  2666.     tmpParticle = getReadyParticle();
  2667.     tmpParticle.x = a + randomFloat(-liquidSpread, liquidSpread);
  2668.     tmpParticle.y = b + randomFloat(-liquidSpread, liquidSpread);
  2669.     tmpParticle.initSpeed = 0;
  2670.     tmpParticle.maxDuration = -1;
  2671.     tmpParticle.duration = 0;
  2672.     tmpParticle.initScale = randomFloat(60, 150);
  2673.     tmpParticle.scale = tmpParticle.initScale;
  2674.     tmpParticle.rotation = randomInt(0, 5);
  2675.     tmpParticle.alpha = randomFloat(.3, .5);
  2676.     tmpParticle.fadeSpeed = 2E-5;
  2677.     tmpParticle.checkCollisions = !1;
  2678.     tmpParticle.spriteIndex = randomInt(e, e + 1);
  2679.     tmpParticle.layer = 0;
  2680.     tmpParticle.forceShow = !1;
  2681.     tmpParticle.active = !0
  2682. }
  2683. var tmpDist = 0,
  2684.     maxShakeDist = 2E3,
  2685.     maxExplosionDuration = 400,
  2686.     maxShake = 9,
  2687.     tmpShake = 0,
  2688.     tmpDir = 0;
  2689.  
  2690. function createExplosion(a, b, d) {
  2691.     tmpDist = getDistance(a, b, player.x, player.y);
  2692.     tmpDist <= maxShakeDist && (tmpDir = getAngle(a, player.x, b, player.y), screenShake(d * maxShake * (1 - tmpDist / maxShakeDist), tmpDir));
  2693.     playSound("explosion", a, b);
  2694.     for (var e = 0; 30 > e; ++e) {
  2695.         tmpParticle = getReadyParticle();
  2696.         tmpParticle.dir = mathRound(randomFloat(-mathPI, mathPI) / (mathPI / 3)) * (mathPI / 3);
  2697.         tmpParticle.forceShow = !0;
  2698.         tmpParticle.spriteIndex = 2;
  2699.         tmpParticle.checkCollisions = !0;
  2700.         tmpParticle.alpha = 1;
  2701.         tmpParticle.fadeSpeed = 0;
  2702.         tmpParticle.initSpeed = 0;
  2703.         tmpParticle.maxDuration = -1;
  2704.         tmpParticle.duration = 0;
  2705.         tmpParticle.layer = 1;
  2706.         tmpParticle.rotation = 0;
  2707.         if (0 == e) tmpParticle.x = a, tmpParticle.y = b, tmpParticle.initScale = randomFloat(50, 60) * d, tmpParticle.rotation = randomInt(0, 5), tmpParticle.speed = 0, tmpParticle.fadeSpeed = 2E-4, tmpParticle.checkCollisions = !1, tmpParticle.spriteIndex = 6, tmpParticle.layer = 0;
  2708.         else if (10 >= e) tmpDist = e * d, tmpParticle.x = a + tmpDist * mathCOS(tmpParticle.dir), tmpParticle.y = b + tmpDist * mathSIN(tmpParticle.dir), tmpParticle.initScale = randomFloat(30, 33) *
  2709.             d, tmpParticle.initSpeed = 3 / tmpParticle.initScale * d, tmpParticle.maxDuration = .8 * maxExplosionDuration;
  2710.         else {
  2711.             tmpDist = randomFloat(0, 10) * d;
  2712.             tmpParticle.x = a + tmpDist * mathCOS(tmpParticle.dir);
  2713.             tmpParticle.y = b + tmpDist * mathSIN(tmpParticle.dir);
  2714.             var f = randomFloat(.7, 1.4);
  2715.             tmpParticle.initScale = 11 * d * f;
  2716.             tmpParticle.initSpeed = 12 / tmpParticle.initScale * d / f;
  2717.             tmpParticle.maxDuration = maxExplosionDuration * f
  2718.         }
  2719.         tmpParticle.scale = tmpParticle.initScale;
  2720.         tmpParticle.active = !0
  2721.     }
  2722. }
  2723.  
  2724. function muzzleFlash(a, b, d) {}
  2725.  
  2726. function stillDustParticle(a, b, d) {
  2727.     tmpParticle = getReadyParticle();
  2728.     tmpParticle.x = a + randomInt(-10, 10);
  2729.     tmpParticle.y = b;
  2730.     tmpParticle.initScale = randomFloat(18, 25);
  2731.     tmpParticle.initSpeed = .05;
  2732.     tmpParticle.maxDuration = 600;
  2733.     tmpParticle.duration = 0;
  2734.     tmpParticle.dir = randomFloat(0, 2 * mathPI);
  2735.     tmpParticle.rotation = 0;
  2736.     tmpParticle.spriteIndex = 2;
  2737.     tmpParticle.layer = d ? 1 : 0;
  2738.     tmpParticle.alpha = 1;
  2739.     tmpParticle.fadeSpeed = 0;
  2740.     tmpParticle.checkCollisions = !1;
  2741.     tmpParticle.forceShow = d;
  2742.     tmpParticle.active = !0
  2743. }
  2744. var anglDif = 0,
  2745.     PI2 = 2 * mathPI;
  2746.  
  2747. function getAngleDifference(a, b) {
  2748.     anglDif = mathABS(b - a) % PI2;
  2749.     return anglDif > mathPI ? PI2 - anglDif : anglDif
  2750. }
  2751.  
  2752. function getDistance(a, b, d, e) {
  2753.     return mathSQRT(mathPOW(d - a, 2) + mathPOW(e - b, 2))
  2754. }
  2755.  
  2756. function getAngle(a, b, d, e) {
  2757.     return mathATAN2(e - b, d - a)
  2758. }
  2759.  
  2760. function shadeColor(a, b) {
  2761.     var d = parseInt(a.substring(1, 3), 16),
  2762.         e = parseInt(a.substring(3, 5), 16),
  2763.         f = parseInt(a.substring(5, 7), 16),
  2764.         d = parseInt(d * (100 + b) / 100),
  2765.         e = parseInt(e * (100 + b) / 100),
  2766.         f = parseInt(f * (100 + b) / 100),
  2767.         d = 255 > d ? d : 255,
  2768.         e = 255 > e ? e : 255,
  2769.         f = 255 > f ? f : 255,
  2770.         d = 1 == d.toString(16).length ? "0" + d.toString(16) : d.toString(16),
  2771.         e = 1 == e.toString(16).length ? "0" + e.toString(16) : e.toString(16),
  2772.         f = 1 == f.toString(16).length ? "0" + f.toString(16) : f.toString(16);
  2773.     return "#" + d + e + f
  2774. }
  2775.  
  2776. function randomFloat(a, b) {
  2777.     return a + Math.random() * (b - a)
  2778. }
  2779.  
  2780. function randomInt(a, b) {
  2781.     return mathFloor(Math.random() * (b - a + 1)) + a
  2782. }
  2783.  
  2784. function linearInterpolate(a, b, d) {
  2785.     var e = a - b;
  2786.     return e * e > d * d ? b + d : a
  2787. }
  2788. var lastTime = 0,
  2789.     nextTime = 0;
  2790.  
  2791. function prepareUpdate(a) {
  2792.     currentTime = Date.now();
  2793.     nextTime = mathMax(lastTime + 1E3 / targetFPS, currentTime);
  2794.     setTimeout(function() {
  2795.         a(lastTime = nextTime)
  2796.     }, nextTime - currentTime)
  2797. }
  2798.  
  2799. function callUpdate() {
  2800.     prepareUpdate(callUpdate);
  2801.     updateGameLoop()
  2802. }
  2803. callUpdate();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement