Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function roll(winner) {
- if (route.getPage() != 'jackpot' && currentGamesTab != 'jackpot') return
- status = 'rolling'
- var $el = {
- entrylist: $globalScope.find('.pot-roll .entrylist'),
- potroll: $globalScope.find('.pot-roll'),
- items: $globalScope.find('.pot-items'),
- entries: $globalScope.find('.pot-entries')
- }
- var winnerWonItems = $globalScope.find('.status .value.item-count span').text()
- var winnerWonVal = $globalScope.find('.status .value.pot-worth').html()
- while ($el.entrylist.children().length <= 50) {
- var entry = $el.entries.find('.pot-entries .item').eq(getRandomInt(0, $globalScope.find('.pot-entries .item').length - 1)).find('img').attr('src')
- $globalScope.find('.pot-roll .entrylist').append('<img src="' + entry + '">')
- }
- $el.potroll.slideDown()
- $el.items.slideUp(function() {
- $(this).empty()
- })
- $el.entries.slideUp(function() {
- $(this).empty()
- })
- $el.entrylist.find('img:eq(40)').attr('src', winner.avatarURL)
- var ew = $el.entrylist.find('img:eq(0)').width()
- $el.entrylist.width(ew * $el.entrylist.find('img').length)
- var offset = ew * 40
- offset += getRandomInt(5, ew - 5)
- $el.entrylist.animate({
- left: '-=' + offset + 'px'
- }, 8000, 'easeOutQuint', function() {
- // if(winner.id == user.id) {
- // tAlert('success', 'Congratulations, you\'ve just won '+ winnerWonItems +' items worth $'+ winnerWonVal, 'Jackpot');
- // if(document.hidden) {
- // tNotify('Jackpot', 'Congratulations, you\'ve just won '+ winnerWonItems +' items worth $'+ winnerWonVal, '#');
- // }
- // $('#confetti').fadeIn();
- // setTimeout(function(){
- // $('#confetti').fadeOut();
- // }, 3500);
- // }
- setTimeout(function() {
- getPot()
- }, 2000)
- })
- }
- return {
- init: init,
- load: getPot,
- reset: resetPot,
- entries: function() {
- return entries
- },
- debug: debugEntry,
- roll: roll
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement