dkforest

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

commit aa536699a1bb8b29bb047eb0abe14a3901973bac
parent 4e0c8041dc496acd8d3e3df6f1b401af16f147fb
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat, 23 Dec 2023 21:57:47 -0500

fixes

Diffstat:
Mpkg/web/handlers/poker.go | 5+++--
Mpkg/web/handlers/poker/poker.go | 13++++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/pkg/web/handlers/poker.go b/pkg/web/handlers/poker.go @@ -447,7 +447,7 @@ func PokerBetHandler(c echo.Context) error { } roomUserTopic := roomID.UserTopic(authUser.ID) - sub := poker.PokerPubSub.Subscribe([]string{roomUserTopic}) + sub := poker.PokerPubSub.Subscribe([]string{roomID.Topic(), roomUserTopic}) defer sub.Close() quit := hutils.CloseSignalChan(c) hutils.SetStreamingHeaders(c) @@ -477,8 +477,9 @@ func PokerBetHandler(c echo.Context) error { g.Bet(authUser.ID, raiseValue) } } - send(`<style>#actionsForm { display: none; }</style>`) + send(fmt.Sprintf(`<meta http-equiv="refresh" content="0" />`)) c.Response().Flush() + return nil } else { diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -24,7 +24,7 @@ import ( const NbPlayers = 6 const MaxUserCountdown = 60 -const MinTimeAfterGame = 10 +const MinTimeAfterGame = 1 const BackfacingDeg = "-180deg" const BurnStackX = 400 const BurnStackY = 30 @@ -34,7 +34,7 @@ const DealSpacing = 55 const DealerStackX = 250 const DealerStackY = 30 const NbCardsPerPlayer = 2 -const animationTime = 1000 * time.Millisecond +const animationTime = 100 * time.Millisecond type Poker struct { sync.Mutex @@ -885,7 +885,7 @@ func doBet(g *PokerGame, p *pokerPlayer, return continueGetPlayerEventLoop } if playerTotalBet < minBet+minRaise { - msg := fmt.Sprintf("%s (%d) is too low. Must %s at least %d", betLbl, evt.Bet, betLbl, (minBet+minRaise)-playerBet) + msg := fmt.Sprintf("%s (%d) is too low. Must %s at least %d", betLbl, evt.Bet, betLbl, minRaise) PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) return continueGetPlayerEventLoop } @@ -1285,10 +1285,13 @@ func dealerThread(g *PokerGame, eligiblePlayers seatedPlayers) { applyBigBlindBet(g, bigBlindBet, bbIdx) time.Sleep(animationTime) g.ongoing.hasBet.Set(true) + g.ongoing.MinRaise.Set(g.PokerTableMinBet) // Deal players cards dealPlayersCards(g, seats, &idx) + PokerPubSub.Pub(roomTopic, RefreshButtonsEvent{}) + // Wait for players to bet/call/check/fold... time.Sleep(animationTime) skip := utils.Ternary(isHeadsUpGame, 1, 2) @@ -1833,7 +1836,7 @@ func buildActionsDiv(roomID RoomID) (html string) { <iframe src="/poker/{{ .RoomID }}/deal" id="dealBtn"></iframe> <iframe src="/poker/{{ .RoomID }}/unsit" id="unSitBtn"></iframe> </td> - <td style="vertical-align: top;" rowspan="2"> + <td style="vertical-align: top;"> <iframe src="/poker/{{ .RoomID }}/bet" id="betBtn"></iframe> </td> </tr> @@ -2330,7 +2333,7 @@ body { #checkBtn { width: 60px; height: 30px; display: inline-block; vertical-align: top; } #foldBtn { width: 50px; height: 30px; display: inline-block; vertical-align: top; } #callBtn { width: 50px; height: 30px; display: inline-block; vertical-align: top; } -#betBtn { width: 300px; height: 100px; display: inline-block; vertical-align: top; } +#betBtn { width: 400px; height: 45px; display: inline-block; vertical-align: top; } .countdown { --duration: ` + itoa(MaxUserCountdown) + `; --size: 30; } #countdown1 { top: 46px; left: 717px; position: absolute; display: none; z-index: 100; } #countdown2 { top: 167px; left: 729px; position: absolute; display: none; z-index: 100; }