From 55a1b12cb78926e9308114c347996c7a5c763252 Mon Sep 17 00:00:00 2001 From: Duck <31627079+duckboycool@users.noreply.github.com> Date: Sat, 9 May 2026 09:01:22 -0600 Subject: [PATCH] CommonClient: Make hint cost (shown in server label) update (#6149) --- CommonClient.py | 6 +++++- kvui.py | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CommonClient.py b/CommonClient.py index 3f98a4eff1..2da41f8360 100755 --- a/CommonClient.py +++ b/CommonClient.py @@ -1069,7 +1069,7 @@ async def process_server_cmd(ctx: CommonContext, args: dict): if "players" in args: ctx.consume_players_package(args["players"]) if "hint_points" in args: - ctx.hint_points = args['hint_points'] + ctx.hint_points = args["hint_points"] if "checked_locations" in args: checked = set(args["checked_locations"]) ctx.checked_locations |= checked @@ -1077,6 +1077,10 @@ async def process_server_cmd(ctx: CommonContext, args: dict): if "permissions" in args: ctx.update_permissions(args["permissions"]) + # Update hint info for local display + if "hint_cost" in args: + ctx.hint_cost = int(args["hint_cost"]) + elif cmd == 'Print': ctx.on_print(args) diff --git a/kvui.py b/kvui.py index 14d8d18528..8fcf9a7542 100644 --- a/kvui.py +++ b/kvui.py @@ -363,15 +363,16 @@ class ServerLabel(HoverBehavior, MDTooltip, MDBoxLayout): text += "\nPermissions:" for permission_name, permission_data in ctx.permissions.items(): text += f"\n {permission_name}: {permission_data}" - if ctx.hint_cost is not None and ctx.total_locations: - min_cost = int(ctx.server_version >= (0, 3, 9)) - text += f"\nA new !hint costs {ctx.hint_cost}% of checks made. " \ - f"For you this means every " \ - f"{max(min_cost, int(ctx.hint_cost * 0.01 * ctx.total_locations))} " \ - "location checks." \ - f"\nYou currently have {ctx.hint_points} points." - elif ctx.hint_cost == 0: - text += "\n!hint is free to use." + if ctx.total_locations and ctx.hint_cost is not None: + if ctx.hint_cost == 0: + text += "\n!hint is free to use." + else: + min_cost = int(ctx.server_version >= (0, 3, 9)) + text += f"\nA new !hint costs {ctx.hint_cost}% of checks made. " \ + f"For you this means every " \ + f"{max(min_cost, int(ctx.hint_cost * 0.01 * ctx.total_locations))} " \ + "location checks." \ + f"\nYou currently have {ctx.hint_points} points." if ctx.stored_data and "_read_race_mode" in ctx.stored_data: text += "\nRace mode is enabled." \ if ctx.stored_data["_read_race_mode"] else "\nRace mode is disabled."