Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name New Userscript
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author You
- // @match http://vertix.io/
- // @grant unsafeWindow
- // ==/UserScript==
- (function() {
- function canSee(a, b, d, e) {
- return true
- }
- addJS_Node (canSee);
- function setupSocket(a) {
- a.on("pong1", receivePing);
- null != pingInterval && clearInterval(pingInterval);
- pingInterval = setInterval(function() {
- pingStart = Date.now();
- a.emit("ping1")
- }, 2E3);
- a.on("yourRoom", function(a, d) {
- room = a;
- serverKeyTxt.innerHTML = d
- });
- a.on("connect_failed", function() {
- kickPlayer("Connection failed. Please check your internet connection.")
- });
- a.on("disconnect", function(a) {
- kickPlayer("Disconnected. Your connection timed out.");
- console.log(a)
- });
- a.on("error", function(a) {
- console.log("PLEASE NOTIFY THE DEVELOPER OF THE FOLLOWING ERROR");
- console.log("ERROR: " + a)
- });
- a.on("welcome", function(b, d) {
- player.id = b.id;
- player.room = b.room;
- room = player.room;
- player.name = playerName;
- player.classIndex = playerClassIndex;
- b.name = player.name;
- b.classIndex = playerClassIndex;
- a.emit("gotit", b, d, Date.now(), !1);
- player.dead = !0;
- d && (deactiveAllAnimTexts(), gameStart = !1, hideUI(!1), document.getElementById("startMenuWrapper").style.display = "block");
- gameOver && (document.getElementById("gameStatWrapper").style.display = "none");
- gameOverFade = gameOver = !1;
- targetChanged = !0;
- mobile &&
- (hideMenuUI(), hideUI(!0), document.getElementById("startMenuWrapper").style.display = "none");
- resize()
- });
- a.on("cSrvRes", function(a, d) {
- d ? (serverKeyTxt.innerHTML = a, serverCreateMessage.innerHTML = "Success. Created server with IP: " + a) : serverCreateMessage.innerHTML = a
- });
- a.on("regRes", function(a, d) {
- d || (loginMessage.style.display = "block");
- loginMessage.innerHTML = a
- });
- a.on("logRes", function(a, d) {
- if (d) {
- loginMessage.style.display = "none";
- loginMessage.innerHTML = "";
- loginWrapper.style.display = "none";
- loggedInWrapper.style.display =
- "block";
- document.getElementById("playerNameInput").value = a.text;
- tmpLogKey = a.logKey;
- tmpUserName = a.text;
- setCookie("logKey", a.logKey);
- setCookie("userName", a.text);
- loggedIn = !0;
- player.loggedIn = !0;
- var b = findUserByIndex(player.index);
- b && (b.loggedIn = !0)
- } else loginMessage.style.display = "block", loginMessage.innerHTML = a;
- loadSavedClass()
- });
- a.on("recovRes", function(b, d) {
- loginMessage.style.display = "block";
- loginMessage.innerHTML = b;
- if (d) {
- document.getElementById("recoverForm").style.display = "block";
- var e = document.getElementById("chngPassKey"),
- f = document.getElementById("chngPassPass");
- document.getElementById("chngPassButton").onclick = function() {
- loginMessage.style.display = "block";
- loginMessage.innerHTML = "Please Wait...";
- a.emit("dbCngPass", {
- passKey: e.value,
- newPass: f.value
- });
- a.on("cngPassRes", function(a, b) {
- loginMessage.style.display = "block";
- loginMessage.innerHTML = a;
- b && (document.getElementById("recoverForm").style.display = "none")
- })
- }
- }
- });
- a.on("dbClanCreateR", function(a, d) {
- d ? (clanSignUp.style.display = "none", 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)
- });
- a.on("dbClanJoinR", function(a, d) {
- if (d) {
- clanSignUp.style.display = "none";
- clanStats.style.display = "block";
- clanHeader.innerHTML = "[" + a + "] Clan:";
- player.account.clan = a;
- var b = findUserByIndex(player.index);
- b && (b.account.clan = a);
- leaveClanButton.style.display = "inline-block";
- leaveClanButton.innerHTML = "Leave Clan"
- } else clanDBMessage.style.display =
- "block", clanDBMessage.innerHTML = a
- });
- a.on("dbClanInvR", function(a, d) {
- clanInvMessage.style.display = "block";
- clanInvMessage.innerHTML = a
- });
- a.on("dbKickInvR", function(a, d) {
- clanInvMessage.style.display = "block";
- clanInvMessage.innerHTML = a
- });
- a.on("dbClanLevR", function(a, d) {
- d && (clanSignUp.style.display = "block", clanStats.style.display = "none", clanHeader.innerHTML = "Clans", clanDBMessage.style.display = "block", clanDBMessage.innerHTML = a, leaveClanButton.style.display = "none")
- });
- a.on("dbChatR", function(a, d) {
- clanChtMessage.style.display =
- "inline-block";
- clanChtMessage.innerHTML = a.text;
- d && (a.newURL.match(/^https?:\/\//i) || (a.newURL = "http://" + a.newURL), clanChatLink.innerHTML = "<a target='_blank' href='" + a.newURL + "'>Clan Chat</a>")
- });
- a.on("dbChangeUserR", function(a, d) {
- d ? (setCookie("userName", a), player.account.user_name = a, editProfileMessage.innerHTML = "Success. Account Updated.") : editProfileMessage.innerHTML = a
- });
- a.on("dbClanStats", function(a) {
- updateClanPage(a)
- });
- a.on("updAccStat", function(a) {
- updateAccountPage(a)
- });
- a.on("gameSetup", function(a,
- d, e) {
- a = JSON.parse(a);
- if (d) {
- gameMap = a.mapData;
- gameMap.tiles = [];
- gameWidth = gameMap.width;
- gameHeight = gameMap.height;
- mapTileScale = a.tileScale;
- gameObjects = a.usersInRoom;
- for (d = 0; d < gameObjects.length; ++d) gameObjects[d].type = "player";
- gameMode = gameMap.gameMode;
- "blue" == a.you.team ? document.getElementById("gameModeText").innerHTML = gameMode.desc2 : document.getElementById("gameModeText").innerHTML = gameMode.desc1;
- currentLikeButton = "";
- var b = null;
- for (d = 0; d < gameMap.clutter.length; ++d) b = gameMap.clutter[d], b.type = "clutter",
- gameObjects.push(b);
- setupMap(gameMap);
- cachedMiniMap = null;
- deactivateSprays();
- for (d = 0; 100 > d; ++d) bullets.push(new Projectile)
- }
- e && (gameStart = !0, showUI(), document.getElementById("cvs").focus());
- keys.lm = 0;
- maxScreenHeight = a.maxScreenHeight * a.viewMult * 1.5;
- maxScreenWidth = a.maxScreenWidth * a.viewMult * 1.5;
- viewMult = a.viewMult;
- a.you.type = "player";
- player = a.you;
- e = findUserByIndex(a.you.index);
- null != e ? gameObjects[gameObjects.indexOf(e)] = a.you : gameObjects.push(a.you);
- updateWeaponUI(player, !0);
- inMainMenu && ($("#loadingWrapper").fadeOut(0,
- function() {}), inMainMenu = !1);
- startingGame = !1;
- resize()
- });
- a.on("lb", updateLeaderboard);
- a.on("ts", updateTeamScores);
- a.on("rsd", receiveServerData);
- a.on("upd", updateUserValue);
- a.on("vt", updateVoteStats);
- a.on("add", addUser);
- a.on("updHt", updateHatList);
- a.on("updShrt", updateShirtList);
- a.on("updCmo", updateCamosList);
- a.on("updSprs", updateSpraysList);
- a.on("crtSpr", createSpray);
- a.on("rem", removeUser);
- a.on("cht", messageFromServer);
- a.on("kick", function(a) {
- kickPlayer(a)
- });
- a.on("1", function(a) {
- var b = findUserByIndex(a.gID),
- e = mathABS(a.amount);
- (a.dID != player.index || a.gID == player.index) && 0 >= a.amount && a.gID == player.index && 0 != e && screenShake(e / 2, a.dir);
- null != a.dID && a.dID == player.index && null != b && 0 < e && b.onScreen && (0 > a.amount ? startMovingAnimText(e + "", b.x - b.width / 2, b.y - b.height, "#d95151", e / 10) : startMovingAnimText(e + "", b.x - b.width / 2, b.y - b.height, "#5ed951", e / 10));
- null != a.bi && (e = findServerBullet(a.bi), void 0 != e && e.owner.index != player.index && (b.onScreen && 0 > a.amount && (particleCone(12, b.x, b.y - b.height / 2 - b.jumpY, e.dir + mathPI, mathPI /
- randomInt(5, 7), .5, 16, 0, !0), createLiquid(b.x, b.y, e.dir, 4)), e.active = !1));
- null != b && (b.health = a.h, b.index == player.index && (updatePlayerInfo(b), updateUiStats(b)))
- });
- a.on("2", someoneShot);
- a.on("jum", otherJump);
- a.on("ex", createExplosion);
- a.on("r", function(a) {
- var b = findUserByIndex(player.index);
- null != b && (0 == a && 1 < b.weapons[a].maxAmmo && showNotification("Ammo Full"), b.weapons[a].reloadTime = 0, b.weapons[a].ammo = b.weapons[a].maxAmmo, setCooldownAnimation(a, b.weapons[a].reloadTime, !1), updateUiStats(b))
- });
- a.on("3",
- function(a) {
- var b = findUserByIndex(a.gID),
- e = findUserByIndex(a.dID);
- b.dead = !0;
- 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");
- else if (a.dID == player.index && a.gID != player.index) {
- playSound("kill1", e.x, e.y);
- var f = "";
- b.team != e.team ? (a.sS = "+" + a.sS, f = 1 >= a.kd || void 0 == a.kd ? "Enemy Killed" : 2 == a.kd ? "Double Kill" : 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");
- a.ast && (f = "Kill Assist");
- startBigAnimText(f, a.sS + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.25)
- }
- if (a.gID == player.index) {
- hideStatTable();
- gameStart = !1;
- hideUI(!1);
- player.dead = !0;
- try {
- googletag.pubads().refresh()
- } catch (h) {}
- window.setTimeout(function() {
- gameOver || (document.getElementById("startMenuWrapper").style.display = "block", document.getElementById("linkBox").style.display = "block")
- }, 1300);
- playSound("death1", player.x, player.y);
- startSoundTrack(1)
- }
- });
- a.on("4", function(a, d, e) {
- if (0 == e) null != gameMap && void 0 != a.active && (gameMap.pickups[d].active = a.active);
- else
- 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 != a.x && (gameObjects[e].x = a.x), void 0 != a.y && (gameObjects[e].y = a.y))
- });
- a.on("tprt", function(a) {
- var b = findUserByIndex(a.indx);
- void 0 != b && (b.x = a.newX, b.y = a.newY, createSmokePuff(b.x, b.y, 5, !1, 1), a.indx == player.index ? (player.x = a.newX, player.y = a.newY, startBigAnimText("ZONE ENTERED",
- "+" + a.scor + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.3)) : (createSmokePuff(a.oldX, a.oldY, 5, !1, 1), showNotification(b.name + " scored")))
- });
- a.on("5", function(a) {
- showNotification(a)
- });
- a.on("6", function(a, d, e) {
- player.dead || startBigAnimText(a, d, 2E3, !0, "#ffffff", "#5151d9", !0, e)
- });
- a.on("7", function(a, d, e, f) {
- try {
- gameOver = !0, document.getElementById("startMenuWrapper").style.display = "none", showStatTable(d, e, a, !1, f, !0), startSoundTrack(1)
- } catch (h) {
- console.log(h)
- }
- try {
- googletag.pubads().refresh()
- } catch (h) {}
- });
- a.on("8",
- function(a) {
- document.getElementById("nextGameTimer").innerHTML = a + ": UNTIL NEXT ROUND"
- })
- }
- addJS_Node(setupSocket);
- function screenShake(a, b) {
- var idiot = 0;
- }
- function updateScreenShake(a) {
- var idiot = 0;
- }
- addJS_Node(screenShake);
- addJS_Node(updateScreenShake);
- function shootBullet(a) {
- console.log(target.f);
- if (!a.dead && void 0 != getCurrentWeapon(a) && 0 == a.spawnProtection && 0 <= getCurrentWeapon(a).weaponIndex && 0 >= getCurrentWeapon(a).reloadTime && 0 < getCurrentWeapon(a).ammo) {
- screenShake(getCurrentWeapon(a).shake, target.f);
- for (var b = 0; b < getCurrentWeapon(a).bulletsPerShot; ++b) {
- getCurrentWeapon(a).spreadIndex++;
- getCurrentWeapon(a).spreadIndex >= getCurrentWeapon(a).spread.length && (getCurrentWeapon(a).spreadIndex = 0);
- //getCurrentWeapon(a).spreadIndex = 0;
- var d = 0,//getCurrentWeapon(a).spread[getCurrentWeapon(a).spreadIndex],
- d = (target.f +
- mathPI + d).round(2),
- e = getCurrentWeapon(a).holdDist + getCurrentWeapon(a).bDist,
- f = mathRound(a.x + e * mathCOS(d)),
- e = mathRound(a.y - getCurrentWeapon(a).yOffset - a.jumpY + e * mathSIN(d));
- /*shootNextBullet({
- x: f,
- y: e,
- d: d,
- si: -1
- }, a)*/
- }
- var corr = getCurrentWeapon(a).spread[getCurrentWeapon(a).spreadIndex];
- corr = (target.f - corr).round(2);
- socket.emit("1", a.x, a.y, a.jumpY, corr , target.d, currentTime);
- getCurrentWeapon(a).lastShot = currentTime;
- getCurrentWeapon(a).ammo--;
- 0 >= getCurrentWeapon(a).ammo && playerReload(a, !0);
- updateUiStats(a)
- }
- }
- addJS_Node(shootBullet);
- function someoneShot(a) {
- (tmpPlayer = findUserByIndex(a.i), null != tmpPlayer && shootNextBullet(a, tmpPlayer))
- }
- addJS_Node(someoneShot);
- function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
- var D = document;
- var scriptNode = D.createElement ('script');
- if (runOnLoad) {
- scriptNode.addEventListener ("load", runOnLoad, false);
- }
- scriptNode.type = "text/javascript";
- if (text) scriptNode.textContent = text;
- if (s_URL) scriptNode.src = s_URL;
- if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
- var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
- targ.appendChild (scriptNode);
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement