From 5d55f86b27bc612a18d17bcf960654c009ee5177 Mon Sep 17 00:00:00 2001 From: Zebartin <16185081+Zebartin@users.noreply.github.com> Date: Mon, 2 Oct 2023 12:28:31 +0800 Subject: [PATCH] Fix: Salvage relic timeout & check_all assignment --- tasks/assignment/assignment.py | 5 ++++- tasks/item/relics.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks/assignment/assignment.py b/tasks/assignment/assignment.py index a3186d125..33ca947bf 100644 --- a/tasks/assignment/assignment.py +++ b/tasks/assignment/assignment.py @@ -133,6 +133,7 @@ class Assignment(AssignmentClaim, SynthesizeUI): """ logger.hr('Assignment check all', level=1) current, remain, _ = self._limit_status + # current = #Claimable + #Dispatched if current == len(self.dispatched): return remain for group in self._iter_groups(): @@ -150,13 +151,15 @@ class Assignment(AssignmentClaim, SynthesizeUI): current -= 1 remain += 1 insight = True # Order of entries change after claiming + if current == len(self.dispatched): + return remain continue if status == AssignmentStatus.DISPATCHED: self.dispatched[assignment] = datetime.now() + \ self._get_assignment_time() + insight = False # Order of entries does not change here if current == len(self.dispatched): return remain - insight = False # Order of entries does not change here continue break return remain diff --git a/tasks/item/relics.py b/tasks/item/relics.py index 3e36466dd..a0b06b3ce 100644 --- a/tasks/item/relics.py +++ b/tasks/item/relics.py @@ -28,16 +28,20 @@ class RelicsUI(ItemUI): skip_first_screenshot = True interval = Timer(1) + timeout = Timer(5, count=3).start() while 1: # salvage -> first relic selected if skip_first_screenshot: skip_first_screenshot = False else: self.device.screenshot() + if timeout.reached(): + logger.warning('Timeout when selecting first relic') + return False # The first frame entering relic page, SALVAGE is a white button as it's the default state. # At the second frame, SALVAGE is disabled since no items are selected. # So here uses the minus button on the first relic. - if self.image_color_count(FIRST_RELIC_SELECTED, color=(245, 245, 245), threshold=221, count=50): + if self.image_color_count(FIRST_RELIC_SELECTED, color=(245, 245, 245), threshold=221, count=300): logger.info('First relic selected') break if self.appear_then_click(ORDER_DESCENDING, interval=2):