|
|
@ -1402,20 +1402,17 @@ Currency.prototype.collect_bets = function (caller, bet, amount) { |
|
|
|
for (var i = 0; i < __self.bets_viewers.length; i++) { |
|
|
|
if (__self.bets_viewers[i].viewer === caller) { |
|
|
|
has_bet = true; |
|
|
|
__self.bets_board[__self.bets_viewers[i].bet].num -= 1; |
|
|
|
__self.bets_board[__self.bets_viewers[i].bet].total -= __self.bets_viewers[i].amount; |
|
|
|
__self.bets_viewers[i].bet = bet.idx; |
|
|
|
__self.bets_viewers[i].amount = amount; |
|
|
|
if (amount >= 1) { |
|
|
|
if (amount > __self.bets_viewers[i].amount) { |
|
|
|
__self.bets_board[__self.bets_viewers[i].bet].num -= 1; |
|
|
|
__self.bets_board[__self.bets_viewers[i].bet].total -= __self.bets_viewers[i].amount; |
|
|
|
__self.bets_viewers[i].bet = bet.idx; |
|
|
|
__self.bets_viewers[i].amount = amount; |
|
|
|
__self.bets_board[bet.idx].num += 1; |
|
|
|
__self.bets_board[bet.idx].total += amount; |
|
|
|
// add flood users to array
|
|
|
|
if (__self.bets_flood.indexOf(i) < 0) { |
|
|
|
__self.bets_flood.push(i); |
|
|
|
} |
|
|
|
// remove from flood if nullified bet
|
|
|
|
} else if (__self.bets_flood.indexOf(i) > 0) { |
|
|
|
__self.bets_flood.splice(__self.bets_flood.indexOf(i), 1); |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|