Procházet zdrojové kódy

Merge pull request #205 from runhey/dev

Dev
huangrunheng před 2 roky
rodič
revize
b15947f9be
74 změnil soubory, kde provedl 926 přidání a 31 odebrání
  1. 5 5
      README.md
  2. 3 1
      dev_tools/assets_test.py
  3. 112 3
      module/atom/image.py
  4. 1 1
      module/config/config_manual.py
  5. 1 1
      module/config/config_menu.py
  6. 2 0
      module/config/config_model.py
  7. 13 0
      tasks/Component/Costume/assets.py
  8. 1 0
      tasks/Component/Costume/config.py
  9. 5 0
      tasks/Component/Costume/costume_base.py
  10. 47 0
      tasks/Component/Costume/main9/image.json
  11. binární
      tasks/Component/Costume/main9/main9_check_main_9.png
  12. binární
      tasks/Component/Costume/main9/main9_main_goto_exploration_9.png
  13. binární
      tasks/Component/Costume/main9/main9_main_goto_summon_9.png
  14. binární
      tasks/Component/Costume/main9/main9_main_goto_town_9.png
  15. binární
      tasks/Component/Costume/main9/main9_pet_house_9.png
  16. 12 0
      tasks/Component/RightActivity/assets.py
  17. 20 0
      tasks/Component/RightActivity/right_activity.py
  18. 59 0
      tasks/FrogBoss/assets.py
  19. 26 0
      tasks/FrogBoss/config.py
  20. binární
      tasks/FrogBoss/fb/fb_bet_failure.png
  21. binární
      tasks/FrogBoss/fb/fb_bet_left.png
  22. binární
      tasks/FrogBoss/fb/fb_bet_right.png
  23. binární
      tasks/FrogBoss/fb/fb_bet_success.png
  24. binární
      tasks/FrogBoss/fb/fb_bet_success_box.png
  25. binární
      tasks/FrogBoss/fb/fb_bet_sure.png
  26. binární
      tasks/FrogBoss/fb/fb_betted.png
  27. binární
      tasks/FrogBoss/fb/fb_failure_left.png
  28. binární
      tasks/FrogBoss/fb/fb_failure_right.png
  29. binární
      tasks/FrogBoss/fb/fb_frog_boss_enter.png
  30. binární
      tasks/FrogBoss/fb/fb_frog_boss_rest.png
  31. binární
      tasks/FrogBoss/fb/fb_gold_30.png
  32. binární
      tasks/FrogBoss/fb/fb_gold_30_check.png
  33. binární
      tasks/FrogBoss/fb/fb_next_competition.png
  34. binární
      tasks/FrogBoss/fb/fb_success_left.png
  35. binární
      tasks/FrogBoss/fb/fb_success_right.png
  36. 128 0
      tasks/FrogBoss/fb/image.json
  37. 20 0
      tasks/FrogBoss/fb/image2.json
  38. 29 0
      tasks/FrogBoss/fb/ocr.json
  39. 160 0
      tasks/FrogBoss/script_task.py
  40. 1 1
      tasks/GameUi/game_ui.py
  41. 35 1
      tasks/Hyakkiyakou/assets.py
  42. 99 0
      tasks/Hyakkiyakou/generate.py
  43. 119 0
      tasks/Hyakkiyakou/train/image.json
  44. 9 0
      tasks/Hyakkiyakou/train/swipe.json
  45. binární
      tasks/Hyakkiyakou/train/train_switch_background.png
  46. binární
      tasks/Hyakkiyakou/train/train_tcheck_1.png
  47. binární
      tasks/Hyakkiyakou/train/train_tcheck_2.png
  48. binární
      tasks/Hyakkiyakou/train/train_tcheck_3.png
  49. binární
      tasks/Hyakkiyakou/train/train_tcheck_4.png
  50. binární
      tasks/Hyakkiyakou/train/train_tcheck_5.png
  51. binární
      tasks/Hyakkiyakou/train/train_tcheck_6.png
  52. binární
      tasks/Hyakkiyakou/train/train_tpage_1.png
  53. binární
      tasks/Hyakkiyakou/train/train_tpage_2.png
  54. binární
      tasks/Hyakkiyakou/train/train_tpage_3.png
  55. binární
      tasks/Hyakkiyakou/train/train_tpage_4.png
  56. binární
      tasks/Hyakkiyakou/train/train_tpage_5.png
  57. binární
      tasks/Hyakkiyakou/train/train_tpage_6.png
  58. 1 1
      tasks/KekkaiActivation/assets.py
  59. binární
      tasks/KekkaiActivation/cards/cards_cards_kaiko_6.png
  60. 1 1
      tasks/KekkaiActivation/cards/image.json
  61. 1 1
      tasks/KekkaiActivation/script_task.py
  62. 1 1
      tasks/KekkaiUtilize/assets.py
  63. 1 1
      tasks/KekkaiUtilize/utilize/image_2.json
  64. 2 2
      tasks/RichMan/assets.py
  65. 1 1
      tasks/RichMan/mall/navbar/image_side.json
  66. binární
      tasks/RichMan/mall/navbar/navbar_side_sure_friends.png
  67. 2 2
      tasks/RichMan/mall/special/image.json
  68. binární
      tasks/RichMan/mall/special/special_sp_swipe_check.png
  69. 0 1
      tasks/RichMan/script_task.py
  70. 2 2
      tasks/RyouToppa/assets.py
  71. binární
      tasks/RyouToppa/dev/dev_toppa_lock_team.png
  72. binární
      tasks/RyouToppa/dev/dev_toppa_unlock_team.png
  73. 4 4
      tasks/RyouToppa/dev/image.json
  74. 3 1
      tasks/SoulsTidy/script_task.py

+ 5 - 5
README.md

@@ -39,7 +39,7 @@
 - **阴阳寮**: 结界上卡、结界蹭卡、结界突破、寮突破、狩猎战、集体任务
 - **阴阳寮**: 结界上卡、结界蹭卡、结界突破、寮突破、狩猎战、集体任务
 - **御魂副本**: 八岐大蛇、业原火、日轮之城、永生之海
 - **御魂副本**: 八岐大蛇、业原火、日轮之城、永生之海
 - **肝帝专属**: 探索、契灵、御灵、觉醒副本、石距
 - **肝帝专属**: 探索、契灵、御灵、觉醒副本、石距
-- **限时活动**: 每期爬塔、超鬼王
+- **限时活动**: 每期爬塔、超鬼王、对弈竞猜
 
 
 ### 显著特点 
 ### 显著特点 
 - **全部任务**: 你能想到的没有想到的都有,一条龙给你解放双手(该画饼画饼,该挖坑挖坑)
 - **全部任务**: 你能想到的没有想到的都有,一条龙给你解放双手(该画饼画饼,该挖坑挖坑)
@@ -57,8 +57,8 @@ This project is licensed under the GNU General Public License v3.0.
 ## 关于 Alas
 ## 关于 Alas
 OAS 基于碧蓝航线脚本 [AzurLaneAutoScript](https://github.com/LmeSzinc/AzurLaneAutoScript) 开发,考虑到星穹铁道脚本 [StarRailCopilot](https://github.com/LmeSzinc/StarRailCopilot) 中所提及的问题,
 OAS 基于碧蓝航线脚本 [AzurLaneAutoScript](https://github.com/LmeSzinc/AzurLaneAutoScript) 开发,考虑到星穹铁道脚本 [StarRailCopilot](https://github.com/LmeSzinc/StarRailCopilot) 中所提及的问题,
 OAS 在其基础上进行了如下优化:
 OAS 在其基础上进行了如下优化:
-- **调整设计架构**: 将前后端拆离出来更加灵活,方便后续的维护和扩展;更改些代码架构使其减少同游戏耦合,更加通用。
-- **搭建新的GUI**: 原生的方案过于臃肿,选用 [flutter](https://flutter.cn) 搭建一个全平台的界面端,界面更加舒适简洁
+- **调整设计架构**: 将前后端拆离出来更加灵活,方便后续的维护和扩展;优化代码架构使其减少同游戏耦合,更加通用。
+- **搭建新的GUI**: 原先的方案过于臃肿,选用 [flutter](https://flutter.cn) 搭建一个全平台的界面端,界面更加舒适简洁
 - **新的OCR库**: 跟随 [LmeSzinc](https://github.com/LmeSzinc) 的步伐, [ppocr-onnx](https://github.com/triwinds/ppocr-onnx) 更加简易使用,精度更高速度更快 
 - **新的OCR库**: 跟随 [LmeSzinc](https://github.com/LmeSzinc) 的步伐, [ppocr-onnx](https://github.com/triwinds/ppocr-onnx) 更加简易使用,精度更高速度更快 
 - **新的Assets管理**: 构建了一个新的Assets管理系统,更加方便的管理游戏资源如图片,文字,点击等等
 - **新的Assets管理**: 构建了一个新的Assets管理系统,更加方便的管理游戏资源如图片,文字,点击等等
 - **配置文件 [pydantic](https://github.com/pydantic/pydantic) 化**: pydantic 可以更加优雅的管理用户配置
 - **配置文件 [pydantic](https://github.com/pydantic/pydantic) 化**: pydantic 可以更加优雅的管理用户配置
@@ -85,7 +85,7 @@ OAS 在其基础上进行了如下优化:
 为此保持较高的入群门槛:  
 为此保持较高的入群门槛:  
 - 你的QQ等级必须大于32级(🌞🌞),注册时间超过一年,低等级账号成分复杂,还请见谅。
 - 你的QQ等级必须大于32级(🌞🌞),注册时间超过一年,低等级账号成分复杂,还请见谅。
 - 你必须拥有一个 Github 账户来点一个 **Star** (这并不影响你入群后取消Star),同样的要求注册时间过半年。
 - 你必须拥有一个 Github 账户来点一个 **Star** (这并不影响你入群后取消Star),同样的要求注册时间过半年。
-- 入群验证填入你的 Github 账号名,无需在意问题是什么。
+- 入群验证填入你的 Github id,无需在意问题是什么,由QQ机器人审核(机器永远的对的)。
 
 
 #### QQ开发群: 207613181
 #### QQ开发群: 207613181
 
 
@@ -95,7 +95,7 @@ OAS 在其基础上进行了如下优化:
 
 
 ## 安装 Installation 
 ## 安装 Installation 
 
 
-- [学习提问](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/scientific-question): 最基本的要求,**必看必学必会**
+- [学会提问](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/scientific-question): 最基本的要求,**必看必学必会**
 - [用户手册](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/getting-started): 在线手册,不定期更新,包含所有使用说明
 - [用户手册](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/getting-started): 在线手册,不定期更新,包含所有使用说明
 - [安装教程](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/installation): 保姆式安装手册,多翻翻有惊喜
 - [安装教程](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/installation): 保姆式安装手册,多翻翻有惊喜
 - [开发文档](https://runhey.github.io/OnmyojiAutoScript-website/docs/development/preamble): 虽然迭代很多、年久失修,但入门开发必读,具体以源码为准
 - [开发文档](https://runhey.github.io/OnmyojiAutoScript-website/docs/development/preamble): 虽然迭代很多、年久失修,但入门开发必读,具体以源码为准

+ 3 - 1
dev_tools/assets_test.py

@@ -23,7 +23,9 @@ def load_image(file: str):
 
 
 def detect_image(file: str, targe: RuleImage) -> bool:
 def detect_image(file: str, targe: RuleImage) -> bool:
     img = load_image(file)
     img = load_image(file)
-    return targe.match(img)
+    result = targe.test_match(img)
+    logger.info(f'[{targe.name}]: {result}')
+    return result
 
 
 def detect_ocr(file: str, target: RuleOcr):
 def detect_ocr(file: str, target: RuleOcr):
     img = load_image(file)
     img = load_image(file)

+ 112 - 3
module/atom/image.py

@@ -23,6 +23,8 @@ class RuleImage:
         """
         """
         self._match_init = False  # 这个是给后面的 等待图片稳定
         self._match_init = False  # 这个是给后面的 等待图片稳定
         self._image = None  # 这个是匹配的目标
         self._image = None  # 这个是匹配的目标
+        self._kp = None  #
+        self._des = None
         self.method = method
         self.method = method
 
 
         self.roi_front: list = list(roi_front)
         self.roi_front: list = list(roi_front)
@@ -73,6 +75,12 @@ class RuleImage:
             self.roi_front[3] = height
             self.roi_front[3] = height
             logger.info(f"roi_front size changed to {width}x{height}")
             logger.info(f"roi_front size changed to {width}x{height}")
 
 
+    def load_kp_des(self) -> None:
+        if self._kp is not None and self._des is not None:
+            return
+        self._kp, self._des = self.sift.detectAndCompute(self.image, None)
+
+
     @property
     @property
     def image(self):
     def image(self):
         """
         """
@@ -91,6 +99,26 @@ class RuleImage:
         """
         """
         return self.method == "Template matching"
         return self.method == "Template matching"
 
 
+    @cached_property
+    def is_sift_flann(self) -> bool:
+        return self.method == "Sift Flann"
+
+    @cached_property
+    def sift(self):
+        return cv2.SIFT_create()
+
+    @cached_property
+    def kp(self):
+        if self._kp is None:
+            self.load_kp_des()
+        return self._kp
+
+    @cached_property
+    def des(self):
+        if self._des is None:
+            self.load_kp_des()
+        return self._des
+
     def corp(self, image: np.array) -> np.array:
     def corp(self, image: np.array) -> np.array:
         """
         """
         截取图片
         截取图片
@@ -149,9 +177,90 @@ class RuleImage:
         x, y, w, h = self.roi_front
         x, y, w, h = self.roi_front
         return int(x + w//2), int(y + h//2)
         return int(x + w//2), int(y + h//2)
 
 
+    def test_match(self, image: np.array):
+        if self.is_template_match:
+            return self.match(image)
+        if self.is_sift_flann:
+            return self.sift_match(image, show=True)
+
+    def sift_match(self, image: np.array, show=False) -> bool:
+        """
+        特征匹配,同样会修改 roi_front
+        :param image: 是游戏的截图,就是转通道后的截图
+        :param show: 测试用的
+        :return:
+        """
+        source = self.corp(image)
+        kp, des = self.sift.detectAndCompute(source, None)
+        # 参数1:index_params
+        #    对于SIFT和SURF,可以传入参数index_params=dict(algorithm=FLANN_INDEX_KDTREE, trees=5)。
+        #    对于ORB,可以传入参数index_params=dict(algorithm=FLANN_INDEX_LSH, table_number=6, key_size=12)。
+        index_params = dict(algorithm=1, trees=5)
+        # 参数2:search_params 指定递归遍历的次数,值越高结果越准确,但是消耗的时间也越多。
+        search_params = dict(checks=50)
+        # 根据设置的参数创建特征匹配器 指定匹配的算法和kd树的层数,指定返回的个数
+        flann = cv2.FlannBasedMatcher(index_params, search_params)
+        # 利用创建好的特征匹配器利用k近邻算法来用模板的特征描述符去匹配图像的特征描述符,k指的是返回前k个最匹配的特征区域
+        # 返回的是最匹配的两个特征点的信息,返回的类型是一个列表,列表元素的类型是Dmatch数据类型,具体是什么我也不知道
+        # 第一个参数是小图的des, 第二个参数是大图的des
+        matches = flann.knnMatch(self.des, des, k=2)
+
+        good = []
+        result = True
+        for i, (m, n) in enumerate(matches):
+            # 设定阈值, 距离小于对方的距离的0.7倍我们认为是好的匹配点.
+            if m.distance < 0.6 * n.distance:
+                good.append(m)
+        if len(good) >= 4:
+            src_pts = float32([self.kp[m.queryIdx].pt for m in good]).reshape(-1, 1, 2)
+            dst_pts = float32([kp[m.trainIdx].pt for m in good]).reshape(-1, 1, 2)
+
+            # 计算透视变换矩阵m, 要求点的数量>=4
+            m, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC, 5.0)
+            # 创建一个包含模板图像四个角坐标的数组
+            w, h = self.roi_front[2], self.roi_front[3]
+            pts = float32([[0, 0], [0, h - 1], [w - 1, h - 1], [w - 1, 0]]).reshape(-1, 1, 2)
+            if m is None:
+                result = False
+            else:
+                dst = int32(cv2.perspectiveTransform(pts, m))
+                self.roi_front[0] = dst[0, 0, 0] + self.roi_back[0]
+                self.roi_front[1] = dst[0, 0, 1] + self.roi_back[1]
+                if show:
+                    cv2.polylines(source, [dst], isClosed=True, color=(0, 0, 255), thickness=2)
+        else:
+            result = False
+
+        # https://blog.csdn.net/cungudafa/article/details/105399278
+        # https://blog.csdn.net/qq_45832961/article/details/122776322
+        if show:
+            # 准备一个空的掩膜来绘制好的匹配
+            mask_matches = [[0, 0] for i in range(len(matches))]
+            # 向掩膜中添加数据
+            for i, (m, n) in enumerate(matches):
+                if m.distance < 0.6 * n.distance:  # 理论上0.7最好
+                    mask_matches[i] = [1, 0]
+            img_matches = cv2.drawMatchesKnn(self.image, self.kp, source, kp, matches, None,
+                                             matchColor=(0, 255, 0), singlePointColor=(255, 0, 0),
+                                             matchesMask=mask_matches, flags=0)
+            cv2.imshow(f'Sift Flann: {self.name}', img_matches)
+            cv2.waitKey(0)
+            cv2.destroyAllWindows()
+        return result
 
 
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
-    image = cv2.imread("D:/4713.jpg")
-    mat = RuleImage(roi_front=(758,122,66,77), roi_back=(339,104,836,120), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_explore.png")
-    print(mat.match(image))
+    from dev_tools.assets_test import detect_image
+
+    IMAGE_FILE = './log/test/QQ截图20240223151924.png'
+    from tasks.Restart.assets import RestartAssets
+    jade = RestartAssets.I_HARVEST_JADE
+    jade.method = 'Sift Flann'
+    sign = RestartAssets.I_HARVEST_SIGN
+    sign.method = 'Sift Flann'
+    print(jade.roi_front)
+
+    detect_image(IMAGE_FILE, jade)
+    detect_image(IMAGE_FILE, sign)
+    print(jade.roi_front)
+

+ 1 - 1
module/config/config_manual.py

@@ -18,7 +18,7 @@ class ConfigManual:
         > TrueOrochi > RichMan
         > TrueOrochi > RichMan
         > CollectiveMissions
         > CollectiveMissions
         > Pets > TalismanPass > SoulsTidy > Delegation
         > Pets > TalismanPass > SoulsTidy > Delegation
-        > Secret > WeeklyTrifles > MysteryShop > Duel > MetaDemon
+        > Secret > WeeklyTrifles > MysteryShop > Duel > MetaDemon > FrogBoss
         """
         """
 
 
     DEVICE_OVER_HTTP = False
     DEVICE_OVER_HTTP = False

+ 1 - 1
module/config/config_menu.py

@@ -32,7 +32,7 @@ class ConfigMenu:
         # 每周任务
         # 每周任务
         self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan', 'Secret', 'WeeklyTrifles', 'MysteryShop', 'Duel']
         self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan', 'Secret', 'WeeklyTrifles', 'MysteryShop', 'Duel']
         # 活动的任务
         # 活动的任务
-        self.menu["Activity Task"] = ['ActivityShikigami', 'MetaDemon']
+        self.menu["Activity Task"] = ['ActivityShikigami', 'MetaDemon', 'FrogBoss']
         # 开发工具
         # 开发工具
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
 
 

+ 2 - 0
module/config/config_model.py

@@ -47,6 +47,7 @@ from tasks.Hunt.config import Hunt
 # 这一部分是活动的配置-----------------------------------------------------------------------------------------------------
 # 这一部分是活动的配置-----------------------------------------------------------------------------------------------------
 from tasks.ActivityShikigami.config import ActivityShikigami
 from tasks.ActivityShikigami.config import ActivityShikigami
 from tasks.MetaDemon.config import MetaDemon
 from tasks.MetaDemon.config import MetaDemon
+from tasks.FrogBoss.config import FrogBoss
 # ----------------------------------------------------------------------------------------------------------------------
 # ----------------------------------------------------------------------------------------------------------------------
 
 
 # 肝帝专属---------------------------------------------------------------------------------------------------------------
 # 肝帝专属---------------------------------------------------------------------------------------------------------------
@@ -99,6 +100,7 @@ class ConfigModel(ConfigBase):
     # 这些是活动的
     # 这些是活动的
     activity_shikigami: ActivityShikigami = Field(default_factory=ActivityShikigami)
     activity_shikigami: ActivityShikigami = Field(default_factory=ActivityShikigami)
     meta_demon: MetaDemon = Field(default_factory=MetaDemon)
     meta_demon: MetaDemon = Field(default_factory=MetaDemon)
+    frog_boss: FrogBoss = Field(default_factory=FrogBoss)
 
 
     # 这些是肝帝专属
     # 这些是肝帝专属
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)

+ 13 - 0
tasks/Component/Costume/assets.py

@@ -114,3 +114,16 @@ class CostumeAssets:
 	I_PET_HOUSE_8 = RuleImage(roi_front=(1110,499,50,40), roi_back=(1033,469,241,83), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main8/main8_pet_house_8.png")
 	I_PET_HOUSE_8 = RuleImage(roi_front=(1110,499,50,40), roi_back=(1033,469,241,83), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main8/main8_pet_house_8.png")
 
 
 
 
+	# Image Rule Assets
+	# description 
+	I_CHECK_MAIN_9 = RuleImage(roi_front=(764,117,134,42), roi_back=(149,109,1099,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_check_main_9.png")
+	# description 
+	I_MAIN_GOTO_EXPLORATION_9 = RuleImage(roi_front=(553,107,31,30), roi_back=(234,98,904,68), threshold=0.7, method="Template matching", file="./tasks/Component/Costume/main9/main9_main_goto_exploration_9.png")
+	#  
+	I_MAIN_GOTO_SUMMON_9 = RuleImage(roi_front=(970,210,35,29), roi_back=(609,194,623,68), threshold=0.7, method="Template matching", file="./tasks/Component/Costume/main9/main9_main_goto_summon_9.png")
+	# description 
+	I_MAIN_GOTO_TOWN_9 = RuleImage(roi_front=(684,342,41,42), roi_back=(276,321,999,78), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_main_goto_town_9.png")
+	# description 
+	I_PET_HOUSE_9 = RuleImage(roi_front=(888,327,40,35), roi_back=(730,316,440,57), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_pet_house_9.png")
+
+

+ 1 - 0
tasks/Component/Costume/config.py

@@ -15,6 +15,7 @@ class MainType(str, Enum):
     COSTUME_MAIN_6 = 'costume_main_6'  # 暖池青苑
     COSTUME_MAIN_6 = 'costume_main_6'  # 暖池青苑
     COSTUME_MAIN_7 = 'costume_main_7'  # 盛夏幽庭
     COSTUME_MAIN_7 = 'costume_main_7'  # 盛夏幽庭
     COSTUME_MAIN_8 = 'costume_main_8'  # 远海航船
     COSTUME_MAIN_8 = 'costume_main_8'  # 远海航船
+    COSTUME_MAIN_9 = 'costume_main_9'  # 结缘神社
 
 
 # 结界皮肤
 # 结界皮肤
 class RealmType(str, Enum):
 class RealmType(str, Enum):

+ 5 - 0
tasks/Component/Costume/costume_base.py

@@ -51,6 +51,11 @@ main_costume_model = {
                               'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_8',
                               'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_8',
                               'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_8',
                               'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_8',
                               'I_PET_HOUSE': 'I_PET_HOUSE_8', },
                               'I_PET_HOUSE': 'I_PET_HOUSE_8', },
+    MainType.COSTUME_MAIN_9: {'I_CHECK_MAIN': 'I_CHECK_MAIN_9',
+                              'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_9',
+                              'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_9',
+                              'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_9',
+                              'I_PET_HOUSE': 'I_PET_HOUSE_9', },
 }
 }
 
 
 # 结界皮肤
 # 结界皮肤

+ 47 - 0
tasks/Component/Costume/main9/image.json

@@ -0,0 +1,47 @@
+[
+  {
+    "itemName": "check_main_9",
+    "imageName": "main9_check_main_9.png",
+    "roiFront": "764,117,134,42",
+    "roiBack": "149,109,1099,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "main_goto_exploration_9",
+    "imageName": "main9_main_goto_exploration_9.png",
+    "roiFront": "553,107,31,30",
+    "roiBack": "234,98,904,68",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "description"
+  },
+  {
+    "itemName": "main_goto_summon_9",
+    "imageName": "main9_main_goto_summon_9.png",
+    "roiFront": "970,210,35,29",
+    "roiBack": "609,194,623,68",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": ""
+  },
+  {
+    "itemName": "main_goto_town_9",
+    "imageName": "main9_main_goto_town_9.png",
+    "roiFront": "684,342,41,42",
+    "roiBack": "276,321,999,78",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "pet_house_9",
+    "imageName": "main9_pet_house_9.png",
+    "roiFront": "888,327,40,35",
+    "roiBack": "730,316,440,57",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

binární
tasks/Component/Costume/main9/main9_check_main_9.png


binární
tasks/Component/Costume/main9/main9_main_goto_exploration_9.png


binární
tasks/Component/Costume/main9/main9_main_goto_summon_9.png


binární
tasks/Component/Costume/main9/main9_main_goto_town_9.png


binární
tasks/Component/Costume/main9/main9_pet_house_9.png


+ 12 - 0
tasks/Component/RightActivity/assets.py

@@ -0,0 +1,12 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class RightActivityAssets: 
+	pass
+

+ 20 - 0
tasks/Component/RightActivity/right_activity.py

@@ -0,0 +1,20 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from module.atom.image import RuleImage
+from module.logger import logger
+
+from tasks.base_task import BaseTask
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main
+
+
+class RightActivity(GameUi):
+    def enter(self, target: RuleImage):
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+        self.ui_click_until_disappear(target, interval=3.5)
+
+
+
+

+ 59 - 0
tasks/FrogBoss/assets.py

@@ -0,0 +1,59 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class FrogBossAssets: 
+
+
+	# Image Rule Assets
+	# 左边竞猜 
+	I_BET_LEFT = RuleImage(roi_front=(88,342,145,100), roi_back=(88,342,145,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_left.png")
+	# 右边竞猜 
+	I_BET_RIGHT = RuleImage(roi_front=(1044,344,146,100), roi_back=(1044,344,146,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_right.png")
+	# description 
+	I_BET_SUCCESS_BOX = RuleImage(roi_front=(590,439,87,50), roi_back=(590,439,87,50), threshold=0.75, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_success_box.png")
+	# 左边赢了 
+	I_SUCCESS_LEFT = RuleImage(roi_front=(108,352,100,100), roi_back=(108,352,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_left.png")
+	# 右边输了 
+	I_FAILURE_RIGHT = RuleImage(roi_front=(1067,341,100,100), roi_back=(1067,341,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_right.png")
+	# description 
+	I_NEXT_COMPETITION = RuleImage(roi_front=(1098,510,42,36), roi_back=(1098,510,42,36), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_next_competition.png")
+	# 30万金币 
+	I_GOLD_30 = RuleImage(roi_front=(824,499,78,76), roi_back=(824,499,78,76), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30.png")
+	# 确认竞猜 
+	I_BET_SURE = RuleImage(roi_front=(1014,404,100,100), roi_back=(1014,404,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_sure.png")
+	# description 
+	I_GOLD_30_CHECK = RuleImage(roi_front=(512,180,68,83), roi_back=(402,141,459,489), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_gold_30_check.png")
+	# description 
+	I_BETTED = RuleImage(roi_front=(93,352,125,54), roi_back=(49,322,1192,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_betted.png")
+	# description 
+	I_SUCCESS_RIGHT = RuleImage(roi_front=(1061,336,122,116), roi_back=(1061,336,122,116), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_success_right.png")
+	# description 
+	I_FAILURE_LEFT = RuleImage(roi_front=(107,351,100,100), roi_back=(107,351,100,100), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_failure_left.png")
+	# description 
+	I_BET_FAILURE = RuleImage(roi_front=(510,266,269,72), roi_back=(510,266,269,72), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_failure.png")
+	# description 
+	I_BET_SUCCESS = RuleImage(roi_front=(512,264,260,73), roi_back=(433,214,418,151), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_bet_success.png")
+
+
+	# Image Rule Assets
+	# description 
+	I_FROG_BOSS_ENTER = RuleImage(roi_front=(1191,391,36,38), roi_back=(1174,135,78,320), threshold=0.7, method="Template matching", file="./tasks/FrogBoss/fb/fb_frog_boss_enter.png")
+	# description 
+	I_FROG_BOSS_REST = RuleImage(roi_front=(508,266,169,64), roi_back=(508,266,169,64), threshold=0.8, method="Template matching", file="./tasks/FrogBoss/fb/fb_frog_boss_rest.png")
+
+
+	# Ocr Rule Assets
+	# Ocr-description 
+	O_LEFT_COUNT = RuleOcr(roi=(144,541,69,31), area=(144,541,69,31), mode="Digit", method="Default", keyword="", name="left_count")
+	# Ocr-description 
+	O_RIGHT_COUNT = RuleOcr(roi=(1110,542,77,32), area=(1110,542,77,32), mode="Digit", method="Default", keyword="", name="right_count")
+	# Ocr-description 
+	O_TIME_REMAIN = RuleOcr(roi=(590,601,91,35), area=(590,601,91,35), mode="Duration", method="Default", keyword="", name="time_remain")
+
+

+ 26 - 0
tasks/FrogBoss/config.py

@@ -0,0 +1,26 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+
+from enum import Enum
+from pydantic import BaseModel, Field
+
+from tasks.Component.config_base import ConfigBase, Time
+from tasks.Component.config_scheduler import Scheduler
+
+
+class Strategy(str, Enum):
+    Majority = 'frog_majority'
+    Minority = 'frog_minority'
+    Bilibili = 'frog_bilibili'
+
+class FrogBossConfig(ConfigBase):
+    before_end_frog: Time = Field(default=Time(0, 15, 0), description='before_end_frog_help')
+    strategy_frog: Strategy = Field(default=Strategy.Majority, description='strategy_frog_help')
+
+class FrogBoss(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    frog_boss_config: FrogBossConfig = Field(default_factory=FrogBossConfig)
+
+
+

binární
tasks/FrogBoss/fb/fb_bet_failure.png


binární
tasks/FrogBoss/fb/fb_bet_left.png


binární
tasks/FrogBoss/fb/fb_bet_right.png


binární
tasks/FrogBoss/fb/fb_bet_success.png


binární
tasks/FrogBoss/fb/fb_bet_success_box.png


binární
tasks/FrogBoss/fb/fb_bet_sure.png


binární
tasks/FrogBoss/fb/fb_betted.png


binární
tasks/FrogBoss/fb/fb_failure_left.png


binární
tasks/FrogBoss/fb/fb_failure_right.png


binární
tasks/FrogBoss/fb/fb_frog_boss_enter.png


binární
tasks/FrogBoss/fb/fb_frog_boss_rest.png


binární
tasks/FrogBoss/fb/fb_gold_30.png


binární
tasks/FrogBoss/fb/fb_gold_30_check.png


binární
tasks/FrogBoss/fb/fb_next_competition.png


binární
tasks/FrogBoss/fb/fb_success_left.png


binární
tasks/FrogBoss/fb/fb_success_right.png


+ 128 - 0
tasks/FrogBoss/fb/image.json

@@ -0,0 +1,128 @@
+[
+  {
+    "itemName": "bet_left",
+    "imageName": "fb_bet_left.png",
+    "roiFront": "88,342,145,100",
+    "roiBack": "88,342,145,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左边竞猜"
+  },
+  {
+    "itemName": "bet_right",
+    "imageName": "fb_bet_right.png",
+    "roiFront": "1044,344,146,100",
+    "roiBack": "1044,344,146,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右边竞猜"
+  },
+  {
+    "itemName": "bet_success_box",
+    "imageName": "fb_bet_success_box.png",
+    "roiFront": "590,439,87,50",
+    "roiBack": "590,439,87,50",
+    "method": "Template matching",
+    "threshold": 0.75,
+    "description": "description"
+  },
+  {
+    "itemName": "success_left",
+    "imageName": "fb_success_left.png",
+    "roiFront": "108,352,100,100",
+    "roiBack": "108,352,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左边赢了"
+  },
+  {
+    "itemName": "failure_right",
+    "imageName": "fb_failure_right.png",
+    "roiFront": "1067,341,100,100",
+    "roiBack": "1067,341,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右边输了"
+  },
+  {
+    "itemName": "next_competition",
+    "imageName": "fb_next_competition.png",
+    "roiFront": "1098,510,42,36",
+    "roiBack": "1098,510,42,36",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "gold_30",
+    "imageName": "fb_gold_30.png",
+    "roiFront": "824,499,78,76",
+    "roiBack": "824,499,78,76",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "30万金币"
+  },
+  {
+    "itemName": "bet_sure",
+    "imageName": "fb_bet_sure.png",
+    "roiFront": "1014,404,100,100",
+    "roiBack": "1014,404,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "确认竞猜"
+  },
+  {
+    "itemName": "gold_30_check",
+    "imageName": "fb_gold_30_check.png",
+    "roiFront": "512,180,68,83",
+    "roiBack": "402,141,459,489",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "betted",
+    "imageName": "fb_betted.png",
+    "roiFront": "93,352,125,54",
+    "roiBack": "49,322,1192,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "success_right",
+    "imageName": "fb_success_right.png",
+    "roiFront": "1061,336,122,116",
+    "roiBack": "1061,336,122,116",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "failure_left",
+    "imageName": "fb_failure_left.png",
+    "roiFront": "107,351,100,100",
+    "roiBack": "107,351,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "bet_failure",
+    "imageName": "fb_bet_failure.png",
+    "roiFront": "510,266,269,72",
+    "roiBack": "510,266,269,72",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "bet_success",
+    "imageName": "fb_bet_success.png",
+    "roiFront": "512,264,260,73",
+    "roiBack": "433,214,418,151",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

+ 20 - 0
tasks/FrogBoss/fb/image2.json

@@ -0,0 +1,20 @@
+[
+  {
+    "itemName": "frog_boss_enter",
+    "imageName": "fb_frog_boss_enter.png",
+    "roiFront": "1191,391,36,38",
+    "roiBack": "1174,135,78,320",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "description"
+  },
+  {
+    "itemName": "frog_boss_rest",
+    "imageName": "fb_frog_boss_rest.png",
+    "roiFront": "508,266,169,64",
+    "roiBack": "508,266,169,64",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

+ 29 - 0
tasks/FrogBoss/fb/ocr.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "left_count",
+    "roiFront": "144,541,69,31",
+    "roiBack": "144,541,69,31",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  },
+  {
+    "itemName": "right_count",
+    "roiFront": "1110,542,77,32",
+    "roiBack": "1110,542,77,32",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  },
+  {
+    "itemName": "time_remain",
+    "roiFront": "590,601,91,35",
+    "roiBack": "590,601,91,35",
+    "mode": "Duration",
+    "method": "Default",
+    "keyword": "",
+    "description": "Ocr-description"
+  }
+]

+ 160 - 0
tasks/FrogBoss/script_task.py

@@ -0,0 +1,160 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from cached_property import cached_property
+from datetime import datetime
+
+from module.exception import TaskEnd
+from module.logger import logger
+from module.atom.image import RuleImage
+from module.base.timer import Timer
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_main
+from tasks.Component.RightActivity.right_activity import RightActivity
+from tasks.Component.config_base import TimeDelta
+from tasks.FrogBoss.assets import FrogBossAssets
+from tasks.FrogBoss.config import Strategy
+
+class ScriptTask(RightActivity, FrogBossAssets):
+    def run(self):
+        self.enter(self.I_FROG_BOSS_ENTER)
+        # 进入主界面
+        while 1:
+            self.screenshot()
+
+            # 已经下注
+            if self.appear(self.I_BETTED):
+                logger.info('You have betted')
+                break
+            # 休息中
+            if self.appear(self.I_FROG_BOSS_REST):
+                logger.info('Frog Boss Rest')
+                break
+            # 竞猜成功
+            if self.appear(self.I_BET_SUCCESS):
+                logger.info('You bet win')
+                self.detect()
+                while 1:
+                    self.screenshot()
+                    if self.appear(self.I_BET_LEFT) and self.appear(self.I_BET_RIGHT):
+                        break
+                    if self.appear_then_click(self.I_BET_SUCCESS_BOX, interval=1):
+                        continue
+                    if self.appear_then_click(self.I_NEXT_COMPETITION, interval=4):
+                        continue
+                continue
+            # 竞猜失败
+            if self.appear(self.I_BET_FAILURE):
+                logger.info('You bet lose')
+                self.ui_click_until_disappear(self.I_NEXT_COMPETITION)
+                self.detect()
+                continue
+            # 正式竞猜
+            if self.appear(self.I_BET_LEFT) and self.appear(self.I_BET_RIGHT):
+                self.do_bet()
+                continue
+
+        logger.info('FrogBoss end')
+        self.next_run()
+        raise TaskEnd('FrogBoss')
+
+    def next_run(self):
+        time = self.config.model.frog_boss.frog_boss_config.before_end_frog
+        time_delta = TimeDelta(hours=time.hour, minutes=time.minute, seconds=time.second)
+        time_now = datetime.now()
+        time_set = time_now.replace(minute=0, second=0, microsecond=0)
+        if 10 <= time_now.hour < 12:
+            time_set = time_set.replace(hour=14)
+        elif 12 <= time_now.hour < 14:
+            time_set = time_set.replace(hour=16)
+        elif 14 <= time_now.hour < 16:
+            time_set = time_set.replace(hour=18)
+        elif 16 <= time_now.hour < 18:
+            time_set = time_set.replace(hour=20)
+        elif 18 <= time_now.hour < 20:
+            time_set = time_set.replace(hour=22)
+        elif 20 <= time_now.hour < 22:
+            time_set = time_set.replace(hour=24)
+        elif 22 <= time_now.hour < 24:
+            day = time_now.day + 1
+            time_set = time_set.replace(day=day, hour=12)
+        else:
+            time_set = time_set.replace(hour=12)
+
+        self.set_next_run(task='FrogBoss', target=time_set - time_delta)
+
+    def do_bet(self):
+        logger.hr('do bet', level=2)
+        self.screenshot()
+        count_left = self.O_LEFT_COUNT.ocr(self.device.image)
+        count_right = self.O_RIGHT_COUNT.ocr(self.device.image)
+        match self.config.model.frog_boss.frog_boss_config.strategy_frog:
+            case Strategy.Majority:
+                click_image = self.I_BET_LEFT if count_left > count_right else self.I_BET_RIGHT
+            case Strategy.Minority:
+                click_image = self.I_BET_LEFT if count_left < count_right else self.I_BET_RIGHT
+            case Strategy.Bilibili:
+                click_image = self.I_BET_LEFT if count_left > count_right else self.I_BET_RIGHT
+            case _:
+                raise ValueError(f'Unknown bet mode: {self.config.model.frog_boss.frog_boss_config.strategy_frog}')
+        logger.info(f'You strategy is {self.config.model.frog_boss.frog_boss_config.strategy_frog} and bet on {click_image}')
+        self.ui_click_until_disappear(click_image)
+        gold_30_timer = Timer(10)
+        gold_30_timer.start()
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GOLD_30_CHECK):
+                break
+            if gold_30_timer.reached():
+                logger.info('Gold 30 not appear')
+                break
+            if self.appear_then_click(self.I_GOLD_30, interval=3):
+                continue
+        # 正式下注
+        logger.info('Formal bet')
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_BETTED):
+                break
+            if self.appear_then_click(self.I_GOLD_30, interval=2):
+                continue
+            if self.appear_then_click(self.I_BET_SURE, interval=2):
+                continue
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=2):
+                continue
+            if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=2):
+                continue
+
+    def detect(self) -> bool:
+        """
+        检测是左边赢了还是右边赢的
+        :return: True 左边赢了
+        """
+        if self.appear(self.I_SUCCESS_LEFT) and self.appear(self.I_FAILURE_RIGHT):
+            result = True
+            logger.info('Left win')
+        elif self.appear(self.I_SUCCESS_RIGHT) and self.appear(self.I_FAILURE_LEFT):
+            result = False
+            logger.info('Right win')
+        else:
+            result = True
+        return result
+
+    def get_bilibili(self) -> RuleImage:
+        """
+        获取博主的策略选择
+        :return:
+        """
+        pass
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+
+    t.run()
+

+ 1 - 1
tasks/GameUi/game_ui.py

@@ -126,7 +126,7 @@ class GameUi(BaseTask, GameUiAssets):
                     return page
                     return page
             # Try to close unknown page
             # Try to close unknown page
             for close in self.ui_close:
             for close in self.ui_close:
-                if self.appear_then_click(close, interval=1):
+                if self.appear_then_click(close, interval=1.5):
                     logger.info('Trying to switch to supported page')
                     logger.info('Trying to switch to supported page')
                     timeout = Timer(10, count=20).start()
                     timeout = Timer(10, count=20).start()
             # Unknown page but able to handle
             # Unknown page but able to handle

+ 35 - 1
tasks/Hyakkiyakou/assets.py

@@ -8,5 +8,39 @@ from module.atom.list import RuleList
 # This file was automatically generated by ./dev_tools/assets_extract.py.
 # This file was automatically generated by ./dev_tools/assets_extract.py.
 # Don't modify it manually.
 # Don't modify it manually.
 class HyakkiyakouAssets: 
 class HyakkiyakouAssets: 
-	pass
+
+
+	# Image Rule Assets
+	# 缘结之庭 
+	I_TPAGE_1 = RuleImage(roi_front=(238,504,221,123), roi_back=(121,480,950,166), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_1.png")
+	# 本丸御殿 
+	I_TPAGE_2 = RuleImage(roi_front=(491,506,231,120), roi_back=(132,479,933,171), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_2.png")
+	# 之境 
+	I_TPAGE_3 = RuleImage(roi_front=(748,504,240,118), roi_back=(125,482,937,166), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_3.png")
+	# 鲸歌潜岸 
+	I_TPAGE_4 = RuleImage(roi_front=(281,507,233,120), roi_back=(124,484,933,163), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_4.png")
+	# 杨帆远航 
+	I_TPAGE_5 = RuleImage(roi_front=(539,506,238,120), roi_back=(130,483,940,166), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_5.png")
+	# 繁影留住 
+	I_TPAGE_6 = RuleImage(roi_front=(801,505,232,118), roi_back=(128,493,937,153), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tpage_6.png")
+	# description 
+	I_TCHECK_1 = RuleImage(roi_front=(19,246,100,100), roi_back=(2,218,135,215), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_1.png")
+	# description 
+	I_TCHECK_2 = RuleImage(roi_front=(9,216,157,226), roi_back=(0,197,186,263), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_2.png")
+	# description 
+	I_TCHECK_3 = RuleImage(roi_front=(5,126,138,299), roi_back=(2,110,147,345), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_3.png")
+	# description 
+	I_TCHECK_4 = RuleImage(roi_front=(7,108,100,332), roi_back=(0,101,120,347), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_4.png")
+	# description 
+	I_TCHECK_5 = RuleImage(roi_front=(23,111,100,355), roi_back=(9,99,134,378), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_5.png")
+	# description 
+	I_TCHECK_6 = RuleImage(roi_front=(9,107,100,350), roi_back=(3,97,113,369), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/train/train_tcheck_6.png")
+	# description 
+	I_SWITCH_BACKGROUND = RuleImage(roi_front=(992,649,105,36), roi_back=(969,627,152,72), threshold=0.7, method="Template matching", file="./tasks/Hyakkiyakou/train/train_switch_background.png")
+
+
+	# Swipe Rule Assets
+	# description 
+	S_TSWIPE = RuleSwipe(roi_front=(612,527,21,91), roi_back=(359,519,23,100), mode="default", name="tswipe")
+
 
 

+ 99 - 0
tasks/Hyakkiyakou/generate.py

@@ -0,0 +1,99 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+import cv2
+from time import time, sleep
+from random import randint
+from cached_property import cached_property
+
+from module.daemon.benchmark import Benchmark
+from module.atom.swipe import RuleSwipe
+from module.atom.image import RuleImage
+from module.logger import logger
+
+from tasks.Script.config_device import ScreenshotMethod, ControlMethod
+from tasks.Hyakkiyakou.assets import HyakkiyakouAssets
+
+
+class ScriptTask(Benchmark, HyakkiyakouAssets):
+    Left_Swipe = RuleSwipe(roi_front=(122, 155, 480, 426),
+                           roi_back=(667, 147, 461, 427),
+                           mode="default",
+                           name="Left Swipe")
+
+    def run_simple(self, hero_name: str='test'):
+        self.add_one_video(hero_name, index=0)
+
+    def run(self, hero_name: str = 'test'):
+        """
+        :param hero_name: 你式神的名字
+        :return:
+        """
+        self.screenshot_benchmark()
+        self.record_one(self.I_TPAGE_1, self.I_TCHECK_1, hero_name, index=1)
+        self.record_one(self.I_TPAGE_2, self.I_TCHECK_2, hero_name, index=2)
+        self.record_one(self.I_TPAGE_3, self.I_TCHECK_3, hero_name, index=3)
+        self.record_one(self.I_TPAGE_4, self.I_TCHECK_4, hero_name, index=4)
+        self.record_one(self.I_TPAGE_5, self.I_TCHECK_5, hero_name, index=5)
+        self.record_one(self.I_TPAGE_6, self.I_TCHECK_6, hero_name, index=6)
+
+    def screenshot_benchmark(self):
+        self.config.model.script.device.screenshot_method = ScreenshotMethod.WINDOW_BACKGROUND
+        # self.config.model.script.device.control_method = ControlMethod.WINDOW_MESSAGE
+        self.benchmark([ScreenshotMethod.WINDOW_BACKGROUND])
+
+    @classmethod
+    def video(cls, name: str = 'test'):
+        return cv2.VideoWriter(f'./log/tmp/{name}_{int(time() * 1000)}.avi',
+                               cv2.VideoWriter_fourcc(*'XVID'),
+                               10,  # fps
+                               (1280, 720),  # frame size
+                               )
+
+    def add_one_frame(self, video):
+        self.screenshot()
+        video.write(self.device.image)
+        # 竖直方向在240-480之间随机滑动
+        self.device.swipe(p1=(640, 240 + randint(0, 240)), p2=(640 - 64, 240 + randint(0, 240)),
+                          distance_check=False)
+        # self.device.swipe(p1=(640, 360), p2=(640-64, 360))
+        sleep(0.5)
+
+    def add_one_video(self, name: str, index: int = 0):
+        video = ScriptTask.video(name=f'{name}_{index}')
+        for _ in range(20):
+            self.add_one_frame(video)
+        video.release()
+        cv2.destroyAllWindows()
+
+    def record_one(self, tpage: RuleImage, tcheck: RuleImage, name: str, index: int = 0):
+        logger.info(f'开始录制第{index}个视频')
+        while 1:
+            self.screenshot()
+            if self.appear(tpage):
+                self.ui_click(tpage, tcheck)
+                break
+            self.appear_then_click(self.I_SWITCH_BACKGROUND, interval=4)
+            sleep(1)
+            self.swipe(self.S_TSWIPE, interval=2.5)
+        while 1:
+            self.screenshot()
+            if not self.appear(tpage):
+                break
+            if self.appear_then_click(tcheck, interval=1.2):
+                continue
+
+        logger.info(f'已进入第{index}个背景')
+        self.add_one_video(name, index=index)
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('test')
+    d = Device(c)
+    t = ScriptTask(c, d)
+    HERO_NAME = 'test'
+    # t.run(HERO_NAME)
+    t.run_simple(HERO_NAME)

+ 119 - 0
tasks/Hyakkiyakou/train/image.json

@@ -0,0 +1,119 @@
+[
+  {
+    "itemName": "tpage_1",
+    "imageName": "train_tpage_1.png",
+    "roiFront": "238,504,221,123",
+    "roiBack": "121,480,950,166",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "缘结之庭"
+  },
+  {
+    "itemName": "tpage_2",
+    "imageName": "train_tpage_2.png",
+    "roiFront": "491,506,231,120",
+    "roiBack": "132,479,933,171",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "本丸御殿"
+  },
+  {
+    "itemName": "tpage_3",
+    "imageName": "train_tpage_3.png",
+    "roiFront": "748,504,240,118",
+    "roiBack": "125,482,937,166",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "之境"
+  },
+  {
+    "itemName": "tpage_4",
+    "imageName": "train_tpage_4.png",
+    "roiFront": "281,507,233,120",
+    "roiBack": "124,484,933,163",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "鲸歌潜岸"
+  },
+  {
+    "itemName": "tpage_5",
+    "imageName": "train_tpage_5.png",
+    "roiFront": "539,506,238,120",
+    "roiBack": "130,483,940,166",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "杨帆远航"
+  },
+  {
+    "itemName": "tpage_6",
+    "imageName": "train_tpage_6.png",
+    "roiFront": "801,505,232,118",
+    "roiBack": "128,493,937,153",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "繁影留住"
+  },
+  {
+    "itemName": "tcheck_1",
+    "imageName": "train_tcheck_1.png",
+    "roiFront": "19,246,100,100",
+    "roiBack": "2,218,135,215",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "tcheck_2",
+    "imageName": "train_tcheck_2.png",
+    "roiFront": "9,216,157,226",
+    "roiBack": "0,197,186,263",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "tcheck_3",
+    "imageName": "train_tcheck_3.png",
+    "roiFront": "5,126,138,299",
+    "roiBack": "2,110,147,345",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "tcheck_4",
+    "imageName": "train_tcheck_4.png",
+    "roiFront": "7,108,100,332",
+    "roiBack": "0,101,120,347",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "tcheck_5",
+    "imageName": "train_tcheck_5.png",
+    "roiFront": "23,111,100,355",
+    "roiBack": "9,99,134,378",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "tcheck_6",
+    "imageName": "train_tcheck_6.png",
+    "roiFront": "9,107,100,350",
+    "roiBack": "3,97,113,369",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "switch_background",
+    "imageName": "train_switch_background.png",
+    "roiFront": "992,649,105,36",
+    "roiBack": "969,627,152,72",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "description"
+  }
+]

+ 9 - 0
tasks/Hyakkiyakou/train/swipe.json

@@ -0,0 +1,9 @@
+[
+  {
+    "itemName": "tswipe",
+    "roiFront": "612,527,21,91",
+    "roiBack": "359,519,23,100",
+    "mode": "default",
+    "description": "description"
+  }
+]

binární
tasks/Hyakkiyakou/train/train_switch_background.png


binární
tasks/Hyakkiyakou/train/train_tcheck_1.png


binární
tasks/Hyakkiyakou/train/train_tcheck_2.png


binární
tasks/Hyakkiyakou/train/train_tcheck_3.png


binární
tasks/Hyakkiyakou/train/train_tcheck_4.png


binární
tasks/Hyakkiyakou/train/train_tcheck_5.png


binární
tasks/Hyakkiyakou/train/train_tcheck_6.png


binární
tasks/Hyakkiyakou/train/train_tpage_1.png


binární
tasks/Hyakkiyakou/train/train_tpage_2.png


binární
tasks/Hyakkiyakou/train/train_tpage_3.png


binární
tasks/Hyakkiyakou/train/train_tpage_4.png


binární
tasks/Hyakkiyakou/train/train_tpage_5.png


binární
tasks/Hyakkiyakou/train/train_tpage_6.png


+ 1 - 1
tasks/KekkaiActivation/assets.py

@@ -78,7 +78,7 @@ class KekkaiActivationAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# description 
 	# description 
-	I_CARDS_KAIKO_6 = RuleImage(roi_front=(193,192,89,73), roi_back=(169,148,130,501), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/cards/cards_cards_kaiko_6.png")
+	I_CARDS_KAIKO_6 = RuleImage(roi_front=(193,204,89,73), roi_back=(169,148,130,501), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/cards/cards_cards_kaiko_6.png")
 	# description 
 	# description 
 	I_CARDS_KAIKO_5 = RuleImage(roi_front=(191,345,88,58), roi_back=(172,162,126,488), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/cards/cards_cards_kaiko_5.png")
 	I_CARDS_KAIKO_5 = RuleImage(roi_front=(191,345,88,58), roi_back=(172,162,126,488), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/cards/cards_cards_kaiko_5.png")
 	# description 
 	# description 

binární
tasks/KekkaiActivation/cards/cards_cards_kaiko_6.png


+ 1 - 1
tasks/KekkaiActivation/cards/image.json

@@ -2,7 +2,7 @@
   {
   {
     "itemName": "cards_kaiko_6",
     "itemName": "cards_kaiko_6",
     "imageName": "cards_cards_kaiko_6.png",
     "imageName": "cards_cards_kaiko_6.png",
-    "roiFront": "193,192,89,73",
+    "roiFront": "193,204,89,73",
     "roiBack": "169,148,130,501",
     "roiBack": "169,148,130,501",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,

+ 1 - 1
tasks/KekkaiActivation/script_task.py

@@ -360,7 +360,7 @@ class ScriptTask(KU, KekkaiActivationAssets):
                 if not self.appear(self.I_REALM_SHIN):
                 if not self.appear(self.I_REALM_SHIN):
                     continue
                     continue
                 break
                 break
-            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1):
+            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=2.5):
                 continue
                 continue
 
 
     def harvest_card(self):
     def harvest_card(self):

+ 1 - 1
tasks/KekkaiUtilize/assets.py

@@ -105,7 +105,7 @@ class KekkaiUtilizeAssets:
 	# description 
 	# description 
 	I_U_MOON_2 = RuleImage(roi_front=(552,313,46,44), roi_back=(542,174,81,437), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_moon_2.png")
 	I_U_MOON_2 = RuleImage(roi_front=(552,313,46,44), roi_back=(542,174,81,437), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_moon_2.png")
 	# description 
 	# description 
-	I_CHECK_FRIEND_REALM_1 = RuleImage(roi_front=(1059,17,90,21), roi_back=(1050,4,107,65), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_check_friend_realm_1.png")
+	I_CHECK_FRIEND_REALM_1 = RuleImage(roi_front=(1059,17,90,21), roi_back=(844,4,421,65), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_check_friend_realm_1.png")
 	# description 
 	# description 
 	I_CHECK_FRIEND_REALM_2 = RuleImage(roi_front=(590,143,44,52), roi_back=(538,106,161,158), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_check_friend_realm_2.png")
 	I_CHECK_FRIEND_REALM_2 = RuleImage(roi_front=(590,143,44,52), roi_back=(538,106,161,158), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_check_friend_realm_2.png")
 	# 好友寄养 
 	# 好友寄养 

+ 1 - 1
tasks/KekkaiUtilize/utilize/image_2.json

@@ -48,7 +48,7 @@
     "itemName": "check_friend_realm_1",
     "itemName": "check_friend_realm_1",
     "imageName": "utilize_check_friend_realm_1.png",
     "imageName": "utilize_check_friend_realm_1.png",
     "roiFront": "1059,17,90,21",
     "roiFront": "1059,17,90,21",
-    "roiBack": "1050,4,107,65",
+    "roiBack": "844,4,421,65",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 2 - 2
tasks/RichMan/assets.py

@@ -179,7 +179,7 @@ class RichManAssets:
 	# 荣誉 
 	# 荣誉 
 	I_SIDE_CHECK_HONOR = RuleImage(roi_front=(694,12,41,42), roi_back=(694,12,41,42), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_honor.png")
 	I_SIDE_CHECK_HONOR = RuleImage(roi_front=(694,12,41,42), roi_back=(694,12,41,42), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_honor.png")
 	# 友情点 
 	# 友情点 
-	I_SIDE_SURE_FRIENDS = RuleImage(roi_front=(1174,277,68,70), roi_back=(1163,258,93,109), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_friends.png")
+	I_SIDE_SURE_FRIENDS = RuleImage(roi_front=(1190,287,43,52), roi_back=(1163,258,93,109), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_sure_friends.png")
 	# 友情点 
 	# 友情点 
 	I_SIDE_CHECK_FRIENDS = RuleImage(roi_front=(890,8,39,43), roi_back=(890,8,39,43), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_friends.png")
 	I_SIDE_CHECK_FRIENDS = RuleImage(roi_front=(890,8,39,43), roi_back=(890,8,39,43), threshold=0.7, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_side_check_friends.png")
 	# 勋章 
 	# 勋章 
@@ -284,7 +284,7 @@ class RichManAssets:
 	# 购买低级盘 
 	# 购买低级盘 
 	I_SP_BUY_LOW = RuleImage(roi_front=(176,148,144,108), roi_back=(128,142,902,449), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_buy_low.png")
 	I_SP_BUY_LOW = RuleImage(roi_front=(176,148,144,108), roi_back=(128,142,902,449), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_buy_low.png")
 	# 判断是否滑动到底 
 	# 判断是否滑动到底 
-	I_SP_SWIPE_CHECK = RuleImage(roi_front=(847,461,170,82), roi_back=(759,374,341,193), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_swipe_check.png")
+	I_SP_SWIPE_CHECK = RuleImage(roi_front=(900,164,42,61), roi_back=(173,144,840,379), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_swipe_check.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

+ 1 - 1
tasks/RichMan/mall/navbar/image_side.json

@@ -38,7 +38,7 @@
   {
   {
     "itemName": "side_sure_friends",
     "itemName": "side_sure_friends",
     "imageName": "navbar_side_sure_friends.png",
     "imageName": "navbar_side_sure_friends.png",
-    "roiFront": "1174,277,68,70",
+    "roiFront": "1190,287,43,52",
     "roiBack": "1163,258,93,109",
     "roiBack": "1163,258,93,109",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.7,
     "threshold": 0.7,

binární
tasks/RichMan/mall/navbar/navbar_side_sure_friends.png


+ 2 - 2
tasks/RichMan/mall/special/image.json

@@ -29,8 +29,8 @@
   {
   {
     "itemName": "sp_swipe_check",
     "itemName": "sp_swipe_check",
     "imageName": "special_sp_swipe_check.png",
     "imageName": "special_sp_swipe_check.png",
-    "roiFront": "847,461,170,82",
-    "roiBack": "759,374,341,193",
+    "roiFront": "900,164,42,61",
+    "roiBack": "173,144,840,379",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "判断是否滑动到底"
     "description": "判断是否滑动到底"

binární
tasks/RichMan/mall/special/special_sp_swipe_check.png


+ 0 - 1
tasks/RichMan/script_task.py

@@ -44,7 +44,6 @@ class ScriptTask(Mall, Guild, ThousandThings, Shrine):
 if __name__ == '__main__':
 if __name__ == '__main__':
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
-    from memory_profiler import profile
     c = Config('oas1')
     c = Config('oas1')
     d = Device(c)
     d = Device(c)
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)

+ 2 - 2
tasks/RyouToppa/assets.py

@@ -105,9 +105,9 @@ class RyouToppaAssets:
 	# description 
 	# description 
 	I_TOPPA_RECORD = RuleImage(roi_front=(66,628,64,39), roi_back=(66,628,64,39), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/res_toppa_record.png")
 	I_TOPPA_RECORD = RuleImage(roi_front=(66,628,64,39), roi_back=(66,628,64,39), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/res_toppa_record.png")
 	# description 
 	# description 
-	I_TOPPA_LOCK_TEAM = RuleImage(roi_front=(201,601,30,36), roi_back=(201,601,30,36), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/dev_toppa_lock_team.png")
+	I_TOPPA_LOCK_TEAM = RuleImage(roi_front=(203,602,26,32), roi_back=(203,602,26,32), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/dev_toppa_lock_team.png")
 	# description 
 	# description 
-	I_TOPPA_UNLOCK_TEAM = RuleImage(roi_front=(199,603,31,31), roi_back=(199,603,31,31), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/dev_toppa_unlock_team.png")
+	I_TOPPA_UNLOCK_TEAM = RuleImage(roi_front=(202,603,25,31), roi_back=(202,603,25,31), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/dev/dev_toppa_unlock_team.png")
 
 
 
 
 	# Click Rule Assets
 	# Click Rule Assets

binární
tasks/RyouToppa/dev/dev_toppa_lock_team.png


binární
tasks/RyouToppa/dev/dev_toppa_unlock_team.png


+ 4 - 4
tasks/RyouToppa/dev/image.json

@@ -11,8 +11,8 @@
   {
   {
     "itemName": "toppa_lock_team",
     "itemName": "toppa_lock_team",
     "imageName": "dev_toppa_lock_team.png",
     "imageName": "dev_toppa_lock_team.png",
-    "roiFront": "201,601,30,36",
-    "roiBack": "201,601,30,36",
+    "roiFront": "203,602,26,32",
+    "roiBack": "203,602,26,32",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
@@ -20,8 +20,8 @@
   {
   {
     "itemName": "toppa_unlock_team",
     "itemName": "toppa_unlock_team",
     "imageName": "dev_toppa_unlock_team.png",
     "imageName": "dev_toppa_unlock_team.png",
-    "roiFront": "199,603,31,31",
-    "roiBack": "199,603,31,31",
+    "roiFront": "202,603,25,31",
+    "roiBack": "202,603,25,31",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

+ 3 - 1
tasks/SoulsTidy/script_task.py

@@ -133,6 +133,7 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                     continue
                     continue
                 # 出现神赐, 就点击然后消失,
                 # 出现神赐, 就点击然后消失,
                 if self.appear(self.I_ST_GOD_PRESENT):
                 if self.appear(self.I_ST_GOD_PRESENT):
+                    logger.info('God present appear')
                     sleep(0.5)
                     sleep(0.5)
                     self.screenshot()
                     self.screenshot()
                     if not self.appear(self.I_ST_GOD_PRESENT):
                     if not self.appear(self.I_ST_GOD_PRESENT):
@@ -140,12 +141,13 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                     while 1:
                     while 1:
                         self.screenshot()
                         self.screenshot()
                         if not self.appear(self.I_ST_GOD_PRESENT):
                         if not self.appear(self.I_ST_GOD_PRESENT):
+                            logger.info('God present disappear')
                             break
                             break
                         if self.click(self.C_ST_GOD_PRSENT, interval=1):
                         if self.click(self.C_ST_GOD_PRSENT, interval=1):
                             continue
                             continue
                     sleep(0.5)
                     sleep(0.5)
                     break
                     break
-                if self.appear_then_click(self.I_ST_DONATE, interval=3.5):
+                if self.appear_then_click(self.I_ST_DONATE, interval=5.5):
                     continue
                     continue
             logger.info('Donate one')
             logger.info('Donate one')