dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 5b9fe1d0dab445ea390f8efdf3a63f0efb3b9f2e
parent bf71235b90ab70b23bc2604963fd7d663cddd1b8
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  7 Dec 2023 04:14:30 -0500

prevent over betting

Diffstat:
Mpkg/web/handlers/poker/poker.go | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -401,6 +401,11 @@ OUTER: PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) continue } + if bet > p.Cash { + msg := fmt.Sprintf("Bet (%d) is too high. Must bet at most %d", bet, p.Cash) + PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) + continue + } if (p.Bet + bet) > minBet { lastRisePlayerIdx = p.SeatIdx } @@ -742,7 +747,7 @@ func (g *PokerGame) Deal(db *database.DkfDB, roomID string, authUser *database.U func (g *PokerGame) CountEligibleSeated() (count int) { for _, p := range g.Players { - if p != nil && p.Cash > 0 { + if p != nil && p.Cash >= BigBlindBet { count++ } }