Advertisement
Guest User

Pre-Match Map Preview

a guest
Jul 2nd, 2014
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pre-Match Map Preview
  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 0.2
  9. // ==/UserScript==
  10.  
  11.  
  12. extraTime = 2 //increase this if you want more time between when the view zooms in and when the game starts. measured in seconds
  13. zoom = 3.5 //initial zoom level
  14. animationTime = 2 //duration of animation. set to 0 if you want to remove animation
  15.  
  16.  
  17. tagpro.socket.on('time',function(message){
  18.  
  19. frequency = 20
  20. interval = (zoom-1)/(animationTime*(1000/frequency))
  21.  
  22. //use the time left until game starts and the time that the animation takes to calculate when the animation needs to start in order to reach normal zoom at game time.
  23. delay = (message.time/1000-animationTime)*1000-400-extraTime*1000
  24.  
  25. if (message.state == 3) {
  26. //store power up tiles
  27. a=tagpro.tiles[6.1]
  28. b=tagpro.tiles[6.2]
  29. c=tagpro.tiles[6.3]
  30.  
  31. //replace power up tiles with generic ones, I used the fourth, unused power-up tile as my 'generic' tile
  32. var generic = tagpro.tiles[6.4]
  33. tagpro.tiles[6.1] = generic
  34. tagpro.tiles[6.2] = generic
  35. tagpro.tiles[6.3] = generic
  36. changed=true
  37. tagpro.api.redrawBackground()
  38.  
  39.  
  40. tagpro.zoom=zoom
  41. setTimeout(function(){
  42. id=setInterval(function(){
  43. zoom=zoom-interval
  44. tagpro.zoom=zoom
  45.  
  46. //when zoomed in stop animation and replace original power-up tiles
  47. if (zoom <= 1) {
  48. clearInterval(id)
  49. tagpro.zoom=1
  50. tagpro.tiles[6.1] = a
  51. tagpro.tiles[6.2] = b
  52. tagpro.tiles[6.3] = c
  53. tagpro.api.redrawBackground()
  54. }
  55. },frequency)
  56. },delay)
  57. }
  58.  
  59. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement