diff options
| author | historia <[not public]> | 2026-10-03 17:36:06 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-03 17:36:06 -0400 |
| commit | c6d4702c0be4d2b37e1d82ff96265c52847c3f9a (patch) | |
| tree | c0a3d0638b961a9ba06e6fdb30ee5f1cd2061f2e /internal/game/game.go | |
| parent | 0fb83bdf433b9b48240f4ac7a5d4c912f6b808cc (diff) | |
| download | thehouseoficarus-c6d4702c0be4d2b37e1d82ff96265c52847c3f9a.tar.gz | |
feat: partial commands now always work
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index a3a9684..32e3c24 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -599,6 +599,11 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { sess.ClearPrompt() } + // Player aliases resolve first and by exact name only. A partial word never + // expands an alias, and aliases do not join the prefix vocabulary below, so + // an alias "kim" does not stop "ki" from meaning kill. When the whole word + // is an alias ("ki"), that alias wins outright and the built-in command it + // might otherwise abbreviate is never considered. if sess.Account != nil && sess.Account.Aliases != nil { firstSpace := strings.Index(input, " ") var firstWord, rest string @@ -627,11 +632,19 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { // Seated casino players may shorten any of their game's verbs to an // unambiguous prefix (b 1000 -> bet 1000, sp -> spin at Big 6). Only the // current game's vocabulary is considered, and exact commands still win, so - // movement and non-casino commands are never shadowed. + // movement and non-casino commands are never shadowed. Elsewhere a unique + // prefix that the room actually offers may stand for the full command + // (inven -> inventory, pl -> play at a casino table). if canon, ok := g.casinoAbbreviation(sess, cmd); ok { cmd = canon parts[0] = canon input = strings.Join(parts, " ") + } else if len(g.casinoVerbsFor(sess.Player.Name)) == 0 { + if canon, ok := g.resolveCommandPrefix(sess, cmd); ok { + cmd = canon + parts[0] = canon + input = strings.Join(parts, " ") + } } if len(parts) == 1 { |
