Guest User

Untitled

a guest
Aug 9th, 2017
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. // ==UserScript==
  2. // @name TagPro Team Stats
  3. // @namespace http://www.reddit.com/user/thevdude/
  4. // @description Adds team stats to score boards (with PUPs). Updated for v3.2.
  5. // @include http://tagpro-*.koalabeast.com:*
  6. // @include http://tangent.jukejuice.com:*
  7. // @include http://maptest*.newcompte.fr:*
  8. // @include http://justletme.be:*
  9. // @copyright 2014+ thevdude
  10. // @author thevdude, yank
  11. // @version 1.2
  12. // ==/UserScript==
  13.  
  14. function updateTeamStats() {
  15. tagpro.redStats = {
  16. "s-captures": 0,
  17. "s-drops": 0,
  18. "s-grabs": 0,
  19. "s-hold": 0,
  20. "s-pops": 0,
  21. "s-prevent": 0,
  22. "s-returns": 0,
  23. "s-support": 0,
  24. "s-tags": 0,
  25. "s-powerups": 0,
  26. "score": 0,
  27. "points": 0
  28. }
  29.  
  30. tagpro.blueStats = {
  31. "s-captures": 0,
  32. "s-drops": 0,
  33. "s-grabs": 0,
  34. "s-hold": 0,
  35. "s-pops": 0,
  36. "s-prevent": 0,
  37. "s-returns": 0,
  38. "s-support": 0,
  39. "s-tags": 0,
  40. "s-powerups": 0,
  41. "score": 0,
  42. "points": 0
  43. }
  44.  
  45. rS = tagpro.redStats;
  46. bS = tagpro.blueStats;
  47.  
  48. for (x in tagpro.players) {
  49. tpP = tagpro.players[x];
  50.  
  51. if ( tpP.team == 1 ) {
  52. rS["s-captures"] += tpP["s-captures"]
  53. rS["s-drops"] += tpP["s-drops"]
  54. rS["s-grabs"] += tpP["s-grabs"]
  55. rS["s-hold"] += tpP["s-hold"]
  56. rS["s-pops"] += tpP["s-pops"]
  57. rS["s-prevent"] += tpP["s-prevent"]
  58. rS["s-returns"] += tpP["s-returns"]
  59. rS["s-support"] += tpP["s-support"]
  60. rS["s-tags"] += tpP["s-tags"]
  61. rS["s-powerups"] += tpP["s-powerups"]
  62. rS["score"] += tpP["score"]
  63. if(tpP["points"]) rS["points"] += tpP["points"]
  64. } else if (tpP.team == 2 ) {
  65. bS["s-captures"] += tpP["s-captures"]
  66. bS["s-drops"] += tpP["s-drops"]
  67. bS["s-grabs"] += tpP["s-grabs"]
  68. bS["s-hold"] += tpP["s-hold"]
  69. bS["s-pops"] += tpP["s-pops"]
  70. bS["s-prevent"] += tpP["s-prevent"]
  71. bS["s-returns"] += tpP["s-returns"]
  72. bS["s-support"] += tpP["s-support"]
  73. bS["s-tags"] += tpP["s-tags"]
  74. bS["s-powerups"] += tpP["s-powerups"]
  75. bS["score"] += tpP["score"]
  76. if(tpP["points"]) bS["points"] += tpP["points"]
  77. }
  78. }
  79. var rStable = $('.redStats').find("td");
  80. var bStable = $('.blueStats').find("td");
  81. rStable.eq(1).text(rS.score),
  82. rStable.eq(2).text(rS["s-tags"]),
  83. rStable.eq(3).text(rS["s-pops"]),
  84. rStable.eq(4).text(rS["s-grabs"]),
  85. rStable.eq(5).text(rS["s-drops"]),
  86. rStable.eq(6).text(tagpro.helpers.timeFromSeconds(rS["s-hold"], !0)),
  87. rStable.eq(7).text(rS["s-captures"]),
  88. rStable.eq(8).text(tagpro.helpers.timeFromSeconds(rS["s-prevent"], !0)),
  89. rStable.eq(9).text(rS["s-returns"]),
  90. rStable.eq(10).text(rS["s-support"]),
  91. rStable.eq(11).text(rS["s-powerups"]),
  92. rStable.eq(12).text(rS["points"] == 0 ? "-" : rS.points);
  93.  
  94. bStable.eq(1).text(bS.score),
  95. bStable.eq(2).text(bS["s-tags"]),
  96. bStable.eq(3).text(bS["s-pops"]),
  97. bStable.eq(4).text(bS["s-grabs"]),
  98. bStable.eq(5).text(bS["s-drops"]),
  99. bStable.eq(6).text(tagpro.helpers.timeFromSeconds(bS["s-hold"], !0)),
  100. bStable.eq(7).text(bS["s-captures"]),
  101. bStable.eq(8).text(tagpro.helpers.timeFromSeconds(bS["s-prevent"], !0)),
  102. bStable.eq(9).text(bS["s-returns"]),
  103. bStable.eq(10).text(bS["s-support"]),
  104. bStable.eq(11).text(bS["s-powerups"]),
  105. bStable.eq(12).text(bS["points"] == 0 ? "-" : bS.points);
  106. }
  107.  
  108. var teamStatsTable = '<table><tbody><tr><th>Team</th><th>Score</th><th>Tags</th><th>Popped</th><th>Grabs</th><th>Drops</th><th>Hold</th><th>Captures</th><th>Prevent</th><th>Returns</th><th>Support</th><th>Power-ups</th><th>Rank Pts</th></tr></tbody><tbody class="teamStats"><tr class="redStats"><td><span class="scoreName" style="color: #FFB5BD;">RED</span></td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>00:00</td><td>0</td><td>00:00</td><td>0</td><td>0</td><td>0</td><td>-</td></tr><tr class="blueStats"><td><span class="scoreName" style="color: #CFCFFF;">BLUE</span></td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>00:00</td><td>0</td><td>00:00</td><td>0</td><td>0</td><td>0</td><td>-</td></tr></tbody></table>'
  109.  
  110. $('#options').find('table').after(teamStatsTable);
  111. $('.redStats').css('background-color', 'rgba(180, 85, 85, .5)');
  112. $('.blueStats').css('background-color', 'rgba(85, 85, 180, .5)');
  113.  
  114. setInterval(updateTeamStats, 1000);
Add Comment
Please, Sign In to add comment