diff options
| author | historia <[not public]> | 2026-06-11 04:46:27 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-11 08:58:37 +0000 |
| commit | 1b9e2da3b3c438d8dc53d3489725dd5ba0022777 (patch) | |
| tree | 62264f24420bf4cfaa734942c65cc8dd45ba3d3b /internal/game/game.go | |
| parent | 06c02a697e5daf8832a462de5970dd4c0e13a02c (diff) | |
| download | thehouseoficarus-1b9e2da3b3c438d8dc53d3489725dd5ba0022777.tar.gz | |
feat: web client, get/drop updates and fixes
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index 08096b4..50c8f3d 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -58,6 +58,7 @@ func (g *Game) SetHub(hub *net.Hub) { } func (g *Game) HandleSession(sess *net.Session, input string) { + input = player.StripControl(input) switch sess.State { case net.StateAccountName: g.handleAccountName(sess, input) @@ -129,13 +130,23 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { if len(args) == 0 { sess.WriteLine("Get what?") } else if args[0] == "all" { - g.doGetAll(sess) + if len(args) == 1 { + g.doGetAll(sess) + } else { + g.doGetAllNamed(sess, strings.Join(args[1:], " ")) + } } else { g.doGet(sess, strings.Join(args, " ")) } case "drop": if len(args) == 0 { sess.WriteLine("Drop what?") + } else if args[0] == "all" { + if len(args) == 1 { + g.doDropAll(sess) + } else { + g.doDropAllNamed(sess, strings.Join(args[1:], " ")) + } } else { g.doDrop(sess, strings.Join(args, " ")) } @@ -186,15 +197,14 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { g.doToggle(sess, strings.Join(args, " ")) case "exits": g.doExits(sess) - case "ticktest": - g.doTickTest(sess) + case "help": if len(args) == 0 { g.doHelp(sess, "") } else { g.doHelp(sess, strings.Join(args, " ")) } - case "mine", "chop", "fish", "use", "pull", "push": + case "mine", "chop", "fish", "cut", "use", "pull", "push": if len(args) == 0 { sess.WriteLine(fmt.Sprintf("%s what?", cmd)) } else { @@ -214,6 +224,19 @@ func (g *Game) handleGameCommand(sess *net.Session, input string) { case "unalias": g.doUnalias(sess, args) return + case "search": + if len(args) == 0 { + sess.WriteLine("Search what?") + } else { + g.doSearch(sess, strings.Join(args, " ")) + } + return + case "wear", "wield": + g.doWear(sess, strings.Join(args, " ")) + return + case "remove", "unwear", "unwield": + g.doRemove(sess, strings.Join(args, " ")) + return default: sess.WriteLine("Unknown command.") } |
