aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go15
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 {