Skip to content

Commit

Permalink
add client commands to check totem inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Feb 6, 2024
1 parent 77fe726 commit 12188f8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
12 changes: 12 additions & 0 deletions worlds/zork_grand_inquisitor/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ def _cmd_zork(self) -> None:
else:
self.output("Failed to attach to Zork Grand Inquisitor process.")

def _cmd_brog(self) -> None:
"""List received Brog items."""
self.ctx.game_controller.list_received_brog_items()

def _cmd_griff(self) -> None:
"""List received Griff items."""
self.ctx.game_controller.list_received_griff_items()

def _cmd_lucy(self) -> None:
"""List received Lucy items."""
self.ctx.game_controller.list_received_lucy_items()


class ZorkGrandInquisitorContext(CommonClient.CommonContext):
tags: Set[str] = {"AP"}
Expand Down
39 changes: 39 additions & 0 deletions worlds/zork_grand_inquisitor/game_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,45 @@ def close_process_handle(self) -> bool:
def is_process_running(self) -> bool:
return self.game_state_manager.is_process_running

def list_received_brog_items(self) -> None:
self.log("Received Brog Items:")

self._process_received_items()
received_brog_items: Set[ZorkGrandInquisitorItems] = self.received_items & self.brog_items

if not len(received_brog_items):
self.log(" Nothing")
return

for item in sorted(i.value for i in received_brog_items):
self.log(f" {item}")

def list_received_griff_items(self) -> None:
self.log("Received Griff Items:")

self._process_received_items()
received_griff_items: Set[ZorkGrandInquisitorItems] = self.received_items & self.griff_items

if not len(received_griff_items):
self.log(" Nothing")
return

for item in sorted(i.value for i in received_griff_items):
self.log(f" {item}")

def list_received_lucy_items(self) -> None:
self.log("Received Lucy Items:")

self._process_received_items()
received_lucy_items: Set[ZorkGrandInquisitorItems] = self.received_items & self.lucy_items

if not len(received_lucy_items):
self.log(" Nothing")
return

for item in sorted(i.value for i in received_lucy_items):
self.log(f" {item}")

def update(self) -> None:
if self.game_state_manager.is_process_still_running():
try:
Expand Down

0 comments on commit 12188f8

Please sign in to comment.