aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-09 12:49:00 -0400
committerhistoria <[not public]>2026-10-09 12:49:00 -0400
commit6321c0a6b63061ac57a982c9ec5f93c1f731ae65 (patch)
treec65218f07914385645bf1763bde203f6641bf7cc /internal
parente95b15ed51832e46c7d0d90f3c84d0ac0b65fbe3 (diff)
downloadthehouseoficarus-6321c0a6b63061ac57a982c9ec5f93c1f731ae65.tar.gz
fix: removed odds column from wager result when irrelevant, remove balance from mid-game pachinko output
Diffstat (limited to 'internal')
-rw-r--r--internal/casino/pachinko.go6
-rw-r--r--internal/game/render_casino_settlement.go65
2 files changed, 53 insertions, 18 deletions
diff --git a/internal/casino/pachinko.go b/internal/casino/pachinko.go
index a374d06..5f401f1 100644
--- a/internal/casino/pachinko.go
+++ b/internal/casino/pachinko.go
@@ -613,7 +613,7 @@ func (t *pachinkoTable) bet(n, spot string, amount int, w Wallet) []Event {
board := t.private(n, fmt.Sprintf("Stake: %d credits. Choose a top slot 1-%d.", amount, pachinkoLanes))
board.Snapshot = t.snapLocked(pachinkoChoosing)
board.Color = "casino_menu"
- board.Menu = &MenuView{ShowBalance: true, Commands: t.hintsLocked()}
+ board.Menu = &MenuView{Commands: t.hintsLocked()}
return []Event{board}
}
@@ -735,9 +735,9 @@ func (t *pachinkoTable) resolveLocked() []Event {
}
t.stake = Wager{}
t.phase = pachinkoIdle
- label := fmt.Sprintf("Slot %d landed [%s]", t.slot, pachinkoPocketText(pocket, t.doubling))
+ label := fmt.Sprintf("Slot %d [%s]", t.slot, pachinkoPocketText(pocket, t.doubling))
if t.doubling > 0 {
- label = fmt.Sprintf("Slot %d landed [%s after %d DOUBLE]", t.slot, pachinkoPocketText(pocket, t.doubling), t.doubling)
+ label = fmt.Sprintf("Slot %d [%s after %d DOUBLE]", t.slot, pachinkoPocketText(pocket, t.doubling), t.doubling)
}
result.Settlement = []SettlementLine{{
Label: label,
diff --git a/internal/game/render_casino_settlement.go b/internal/game/render_casino_settlement.go
index 8bdf9e1..a7e59c9 100644
--- a/internal/game/render_casino_settlement.go
+++ b/internal/game/render_casino_settlement.go
@@ -23,12 +23,34 @@ func renderCasinoSettlement(lines []casino.SettlementLine, unicode bool, paint f
dash = "-"
h, v, tl, tr, bl, br, tj, bj, lj, rj, cross = "-", "|", "+", "+", "+", "+", "+", "+", "+", "+", "+"
}
+ // The Odds column is only informative when at least one wager quotes
+ // explicit odds. A board that prices every pocket the same way (Pachinko's
+ // "Varies") just repeats one word, so drop the column entirely.
+ showOdds := false
+ for _, line := range lines {
+ if line.Odds != "" && line.Odds != "Varies" {
+ showOdds = true
+ break
+ }
+ }
+ heading := []string{"Wager", "Staked", "Result", "Net"}
+ if showOdds {
+ heading = []string{"Wager", "Staked", "Odds", "Result", "Net"}
+ }
+ columns := len(heading)
+ stakedIdx, oddsIdx, resultIdx, netIdx := 1, -1, columns-2, columns-1
+ if showOdds {
+ oddsIdx = 2
+ }
type row struct {
- cells [5]string
+ cells []string
resultTag, netTag string
}
rows := make([]row, 0, len(lines))
- widths := [5]int{5, 6, 4, 6, 3}
+ widths := make([]int, columns)
+ for i, head := range heading {
+ widths[i] = color.VisibleLen(head)
+ }
var staked, returned, active int64
settled := 0
netTag := func(net int64) string {
@@ -79,27 +101,40 @@ func renderCasinoSettlement(lines []casino.SettlementLine, unicode bool, paint f
returned += int64(line.Returned)
settled++
}
- r := row{[5]string{label, strconv.Itoa(line.Stake), odds, result, amount}, rt, nt}
+ cells := []string{label, strconv.Itoa(line.Stake), result, amount}
+ if showOdds {
+ cells = []string{label, strconv.Itoa(line.Stake), odds, result, amount}
+ }
+ r := row{cells, rt, nt}
rows = append(rows, r)
for i, s := range r.cells {
widths[i] = max(widths[i], color.VisibleLen(s))
}
}
widths[0] = min(widths[0], 24)
- widths[2] = min(widths[2], 10)
- // Borders and cell padding occupy sixteen columns.
- widths[0] = min(widths[0], 79-16-widths[1]-widths[2]-widths[3]-widths[4])
+ if showOdds {
+ widths[oddsIdx] = min(widths[oddsIdx], 10)
+ }
+ // The frame adds two padding spaces per cell, the internal separators
+ // and the two outer borders, so it costs 3*columns+1 characters.
+ others := 0
+ for i, w := range widths {
+ if i != 0 {
+ others += w
+ }
+ }
+ widths[0] = min(widths[0], 79-(3*columns+1)-others)
widths[0] = max(widths[0], 5)
// Grow the label column to reach the 50-wide minimum box (a readable footer
// without forcing tiny one-wager receipts wide).
- sum := 4
+ sum := columns - 1
for _, w := range widths {
sum += w + 2
}
widths[0] += max(0, 50-sum)
inner := max(50, sum)
border := func(left, join, right string) string {
- parts := make([]string, 5)
+ parts := make([]string, columns)
for i, w := range widths {
parts[i] = strings.Repeat(h, w+2)
}
@@ -112,26 +147,26 @@ func renderCasinoSettlement(lines []casino.SettlementLine, unicode bool, paint f
}
return s + spaces
}
- formatRow := func(cells [5]string, rt, nt string) string {
- parts := make([]string, 5)
+ formatRow := func(cells []string, rt, nt string) string {
+ parts := make([]string, len(cells))
for i, s := range cells {
tag := "casino_action"
- if i == 3 {
+ if i == resultIdx {
tag = rt
}
- if i == 4 {
+ if i == netIdx {
tag = nt
}
- parts[i] = " " + paint(tag, pad(s, widths[i], i == 1 || i == 2 || i == 4)) + " "
+ parts[i] = " " + paint(tag, pad(s, widths[i], i == stakedIdx || i == oddsIdx || i == netIdx)) + " "
}
return paint("dim", v) + strings.Join(parts, paint("dim", v)) + paint("dim", v)
}
- out := []string{border(tl, tj, tr), formatRow([5]string{"Wager", "Staked", "Odds", "Result", "Net"}, "casino_action", "casino_action"), border(lj, cross, rj)}
+ out := []string{border(tl, tj, tr), formatRow(heading, "casino_action", "casino_action"), border(lj, cross, rj)}
for _, r := range rows {
// Wrapping uses runes, matching the existing MUD visible-width contract.
remaining := r.cells
for {
- var cells [5]string
+ cells := make([]string, len(remaining))
more := false
for i, s := range remaining {
runes := []rune(strings.Join(strings.Fields(s), " "))