Skip to content

Commit

Permalink
add a client command to list received hotspots
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Feb 6, 2024
1 parent 12188f8 commit 512b539
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions worlds/zork_grand_inquisitor/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def _cmd_lucy(self) -> None:
"""List received Lucy items."""
self.ctx.game_controller.list_received_lucy_items()

def _cmd_hotspots(self) -> None:
"""List received Hotspots."""
self.ctx.game_controller.list_received_hotspots()


class ZorkGrandInquisitorContext(CommonClient.CommonContext):
tags: Set[str] = {"AP"}
Expand Down
15 changes: 15 additions & 0 deletions worlds/zork_grand_inquisitor/game_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ def list_received_lucy_items(self) -> None:
for item in sorted(i.value for i in received_lucy_items):
self.log(f" {item}")

def list_received_hotspots(self) -> None:
self.log("Received Hotspots:")

self._process_received_items()

hotspot_items: Set[ZorkGrandInquisitorItems] = items_with_tag(ZorkGrandInquisitorTags.HOTSPOT)
received_hotspots: Set[ZorkGrandInquisitorItems] = self.received_items & hotspot_items

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

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

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

0 comments on commit 512b539

Please sign in to comment.