aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_registry.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-01 05:05:11 -0400
committerhistoria <[not public]>2026-10-01 05:05:11 -0400
commitd4eae333a8d8a96452bbf3617aa85b50466c11a7 (patch)
tree90d4cf075fe5467b35e5cc53ff3ee30fc4ee1feb /internal/game/cmd_registry.go
parent299b5b67aa80ba2539d7a91c60943060b0426b45 (diff)
downloadthehouseoficarus-d4eae333a8d8a96452bbf3617aa85b50466c11a7.tar.gz
feat: concise table/machine names, casino command shortcuts, remove payout video poker command
Diffstat (limited to 'internal/game/cmd_registry.go')
-rw-r--r--internal/game/cmd_registry.go39
1 files changed, 36 insertions, 3 deletions
diff --git a/internal/game/cmd_registry.go b/internal/game/cmd_registry.go
index d7b808b..fbb401c 100644
--- a/internal/game/cmd_registry.go
+++ b/internal/game/cmd_registry.go
@@ -54,9 +54,6 @@ var commandRegistry = map[string]commandDef{
"game": {func(g *Game, s *net.Session, args []string, _ string) {
g.executeTableAction(s, "game "+strings.Join(args, " "))
}, ClassInstant},
- "payout": {func(g *Game, s *net.Session, args []string, _ string) {
- g.executeTableAction(s, "payout "+strings.Join(args, " "))
- }, ClassInstant},
"roll": {func(g *Game, s *net.Session, _ []string, _ string) { g.executeTableAction(s, "roll") }, ClassActive},
"autoroll": {func(g *Game, s *net.Session, _ []string, _ string) { g.executeTableAction(s, "autoroll") }, ClassInstant},
"unbet": {func(g *Game, s *net.Session, args []string, _ string) {
@@ -241,6 +238,42 @@ func classifyCommand(cmd string) CommandClass {
return ClassUnknown
}
+// casinoShortVerbs are the casino verbs a seated player may abbreviate to an
+// unambiguous prefix. "stop" and "rules" are deliberately absent: their
+// prefixes (st, r, ru) would otherwise shadow stand and movement, so those two
+// commands must be typed in full.
+var casinoShortVerbs = []string{
+ "bet", "deal", "draw", "hold", "paytable", "denom", "denomination",
+ "hands", "feature", "game", "roll", "autoroll", "unbet", "table",
+ "status", "list", "watch", "sitout", "decline", "hit", "stand",
+ "double", "split", "insurance", "surrender", "spin", "autobet",
+ "autospin", "rebet",
+}
+
+// casinoAbbreviation resolves a seated casino player's unambiguous command
+// prefix to its full verb. An exact command (including the h/st/dd/sp aliases
+// and video poker's d) always wins, so a prefix never shadows a real command;
+// an ambiguous prefix resolves to nothing and falls through unchanged.
+func (g *Game) casinoAbbreviation(sess *net.Session, cmd string) (string, bool) {
+ if sess == nil || sess.Player == nil || cmd == "" || !g.inCasinoGame(sess.Player.Name) {
+ return "", false
+ }
+ if _, ok := commandRegistry[cmd]; ok {
+ return "", false
+ }
+ match := ""
+ for _, verb := range casinoShortVerbs {
+ if !strings.HasPrefix(verb, cmd) {
+ continue
+ }
+ if match != "" {
+ return "", false
+ }
+ match = verb
+ }
+ return match, match != ""
+}
+
func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawInput string) {
p := sess.Player