Fix: Salvage relic timeout & check_all assignment

This commit is contained in:
Zebartin 2023-10-02 12:28:31 +08:00
parent b264fd5f3c
commit 5d55f86b27
2 changed files with 9 additions and 2 deletions

View File

@ -133,6 +133,7 @@ class Assignment(AssignmentClaim, SynthesizeUI):
""" """
logger.hr('Assignment check all', level=1) logger.hr('Assignment check all', level=1)
current, remain, _ = self._limit_status current, remain, _ = self._limit_status
# current = #Claimable + #Dispatched
if current == len(self.dispatched): if current == len(self.dispatched):
return remain return remain
for group in self._iter_groups(): for group in self._iter_groups():
@ -150,13 +151,15 @@ class Assignment(AssignmentClaim, SynthesizeUI):
current -= 1 current -= 1
remain += 1 remain += 1
insight = True # Order of entries change after claiming insight = True # Order of entries change after claiming
if current == len(self.dispatched):
return remain
continue continue
if status == AssignmentStatus.DISPATCHED: if status == AssignmentStatus.DISPATCHED:
self.dispatched[assignment] = datetime.now() + \ self.dispatched[assignment] = datetime.now() + \
self._get_assignment_time() self._get_assignment_time()
insight = False # Order of entries does not change here
if current == len(self.dispatched): if current == len(self.dispatched):
return remain return remain
insight = False # Order of entries does not change here
continue continue
break break
return remain return remain

View File

@ -28,16 +28,20 @@ class RelicsUI(ItemUI):
skip_first_screenshot = True skip_first_screenshot = True
interval = Timer(1) interval = Timer(1)
timeout = Timer(5, count=3).start()
while 1: # salvage -> first relic selected while 1: # salvage -> first relic selected
if skip_first_screenshot: if skip_first_screenshot:
skip_first_screenshot = False skip_first_screenshot = False
else: else:
self.device.screenshot() 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. # 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. # At the second frame, SALVAGE is disabled since no items are selected.
# So here uses the minus button on the first relic. # 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') logger.info('First relic selected')
break break
if self.appear_then_click(ORDER_DESCENDING, interval=2): if self.appear_then_click(ORDER_DESCENDING, interval=2):