From 1778e3075739368e7005cd4678f0a123da19b37b Mon Sep 17 00:00:00 2001 From: PoryGone Date: Fri, 15 Dec 2023 19:07:19 -0500 Subject: [PATCH 1/4] Properly handle Disabled hints --- CommonClient.py | 11 +++++++---- MultiServer.py | 6 +++++- docs/network protocol.md | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CommonClient.py b/CommonClient.py index c4d80f341611..67948e65bb7c 100644 --- a/CommonClient.py +++ b/CommonClient.py @@ -698,10 +698,13 @@ async def process_server_cmd(ctx: CommonContext, args: dict): if args['password']: logger.info('Password required') ctx.update_permissions(args.get("permissions", {})) - logger.info( - f"A !hint costs {args['hint_cost']}% of your total location count as points" - f" and you get {args['location_check_points']}" - f" for each location checked. Use !hint for more information.") + if args['hint_cost'] > 100: + logger.info('Hints are disabled.') + else: + logger.info( + f"A !hint costs {args['hint_cost']}% of your total location count as points" + f" and you get {args['location_check_points']}" + f" for each location checked. Use !hint for more information.") ctx.hint_cost = int(args['hint_cost']) ctx.check_points = int(args['location_check_points']) diff --git a/MultiServer.py b/MultiServer.py index 9d2e9b564e75..ec43dbe6d3da 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1425,7 +1425,11 @@ def get_hints(self, input_text: str, for_location: bool = False) -> bool: points_available = get_client_points(self.ctx, self.client) cost = self.ctx.get_hint_cost(self.client.slot) - if not input_text: + if self.ctx.hint_cost > 100: + self.output(f"Sorry, hints are disabled.") + hints = [] + return True + elif not input_text: hints = {hint.re_check(self.ctx, self.client.team) for hint in self.ctx.hints[self.client.team, self.client.slot]} self.ctx.hints[self.client.team, self.client.slot] = hints diff --git a/docs/network protocol.md b/docs/network protocol.md index 199f96f48131..6699ce012a6d 100644 --- a/docs/network protocol.md +++ b/docs/network protocol.md @@ -72,7 +72,7 @@ Sent to clients when they connect to an Archipelago server. | tags | list\[str\] | Denotes special features or capabilities that the sender is capable of. Example: `WebHost` | | password | bool | Denoted whether a password is required to join this room. | | permissions | dict\[str, [Permission](#Permission)\[int\]\] | Mapping of permission name to [Permission](#Permission), keys are: "release", "collect" and "remaining". | -| hint_cost | int | The percentage of total locations that need to be checked to receive a hint from the server. | +| hint_cost | int | The percentage of total locations that need to be checked to receive a hint from the server. Set to a value greater than 100 to disable hints. | | location_check_points | int | The amount of hint points you receive per item/location check completed. | | games | list\[str\] | List of games present in this multiworld. | | datapackage_versions | dict\[str, int\] | Data versions of the individual games' data packages the server will send. Used to decide which games' caches are outdated. See [Data Package Contents](#Data-Package-Contents). **Deprecated. Use `datapackage_checksums` instead.** | From 78dd85c9f5057f0ae13b552b6542f9167329aff7 Mon Sep 17 00:00:00 2001 From: PoryGone Date: Fri, 5 Jan 2024 03:13:13 -0500 Subject: [PATCH 2/4] Output adjustment --- MultiServer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MultiServer.py b/MultiServer.py index ec43dbe6d3da..ceb4953a2672 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1426,7 +1426,7 @@ def get_hints(self, input_text: str, for_location: bool = False) -> bool: cost = self.ctx.get_hint_cost(self.client.slot) if self.ctx.hint_cost > 100: - self.output(f"Sorry, hints are disabled.") + self.output("Sorry, hints are disabled.") hints = [] return True elif not input_text: From 638be78b81c5d62ada3f9a43cd2da1498c8cfc67 Mon Sep 17 00:00:00 2001 From: PoryGone Date: Sat, 30 Nov 2024 15:27:18 -0500 Subject: [PATCH 3/4] Block Scout Hints when disabled, update option wording --- MultiServer.py | 2 +- WebHostLib/templates/generate.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index 30249d98b2d4..2b73f43895c0 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1892,7 +1892,7 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict): return target_item, target_player, flags = ctx.locations[client.slot][location] - if create_as_hint: + if create_as_hint and self.ctx.hint_cost <= 100: hints.extend(collect_hint_location_id(ctx, client.team, client.slot, location, HintStatus.HINT_UNSPECIFIED)) locs.append(NetworkItem(target_item, location, target_player, flags)) diff --git a/WebHostLib/templates/generate.html b/WebHostLib/templates/generate.html index 53d98dfae6ba..de967e505be6 100644 --- a/WebHostLib/templates/generate.html +++ b/WebHostLib/templates/generate.html @@ -159,7 +159,7 @@

Generate Game{% if race %} (Race Mode){% endif %}

From 22c5348b677e5d3af43ee468eecf28a834d6f8ac Mon Sep 17 00:00:00 2001 From: PoryGone Date: Sat, 30 Nov 2024 15:51:21 -0500 Subject: [PATCH 4/4] Fix option access --- MultiServer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MultiServer.py b/MultiServer.py index 2b73f43895c0..64fc431ad5c4 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -1892,7 +1892,7 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict): return target_item, target_player, flags = ctx.locations[client.slot][location] - if create_as_hint and self.ctx.hint_cost <= 100: + if create_as_hint and ctx.hint_cost <= 100: hints.extend(collect_hint_location_id(ctx, client.team, client.slot, location, HintStatus.HINT_UNSPECIFIED)) locs.append(NetworkItem(target_item, location, target_player, flags))