MultiServer: if there is a hint cost, don't make it 0 (#1581)

This commit is contained in:
Fabian Dill 2023-03-24 23:14:34 +01:00 committed by GitHub
parent 03cf525b2c
commit 7e52b6d8bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -597,7 +597,7 @@ class Context:
def get_hint_cost(self, slot):
if self.hint_cost:
return max(0, int(self.hint_cost * 0.01 * len(self.locations[slot])))
return max(1, int(self.hint_cost * 0.01 * len(self.locations[slot])))
return 0
def recheck_hints(self, team: typing.Optional[int] = None, slot: typing.Optional[int] = None):

View File

@ -148,9 +148,11 @@ class ServerLabel(HovererableLabel):
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 {max(0, int(ctx.hint_cost * 0.01 * ctx.total_locations))} " \
"location checks."
f"For you this means every " \
f"{max(min_cost, int(ctx.hint_cost * 0.01 * ctx.total_locations))}" \
f" location checks."
elif ctx.hint_cost == 0:
text += "\n!hint is free to use."