From 7687d20466f950456c0be33cce7543a304983a93 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:56:49 +0800 Subject: [PATCH] Fix: Avoid TooManyClickError when receiving lots of missions --- module/reward/reward.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/module/reward/reward.py b/module/reward/reward.py index b340a991e..149536dd3 100644 --- a/module/reward/reward.py +++ b/module/reward/reward.py @@ -85,6 +85,8 @@ class Reward(UI): timeout = Timer(10) exit_timer.start() timeout.start() + # Record received missions to clear click record + clicked_mission = False reward = False while 1: @@ -98,6 +100,11 @@ class Reward(UI): exit_timer.reset() timeout.reset() reward = True + # MISSION_SINGLE -> GET_ITEMS_* means one mission reward received + if clicked_mission: + logger.info('Got items from mission') + self.device.click_record_clear() + clicked_mission = False continue for button in [MISSION_MULTI, MISSION_SINGLE]: @@ -105,6 +112,7 @@ class Reward(UI): continue if self.match_template_color(button, offset=(20, 200), interval=interval): self.device.click(button) + clicked_mission = True exit_timer.reset() click_timer.reset() timeout.reset()