Add count to missing command

Add a server's missing command
Fix password wasn't able to remove a set password
This commit is contained in:
Fabian Dill 2020-04-20 11:47:50 +02:00
parent ecc2b03aed
commit 5a57519c32
2 changed files with 24 additions and 3 deletions

View File

@ -824,10 +824,17 @@ class ClientCommandProcessor(CommandProcessor):
get_location_name_from_address(item.location), index, len(self.ctx.items_received)))
def _cmd_missing(self):
"""List all missing location checks"""
"""List all missing location checks, from your local game state"""
count = 0
for location in [k for k, v in Regions.location_table.items() if type(v[0]) is int]:
if location not in self.ctx.locations_checked:
logging.info('Missing: ' + location)
self.output('Missing: ' + location)
count += 1
if count:
self.output(f"Found {count} missing location checks")
else:
self.output("No missing location checks found.")
def _cmd_show_items(self, toggle: str = ""):
"""Toggle showing of items received across the team"""

View File

@ -466,6 +466,20 @@ class ClientMessageProcessor(CommandProcessor):
timer = 10
asyncio.create_task(countdown(self.ctx, timer))
def _cmd_missing(self):
"""List all missing location checks from the server's perspective"""
buffer = "" # try not to spam small packets over network
count = 0
for location_id, location_name in Regions.lookup_id_to_name.items(): # cheat console is -1, keep in mind
if location_id != -1 and location_id not in self.ctx.location_checks[self.client.team, self.client.slot]:
buffer += f'Missing: {location_name}\n'
count += 1
if buffer:
self.output(buffer + f"Found {count} missing location checks")
else:
self.output("No missing location checks found.")
@mark_raw
def _cmd_getitem(self, item_name: str):
"""Cheat in an item"""
@ -670,7 +684,7 @@ class ServerCommandProcessor(CommandProcessor):
self.ctx.running = False
@mark_raw
def _cmd_password(self, new_password: str):
def _cmd_password(self, new_password: str = ""):
"""Set the server password. Leave the password text empty to remove the password"""
set_password(self.ctx, new_password if new_password else None)