From 27901008bc07e8fac2243aac48e8187d19c950a0 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Tue, 9 Jun 2020 05:22:48 +0200 Subject: [PATCH] fix that hints print already collected items again --- MultiServer.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index f8b0ddd7..34da42ae 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -719,22 +719,24 @@ class ClientMessageProcessor(CommandProcessor): if not new_hints: self.output("Hint was previously used, no points deducted.") if new_hints: - found_hints = sum(not hint.found for hint in new_hints) - if not found_hints: # everything's been found, no need to pay + found_hints = [hint for hint in new_hints if hint.found] + not_found_hints = [hint for hint in new_hints if not hint.found] + + if not not_found_hints: # everything's been found, no need to pay can_pay = 1000 elif self.ctx.hint_cost: can_pay = points_available // self.ctx.hint_cost else: can_pay = 1000 import random - new_hints = [hint for hint in new_hints if not hint.found] - random.shuffle(new_hints) + + random.shuffle(not_found_hints) if can_pay: hints = [] while can_pay > 0: - if not new_hints: + if not not_found_hints: break - hint = new_hints.pop() + hint = not_found_hints.pop() hints.append(hint) can_pay -= 1 self.ctx.hints_used[self.client.team, self.client.slot] += 1 @@ -746,7 +748,7 @@ class ClientMessageProcessor(CommandProcessor): else: self.output( "Could not pay for everything. Rerun the hint later with more points to get the remaining hints.") - notify_hints(self.ctx, self.client.team, hints) + notify_hints(self.ctx, self.client.team, found_hints + hints) save(self.ctx) return True