CommonClient: Make hint cost (shown in server label) update (#6149)

This commit is contained in:
Duck
2026-05-09 09:01:22 -06:00
committed by GitHub
parent 3fcd337f65
commit 55a1b12cb7
2 changed files with 15 additions and 10 deletions
+5 -1
View File
@@ -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)
+10 -9
View File
@@ -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 <itemname> 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 <itemname> 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."