Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pre-Match Map Preview V2
  3. // @namespace http://www.reddit.com/user/happytagpro/
  4. // @include http://tagpro-*.koalabeast.com:*
  5. // @include http://tangent.jukejuice.com:*
  6. // @include http://maptest.newcompte.fr:*
  7. // @author happy
  8. // @version 2
  9. // ==/UserScript==
  10.  
  11. extraTime = 1 //increase this if you want more time between when the view zooms in and when the game starts. measured in seconds
  12. zoom = 2.5 //initial zoom level
  13.  
  14. killPlayers = false
  15.  
  16. tagpro.socket.on('time',function(message){
  17.  
  18. time = message.time/1000
  19.  
  20. if (message.state == 3) {
  21.  
  22. killPlayers = true
  23.  
  24. //store power up tiles and balls
  25. jukeJuice = tagpro.tiles[6.1]
  26. rollingBomb = tagpro.tiles[6.2]
  27. tagPro = tagpro.tiles[6.3]
  28.  
  29. //replace power up tiles with generic ones, I used the fourth, unused power-up tile as my 'generic' tile, replace ball tiles with blank space tiles.
  30. var generic = tagpro.tiles[6.4]
  31. tagpro.tiles[6.1] = generic
  32. tagpro.tiles[6.2] = generic
  33. tagpro.tiles[6.3] = generic
  34. tagpro.api.redrawBackground()
  35.  
  36. //zoom out, center map
  37. tagpro.spectator = true
  38. tagpro.zoom = zoom
  39. centerView()
  40.  
  41. //when zoomed in, put back power ups and players
  42. delay = time-extraTime
  43. setTimeout(function(){
  44. tagpro.viewPort.followPlayer = true
  45. tagpro.zoom = 1
  46. tagpro.spectator = false
  47. tagpro.settings.ui.spectatorInfo = true
  48. killPlayers = false
  49.  
  50. tagpro.tiles[6.1] = jukeJuice
  51. tagpro.tiles[6.2] = rollingBomb
  52. tagpro.tiles[6.3] = tagPro
  53. for (id in tagpro.players) {
  54. tagpro.players[id].dead = false
  55. }
  56. tagpro.api.redrawBackground()
  57. },delay*1000)
  58. }
  59. })
  60.  
  61. //kill oppoent players (so that you can't see their positions when zoomed out)
  62. tagpro.socket.on('p',function(m){
  63. if (killPlayers) {
  64. if (!!m[0]) {
  65. if (!!tagpro.playerId) {
  66. for (id in tagpro.players) {
  67. if (tagpro.players[id].team != tagpro.players[tagpro.playerId].team) {
  68. tagpro.players[id].dead = true
  69. }
  70. }
  71. }
  72. }
  73. }
  74. })
  75.  
  76. //hide spectator message
  77. tagpro.settings.ui.spectatorInfo = false
  78.  
  79. //hide 'game starting soon...' alert so that you can see the map
  80. setTimeout(function(){
  81. original = tagpro.ui.largeAlert
  82. tagpro.ui.largeAlert = function (e,t,n,r,i){
  83. if (r == "Match Begins Soon...") {
  84. r=''
  85. }
  86. return original(e,t,n,r,i)
  87. }
  88. },400)
  89.  
  90. //press 'c' to center the viewPort, I've put a delay on this because otherwise the keypress wouldn't register. code taken from spec bot
  91. function centerView() {
  92. setTimeout(function(){
  93. var press = $.Event('keydown');
  94. press.which = '67';
  95. $("#viewPort").trigger(press);
  96. press = $.Event('keyup');
  97. $("#viewPort").trigger(press);
  98. },50)
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement