dkforest

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

commit 88cf824d3a8be65bddbfc75f6a126572a31b9335
parent 4eee2dbe86b309f0faec881fbc70ee14428b021c
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 17 Dec 2023 17:20:13 -0500

add table type

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -54,6 +54,7 @@ func (p *Poker) GetOrCreateGame(db *database.DkfDB, roomID RoomID, pokerTableID DB: db, RoomID: roomID, PokerTableID: pokerTableID, + TableType: TableTypeRake, PokerTableMinBet: pokerTableMinBet, PokerTableIsTest: pokerTableIsTest, PlayersEventCh: make(chan PlayerEvent), @@ -183,6 +184,7 @@ type PokerGame struct { DB *database.DkfDB RoomID RoomID PokerTableID int64 + TableType int PokerTableMinBet database.PokerChip PokerTableIsTest bool PlayersEventCh chan PlayerEvent @@ -1047,7 +1049,9 @@ func dealerThread(g *PokerGame) { } // No flop, no drop - collectRake = true + if g.TableType == TableTypeRake { + collectRake = true + } skip = utils.Ternary(isHeadsUpGame, 1, 0) @@ -1150,6 +1154,11 @@ func autoUnsitInactivePlayers(g *PokerGame) { } } +const ( + TableTypeRake = iota + TableType2 +) + func applyGains(g *PokerGame, playersGain []PlayerGain, mainPot, rake database.PokerChip) (winnersStr, winnerHand string) { ongoing := g.Ongoing pokerTableID := g.PokerTableID @@ -1158,10 +1167,12 @@ func applyGains(g *PokerGame, playersGain []PlayerGain, mainPot, rake database.P if nbPlayersGain >= 1 { winnerHand = utils.Ternary(nbPlayersGain == 1, playersGain[0].HandStr, "Split pot") - if !g.PokerTableIsTest { - _ = tx.IncrPokerCasinoRake(rake) + if g.TableType == TableTypeRake { + if !g.PokerTableIsTest { + _ = tx.IncrPokerCasinoRake(rake) + } + g.newLogEvent(fmt.Sprintf("Rake %d (%.2f%%)", rake, (float64(rake)/float64(mainPot))*100)) } - g.newLogEvent(fmt.Sprintf("Rake %d (%.2f%%)", rake, (float64(rake)/float64(mainPot))*100)) for _, el := range playersGain { g.newLogEvent(fmt.Sprintf("Winner #%d: %s %s -> %d", el.Group, el.Player.Username, el.HandStr, el.Gain))