diff --git a/setage.py b/setage.py index 618b990..c17c73f 100755 --- a/setage.py +++ b/setage.py @@ -453,6 +453,19 @@ class SetageShell(Cmd): if arg == "": print("> What should I take?") return + elif len(arg.split(",")) > 1: + for item in [a.strip() for a in arg.split(",")]: + if "items" not in cur_room: + print("> I don't see anything that I could take...") + return + if len(cur_room["items"]) == 0: + print("> I don't see anything that I could take...") + return + if item in cur_room["items"].keys(): + inventory.update({item: cur_room["items"].pop(item)}) + print(f"{item} added to inventory.") + else: + print("> I don't see anything like that...") elif arg: if "items" not in cur_room: print("> I don't see anything that I could take...") @@ -477,6 +490,7 @@ class SetageShell(Cmd): if not text: return list(items) else: + # FIXME: handle multiple items return [comp for comp in items if comp.startswith(text)] def do_inventory(self, arg):