Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. function roll(winner) {
  2. if (route.getPage() != 'jackpot' && currentGamesTab != 'jackpot') return
  3.  
  4. status = 'rolling'
  5.  
  6. var $el = {
  7. entrylist: $globalScope.find('.pot-roll .entrylist'),
  8. potroll: $globalScope.find('.pot-roll'),
  9. items: $globalScope.find('.pot-items'),
  10. entries: $globalScope.find('.pot-entries')
  11. }
  12.  
  13. var winnerWonItems = $globalScope.find('.status .value.item-count span').text()
  14. var winnerWonVal = $globalScope.find('.status .value.pot-worth').html()
  15.  
  16. while ($el.entrylist.children().length <= 50) {
  17. var entry = $el.entries.find('.pot-entries .item').eq(getRandomInt(0, $globalScope.find('.pot-entries .item').length - 1)).find('img').attr('src')
  18. $globalScope.find('.pot-roll .entrylist').append('<img src="' + entry + '">')
  19. }
  20.  
  21. $el.potroll.slideDown()
  22. $el.items.slideUp(function() {
  23. $(this).empty()
  24. })
  25. $el.entries.slideUp(function() {
  26. $(this).empty()
  27. })
  28.  
  29. $el.entrylist.find('img:eq(40)').attr('src', winner.avatarURL)
  30. var ew = $el.entrylist.find('img:eq(0)').width()
  31. $el.entrylist.width(ew * $el.entrylist.find('img').length)
  32. var offset = ew * 40
  33. offset += getRandomInt(5, ew - 5)
  34.  
  35. $el.entrylist.animate({
  36. left: '-=' + offset + 'px'
  37. }, 8000, 'easeOutQuint', function() {
  38. // if(winner.id == user.id) {
  39. // tAlert('success', 'Congratulations, you\'ve just won '+ winnerWonItems +' items worth $'+ winnerWonVal, 'Jackpot');
  40. // if(document.hidden) {
  41. // tNotify('Jackpot', 'Congratulations, you\'ve just won '+ winnerWonItems +' items worth $'+ winnerWonVal, '#');
  42. // }
  43.  
  44. // $('#confetti').fadeIn();
  45. // setTimeout(function(){
  46. // $('#confetti').fadeOut();
  47. // }, 3500);
  48. // }
  49.  
  50. setTimeout(function() {
  51. getPot()
  52. }, 2000)
  53. })
  54. }
  55.  
  56. return {
  57. init: init,
  58. load: getPot,
  59. reset: resetPot,
  60. entries: function() {
  61. return entries
  62. },
  63. debug: debugEntry,
  64. roll: roll
  65. }
  66. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement