commit 7356c46b1cb57b7ccee55dba43134a953b115c6e
parent 489cdcac8cfd1e33953db3462bf84edd7c4eb5ff
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 26 Dec 2023 14:33:20 -0500
cleanup
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -324,10 +324,12 @@ func (p *PokerPlayer) refundBet(db *database.DkfDB, pokerTableID int64) {
func (p *PokerPlayer) doBetAndNotif(g *Game, bet database.PokerChip) {
p.doBet(g.db, g.pokerTableID, bet)
PubSub.Pub(g.roomID.Topic(), PlayerBetEvent{PlayerSeatIdx: p.seatIdx, Player: p.username, Bet: bet, TotalBet: p.GetBet(), Cash: p.getCash()})
+ pubCashBonus(g, p.seatIdx, bet, false)
+}
- seatIdx := p.seatIdx
+func pubCashBonus(g *Game, seatIdx int, amount database.PokerChip, isGain bool) {
g.seatsAnimation[seatIdx] = !g.seatsAnimation[seatIdx]
- PubSub.Pub(g.roomID.Topic(), CashBonusEvent{PlayerSeatIdx: seatIdx, Gain: bet, Animation: g.seatsAnimation[seatIdx]})
+ PubSub.Pub(g.roomID.Topic(), CashBonusEvent{PlayerSeatIdx: seatIdx, Gain: amount, Animation: g.seatsAnimation[seatIdx], IsGain: isGain})
}
type playerCard struct {
@@ -1446,10 +1448,7 @@ func applyGains(g *Game, playersGain []PlayerGain, mainPot, rake database.PokerC
g.newLogEvent(fmt.Sprintf("Winner #%d: %s %s -> %d", el.Group, el.Player.username, el.HandStr, el.Gain))
winnersStr += el.Player.username.String() + " "
el.Player.gain(tx, pokerTableID, el.Gain)
-
- seatIdx := el.Player.seatIdx
- g.seatsAnimation[seatIdx] = !g.seatsAnimation[seatIdx]
- PubSub.Pub(g.roomID.Topic(), CashBonusEvent{PlayerSeatIdx: seatIdx, Gain: el.Gain, Animation: g.seatsAnimation[seatIdx], IsGain: true})
+ pubCashBonus(g, el.Player.seatIdx, el.Gain, true)
}
for _, op := range ongoing.players {
op.gain(tx, pokerTableID, 0)