diff options
| author | historia <[not public]> | 2026-10-05 17:05:14 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-05 17:05:14 -0400 |
| commit | e42952469dadfb3535633c66c881050ac128703c (patch) | |
| tree | a78f7396b72cdbd6fa4f6c454c830f40cf2ad0cb /internal/game/game.go | |
| parent | 90ad8c0c33b519d5830c69d4128bdc984b5e9de8 (diff) | |
| download | thehouseoficarus-e42952469dadfb3535633c66c881050ac128703c.tar.gz | |
fix: gather verbs, walk oom, admin path bypass, roulette refund
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index 0c550ae..df8dab2 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -567,7 +567,11 @@ func (g *Game) AdminPlayerFileOnline(relPath string) bool { // path that is not players/<kind>/<name>.yaml, including a bare directory or // a non-YAML file, so callers never treat an unrelated file as a player file. func playerDataFileName(relPath string) (name, kind string, ok bool) { - clean := filepath.ToSlash(filepath.Clean(strings.TrimPrefix(strings.TrimPrefix(relPath, "/"), "data/"))) + clean := filepath.ToSlash(filepath.Clean("/" + strings.TrimPrefix(relPath, "/"))) + clean = strings.TrimPrefix(clean, "/") + for strings.HasPrefix(clean, "data/") { + clean = strings.TrimPrefix(clean, "data/") + } name, found := strings.CutSuffix(filepath.Base(clean), ".yaml") if !found || name == "" { return "", "", false @@ -627,10 +631,16 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { } parts := strings.Fields(strings.ToLower(input)) + orig := strings.Fields(input) if len(parts) == 0 { g.reprompt(sess) return } + // orig preserves argument case for handlers that read rawInput (global, + // symbol, prompt, addlocalobj); parts is the lowercased dispatch form. + if len(orig) != len(parts) { + orig = parts + } cmd := parts[0] // Counter commands exist only while using the counter, before global prefixes. @@ -649,12 +659,14 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { if canon, ok := g.casinoAbbreviation(sess, cmd); ok { cmd = canon parts[0] = canon - input = strings.Join(parts, " ") + orig[0] = canon + input = strings.Join(orig, " ") } 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, " ") + orig[0] = canon + input = strings.Join(orig, " ") } } |
