Advertisement
Guest User

Untitled

a guest
Feb 12th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.36 KB | None | 0 0
  1. // ==UserScript==
  2. // @name New Userscript
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match http://vertix.io/
  8. // @grant unsafeWindow
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.  
  13. function canSee(a, b, d, e) {
  14. return true
  15.  
  16. }
  17.  
  18. addJS_Node (canSee);
  19.  
  20. function setupSocket(a) {
  21. a.on("pong1", receivePing);
  22. null != pingInterval && clearInterval(pingInterval);
  23. pingInterval = setInterval(function() {
  24. pingStart = Date.now();
  25. a.emit("ping1")
  26. }, 2E3);
  27. a.on("yourRoom", function(a, d) {
  28. room = a;
  29. serverKeyTxt.innerHTML = d
  30. });
  31. a.on("connect_failed", function() {
  32. kickPlayer("Connection failed. Please check your internet connection.")
  33. });
  34. a.on("disconnect", function(a) {
  35. kickPlayer("Disconnected. Your connection timed out.");
  36. console.log(a)
  37. });
  38. a.on("error", function(a) {
  39. console.log("PLEASE NOTIFY THE DEVELOPER OF THE FOLLOWING ERROR");
  40. console.log("ERROR: " + a)
  41. });
  42. a.on("welcome", function(b, d) {
  43. player.id = b.id;
  44. player.room = b.room;
  45. room = player.room;
  46. player.name = playerName;
  47. player.classIndex = playerClassIndex;
  48. b.name = player.name;
  49. b.classIndex = playerClassIndex;
  50. a.emit("gotit", b, d, Date.now(), !1);
  51. player.dead = !0;
  52. d && (deactiveAllAnimTexts(), gameStart = !1, hideUI(!1), document.getElementById("startMenuWrapper").style.display = "block");
  53. gameOver && (document.getElementById("gameStatWrapper").style.display = "none");
  54. gameOverFade = gameOver = !1;
  55. targetChanged = !0;
  56. mobile &&
  57. (hideMenuUI(), hideUI(!0), document.getElementById("startMenuWrapper").style.display = "none");
  58. resize()
  59. });
  60. a.on("cSrvRes", function(a, d) {
  61. d ? (serverKeyTxt.innerHTML = a, serverCreateMessage.innerHTML = "Success. Created server with IP: " + a) : serverCreateMessage.innerHTML = a
  62. });
  63. a.on("regRes", function(a, d) {
  64. d || (loginMessage.style.display = "block");
  65. loginMessage.innerHTML = a
  66. });
  67. a.on("logRes", function(a, d) {
  68. if (d) {
  69. loginMessage.style.display = "none";
  70. loginMessage.innerHTML = "";
  71. loginWrapper.style.display = "none";
  72. loggedInWrapper.style.display =
  73. "block";
  74. document.getElementById("playerNameInput").value = a.text;
  75. tmpLogKey = a.logKey;
  76. tmpUserName = a.text;
  77. setCookie("logKey", a.logKey);
  78. setCookie("userName", a.text);
  79. loggedIn = !0;
  80. player.loggedIn = !0;
  81. var b = findUserByIndex(player.index);
  82. b && (b.loggedIn = !0)
  83. } else loginMessage.style.display = "block", loginMessage.innerHTML = a;
  84. loadSavedClass()
  85. });
  86. a.on("recovRes", function(b, d) {
  87. loginMessage.style.display = "block";
  88. loginMessage.innerHTML = b;
  89. if (d) {
  90. document.getElementById("recoverForm").style.display = "block";
  91. var e = document.getElementById("chngPassKey"),
  92. f = document.getElementById("chngPassPass");
  93. document.getElementById("chngPassButton").onclick = function() {
  94. loginMessage.style.display = "block";
  95. loginMessage.innerHTML = "Please Wait...";
  96. a.emit("dbCngPass", {
  97. passKey: e.value,
  98. newPass: f.value
  99. });
  100. a.on("cngPassRes", function(a, b) {
  101. loginMessage.style.display = "block";
  102. loginMessage.innerHTML = a;
  103. b && (document.getElementById("recoverForm").style.display = "none")
  104. })
  105. }
  106. }
  107. });
  108. a.on("dbClanCreateR", function(a, d) {
  109. d ? (clanSignUp.style.display = "none", clanStats.style.display = "block", clanHeader.innerHTML =
  110. "[" + a + "] Clan:", clanAdminPanel.style.display = "block", leaveClanButton.style.display = "inline-block", leaveClanButton.innerHTML = "DELETE CLAN") : (clanDBMessage.style.display = "block", clanDBMessage.innerHTML = a)
  111. });
  112. a.on("dbClanJoinR", function(a, d) {
  113. if (d) {
  114. clanSignUp.style.display = "none";
  115. clanStats.style.display = "block";
  116. clanHeader.innerHTML = "[" + a + "] Clan:";
  117. player.account.clan = a;
  118. var b = findUserByIndex(player.index);
  119. b && (b.account.clan = a);
  120. leaveClanButton.style.display = "inline-block";
  121. leaveClanButton.innerHTML = "Leave Clan"
  122. } else clanDBMessage.style.display =
  123. "block", clanDBMessage.innerHTML = a
  124. });
  125. a.on("dbClanInvR", function(a, d) {
  126. clanInvMessage.style.display = "block";
  127. clanInvMessage.innerHTML = a
  128. });
  129. a.on("dbKickInvR", function(a, d) {
  130. clanInvMessage.style.display = "block";
  131. clanInvMessage.innerHTML = a
  132. });
  133. a.on("dbClanLevR", function(a, d) {
  134. d && (clanSignUp.style.display = "block", clanStats.style.display = "none", clanHeader.innerHTML = "Clans", clanDBMessage.style.display = "block", clanDBMessage.innerHTML = a, leaveClanButton.style.display = "none")
  135. });
  136. a.on("dbChatR", function(a, d) {
  137. clanChtMessage.style.display =
  138. "inline-block";
  139. clanChtMessage.innerHTML = a.text;
  140. d && (a.newURL.match(/^https?:\/\//i) || (a.newURL = "http://" + a.newURL), clanChatLink.innerHTML = "<a target='_blank' href='" + a.newURL + "'>Clan Chat</a>")
  141. });
  142. a.on("dbChangeUserR", function(a, d) {
  143. d ? (setCookie("userName", a), player.account.user_name = a, editProfileMessage.innerHTML = "Success. Account Updated.") : editProfileMessage.innerHTML = a
  144. });
  145. a.on("dbClanStats", function(a) {
  146. updateClanPage(a)
  147. });
  148. a.on("updAccStat", function(a) {
  149. updateAccountPage(a)
  150. });
  151. a.on("gameSetup", function(a,
  152. d, e) {
  153. a = JSON.parse(a);
  154. if (d) {
  155. gameMap = a.mapData;
  156. gameMap.tiles = [];
  157. gameWidth = gameMap.width;
  158. gameHeight = gameMap.height;
  159. mapTileScale = a.tileScale;
  160. gameObjects = a.usersInRoom;
  161. for (d = 0; d < gameObjects.length; ++d) gameObjects[d].type = "player";
  162. gameMode = gameMap.gameMode;
  163. "blue" == a.you.team ? document.getElementById("gameModeText").innerHTML = gameMode.desc2 : document.getElementById("gameModeText").innerHTML = gameMode.desc1;
  164. currentLikeButton = "";
  165. var b = null;
  166. for (d = 0; d < gameMap.clutter.length; ++d) b = gameMap.clutter[d], b.type = "clutter",
  167. gameObjects.push(b);
  168. setupMap(gameMap);
  169. cachedMiniMap = null;
  170. deactivateSprays();
  171. for (d = 0; 100 > d; ++d) bullets.push(new Projectile)
  172. }
  173. e && (gameStart = !0, showUI(), document.getElementById("cvs").focus());
  174. keys.lm = 0;
  175. maxScreenHeight = a.maxScreenHeight * a.viewMult * 1.5;
  176. maxScreenWidth = a.maxScreenWidth * a.viewMult * 1.5;
  177. viewMult = a.viewMult;
  178. a.you.type = "player";
  179. player = a.you;
  180. e = findUserByIndex(a.you.index);
  181. null != e ? gameObjects[gameObjects.indexOf(e)] = a.you : gameObjects.push(a.you);
  182. updateWeaponUI(player, !0);
  183. inMainMenu && ($("#loadingWrapper").fadeOut(0,
  184. function() {}), inMainMenu = !1);
  185. startingGame = !1;
  186. resize()
  187. });
  188. a.on("lb", updateLeaderboard);
  189. a.on("ts", updateTeamScores);
  190. a.on("rsd", receiveServerData);
  191. a.on("upd", updateUserValue);
  192. a.on("vt", updateVoteStats);
  193. a.on("add", addUser);
  194. a.on("updHt", updateHatList);
  195. a.on("updShrt", updateShirtList);
  196. a.on("updCmo", updateCamosList);
  197. a.on("updSprs", updateSpraysList);
  198. a.on("crtSpr", createSpray);
  199. a.on("rem", removeUser);
  200. a.on("cht", messageFromServer);
  201. a.on("kick", function(a) {
  202. kickPlayer(a)
  203. });
  204. a.on("1", function(a) {
  205. var b = findUserByIndex(a.gID),
  206. e = mathABS(a.amount);
  207. (a.dID != player.index || a.gID == player.index) && 0 >= a.amount && a.gID == player.index && 0 != e && screenShake(e / 2, a.dir);
  208. 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));
  209. 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 /
  210. randomInt(5, 7), .5, 16, 0, !0), createLiquid(b.x, b.y, e.dir, 4)), e.active = !1));
  211. null != b && (b.health = a.h, b.index == player.index && (updatePlayerInfo(b), updateUiStats(b)))
  212. });
  213. a.on("2", someoneShot);
  214. a.on("jum", otherJump);
  215. a.on("ex", createExplosion);
  216. a.on("r", function(a) {
  217. var b = findUserByIndex(player.index);
  218. 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))
  219. });
  220. a.on("3",
  221. function(a) {
  222. var b = findUserByIndex(a.gID),
  223. e = findUserByIndex(a.dID);
  224. b.dead = !0;
  225. 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");
  226. else if (a.dID == player.index && a.gID != player.index) {
  227. playSound("kill1", e.x, e.y);
  228. var f = "";
  229. 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!" :
  230. 7 == a.kd ? "Stop!" : "Godlike!") : (f = "Team Kill", a.sS = "no");
  231. a.ast && (f = "Kill Assist");
  232. startBigAnimText(f, a.sS + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.25)
  233. }
  234. if (a.gID == player.index) {
  235. hideStatTable();
  236. gameStart = !1;
  237. hideUI(!1);
  238. player.dead = !0;
  239. try {
  240. googletag.pubads().refresh()
  241. } catch (h) {}
  242. window.setTimeout(function() {
  243. gameOver || (document.getElementById("startMenuWrapper").style.display = "block", document.getElementById("linkBox").style.display = "block")
  244. }, 1300);
  245. playSound("death1", player.x, player.y);
  246. startSoundTrack(1)
  247. }
  248. });
  249. a.on("4", function(a, d, e) {
  250. if (0 == e) null != gameMap && void 0 != a.active && (gameMap.pickups[d].active = a.active);
  251. else
  252. 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))
  253. });
  254. a.on("tprt", function(a) {
  255. var b = findUserByIndex(a.indx);
  256. 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",
  257. "+" + a.scor + " POINTS", 2E3, !0, "#ffffff", "#5151d9", !0, 1.3)) : (createSmokePuff(a.oldX, a.oldY, 5, !1, 1), showNotification(b.name + " scored")))
  258. });
  259. a.on("5", function(a) {
  260. showNotification(a)
  261. });
  262. a.on("6", function(a, d, e) {
  263. player.dead || startBigAnimText(a, d, 2E3, !0, "#ffffff", "#5151d9", !0, e)
  264. });
  265. a.on("7", function(a, d, e, f) {
  266. try {
  267. gameOver = !0, document.getElementById("startMenuWrapper").style.display = "none", showStatTable(d, e, a, !1, f, !0), startSoundTrack(1)
  268. } catch (h) {
  269. console.log(h)
  270. }
  271. try {
  272. googletag.pubads().refresh()
  273. } catch (h) {}
  274. });
  275. a.on("8",
  276. function(a) {
  277. document.getElementById("nextGameTimer").innerHTML = a + ": UNTIL NEXT ROUND"
  278. })
  279. }
  280.  
  281. addJS_Node(setupSocket);
  282.  
  283. function screenShake(a, b) {
  284. var idiot = 0;
  285. }
  286.  
  287. function updateScreenShake(a) {
  288. var idiot = 0;
  289. }
  290.  
  291. addJS_Node(screenShake);
  292. addJS_Node(updateScreenShake);
  293.  
  294. function shootBullet(a) {
  295. console.log(target.f);
  296. if (!a.dead && void 0 != getCurrentWeapon(a) && 0 == a.spawnProtection && 0 <= getCurrentWeapon(a).weaponIndex && 0 >= getCurrentWeapon(a).reloadTime && 0 < getCurrentWeapon(a).ammo) {
  297. screenShake(getCurrentWeapon(a).shake, target.f);
  298. for (var b = 0; b < getCurrentWeapon(a).bulletsPerShot; ++b) {
  299. getCurrentWeapon(a).spreadIndex++;
  300. getCurrentWeapon(a).spreadIndex >= getCurrentWeapon(a).spread.length && (getCurrentWeapon(a).spreadIndex = 0);
  301. //getCurrentWeapon(a).spreadIndex = 0;
  302. var d = 0,//getCurrentWeapon(a).spread[getCurrentWeapon(a).spreadIndex],
  303. d = (target.f +
  304. mathPI + d).round(2),
  305. e = getCurrentWeapon(a).holdDist + getCurrentWeapon(a).bDist,
  306. f = mathRound(a.x + e * mathCOS(d)),
  307. e = mathRound(a.y - getCurrentWeapon(a).yOffset - a.jumpY + e * mathSIN(d));
  308. /*shootNextBullet({
  309. x: f,
  310. y: e,
  311. d: d,
  312. si: -1
  313. }, a)*/
  314. }
  315. var corr = getCurrentWeapon(a).spread[getCurrentWeapon(a).spreadIndex];
  316. corr = (target.f - corr).round(2);
  317. socket.emit("1", a.x, a.y, a.jumpY, corr , target.d, currentTime);
  318. getCurrentWeapon(a).lastShot = currentTime;
  319. getCurrentWeapon(a).ammo--;
  320. 0 >= getCurrentWeapon(a).ammo && playerReload(a, !0);
  321. updateUiStats(a)
  322. }
  323. }
  324.  
  325. addJS_Node(shootBullet);
  326.  
  327. function someoneShot(a) {
  328. (tmpPlayer = findUserByIndex(a.i), null != tmpPlayer && shootNextBullet(a, tmpPlayer))
  329. }
  330.  
  331. addJS_Node(someoneShot);
  332.  
  333.  
  334. function addJS_Node (text, s_URL, funcToRun, runOnLoad) {
  335. var D = document;
  336. var scriptNode = D.createElement ('script');
  337. if (runOnLoad) {
  338. scriptNode.addEventListener ("load", runOnLoad, false);
  339. }
  340. scriptNode.type = "text/javascript";
  341. if (text) scriptNode.textContent = text;
  342. if (s_URL) scriptNode.src = s_URL;
  343. if (funcToRun) scriptNode.textContent = '(' + funcToRun.toString() + ')()';
  344.  
  345. var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
  346. targ.appendChild (scriptNode);
  347. }
  348. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement