aboutsummaryrefslogtreecommitdiff
path: root/internal/game/casino_ux.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/casino_ux.go')
-rw-r--r--internal/game/casino_ux.go77
1 files changed, 42 insertions, 35 deletions
diff --git a/internal/game/casino_ux.go b/internal/game/casino_ux.go
index 1d66f43..6d666f7 100644
--- a/internal/game/casino_ux.go
+++ b/internal/game/casino_ux.go
@@ -109,14 +109,26 @@ func (g *Game) showCasinoChoices(sess *net.Session, choices []casinoChoice) {
sess.WriteLine(g.renderCasinoCommands(sess, "", "Choose a game (use an unambiguous name or abbreviation):", commands))
}
+// renderCasinoFelt draws a table's felt (layout, payouts, board) without the
+// prose rule text. The table command shows this; rules opens the help page.
+// Craps and roulette already render their felt through the live status
+// snapshot, so they return nothing here.
+func (g *Game) renderCasinoFelt(sess *net.Session, cfg casino.TableConfig) string {
+ switch cfg.Game {
+ case casino.GameBlackjack:
+ return g.renderCasinoSnapshot(sess, &casino.BlackjackRulesView{Config: cfg})
+ case casino.GameBaccarat:
+ return g.renderCasinoSnapshot(sess, &casino.BaccaratRulesView{Config: cfg})
+ case casino.GamePaiGow:
+ return renderPaiGowFelt(cfg, g.colorMode(sess), sess.Player.OptionBool("unicode"))
+ }
+ return ""
+}
+
func (g *Game) executeTableStatus(sess *net.Session, args []string, _ string) {
if sess.Player == nil {
return
}
- if len(args) > 0 && args[0] != "rules" && args[0] != "help" {
- sess.WriteLine("Use table, table rules, or table help.")
- return
- }
t, playing := g.Casino.Participation(sess.Player.Name)
if !playing || t == nil {
if len(args) > 0 && args[0] == "help" {
@@ -132,41 +144,36 @@ func (g *Game) executeTableStatus(sess *net.Session, args []string, _ string) {
}
return
}
- if len(args) > 0 && args[0] == "rules" {
- // The felt and the exact, per-table wording stay under table rules;
- // bare rules opens the game's own help page.
- if t.Config.Game == casino.GameVideoPoker {
- g.executeTableAction(sess, "paytable")
- } else {
- sess.WriteLine(g.renderCasinoRules(sess, t.Config))
- }
- return
- }
+ // table help remains a shortcut to the seated game's help page; the old
+ // "table rules" subcommand is gone, so bare table always shows the felt.
if len(args) > 0 && args[0] == "help" {
g.doHelp(sess, t.HelpTopic())
- } else {
- g.emitCasinoEvents(t.Status(sess.Player.Name))
- if t.Config.Game == casino.GameRoulette {
- sess.WriteLine(g.rouletteReminder(sess, t.Config))
- } else {
- sess.WriteLine(g.colorize(sess, "command", "Learn to play: rules. Exact payouts: table rules."))
+ if t.Config.Game != casino.GameVideoPoker {
+ commands := []casino.MenuCommand{
+ {Command: "rules", Desc: "Help page for this game variant"},
+ {Command: "list", Desc: "Every bet available right now, with payouts"},
+ {Command: "option casino_display compact", Desc: "Compact action hints (detailed for full command menus)"},
+ {Command: "help casino", Desc: "Quick guides to all casino games"},
+ }
+ sess.WriteLine(g.renderCasinoCommands(sess, "", "Table controls", commands))
}
+ return
}
- if len(args) > 0 {
- // Reuse the game's current-state menu instead of advertising actions
- // (insurance, split, rebet, etc.) that may not be legal right now.
- g.emitCasinoEvents(t.Status(sess.Player.Name))
- if t.Config.Game == casino.GameVideoPoker {
- return
- }
- commands := []casino.MenuCommand{
- {Command: "rules", Desc: "Help page for this game variant"},
- {Command: "list", Desc: "Every bet available right now, with payouts"},
- {Command: "table rules", Desc: "This table’s exact rules and payouts"},
- {Command: "option casino_display compact", Desc: "Compact action hints (detailed for full command menus)"},
- {Command: "help casino", Desc: "Quick guides to all casino games"},
- }
- sess.WriteLine(g.renderCasinoCommands(sess, "", "Table controls", commands))
+ // The table command always shows the live felt. The rules command opens
+ // the game's help page; there is no separate "table rules" command.
+ if t.Config.Game == casino.GameVideoPoker {
+ // A video poker cabinet's felt is its paytable.
+ g.executeTableAction(sess, "paytable")
+ return
+ }
+ g.emitCasinoEvents(t.Status(sess.Player.Name))
+ if felt := g.renderCasinoFelt(sess, t.Config); felt != "" {
+ sess.WriteLine(felt)
+ }
+ if t.Config.Game == casino.GameRoulette {
+ sess.WriteLine(g.rouletteReminder(sess, t.Config))
+ } else {
+ sess.WriteLine(g.colorize(sess, "command", "Learn to play: rules."))
}
}