From 847582ff5f0ef4329ab1601ab5bd22b99dae53cf Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Tue, 24 Jan 2023 03:36:27 +0100 Subject: [PATCH] Server: fix release_mode (#1407) * Server: fix release_mode * Core: actually rename forfeit to release across the program --- CommonClient.py | 4 ++-- MultiServer.py | 17 +++++++++-------- NetUtils.py | 2 +- WebHostLib/static/assets/faq/faq_en.md | 2 +- WebHostLib/templates/generate.html | 2 +- docs/adding games.md | 2 +- docs/network protocol.md | 14 +++++++------- worlds/generic/docs/commands_en.md | 13 ++++++------- worlds/generic/docs/setup_en.md | 2 +- worlds/generic/docs/using_website_en.md | 2 +- worlds/meritous/docs/setup_en.md | 2 +- worlds/witness/Options.py | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/CommonClient.py b/CommonClient.py index e3c325d2..e0970cdb 100644 --- a/CommonClient.py +++ b/CommonClient.py @@ -193,7 +193,7 @@ class CommonContext: self.hint_cost = None self.slot_info = {} self.permissions = { - "forfeit": "disabled", + "release": "disabled", "collect": "disabled", "remaining": "disabled", } @@ -260,7 +260,7 @@ class CommonContext: self.server_task = None self.hint_cost = None self.permissions = { - "forfeit": "disabled", + "release": "disabled", "collect": "disabled", "remaining": "disabled", } diff --git a/MultiServer.py b/MultiServer.py index 564f7949..32c8c1a5 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -119,7 +119,6 @@ class Context: "location_check_points": int, "server_password": str, "password": str, - "forfeit_mode": str, # TODO remove around 0.4 "release_mode": str, "remaining_mode": str, "collect_mode": str, @@ -141,7 +140,7 @@ class Context: non_hintable_names: typing.Dict[str, typing.Set[str]] def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int, - hint_cost: int, item_cheat: bool, forfeit_mode: str = "disabled", collect_mode="disabled", + hint_cost: int, item_cheat: bool, release_mode: str = "disabled", collect_mode="disabled", remaining_mode: str = "disabled", auto_shutdown: typing.SupportsFloat = 0, compatibility: int = 2, log_network: bool = False): super(Context, self).__init__() @@ -157,7 +156,7 @@ class Context: self.player_names: typing.Dict[team_slot, str] = {} self.player_name_lookup: typing.Dict[str, team_slot] = {} self.connect_names = {} # names of slots clients can connect to - self.allow_forfeits = {} + self.allow_releases = {} # player location_id item_id target_player_id self.locations = {} self.host = host @@ -174,7 +173,7 @@ class Context: self.location_check_points = location_check_points self.hints_used = collections.defaultdict(int) self.hints: typing.Dict[team_slot, typing.Set[NetUtils.Hint]] = collections.defaultdict(set) - self.release_mode: str = forfeit_mode + self.release_mode: str = release_mode self.remaining_mode: str = remaining_mode self.collect_mode: str = collect_mode self.item_cheat = item_cheat @@ -593,6 +592,8 @@ class Context: def _set_options(self, server_options: dict): for key, value in server_options.items(): + if key == "forfeit_mode": + key = "release_mode" data_type = self.simple_options.get(key, None) if data_type is not None: if value not in {False, True, None}: # some can be boolean OR text, such as password @@ -1229,7 +1230,7 @@ class ClientMessageProcessor(CommonCommandProcessor): def _cmd_release(self) -> bool: """Sends remaining items in your world to their recipients.""" - if self.ctx.allow_forfeits.get((self.client.team, self.client.slot), False): + if self.ctx.allow_releases.get((self.client.team, self.client.slot), False): release_player(self.ctx, self.client.team, self.client.slot) return True if "enabled" in self.ctx.release_mode: @@ -1885,7 +1886,7 @@ class ServerCommandProcessor(CommonCommandProcessor): player = self.resolve_player(player_name) if player: team, slot, name = player - self.ctx.allow_forfeits[(team, slot)] = True + self.ctx.allow_releases[(team, slot)] = True self.output(f"Player {name} is now allowed to use the !release command at any time.") return True @@ -1898,7 +1899,7 @@ class ServerCommandProcessor(CommonCommandProcessor): player = self.resolve_player(player_name) if player: team, slot, name = player - self.ctx.allow_forfeits[(team, slot)] = False + self.ctx.allow_releases[(team, slot)] = False self.output(f"Player {name} has to follow the server restrictions on use of the !release command.") return True @@ -2053,7 +2054,7 @@ class ServerCommandProcessor(CommonCommandProcessor): return input_text setattr(self.ctx, option_name, attrtype(option)) self.output(f"Set option {option_name} to {getattr(self.ctx, option_name)}") - if option_name in {"forfeit_mode", "release_mode", "remaining_mode", "collect_mode"}: # TODO remove forfeit_mode with 0.4 + if option_name in {"release_mode", "remaining_mode", "collect_mode"}: self.ctx.broadcast_all([{"cmd": "RoomUpdate", 'permissions': get_permissions(self.ctx)}]) elif option_name in {"hint_cost", "location_check_points"}: self.ctx.broadcast_all([{"cmd": "RoomUpdate", option_name: getattr(self.ctx, option_name)}]) diff --git a/NetUtils.py b/NetUtils.py index d7ab7a43..ca44fdea 100644 --- a/NetUtils.py +++ b/NetUtils.py @@ -43,7 +43,7 @@ class Permission(enum.IntFlag): disabled = 0b000 # 0, completely disables access enabled = 0b001 # 1, allows manual use goal = 0b010 # 2, allows manual use after goal completion - auto = 0b110 # 6, forces use after goal completion, only works for forfeit + auto = 0b110 # 6, forces use after goal completion, only works for release auto_enabled = 0b111 # 7, forces use after goal completion, allows manual use any time @staticmethod diff --git a/WebHostLib/static/assets/faq/faq_en.md b/WebHostLib/static/assets/faq/faq_en.md index 6ad50a50..339a2a15 100644 --- a/WebHostLib/static/assets/faq/faq_en.md +++ b/WebHostLib/static/assets/faq/faq_en.md @@ -29,7 +29,7 @@ their game. ## What happens if a person has to leave early? -If a player must leave early, they can use Archipelago's forfeit system. When a player forfeits their game, all the +If a player must leave early, they can use Archipelago's release system. When a player releases their game, all the items in that game which belong to other players are sent out automatically, so other players can continue to play. ## What does multi-game mean? diff --git a/WebHostLib/templates/generate.html b/WebHostLib/templates/generate.html index 0e5b1984..b5fb8325 100644 --- a/WebHostLib/templates/generate.html +++ b/WebHostLib/templates/generate.html @@ -47,7 +47,7 @@ -