diff options
Diffstat (limited to 'asciifarm')
| -rw-r--r-- | asciifarm/client/commandhandler.py | 15 | ||||
| -rw-r--r-- | asciifarm/client/gameclient.py | 3 | ||||
| -rw-r--r-- | asciifarm/client/inputhandler.py | 2 | ||||
| -rw-r--r-- | asciifarm/keybindings/azerty.json | 8 | ||||
| -rw-r--r-- | asciifarm/keybindings/default.json | 18 |
5 files changed, 21 insertions, 25 deletions
diff --git a/asciifarm/client/commandhandler.py b/asciifarm/client/commandhandler.py index 0c3027f..ec5baa3 100644 --- a/asciifarm/client/commandhandler.py +++ b/asciifarm/client/commandhandler.py @@ -29,7 +29,7 @@ class CommandHandler: "selectitem": self.selectItem, "inputwithselected": self.actWithSelected, "use": self.useSelected, - "unuse": self.unUseSelected, + "drop": self.dropSelected, "take": self.takeSelected, "eval": self.eval, "exec": self.exec, @@ -74,7 +74,7 @@ class CommandHandler: self.input(["say", text]) def pick(self, option): - self.input(["pick", option]) + self.input(["interact", [None, "north", "south", "east", "west"], option]) def chat(self, text): self.client.sendChat( text) @@ -103,20 +103,15 @@ class CommandHandler: menu = self.client.display.getSelectedMenu() selected = self.client.display.getSelectedItem(menu) if menu in ("inventory", "equipment"): - action = "use" + self.input(["use", menu, selected]) elif menu == "ground": - action = "interact", - else: - return - self.input([action, selected]) + self.input(["interact", selected]) - def unUseSelected(self): + def dropSelected(self): menu = self.client.display.getSelectedMenu() selected = self.client.display.getSelectedItem(menu) if menu == "inventory": action = "drop" - elif menu == "equipment": - action = "unequip" else: return self.input([action, selected]) diff --git a/asciifarm/client/gameclient.py b/asciifarm/client/gameclient.py index 4013505..c0f702c 100644 --- a/asciifarm/client/gameclient.py +++ b/asciifarm/client/gameclient.py @@ -129,7 +129,8 @@ class Client: if msgType == "ground": self.display.setGround(msg[1]) if msgType == "message": - self.log(*msg[1:]) + type, text = msg[1][:2] + self.log(text, type) if msgType == "options": if msg[1] != None: description, options = msg[1] diff --git a/asciifarm/client/inputhandler.py b/asciifarm/client/inputhandler.py index 0657749..4281c01 100644 --- a/asciifarm/client/inputhandler.py +++ b/asciifarm/client/inputhandler.py @@ -87,7 +87,7 @@ class InputHandler: elif key == "^I": # tab # return to game but keep entered string self.typing = False - elif key.isprintable(): + elif key.isprintable() and len(key) == 1: self.string = self.string[:self.cursor] + key + self.string[self.cursor:] self.cursor += len(key) diff --git a/asciifarm/keybindings/azerty.json b/asciifarm/keybindings/azerty.json index ee04ec5..3d69d07 100644 --- a/asciifarm/keybindings/azerty.json +++ b/asciifarm/keybindings/azerty.json @@ -5,10 +5,10 @@ "w": null, "W": null, "q": ["move", "west"], - "a": ["unuse"], + "a": ["drop"], "A": ["take"], - "Z": ["input", ["attack", "north"]], - "Q": ["input", ["attack", "west"]] + "Z": ["input", ["attack", ["north"]]], + "Q": ["input", ["attack", ["west"]]] }, - "help": "Controls:\n aqsd or arrows:\n Move around\n e: Grab\n q: Drop/unequip\n selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n A: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client" + "help": "Controls:\n aqsd or arrows: Move around\n e: Grab\n q: Drop selected\n r: Interact\n f: Attack\n t: Chat\n E: Use selected\n A: Take selected\n xc: select item\n vb: select menu\n ctrl-c: close client" } diff --git a/asciifarm/keybindings/default.json b/asciifarm/keybindings/default.json index 3fe413f..faf1b40 100644 --- a/asciifarm/keybindings/default.json +++ b/asciifarm/keybindings/default.json @@ -12,11 +12,11 @@ "j": ["move", "south"], "l": ["move", "east"], "h": ["move", "west"], -"e": ["input", ["take"]], -"q": ["unuse"], +"e": ["input", ["take", null]], +"q": ["drop"], "Q": ["take"], "E": ["use"], -"R": ["input", ["interact"]], +"R": ["input", ["interact", [null]]], "r": ["input", ["interact", [null, "north", "south", "east", "west"]]], "x": ["selectitem", -1, true, true], "c": ["selectitem", 1, true, true], @@ -27,16 +27,16 @@ "/": ["selectwidget", -1, true, true], "*": ["selectwidget", 1, true, true], "f": ["input", ["attack", [null, "north", "south", "east", "west"]]], -"F": ["input", ["attack"]], -"W": ["input", ["attack", "north"]], -"S": ["input", ["attack", "south"]], -"D": ["input", ["attack", "east"]], -"A": ["input", ["attack", "west"]], +"F": ["input", ["attack", [null]]], +"W": ["input", ["attack", ["north"]]], +"S": ["input", ["attack", ["south"]]], +"D": ["input", ["attack", ["east"]]], +"A": ["input", ["attack", ["west"]]], "t": ["runinput"], "enter": ["runinput"], "pageup": ["scrollchat", 1], "pagedown": ["scrollchat", -1], "/": ["runinput", "/"] }, -"help": " Controls:\nwasd or arrows: Move around\ne: Grab\nq: Drop/unequip selected\nr: Interact\nf: Attack\nt: Chat\nE: Use selected\nxc: select item\nvb: select menu\nctrl-c: close client\nPgUp/PgDn: scroll chat" +"help": " Controls:\nwasd or arrows: Move around\ne: Grab\nq: Drop selected\nr: Interact\nf: Attack\nt: Chat\nE: Use selected\nxc: select item\nvb: select menu\nctrl-c: close client\nPgUp/PgDn: scroll chat" } |
