From a05c4e8f2f3fe349ea17f6437648723225ec3c13 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Sat, 4 Nov 2023 16:05:57 +0800 Subject: [PATCH] fix(cafe): adjust handle sequence --- tasks/cafe/cafe.py | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tasks/cafe/cafe.py b/tasks/cafe/cafe.py index 48d279c..a33d693 100644 --- a/tasks/cafe/cafe.py +++ b/tasks/cafe/cafe.py @@ -209,27 +209,6 @@ class Cafe(UI): if self.ui_additional(): continue - if is_second_cafe_on and not is_second and status == CafeStatus.FINISHED: - if not SWITCH_CAFE.appear(main=self): - logger.warning('Cafe switch not found') - continue - if SWITCH_CAFE.get(main=self) == 'off': - SWITCH_CAFE.set('on', main=self) - logger.info('Switching to second cafe') - if not SWITCH_CAFE_SELECT.appear(main=self): - logger.info('Cafe switch select not found') - continue - match (SWITCH_CAFE_SELECT.get(main=self)): - case '1': - if self.click_with_interval(CAFE_SECOND): - continue - case '2': - logger.info('Cafe second arrived') - status = CafeStatus.STUDENT_LIST - is_list = False - is_second = True - self.check = 0 - if not loading_timer.reached(): continue @@ -253,6 +232,28 @@ class Cafe(UI): is_reset = True continue + if is_second_cafe_on and not is_second and status == CafeStatus.FINISHED: + if not SWITCH_CAFE.appear(main=self): + logger.warning('Cafe switch not found') + continue + if SWITCH_CAFE.get(main=self) == 'off': + SWITCH_CAFE.set('on', main=self) + logger.info('Switching to second cafe') + if not SWITCH_CAFE_SELECT.appear(main=self): + logger.info('Cafe switch select not found') + continue + match (SWITCH_CAFE_SELECT.get(main=self)): + case '1': + if self.click_with_interval(CAFE_SECOND): + continue + case '2': + logger.info('Cafe second arrived') + SWITCH_CAFE.set('off', main=self) + status = CafeStatus.STUDENT_LIST + is_list = False + is_second = True + self.check = 0 + if action_timer.reached_and_reset(): logger.attr('Status', status) status = self._handle_cafe(status)