Skip to content

Commit

Permalink
MultiServer: Support location name groups in !missing and !checked co…
Browse files Browse the repository at this point in the history
…mmands (ArchipelagoMW#2538)
  • Loading branch information
NewSoupVi authored Apr 14, 2024
1 parent f176589 commit 7c44d74
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,7 @@ def _cmd_remaining(self) -> bool:
"Sorry, !remaining requires you to have beaten the game on this server")
return False

@mark_raw
def _cmd_missing(self, filter_text="") -> bool:
"""List all missing location checks from the server's perspective.
Can be given text, which will be used as filter."""
Expand All @@ -1354,7 +1355,11 @@ def _cmd_missing(self, filter_text="") -> bool:
if locations:
names = [self.ctx.location_names[location] for location in locations]
if filter_text:
names = [name for name in names if filter_text in name]
location_groups = self.ctx.location_name_groups[self.ctx.games[self.client.slot]]
if filter_text in location_groups: # location group name
names = [name for name in names if name in location_groups[filter_text]]
else:
names = [name for name in names if filter_text in name]
texts = [f'Missing: {name}' for name in names]
if filter_text:
texts.append(f"Found {len(locations)} missing location checks, displaying {len(names)} of them.")
Expand All @@ -1365,6 +1370,7 @@ def _cmd_missing(self, filter_text="") -> bool:
self.output("No missing location checks found.")
return True

@mark_raw
def _cmd_checked(self, filter_text="") -> bool:
"""List all done location checks from the server's perspective.
Can be given text, which will be used as filter."""
Expand All @@ -1374,7 +1380,11 @@ def _cmd_checked(self, filter_text="") -> bool:
if locations:
names = [self.ctx.location_names[location] for location in locations]
if filter_text:
names = [name for name in names if filter_text in name]
location_groups = self.ctx.location_name_groups[self.ctx.games[self.client.slot]]
if filter_text in location_groups: # location group name
names = [name for name in names if name in location_groups[filter_text]]
else:
names = [name for name in names if filter_text in name]
texts = [f'Checked: {name}' for name in names]
if filter_text:
texts.append(f"Found {len(locations)} done location checks, displaying {len(names)} of them.")
Expand Down

0 comments on commit 7c44d74

Please sign in to comment.