From c0a9ef06feb80f114097d76971db7017be1fdc0c Mon Sep 17 00:00:00 2001 From: POLAR me Date: Sat, 15 Feb 2025 06:09:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(meowfficer):=20=E5=A4=84=E7=90=86=E5=96=82?= =?UTF-8?q?=E7=8C=AB=E5=9C=A8=E5=A4=A7=E4=B8=96=E7=95=8C=E4=B8=AD=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E6=97=A0=E9=99=90=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 记录连续出现相同按钮名的次数 - 当连续次数达到 7 次时,判断指挥猫在大世界中,直接确认,结束任务 --- module/meowfficer/enhance.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/module/meowfficer/enhance.py b/module/meowfficer/enhance.py index 3855ab1b7..e874afc8e 100644 --- a/module/meowfficer/enhance.py +++ b/module/meowfficer/enhance.py @@ -156,7 +156,8 @@ class MeowfficerEnhance(MeowfficerBase): current = 0 retry = Timer(1, count=2) skip_first_screenshot = True - + last_button_names = None # 上一次检测到的按钮特征 + same_button_time = 0 while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -173,6 +174,22 @@ class MeowfficerEnhance(MeowfficerBase): if not len(buttons): break + current_button_names = tuple(sorted(button.name for button in buttons)) + # 如果特征与上一次一致,记录 + if current_button_names == last_button_names: + same_button_time += 1 + else: + # 特征不一致时重置记录 + same_button_time = 0 + last_button_names = current_button_names + if same_button_time >= 7: + logger.warning("指挥猫在大世界中!") + current = 0 #修改扫描数,不然还会"ENHANCE ONCE" + self.ui_click(MEOWFFICER_FEED_CONFIRM, check_button=MEOWFFICER_ENHANCE_CONFIRM, + offset=(20, 20), skip_first_screenshot=True) + self.meow_enhance_confirm() + break #重复点击太多次猫说明这个猫在大世界 + # Else click each button to # apply green check mark # Sleep for stable image