diff options
| author | historia <[not public]> | 2026-10-01 16:26:11 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-01 16:26:11 -0400 |
| commit | d762f8e1360cf38b8e11e69083c2dad59ec7130e (patch) | |
| tree | 4e684608e02b39b6b085e2a2ab9726bdae063240 /internal/game/casino.go | |
| parent | c94728c929045f7c1bdf0166df152d944e5f99bc (diff) | |
| download | thehouseoficarus-d762f8e1360cf38b8e11e69083c2dad59ec7130e.tar.gz | |
fix: trim extra info from games, A2345 support in pai gow, remove bet timers for single player games
Diffstat (limited to 'internal/game/casino.go')
| -rw-r--r-- | internal/game/casino.go | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go index db5bfad..66c90a1 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -595,8 +595,8 @@ func (g *Game) emitCasinoEvents(events []casino.Event) { privateMessage := g.casinoPrivateMessage(sess, category, event.Menu, g.casinoTimeText(text)) privateMessage = g.renderCasinoMessage(sess, category, event.Menu, privateMessage) rendered := g.renderCasinoSnapshot(sess, event.Snapshot) - if header, reminder, ok := g.casinoBoardReminder(sess, category, event.Menu, event.Snapshot, g.casinoTimeText(text)); ok { - privateMessage = composeTableThenReminder(header, rendered, reminder) + if reminder, ok := g.casinoBoardReminder(sess, category, event.Menu, event.Snapshot, g.casinoTimeText(text)); ok { + privateMessage = composeTableThenReminder(rendered, reminder) } else if rendered != "" { privateMessage += "\n" + rendered } @@ -635,35 +635,37 @@ func (g *Game) casinoMenuParts(sess *net.Session, menu *casino.MenuView, message // casinoBoardReminder splits a persistent-board menu (craps, roulette, video // poker, Pai Gow) so its instructions print under the board they describe. // Every other game, and compact displays, keep their menu in one block. -func (g *Game) casinoBoardReminder(sess *net.Session, category string, menu *casino.MenuView, snapshot casino.Snapshot, message string) (header, reminder string, ok bool) { +func (g *Game) casinoBoardReminder(sess *net.Session, category string, menu *casino.MenuView, snapshot casino.Snapshot, message string) (reminder string, ok bool) { if category != "casino_menu" || menu == nil || sess.Player == nil { - return "", "", false + return "", false } _, isCraps := snapshot.(*casino.CrapsSnapshot) _, isPoker := snapshot.(*casino.VideoPokerSnapshot) _, isPaiGow := snapshot.(*casino.PaiGowSnapshot) s, isRoulette := snapshot.(*casino.RouletteSnapshot) if !isPoker && !isCraps && !isPaiGow && (!isRoulette || s.Phase == "playing" || s.Phase == "result") { - return "", "", false + return "", false } if !isPoker && !isCraps && !isPaiGow && sess.Player.OptionString("casino_display") == "compact" && (menu.Repeat || !menu.ShowBalance) { // The compact reminder is already a short block; leave it intact. - return "", "", false + return "", false } balance, heading, commands := g.casinoMenuParts(sess, menu, message) - return g.casinoMenuHeader(sess, balance, heading), g.casinoMenuCommands(sess, commands), true + // The board replaces the game-name heading, and the balance sits with the + // commands underneath it rather than above the graphic. + return g.renderCasinoCommands(sess, balance, heading, commands), true } -// composeTableThenReminder joins a menu header, the board graphic, and the -// wager reminder. The board snapshot already leads with a blank line, and the -// reminder keeps exactly one blank line below the board's last visible row. -func composeTableThenReminder(header, table, reminder string) string { - out := header - if table != "" { - out += "\n" + strings.TrimRight(table, "\n") - } +// composeTableThenReminder joins a board graphic and the wager reminder. The +// board snapshot already leads with a blank line, and the reminder keeps +// exactly one blank line below the board's last visible row. +func composeTableThenReminder(table, reminder string) string { + out := strings.TrimRight(table, "\n") if reminder != "" { - out += "\n\n" + reminder + if out != "" { + out += "\n\n" + } + out += reminder } return out } @@ -766,18 +768,19 @@ func (g *Game) renderCasinoCommands(sess *net.Session, balance, heading string, } // casinoMenuHeader formats the balance and heading that introduce a casino -// menu. It is split from the command list so the roulette board can be drawn -// between them. +// menu. The heading (if any) comes first so the balance always sits directly +// above the command list. It is split from the command list so the roulette +// board can be drawn between them. func (g *Game) casinoMenuHeader(sess *net.Session, balance, heading string) string { var sb strings.Builder - if balance != "" { - sb.WriteString(balance) - sb.WriteString("\n\n") - } if heading != "" { sb.WriteString(g.colorize(sess, "casino_action", heading)) sb.WriteString("\n\n") } + if balance != "" { + sb.WriteString(balance) + sb.WriteString("\n\n") + } return strings.TrimRight(sb.String(), "\n") } |
