diff options
| author | historia <[not public]> | 2026-09-30 16:16:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-30 16:16:17 -0400 |
| commit | a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73 (patch) | |
| tree | 00c9567e620f331a59dd44f1f1fa779ecd94a845 /internal/game/casino.go | |
| parent | 724079f8de1ae69965c6267dca3d7fc3cc86afa2 (diff) | |
| download | thehouseoficarus-a4c09c2d38d1f3bc1d3ad4bdb0234bdea7c37e73.tar.gz | |
feat: additional craps variants added, standardizard casino command hints
Diffstat (limited to 'internal/game/casino.go')
| -rw-r--r-- | internal/game/casino.go | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go index e9334fc..c2c4c4f 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -695,18 +695,8 @@ func (g *Game) casinoPrivateMessage(sess *net.Session, category string, menu *ca commands[i].Desc += " [unavailable: insufficient funds]" } } - if sess.Player.OptionString("casino_display") == "compact" && menu.Repeat { - var repeat string - for _, c := range commands { - if c.Command == "bet" { - repeat = g.colorize(sess, "command", "bet / rebet") + " " + c.Desc - break - } - } - return g.colorize(sess, "casino_action", heading) + "\n" + balance + "\n " + repeat + "\n " + g.colorize(sess, "command", "bet <amount> [target] | bet min/max | table | sitout | stop") - } if sess.Player.OptionString("casino_display") == "compact" && !menu.ShowBalance { - var hints []string + var hints []casino.MenuCommand for _, c := range commands { label := c.Command switch c.Command { @@ -722,14 +712,9 @@ func (g *Game) casinoPrivateMessage(sess *net.Session, category string, menu *ca if c.Cost > 0 { label += fmt.Sprintf(" (+%d)", c.Cost) } - category := "command" - if c.Cost > casinoAffordable(sess.Player) { - label += " [unavailable]" - category = "casino_warning" - } - hints = append(hints, g.colorize(sess, category, label)) + hints = append(hints, casino.MenuCommand{Command: label, Cost: c.Cost}) } - return g.colorize(sess, "casino_action", heading) + "\n " + strings.Join(hints, " ") + return g.renderCasinoCommands(sess, balance, heading, hints) } return g.renderCasinoCommands(sess, balance, heading, commands) } @@ -796,27 +781,7 @@ func (g *Game) casinoMenuHeader(sess *net.Session, balance, heading string) stri // casinoMenuCommands formats an aligned, colored command list. func (g *Game) casinoMenuCommands(sess *net.Session, commands []casino.MenuCommand) string { - width := 0 - for _, c := range commands { - if n := utf8.RuneCountInString(c.Command); n > width { - width = n - } - } - var sb strings.Builder - for _, c := range commands { - padded := c.Command + strings.Repeat(" ", width-utf8.RuneCountInString(c.Command)) - category := "command" - if sess.Player != nil && c.Cost > casinoAffordable(sess.Player) { - category = "casino_warning" - } - cmd := g.colorize(sess, category, padded) - if c.Desc != "" { - fmt.Fprintf(&sb, " %s %s\n", cmd, c.Desc) - } else { - fmt.Fprintf(&sb, " %s\n", cmd) - } - } - return strings.TrimRight(sb.String(), "\n") + return g.casinoCommandColumns(sess, commands) } func renderBlackjackSnapshotFor(snapshot *casino.BlackjackSnapshot, mode string, unicode bool, size int, style string, art *cardart.Store, viewer string) string { |
