فهرست منبع

Merge branch 'dev'

neptine 4 ماه پیش
والد
کامیت
9383eb601a

+ 1 - 1
module/logger.py

@@ -16,7 +16,7 @@ from rich.rule import Rule
 from typing import Callable, List
 from typing import Callable, List
 
 
 
 
-def cleanup_logs(log_dir: str = "./log", keep_days: int = 7):
+def cleanup_logs(log_dir: str = "./log", keep_days: int = 14):
     """删除 log_dir 下所有早于 keep_days 的文件夹和文件"""
     """删除 log_dir 下所有早于 keep_days 的文件夹和文件"""
     log_path = Path(log_dir)
     log_path = Path(log_dir)
     if not log_path.exists():
     if not log_path.exists():

+ 5 - 1
tasks/Component/GeneralBattle/general_battle.py

@@ -398,13 +398,17 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
 
 
         # 点击预设确认
         # 点击预设确认
         self.wait_until_appear(self.I_PRESET_ENSURE, wait_time=1)
         self.wait_until_appear(self.I_PRESET_ENSURE, wait_time=1)
+        click_timer = Timer(10).start()
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
+            if click_timer.reached():
+                logger.warning("Switch preset failure")
             if not self.appear(self.I_PRESET_ENSURE):
             if not self.appear(self.I_PRESET_ENSURE):
                 break
                 break
-            if self.appear_then_click(self.I_PRESET_ENSURE, threshold=0.8, interval=0.2):
+            if self.appear_then_click(self.I_PRESET_ENSURE, threshold=0.8, interval=1):
                 continue
                 continue
         logger.info("Click preset ensure")
         logger.info("Click preset ensure")
+        return None
 
 
     def random_click_swipt(self):
     def random_click_swipt(self):
         if 0 <= random.randint(0, 500) <= 3:  # 百分之4的概率
         if 0 <= random.randint(0, 500) <= 3:  # 百分之4的概率

+ 1 - 1
tasks/Component/GeneralInvite/assets.py

@@ -105,7 +105,7 @@ class GeneralInviteAssets:
 	# 判断是不是在庭院界面 
 	# 判断是不是在庭院界面 
 	I_GI_HOME = RuleImage(roi_front=(361,34,34,46), roi_back=(361,34,34,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_home.png")
 	I_GI_HOME = RuleImage(roi_front=(361,34,34,46), roi_back=(361,34,34,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_home.png")
 	# 判断是不是在探索界面 
 	# 判断是不是在探索界面 
-	I_GI_EXPLORE = RuleImage(roi_front=(677,11,33,46), roi_back=(677,11,33,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_explore.png")
+	I_GI_EXPLORE = RuleImage(roi_front=(690,16,28,28), roi_back=(688,8,33,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_explore.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

BIN
tasks/Component/GeneralInvite/gi/gi_gi_explore.png


+ 2 - 2
tasks/Component/GeneralInvite/gi/member.json

@@ -29,8 +29,8 @@
   {
   {
     "itemName": "gi_explore",
     "itemName": "gi_explore",
     "imageName": "gi_gi_explore.png",
     "imageName": "gi_gi_explore.png",
-    "roiFront": "677,11,33,46",
-    "roiBack": "677,11,33,46",
+    "roiFront": "690,16,28,28",
+    "roiBack": "688,8,33,46",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "判断是不是在探索界面"
     "description": "判断是不是在探索界面"

+ 19 - 4
tasks/FloatParade/assets.py

@@ -12,9 +12,9 @@ class FloatParadeAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 从庭院进入花车活动 
 	# 从庭院进入花车活动 
-	I_FP_ACCESS = RuleImage(roi_front=(1178,168,43,34), roi_back=(1051,101,210,472), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_access.png")
+	I_FP_ACCESS = RuleImage(roi_front=(1184,385,41,34), roi_back=(1051,101,210,472), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_access.png")
 	# description 
 	# description 
-	I_FP_GETALL0 = RuleImage(roi_front=(1153,287,65,56), roi_back=(1134,261,100,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall0.png")
+	I_FP_GETALL0 = RuleImage(roi_front=(1027,655,37,40), roi_back=(1003,572,267,134), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall0.png")
 	# description 
 	# description 
 	I_FP_GETALL1 = RuleImage(roi_front=(1198,555,53,54), roi_back=(1163,506,113,164), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
 	I_FP_GETALL1 = RuleImage(roi_front=(1198,555,53,54), roi_back=(1163,506,113,164), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
 	# description 
 	# description 
@@ -24,9 +24,9 @@ class FloatParadeAssets:
 	# description 
 	# description 
 	I_FP_BATCH_FALSE = RuleImage(roi_front=(936,515,40,45), roi_back=(924,505,63,65), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_batch_false.png")
 	I_FP_BATCH_FALSE = RuleImage(roi_front=(936,515,40,45), roi_back=(924,505,63,65), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_batch_false.png")
 	# 右下角的任务 
 	# 右下角的任务 
-	I_FP_TASKS = RuleImage(roi_front=(1175,617,79,76), roi_back=(1162,605,100,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_tasks.png")
+	I_FP_TASKS = RuleImage(roi_front=(1184,553,68,66), roi_back=(1167,532,100,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_tasks.png")
 	# 升级 
 	# 升级 
-	I_FP_UPGRADE = RuleImage(roi_front=(1086,74,116,49), roi_back=(1040,52,169,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_upgrade.png")
+	I_FP_UPGRADE = RuleImage(roi_front=(57,180,39,35), roi_back=(19,153,169,100), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_upgrade.png")
 	# 红色关闭 
 	# 红色关闭 
 	I_FP_RED_CLOSE = RuleImage(roi_front=(1170,109,43,44), roi_back=(1157,101,72,62), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_close.png")
 	I_FP_RED_CLOSE = RuleImage(roi_front=(1170,109,43,44), roi_back=(1157,101,72,62), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_close.png")
 	# 寻找花车的切换按钮 
 	# 寻找花车的切换按钮 
@@ -41,5 +41,20 @@ class FloatParadeAssets:
 	I_FP_GIFT_FLAG1 = RuleImage(roi_front=(559,295,55,44), roi_back=(559,295,55,44), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_gift_flag1.png")
 	I_FP_GIFT_FLAG1 = RuleImage(roi_front=(559,295,55,44), roi_back=(559,295,55,44), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_gift_flag1.png")
 	# 礼包类型2 
 	# 礼包类型2 
 	I_FP_GIFT_FLAG2 = RuleImage(roi_front=(557,293,58,47), roi_back=(557,293,58,47), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_gift_flag2.png")
 	I_FP_GIFT_FLAG2 = RuleImage(roi_front=(557,293,58,47), roi_back=(557,293,58,47), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_gift_flag2.png")
+	#  
+	I_FP_SELECT_1 = RuleImage(roi_front=(238,443,110,41), roi_back=(217,420,179,92), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_select_1.png")
+	#  
+	I_FP_SELECT_2 = RuleImage(roi_front=(570,438,116,52), roi_back=(541,418,177,85), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_select_2.png")
+	#  
+	I_FP_SELECT_3 = RuleImage(roi_front=(938,435,104,54), roi_back=(917,415,154,98), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_select_3.png")
+	#  
+	I_RED_POINT_0 = RuleImage(roi_front=(1244,216,19,17), roi_back=(1217,157,59,415), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_red_point_0.png")
+
+
+	# Image Rule Assets
+	#  
+	I_CLAIM_MILEAGE = RuleImage(roi_front=(794,515,142,44), roi_back=(731,493,264,89), threshold=0.8, method="Template matching", file="./tasks/FloatParade/mileage/mileage_claim_mileage.png")
+	# 进入里程(右上角红点) 
+	I_ENTRY_MILEAGE = RuleImage(roi_front=(97,76,19,21), roi_back=(84,69,56,51), threshold=0.8, method="Template matching", file="./tasks/FloatParade/mileage/mileage_entry_mileage.png")
 
 
 
 

BIN
tasks/FloatParade/fp/fp_fp_access.png


BIN
tasks/FloatParade/fp/fp_fp_getall0.png


BIN
tasks/FloatParade/fp/fp_fp_select_1.png


BIN
tasks/FloatParade/fp/fp_fp_select_2.png


BIN
tasks/FloatParade/fp/fp_fp_select_3.png


BIN
tasks/FloatParade/fp/fp_fp_tasks.png


BIN
tasks/FloatParade/fp/fp_fp_upgrade.png


BIN
tasks/FloatParade/fp/fp_red_point_0.png


+ 43 - 7
tasks/FloatParade/fp/image.json

@@ -2,7 +2,7 @@
   {
   {
     "itemName": "fp_access",
     "itemName": "fp_access",
     "imageName": "fp_fp_access.png",
     "imageName": "fp_fp_access.png",
-    "roiFront": "1178,168,43,34",
+    "roiFront": "1184,385,41,34",
     "roiBack": "1051,101,210,472",
     "roiBack": "1051,101,210,472",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
@@ -11,8 +11,8 @@
   {
   {
     "itemName": "fp_getall0",
     "itemName": "fp_getall0",
     "imageName": "fp_fp_getall0.png",
     "imageName": "fp_fp_getall0.png",
-    "roiFront": "1153,287,65,56",
-    "roiBack": "1134,261,100,100",
+    "roiFront": "1027,655,37,40",
+    "roiBack": "1003,572,267,134",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
@@ -56,8 +56,8 @@
   {
   {
     "itemName": "fp_tasks",
     "itemName": "fp_tasks",
     "imageName": "fp_fp_tasks.png",
     "imageName": "fp_fp_tasks.png",
-    "roiFront": "1175,617,79,76",
-    "roiBack": "1162,605,100,100",
+    "roiFront": "1184,553,68,66",
+    "roiBack": "1167,532,100,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "右下角的任务"
     "description": "右下角的任务"
@@ -65,8 +65,8 @@
   {
   {
     "itemName": "fp_upgrade",
     "itemName": "fp_upgrade",
     "imageName": "fp_fp_upgrade.png",
     "imageName": "fp_fp_upgrade.png",
-    "roiFront": "1086,74,116,49",
-    "roiBack": "1040,52,169,100",
+    "roiFront": "57,180,39,35",
+    "roiBack": "19,153,169,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "升级"
     "description": "升级"
@@ -133,5 +133,41 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "礼包类型2"
     "description": "礼包类型2"
+  },
+  {
+    "itemName": "fp_select_1",
+    "imageName": "fp_fp_select_1.png",
+    "roiFront": "238,443,110,41",
+    "roiBack": "217,420,179,92",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
+  },
+  {
+    "itemName": "fp_select_2",
+    "imageName": "fp_fp_select_2.png",
+    "roiFront": "570,438,116,52",
+    "roiBack": "541,418,177,85",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
+  },
+  {
+    "itemName": "fp_select_3",
+    "imageName": "fp_fp_select_3.png",
+    "roiFront": "938,435,104,54",
+    "roiBack": "917,415,154,98",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
+  },
+  {
+    "itemName": "red_point_0",
+    "imageName": "fp_red_point_0.png",
+    "roiFront": "1244,216,19,17",
+    "roiBack": "1217,157,59,415",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
   }
   }
 ]
 ]

+ 20 - 0
tasks/FloatParade/mileage/mileage.json

@@ -0,0 +1,20 @@
+[
+  {
+    "itemName": "claim_mileage",
+    "imageName": "mileage_claim_mileage.png",
+    "roiFront": "794,515,142,44",
+    "roiBack": "731,493,264,89",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
+  },
+  {
+    "itemName": "entry_mileage",
+    "imageName": "mileage_entry_mileage.png",
+    "roiFront": "97,76,19,21",
+    "roiBack": "84,69,56,51",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入里程(右上角红点)"
+  }
+]

BIN
tasks/FloatParade/mileage/mileage_claim_mileage.png


BIN
tasks/FloatParade/mileage/mileage_entry_mileage.png


+ 42 - 48
tasks/FloatParade/script_task.py

@@ -3,35 +3,43 @@
 # github https://github.com/runhey
 # github https://github.com/runhey
 import time
 import time
 
 
+from pydantic.deprecated import config
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main
 from tasks.GameUi.page import page_main
 from tasks.TalismanPass.assets import TalismanPassAssets
 from tasks.TalismanPass.assets import TalismanPassAssets
 from tasks.FloatParade.assets import FloatParadeAssets
 from tasks.FloatParade.assets import FloatParadeAssets
 from tasks.FloatParade.config import FloatParadeConfig, LevelReward
 from tasks.FloatParade.config import FloatParadeConfig, LevelReward
+from tasks.Component.RightActivity.right_activity import RightActivity
 
 
 from module.logger import logger
 from module.logger import logger
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 from module.base.timer import Timer
 from module.base.timer import Timer
 
 
-class ScriptTask(GameUi, FloatParadeAssets, TalismanPassAssets):
+class ScriptTask(RightActivity, FloatParadeAssets, TalismanPassAssets):
 
 
     def run(self):
     def run(self):
-        self.ui_get_current_page()
-        self.ui_goto(page_main)
         con: FloatParadeConfig = self.config.float_parade.float_parade
         con: FloatParadeConfig = self.config.float_parade.float_parade
-
-        # 收取全部奖励
-        self.get_all()
-        # 回退
+        self.enter(self.I_FP_ACCESS)
+        logger.info('Enter float parade')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_FP_TASKS):
+            if self.appear(self.I_FP_UPGRADE):
                 break
                 break
-            if self.appear_then_click(self.I_BACK_Y, interval=3):
+            if self.appear_then_click(self.I_FP_ACCESS, interval=0.8):
                 continue
                 continue
-        logger.info('Goback to float parade main page')
+            if self.appear_then_click(self.I_FP_RED_CLOSE, interval=1.5):
+                continue
+            if self.appear_then_click(self.I_FP_GIFT_CLOSE, interval=3):
+                continue
+            # if self.appear_then_click(self.I_TOGGLE_BUTTON, interval=3):
+            #     continue
+
+        # 收取 放置里程
+        self.get_mileage()
+
         # 收取花车等级奖励
         # 收取花车等级奖励
         self.get_flower(con.level_reward1, con.level_reward2) # 第一种
         self.get_flower(con.level_reward1, con.level_reward2) # 第一种
+
         # main page
         # main page
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_main)
         self.ui_goto(page_main)
@@ -39,33 +47,15 @@ class ScriptTask(GameUi, FloatParadeAssets, TalismanPassAssets):
         self.set_next_run(task='FloatParade', success=True, finish=True)
         self.set_next_run(task='FloatParade', success=True, finish=True)
         raise TaskEnd('FloatParade')
         raise TaskEnd('FloatParade')
 
 
-
-    def get_all(self):
-        """
-        一键收取所有的, 从庭院进入
-        :return:
-        """
-        while 1:
-            self.screenshot()
-            if self.appear(self.I_FP_UPGRADE):
-                break
-            if self.appear_then_click(self.I_FP_ACCESS, interval=0.8):
-                continue
-            if self.appear_then_click(self.I_FP_RED_CLOSE, interval=1.5):
-                continue
-            if self.appear_then_click(self.I_FP_GIFT_CLOSE, interval=3):
-                continue
-            if self.appear_then_click(self.I_FP_TASKS, interval=1.8):
-                continue
-            if self.appear_then_click(self.I_TOGGLE_BUTTON, interval=3):
-                continue
-        logger.info('Enter float parade')
-        logger.info('Click get all reward')
-        if not self.appear(self.I_FP_GETALL1):
-            logger.info('No appear get all button')
+    def get_mileage(self):
+        self.screenshot()
+        if not self.appear(self.I_ENTRY_MILEAGE):
             return
             return
-        self.ui_get_reward(self.I_FP_GETALL1)
-        logger.info('Got all reward')
+        logger.hr("Get mileage reward")
+        self.ui_click( click=self.I_ENTRY_MILEAGE, stop=self.I_CLAIM_MILEAGE, interval=1.9)
+        self.ui_get_reward(self.I_CLAIM_MILEAGE)
+        self.ui_click_until_disappear(self.I_UI_BACK_RED, interval=1.8)
+        logger.info('Got mileage reward')
 
 
     def get_flower(self, level1: LevelReward = LevelReward.TWO, level2: LevelReward = LevelReward.TWO):
     def get_flower(self, level1: LevelReward = LevelReward.TWO, level2: LevelReward = LevelReward.TWO):
         """
         """
@@ -73,21 +63,17 @@ class ScriptTask(GameUi, FloatParadeAssets, TalismanPassAssets):
         :return:
         :return:
         """
         """
         match_level = {
         match_level = {
-            LevelReward.ONE: self.I_TP_LEVEL_1,
-            LevelReward.TWO: self.I_TP_LEVEL_2,
-            LevelReward.THREE: self.I_TP_LEVEL_3,
+            LevelReward.ONE: self.I_FP_SELECT_1,
+            LevelReward.TWO: self.I_FP_SELECT_2,
+            LevelReward.THREE: self.I_FP_SELECT_3,
         }
         }
-        self.screenshot()
-        if not self.appear(self.I_FP_GETALL0):
-            logger.info('No any level reward')
-            return
-        logger.info('Appear level reward')
-        # self.ui_click(self.I_FP_GETALL0, self.I_TP_GET_ALL)
         logger.info('Click level reward')
         logger.info('Click level reward')
         check_timer = Timer(2)
         check_timer = Timer(2)
         check_timer.start()
         check_timer.start()
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
+            if self.appear_then_click(self.I_UI_BACK_RED, interval=0.8):
+                continue
             # 批量选择
             # 批量选择
             if self.appear_then_click(self.I_BATCH_SELECTION, interval=1.5):
             if self.appear_then_click(self.I_BATCH_SELECTION, interval=1.5):
                 continue
                 continue
@@ -100,7 +86,6 @@ class ScriptTask(GameUi, FloatParadeAssets, TalismanPassAssets):
                     pass
                     pass
                 check_timer.reset()
                 check_timer.reset()
                 continue
                 continue
-
             if self.appear(self.I_FP_GIFT_FLAG2) and self.appear_then_click(match_level[level2], interval=0.8):
             if self.appear(self.I_FP_GIFT_FLAG2) and self.appear_then_click(match_level[level2], interval=0.8):
                 logger.info(f'Select {level2} reward')
                 logger.info(f'Select {level2} reward')
                 if self.appear_then_click(self.I_OVERFLOW_CONFIRME, interval=0.8):
                 if self.appear_then_click(self.I_OVERFLOW_CONFIRME, interval=0.8):
@@ -115,10 +100,19 @@ class ScriptTask(GameUi, FloatParadeAssets, TalismanPassAssets):
             if check_timer.reached():
             if check_timer.reached():
                 logger.warning('No reward and break')
                 logger.warning('No reward and break')
                 break
                 break
-            if self.appear_then_click(self.I_FP_GETALL0, interval=2.1):
-                logger.info('Get all reward')
+
+            apper_get_all_0 = self.appear(self.I_FP_GETALL0)  # 出现一键领取就不大会点”任务“
+            if apper_get_all_0:
+                self.click(self.I_FP_GETALL0, interval=2.1)
                 check_timer.reset()
                 check_timer.reset()
                 continue
                 continue
+            elif self.appear_then_click(self.I_FP_TASKS, interval=2.5):
+                check_timer.reset()
+                continue
+
+            if self.appear_then_click(self.I_RED_POINT_0, interval=1.5):
+                continue
+
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':

+ 2 - 1
tasks/GameUi/assets.py

@@ -89,7 +89,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_CHECK_HEIAN_KITAN = RuleImage(roi_front=(27,48,47,39), roi_back=(27,48,47,39), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_heian_kitan.png")
 	I_CHECK_HEIAN_KITAN = RuleImage(roi_front=(27,48,47,39), roi_back=(27,48,47,39), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_heian_kitan.png")
 	# 六道之门检查 
 	# 六道之门检查 
-	I_CHECK_SIX_GATES = RuleImage(roi_front=(1180,614,46,80), roi_back=(1145,585,120,130), threshold=0.85, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
+	I_CHECK_SIX_GATES = RuleImage(roi_front=(411,297,21,21), roi_back=(395,262,54,85), threshold=0.85, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
 	# description 
 	# description 
 	I_CHECK_BONDLING_FAIRYLAND = RuleImage(roi_front=(614,660,56,49), roi_back=(614,660,56,49), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_bondling_fairyland.png")
 	I_CHECK_BONDLING_FAIRYLAND = RuleImage(roi_front=(614,660,56,49), roi_back=(614,660,56,49), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_bondling_fairyland.png")
 	# description 
 	# description 
@@ -279,3 +279,4 @@ class GameUiAssets:
 	# Ocr-description 
 	# Ocr-description 
 	O_NEW = RuleOcr(roi=(0,0,100,100), area=(0,0,100,100), mode="Single", method="Default", keyword="", name="new")
 	O_NEW = RuleOcr(roi=(0,0,100,100), area=(0,0,100,100), mode="Single", method="Default", keyword="", name="new")
 
 
+

BIN
tasks/GameUi/page/page_check_six_gates.png


+ 3 - 3
tasks/GameUi/page/page_img.json

@@ -209,8 +209,8 @@
   {
   {
     "itemName": "check_six_gates",
     "itemName": "check_six_gates",
     "imageName": "page_check_six_gates.png",
     "imageName": "page_check_six_gates.png",
-    "roiFront": "1180,614,46,80",
-    "roiBack": "1145,585,120,130",
+    "roiFront": "411,297,21,21",
+    "roiBack": "395,262,54,85",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.85,
     "threshold": 0.85,
     "description": "六道之门检查"
     "description": "六道之门检查"
@@ -251,4 +251,4 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   }
   }
-]
+]

+ 16 - 6
tasks/HeroTest/script_task.py

@@ -3,19 +3,19 @@
 # github https://github.com/runhey
 # github https://github.com/runhey
 from datetime import datetime, timedelta, time
 from datetime import datetime, timedelta, time
 import random  # type: ignore
 import random  # type: ignore
-from module.atom.image import RuleImage
+from typing import Callable
+
+from module.logger import logger
+from module.exception import TaskEnd
+from module.base.timer import Timer
 
 
+import tasks.GameUi.page as pages
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.HeroTest.assets import HeroTestAssets
 from tasks.HeroTest.assets import HeroTestAssets
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
-
-from module.logger import logger
-from module.exception import TaskEnd
 from tasks.HeroTest.config import Layer, HeroTest, SkillMode
 from tasks.HeroTest.config import Layer, HeroTest, SkillMode
-from typing import Callable
 
 
-import tasks.GameUi.page as pages
 
 
 
 
 class ScriptTask(GameUi, GeneralBattle, HeroTestAssets, SwitchSoul):
 class ScriptTask(GameUi, GeneralBattle, HeroTestAssets, SwitchSoul):
@@ -121,8 +121,18 @@ class ScriptTask(GameUi, GeneralBattle, HeroTestAssets, SwitchSoul):
 
 
     def hero1_skill_wait(self):
     def hero1_skill_wait(self):
         if self.wait_until_appear(self.I_BCMJ_SKILL_ADD_CONFIRM, wait_time=2):
         if self.wait_until_appear(self.I_BCMJ_SKILL_ADD_CONFIRM, wait_time=2):
+            timer = Timer(10).start()
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
+
+                # https://github.com/runhey/OnmyojiAutoScript/issues/1671
+                if timer.reached_and_reset():
+                    if self.appear(self.I_BCMJ_SKILL_ADD_CONFIRM):
+                        logger.warning('No skill selected for 10s, panel still open, retrying')
+                        continue
+                    logger.warning('Skill selection panel closed unexpectedly, exit')
+                    break
+
                 if self.appear_then_click(self.I_BCMJ_SKILL_ADD1, interval=1):
                 if self.appear_then_click(self.I_BCMJ_SKILL_ADD1, interval=1):
                     break
                     break
                 if self.appear_then_click(self.I_BCMJ_SKILL_ADD2, interval=1):
                 if self.appear_then_click(self.I_BCMJ_SKILL_ADD2, interval=1):

+ 5 - 5
tasks/WeeklyTrifles/script_task.py

@@ -80,7 +80,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
             self.screenshot()
             self.screenshot()
             if self.appear(self.I_WT_QR_CODE):
             if self.appear(self.I_WT_QR_CODE):
                 break
                 break
-            if self.appear_then_click(self.I_WT_COLLECT_WECHAT, interval=1):
+            if self.appear_then_click(self.I_WT_COLLECT_WECHAT, interval=4):
                 continue
                 continue
         logger.info('Click share')
         logger.info('Click share')
         get_timer = Timer(3)
         get_timer = Timer(3)
@@ -92,7 +92,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
                 logger.info('Get reward')
                 logger.info('Get reward')
                 break
                 break
 
 
-            if self.appear_then_click(self.I_WT_QR_CODE, self.C_WT_WECHAT, interval=0.8):
+            if self.appear_then_click(self.I_WT_QR_CODE, self.C_WT_WECHAT, interval=2.8):
                 continue
                 continue
             if get_timer.reached():
             if get_timer.reached():
                 logger.warning('Share timeout. The reward may have been obtained')
                 logger.warning('Share timeout. The reward may have been obtained')
@@ -137,7 +137,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
             if self.appear(self.I_WT_NO_DAY):
             if self.appear(self.I_WT_NO_DAY):
                 obtained = True
                 obtained = True
                 break
                 break
-            if self.click(self.C_WT_AB_CLICK, interval=1):
+            if self.click(self.C_WT_AB_CLICK, interval=2.5):
                 continue
                 continue
             if self.appear_then_click(self.I_WT_DAY_BATTLE, interval=2):
             if self.appear_then_click(self.I_WT_DAY_BATTLE, interval=2):
                 continue
                 continue
@@ -281,8 +281,8 @@ if __name__ == '__main__':
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)
     t.screenshot()
     t.screenshot()
 
 
-    t._share_collect()
-    # t._share_area_boss()
+    # t._share_collect()
+    t._share_area_boss()
     # t.click_share(t.I_WT_SE_WECHAT)
     # t.click_share(t.I_WT_SE_WECHAT)