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.go31
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.")
}