From aae78a8a121826e1a81f55e76c66c6111ebd5d03 Mon Sep 17 00:00:00 2001 From: PoryGone <98504756+PoryGone@users.noreply.github.com> Date: Sun, 20 Nov 2022 16:38:34 -0500 Subject: [PATCH] Core: Add MultiServer command to check a specific location (#1242) --- MultiServer.py | 31 ++++++++++++++++++++++++++++++ worlds/generic/docs/commands_en.md | 1 + 2 files changed, 32 insertions(+) diff --git a/MultiServer.py b/MultiServer.py index fc19f8fe..6e82d157 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1905,6 +1905,37 @@ class ServerCommandProcessor(CommonCommandProcessor): """Sends an item to the specified player""" return self._cmd_send_multiple(1, player_name, *item_name) + def _cmd_send_location(self, player_name: str, *location_name: str) -> bool: + """Send out item from a player's location as though they checked it""" + seeked_player, usable, response = get_intended_text(player_name, self.ctx.player_names.values()) + if usable: + team, slot = self.ctx.player_name_lookup[seeked_player] + game = self.ctx.games[slot] + full_name = " ".join(location_name) + + if full_name.isnumeric(): + location, usable, response = int(full_name), True, None + elif self.ctx.location_names_for_game(game) is not None: + location, usable, response = get_intended_text(full_name, self.ctx.location_names_for_game(game)) + else: + self.output("Can't look up location for unknown game. Send by ID instead.") + return False + + if usable: + if isinstance(location, int): + register_location_checks(self.ctx, team, slot, [location]) + else: + seeked_location: int = self.ctx.location_names_for_game(self.ctx.games[slot])[location] + register_location_checks(self.ctx, team, slot, [seeked_location]) + return True + else: + self.output(response) + return False + + else: + self.output(response) + return False + def _cmd_hint(self, player_name: str, *item_name: str) -> bool: """Send out a hint for a player's item to their team""" seeked_player, usable, response = get_intended_text(player_name, self.ctx.player_names.values()) diff --git a/worlds/generic/docs/commands_en.md b/worlds/generic/docs/commands_en.md index dd36460c..28bbe231 100644 --- a/worlds/generic/docs/commands_en.md +++ b/worlds/generic/docs/commands_en.md @@ -92,5 +92,6 @@ including the exclamation point. - `/forbid_forfeit ` Bars the given player from using the `!forfeit` command. - `/send ` Grants the given player the specified item. - `/send_multiple ` Grants the given player the stated amount of the specified item. +- `/send_location ` Send out the given location for the specified player as if the player checked it - `/hint ` Send out a hint for the given item or location for the specified player. - `/option