1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 19:55:12 +00:00

Compare commits

...

2 Commits

Author SHA1 Message Date
29bd71ccc8
fix(cafe): adjust timer of Cafe No.2 2025-01-22 15:01:49 +08:00
d5f4891d4e
fix(cafe): adjust click template offset 2025-01-22 15:01:20 +08:00
2 changed files with 3 additions and 10 deletions

View File

@ -64,7 +64,7 @@ class Cafe(CafeUI):
if handle_invitation(self): if handle_invitation(self):
return CafeStatus.CLICK return CafeStatus.CLICK
case CafeStatus.CLICK: case CafeStatus.CLICK:
buttons = self.get_clickable_buttons(offset=(45, 10)) buttons = self.get_clickable_buttons()
self.click = len(buttons) self.click = len(buttons)
logger.attr('Clickable', self.click) logger.attr('Clickable', self.click)
if not buttons: if not buttons:
@ -112,7 +112,6 @@ class Cafe(CafeUI):
status = CafeStatus.STUDENT_LIST status = CafeStatus.STUDENT_LIST
loading_timer = Timer(2).start() loading_timer = Timer(2).start()
action_timer = Timer(1, count=1) action_timer = Timer(1, count=1)
is_list = False
is_reset = False is_reset = False
is_second = False is_second = False
is_enable = is_reward_on or is_touch_on is_enable = is_reward_on or is_touch_on
@ -129,11 +128,6 @@ class Cafe(CafeUI):
if not loading_timer.reached(): if not loading_timer.reached():
continue continue
if not is_list and status == CafeStatus.STUDENT_LIST and self.appear(STUDENT_LIST):
is_list = True
loading_timer = Timer(3).start()
continue
if not is_reward_on and status == CafeStatus.OCR: if not is_reward_on and status == CafeStatus.OCR:
logger.info('Skip reward') logger.info('Skip reward')
status = CafeStatus.CLICK status = CafeStatus.CLICK
@ -162,9 +156,9 @@ class Cafe(CafeUI):
case '2': case '2':
logger.info('Cafe second arrived') logger.info('Cafe second arrived')
status = CafeStatus.STUDENT_LIST status = CafeStatus.STUDENT_LIST
is_list = False
is_second = True is_second = True
self.check = 0 self.check = 0
loading_timer.reset().start()
else: else:
if not SWITCH_CAFE.appear(main=self): if not SWITCH_CAFE.appear(main=self):
logger.warning('Cafe switch not found') logger.warning('Cafe switch not found')
@ -183,7 +177,6 @@ class Cafe(CafeUI):
logger.info('Cafe second arrived') logger.info('Cafe second arrived')
SWITCH_CAFE.set('off', main=self) SWITCH_CAFE.set('off', main=self)
status = CafeStatus.STUDENT_LIST status = CafeStatus.STUDENT_LIST
is_list = False
is_second = True is_second = True
self.check = 0 self.check = 0

View File

@ -31,7 +31,7 @@ class CafeUI(UI):
# generate result # generate result
return cv2.bitwise_and(image, image, mask=mask) return cv2.bitwise_and(image, image, mask=mask)
def get_clickable_buttons(self, similarity=0.8, offset=(45, 10)): def get_clickable_buttons(self, similarity=0.8, offset=(40, 10)):
image = self.extract_clickable_from_image(self.device.image) image = self.extract_clickable_from_image(self.device.image)
self.template.matched_button._button_offset = offset self.template.matched_button._button_offset = offset
self.template.load_offset(self.template) self.template.load_offset(self.template)