dkforest

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

commit fa3ac0ab9efe77bf6804a0dbc7009c7faf56afcc
parent 4403f142ef161557b9ac283c70e06062aa9f16fa
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 18 Dec 2023 01:25:56 -0500

improve shortcuts

Diffstat:
Mpkg/web/handlers/poker/poker.go | 32+++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1387,25 +1387,31 @@ func PokerBetHandler(c echo.Context) error { default: } } else { - if betBtn == "bet50" { - bet = 50 - } else if betBtn == "bet100" { - bet = 100 - } else if betBtn == "bet200" { - bet = 200 - } - select { - case g.PlayersEventCh <- PlayerEvent{Player: authUser.Username, Bet: bet}: - default: + bet = database.PokerChip(utils.DoParseUint64(strings.TrimPrefix(betBtn, "bet_"))) + if bet > 0 { + select { + case g.PlayersEventCh <- PlayerEvent{Player: authUser.Username, Bet: bet}: + default: + } } } } + shortcuts := `<button type="submit" name="bet" value="bet_50">50</button> + <button type="submit" name="bet" value="bet_100">100</button> + <button type="submit" name="bet" value="bet_200">200</button>` + if g.PokerTableMinBet == 3 { + shortcuts = `<button type="submit" name="bet" value="bet_10">10</button> + <button type="submit" name="bet" value="bet_20">20</button> + <button type="submit" name="bet" value="bet_50">50</button>` + } else if g.PokerTableMinBet == 200 { + shortcuts = `<button type="submit" name="bet" value="bet_400">400</button> + <button type="submit" name="bet" value="bet_800">800</button> + <button type="submit" name="bet" value="bet_1500">1500</button>` + } html := hutils.HtmlCssReset + ` <form method="post"> <input type="number" name="betValue" value="` + itoa2(bet) + `" style="width: 90px;" /><button type="submit" name="bet" value="bet">Bet</button><br /> - <button type="submit" name="bet" value="bet50">50</button> - <button type="submit" name="bet" value="bet100">100</button> - <button type="submit" name="bet" value="bet200">200</button> + ` + shortcuts + ` <button type="submit" name="bet" value="betAllIn">All-in</button> </form>` return c.HTML(http.StatusOK, html)