From 00bf9c569a2d4f4e4a063a8afecd6e89f643b53f Mon Sep 17 00:00:00 2001 From: N00byKing Date: Sat, 29 Jan 2022 15:10:02 +0100 Subject: [PATCH] Add send_multiple command --- MultiServer.py | 19 ++++++++++++------- .../tutorial/archipelago/commands_en.md | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index 13f8614e..ef079344 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1600,8 +1600,8 @@ class ServerCommandProcessor(CommonCommandProcessor): self.output(f"Could not find player {player_name} to forbid the !forfeit command for.") return False - def _cmd_send(self, player_name: str, *item_name: str) -> bool: - """Sends an item to the specified player""" + def _cmd_send_multiple(self, amount: str, player_name: str, *item_name: str) -> bool: + """Sends multiples of an item to the specified player""" 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] @@ -1609,12 +1609,13 @@ class ServerCommandProcessor(CommonCommandProcessor): world = proxy_worlds[self.ctx.games[slot]] item, usable, response = get_intended_text(item, world.item_names) if usable: - new_item = NetworkItem(world.item_name_to_id[item], -1, 0) - get_received_items(self.ctx, team, slot, True).append(new_item) - get_received_items(self.ctx, team, slot, False).append(new_item) - self.ctx.notify_all('Cheat console: sending "' + item + '" to ' + + for i in range(0,int(amount)): + new_item = NetworkItem(world.item_name_to_id[item], -1, 0) + get_received_items(self.ctx, team, slot, True).append(new_item) + get_received_items(self.ctx, team, slot, False).append(new_item) + send_new_items(self.ctx) + self.ctx.notify_all('Cheat console: sending ' + ('' if amount == 1 else amount + ' of ') + '"' + item + '" to ' + self.ctx.get_aliased_name(team, slot)) - send_new_items(self.ctx) return True else: self.output(response) @@ -1623,6 +1624,10 @@ class ServerCommandProcessor(CommonCommandProcessor): self.output(response) return False + def _cmd_send(self, player_name: str, *item_name: str) -> bool: + """Sends an item to the specified player""" + self._cmd_send_multiple(1,player_name,*item_name) + def _cmd_hint(self, player_name: str, *item: 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/WebHostLib/static/assets/tutorial/archipelago/commands_en.md b/WebHostLib/static/assets/tutorial/archipelago/commands_en.md index aaa41b8b..dd36460c 100644 --- a/WebHostLib/static/assets/tutorial/archipelago/commands_en.md +++ b/WebHostLib/static/assets/tutorial/archipelago/commands_en.md @@ -91,5 +91,6 @@ including the exclamation point. - `/allow_forfeit ` Allows the given player to use the `!forfeit` command. - `/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. - `/hint ` Send out a hint for the given item or location for the specified player. - `/option