diff options
Diffstat (limited to 'internal/casino/machine.go')
| -rw-r--r-- | internal/casino/machine.go | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/internal/casino/machine.go b/internal/casino/machine.go index f8730be..36576d0 100644 --- a/internal/casino/machine.go +++ b/internal/casino/machine.go @@ -499,19 +499,25 @@ func formatWins(wins []SlotWin, ways int) string { return message[:len(message)-1] } -var slotCommands = []MenuCommand{ - {Command: "bet <amount>", Desc: "Set your wager"}, - {Command: "bet max", Desc: "Set the maximum wager"}, - {Command: "spin", Desc: "Spin using your current wager"}, - {Command: "autospin", Desc: "Start automatic betting"}, - {Command: "stop", Desc: "Leave the slot machine"}, +func (m *Machine) commands() []MenuCommand { + if m.autoBet { + return []MenuCommand{{Command: "stop", Desc: "Stop automatic betting"}} + } + commands := []MenuCommand{ + {Command: "bet <amount>", Desc: "Set your wager and spin"}, + {Command: "bet max", Desc: "Bet the maximum and spin"}, + } + if m.bet > 0 { + commands = append(commands, MenuCommand{Command: "spin", Desc: "Spin using your current wager", Cost: m.bet}, MenuCommand{Command: "autospin", Desc: "Start automatic betting", Cost: m.bet}) + } + return append(commands, MenuCommand{Command: "stop", Desc: "Leave the slot machine"}) } func (m *Machine) privateMenu(prefix string) []Event { events := m.private(prefix) events[0].Color = "casino_menu" if m.phase == machineReady { - events[0].Menu = &MenuView{Heading: prefix, ShowBalance: true, Commands: slotCommands} + events[0].Menu = &MenuView{Heading: prefix, ShowBalance: true, Commands: m.commands()} } return events } |
