Просмотр исходного кода

Merge pull request #15 from runhey/dev

Dev
huangrunheng 3 лет назад
Родитель
Сommit
da903952cd
71 измененных файлов с 1618 добавлено и 73 удалено
  1. 2 2
      module/atom/image.py
  2. 227 0
      module/atom/list.py
  3. 14 0
      module/atom/scroll.py
  4. 1 1
      module/config/config_manual.py
  5. 1 1
      module/config/config_menu.py
  6. 85 12
      module/dev_tools/assets_extract.py
  7. 1 1
      module/device/control.py
  8. 23 4
      module/device/handle.py
  9. 21 10
      module/device/method/window.py
  10. 2 0
      module/gui/qml.qrc
  11. 40 11
      module/gui/qml/Component/Overview.qml
  12. 1 2
      module/gui/qml/Component/RuleFile.qml
  13. 242 0
      module/gui/qml/Component/RuleFile2.qml
  14. 2 0
      module/gui/qml/Component/SplitPanel.qml
  15. 336 0
      module/gui/qml/Content/ListRule.qml
  16. 8 0
      module/gui/qml/Page/ScriptView.qml
  17. 3 3
      script.py
  18. 1 0
      tasks/AreaBoss/assets.py
  19. 1 1
      tasks/AreaBoss/config.py
  20. 9 0
      tasks/AreaBoss/config_scheduler.py
  21. 1 0
      tasks/CoinChallenge/assets.py
  22. 97 0
      tasks/Component/GeneralBattle/assets.py
  23. 110 0
      tasks/Component/GeneralBattle/click.json
  24. 164 0
      tasks/Component/GeneralBattle/image.json
  25. BIN
      tasks/Component/GeneralBattle/res_buff.png
  26. BIN
      tasks/Component/GeneralBattle/res_buff_awaken.png
  27. BIN
      tasks/Component/GeneralBattle/res_buff_exp_100.png
  28. BIN
      tasks/Component/GeneralBattle/res_buff_exp_50.png
  29. BIN
      tasks/Component/GeneralBattle/res_buff_gold_100.png
  30. BIN
      tasks/Component/GeneralBattle/res_buff_gold_50.png
  31. BIN
      tasks/Component/GeneralBattle/res_buff_soul.png
  32. BIN
      tasks/Component/GeneralBattle/res_exit.png
  33. BIN
      tasks/Component/GeneralBattle/res_exit_ensure.png
  34. BIN
      tasks/Component/GeneralBattle/res_false.png
  35. BIN
      tasks/Component/GeneralBattle/res_local.png
  36. BIN
      tasks/Component/GeneralBattle/res_prepare_dark.png
  37. BIN
      tasks/Component/GeneralBattle/res_prepare_highlight.png
  38. BIN
      tasks/Component/GeneralBattle/res_preset.png
  39. BIN
      tasks/Component/GeneralBattle/res_preset_ensure.png
  40. BIN
      tasks/Component/GeneralBattle/res_reward.png
  41. BIN
      tasks/Component/GeneralBattle/res_statistics.png
  42. BIN
      tasks/Component/GeneralBattle/res_win.png
  43. 16 0
      tasks/Component/GeneralBattle/swipe.json
  44. 1 0
      tasks/DemonEncounter/assets.py
  45. 1 0
      tasks/EternitySea/assets.py
  46. 1 0
      tasks/ExperienceYoukai/assets.py
  47. 1 0
      tasks/FallenSun/assets.py
  48. 1 0
      tasks/GameUi/assets.py
  49. 1 0
      tasks/General/assets.py
  50. 1 0
      tasks/GeneralBattle/assets.py
  51. 1 0
      tasks/GlobalGame/assets.py
  52. 1 0
      tasks/GoldYoukai/assets.py
  53. 1 0
      tasks/Hunt/assets.py
  54. 1 0
      tasks/Nian/assets.py
  55. 8 1
      tasks/Orochi/assets.py
  56. 57 0
      tasks/Orochi/res/list.json
  57. 1 0
      tasks/OrochiJudgement/assets.py
  58. 1 0
      tasks/OrochiMoans/assets.py
  59. 5 0
      tasks/RealmRaid/assets.py
  60. 1 1
      tasks/RealmRaid/config.py
  61. 10 0
      tasks/RealmRaid/config_scheduler.py
  62. 18 0
      tasks/RealmRaid/res/image.json
  63. BIN
      tasks/RealmRaid/res/res_lock_2.png
  64. BIN
      tasks/RealmRaid/res/res_unlock_2.png
  65. 8 0
      tasks/RealmRaid/script_task.py
  66. 1 0
      tasks/Restart/assets.py
  67. 1 0
      tasks/Script/assets.py
  68. 1 0
      tasks/Sougenbi/assets.py
  69. 12 0
      tasks/Utils/assets.py
  70. 24 0
      tasks/Utils/config_scheduler.py
  71. 51 23
      tasks/base_task.py

+ 2 - 2
module/atom/image.py

@@ -17,8 +17,8 @@ class RuleImage:
         初始化
         :param roi_front: 前置roi
         :param roi_back: 后置roi 用于匹配的区域
-        :param method: 匹配方法
-        :param threshold: 阈值
+        :param method: 匹配方法 "Template matching"
+        :param threshold: 阈值  0.8
         :param file: 相对路径, 带后缀
         """
         self.roi_front: list = list(roi_front)

+ 227 - 0
module/atom/list.py

@@ -0,0 +1,227 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+
+import cv2
+import random
+import numpy as np
+
+from random import randint
+
+from ppocronnx.predict_system import BoxedResult
+from module.atom.ocr import RuleOcr
+from module.atom.image import RuleImage
+from module.logger import logger
+
+
+class RuleList:
+
+    def __init__(self, folder: str, direction: str, mode: str, roi_back: tuple, size: tuple, array: list[str]) -> None:
+        """
+        初始化
+        :param folder:
+        :param direction:
+        :param mode:
+        :param roi_back:
+        :param size:
+        :param array:
+        """
+        self.folder = folder
+        self.is_vertical = direction == "vertical"
+        self.is_image = mode == "image"
+        self.is_ocr = mode == "ocr"
+        self.roi_back: list = list(roi_back)
+        self.size: list = list(size)
+        # 这个表示一个区域中一次所能显示的最大数量
+        self.max_show: int = self.roi_back[3] // self.size[1] if self.is_vertical else self.roi_back[2] // self.size[0]
+
+        self.array: list = array
+
+        # 以下是需要计算的
+        self.appear_area: list = None  # 出现的区域
+        self.is_bottom = False  # 表示是否已经滑动到底部了
+        self._target = None  # 目标
+        self.targets = {}  # 目标列表 只是针对image
+
+    def swipe_pos(self, number: int=2, after: bool=True) -> tuple:
+        """
+        返回滑动的起始位置和终点位置
+        :param number:
+        :param after:
+        :return:
+        """
+        center: tuple = (self.roi_back[0] + self.roi_back[2]) // 2, (self.roi_back[1] + self.roi_back[3]) // 2
+        distance: int = self.size[1] * number if self.is_vertical else self.size[0] * number
+        random_start: int = randint(- self.size[0] // 4, self.size[0] // 4) if self.is_vertical else randint(- self.size[1] // 4, self.size[1] // 4)
+        random_end: int = randint(- self.size[0] // 4, self.size[0] // 4) if self.is_vertical else randint(- self.size[1] // 4, self.size[1] // 4)
+
+        x1, y1, x2, y2 = None, None, None, None
+        if self.is_vertical:
+            if after:
+                # 竖直方向向下滑动, 那就是起始点是在下面 终点是在上面
+                x1, y1 = center[0]+random_start, center[1] + distance//2
+                x2, y2 = center[0]+random_end, center[1] - distance//2
+            else:
+                # 竖直方向向上滑动, 那就是起始点是在上面 终点是在下面
+                x1, y1 = center[0]+random_start, center[1] - distance//2
+                x2, y2 = center[0]+random_end, center[1] + distance//2
+        else:
+            if after:
+                # 水平方向向右滑动, 那就是起始点是在右面 终点是在左面
+                x1, y1 = center[0] + distance//2, center[1]+random_start
+                x2, y2 = center[0] - distance//2, center[1]+random_end
+            else:
+                # 水平方向向左滑动, 那就是起始点是在左面 终点是在右面
+                x1, y1 = center[0] - distance//2, center[1]+random_start
+                x2, y2 = center[0] + distance//2, center[1]+random_end
+
+        if x1 is None or y1 is None or x2 is None or y2 is None:
+            raise Exception("滑动位置计算错误")
+        return x1, y1, x2, y2
+
+    def target_check(self, name: str) -> bool:
+        """
+        检查输入的名称
+        :param name:
+        :return:
+        """
+        # 首先获取构建类的信息
+        # roi_front = None
+        # for item in self.array:
+        #     if item["itemName"] == name:
+        #         roi_front = item["roiFront"].split(",")
+        #         break
+        # if roi_front is None:
+        #     logger.error(f'Not found {name} in {self.array}')
+        #     return False
+        file = self.folder + "/" + name + ".png"
+
+        # 保证匹配的目标 是正确的
+        if self.is_image:
+            if self._target is None or isinstance(self._target, RuleOcr):
+                self._target = RuleImage(roi_front=self.roi_back, roi_back=self.roi_back, method="Template matching", threshold=0.8, file=file)
+            # 如果不对的话,就重新构建
+            elif self._target.name != name:
+                self._target = RuleImage(roi_front=self.roi_back, roi_back=self.roi_back, method="Template matching", threshold=0.8, file=file)
+            else:
+                pass
+        elif self.is_ocr:
+            if self._target is None or isinstance(self._target, RuleImage):
+                self._target = RuleOcr(roi=self.roi_back, area=(0, 0, 10, 10), mode="Full", method="Default",
+                                       keyword=name, name=name)
+            elif self._target.name != name:
+                self._target.name = name
+                self._target.keyword = name
+        else:
+            logger.error(f'Not found {name} in {self.array}')
+            return False
+
+    def targets_check(self, targets: list):
+        """
+        检查输入的图片名是缓存有
+        :param targets:
+        :return:
+        """
+        for item in targets:
+            if item in self.targets:
+                continue
+            # 如果还没有缓存的话就先缓存
+            file = self.folder + "/" + item + ".png"
+            self.targets[item] = RuleImage(roi_front=self.roi_back, roi_back=self.roi_back,
+                                           method="Template matching", threshold=0.8, file=file)
+
+    def image_appear(self, image: np.array, name: str) -> bool | tuple:
+        """
+        判断是否出现了某个图片
+        :param image: 屏幕的截图
+        :param name:
+        :return: 如果在当前的显示中,返回可以点击的坐标.如果不是出现就是返回False
+        """
+        if self.is_image and isinstance(name, str):
+            self.target_check(name)
+            appear = self._target.match(image)
+            if appear:
+                return self._target.coord()
+            else:
+                return False
+        elif self.is_image and isinstance(name, list):
+            self.targets_check(name)
+            for item in name:
+                appear = self.targets[item].match(image)
+                if appear:
+                    return self.targets[item].coord()
+            return False
+
+        else:
+            logger.error(f'Mode is not image')
+            return False
+
+    def ocr_appear(self, image: np.array, name: str):
+        """
+        判断是否出现了某个文字,
+        :param image: 屏幕的截图
+        :param name:
+        :return: 如果是出现的返回可以点击的坐标 x , y
+        如果是在当前显示的前面则返回小于零的int, 如果是在当前显示的后面则返回大于零的int,
+        """
+        if self.is_image:
+            return False
+        self.target_check(name)
+
+        # 开始一次ocr的检测
+        boxed_results: list[BoxedResult] = self._target.detect_and_ocr(image)
+        if not boxed_results:
+            logger.warning(f'Not angy result in image')
+            return 0, 0
+
+        # 判断所有的结果,给获取的列表建立引索
+        # index_list = self._target.filter(boxed_results, name)
+        # logger.info(index_list)
+        box = None
+        for item in boxed_results:
+            if item.ocr_text == name and item.score > RuleOcr.score:
+                box = item.box
+                break
+        if box is not None:
+            rec_x, rec_y, rec_w, rec_h = box[0, 0], box[0, 1], box[1, 0] - box[0, 0], box[2, 1] - box[0, 1]
+            x = rec_x + rec_w // 2
+            y = rec_y + rec_h // 2
+            return x, y
+
+        # if index_list and len(index_list) >= 1:
+        #     box = boxed_results[index_list[0]].box
+        #     rec_x, rec_y, rec_w, rec_h = box[0, 0], box[0, 1], box[1, 0] - box[0, 0], box[2, 1] - box[0, 1]
+        #     return rec_x+self.roi_back[0], rec_y+self.roi_back[1], rec_w, rec_h
+
+        # 如果没有找到,那么应该不是在当前的页面,需要获取当前的信息判断是往前滑动还是往后滑动
+        else:
+            keyword_list: list = [item.ocr_text for item in boxed_results if item.score > RuleOcr.score]
+
+            start_index = self.array.index(keyword_list[0])
+            end_index = self.array.index(keyword_list[-1])
+            if name in keyword_list:
+                distance_start = 0
+                distance_end = 0
+
+            current_index = self.array.index(name)
+            distance_start = 0
+            distance_end = 0
+            if current_index < start_index or current_index > end_index:
+                distance_start = current_index - start_index
+                distance_end = current_index - end_index
+            # 如果目标的是在当前的显示的前面, 则distance为负的
+            # 如果目标的是在当前的显示的后面, 则distance为正的
+            # 所有前面返回的是负的,后面返回的是正的
+            if distance_start == 0 and distance_end == 0:
+                logger.error(f'{name} not found in {keyword_list}')
+
+            return (distance_start + distance_end) // 2
+
+
+if __name__ == '__main__':
+    L_N33AME = RuleList(folder="./tasks/Orochi/res", direction="vertical", mode="ocr", roi_back=(160, 130, 317, 500),
+                        size=(301, 86),
+                        array=["壹层", "贰层", "叁层", "肆层", "伍层", "陆层", "柒层", "捌层", "玖层", "拾层", "悲鸣", "神罚"])
+    image = cv2.imread("D:/watu_list_text204237.png")
+    print(L_N33AME.ocr_appear(image, "柒层"))
+    print(L_N33AME.ocr_appear(image, "神罚"))

+ 14 - 0
module/atom/scroll.py

@@ -0,0 +1,14 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+
+
+from module.atom.ocr import RuleOcr
+from module.atom.image import RuleImage
+from module.logger import logger
+
+
+class RuleScroll:
+    pass
+
+

+ 1 - 1
module/config/config_manual.py

@@ -9,7 +9,7 @@ class ConfigManual:
 
     SCHEDULER_PRIORITY = """
         Restart
-        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian
+        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         """
 

+ 1 - 1
module/config/config_menu.py

@@ -22,7 +22,7 @@ class ConfigMenu:
         self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid']
 
         # 开发工具
-        self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule']
+        self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
 
     @cached_property
     def gui_menu(self) -> str:

+ 85 - 12
module/dev_tools/assets_extract.py

@@ -18,6 +18,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.
@@ -191,18 +192,70 @@ class OcrExtractor:
                     f'name="{item["itemName"]}")\n'
         return description + name
 
+
+class ListExtractor:
+    def __init__(self, file: str, data: dict) -> None:
+        """
+        List rule 提取
+        :param data:  json解析后的数据
+        """
+        self.file = str(Path(file).resolve().relative_to((Path.cwd()).resolve()).as_posix())
+        self.image_path = Path(self.file).parent.as_posix()
+        self._result = '\n\n\t# List Rule Assets\n'
+
+        if not isinstance(data, dict):
+            raise TypeError("data must be dict")
+
+        self._result += self.extract(data)
+
+    @property
+    def result(self) -> str:
+        return self._result
+
+    def extract(self, data) -> str:
+        """
+        解析每一项,返回字符串
+        :param data:
+        :return:
+        """
+        width, height = 0, 0
+        array: list = []
+        for item in data["list"]:
+            roi_front = item["roiFront"].split(",")
+            width += int(roi_front[2])
+            height += int(roi_front[3])
+            array.append(f'"{item["itemName"]}"')
+        width = int(width / len(data["list"]))
+        height = int(height / len(data["list"]))
+        array = ', '.join(array)
+
+        description: str = f'\t# {data["description"]} \n'
+        name: str = f'\tL_{name_transform(data["name"])} = RuleList(' \
+                    f'folder="./{str(self.image_path)}", ' \
+                    f'direction="{data["direction"]}", ' \
+                    f'mode="{data["type"]}", ' \
+                    f'roi_back=({data["roiBack"]}), ' \
+                    f'size=({width}, {height}), ' \
+                    f'\n\t\t\t\t\t array=[{str(array)}])\n'
+        return description + name
+
+
+
+
+
 class AssetsExtractor:
 
-    def __init__(self, task_name: str) -> None:
+    def __init__(self, task_path: str) -> None:
         """
         assets 提取某个任务文件夹下的所以的资源
         :param task_name: 任务名
         """
-        self.task_name = task_name
-        self.task_path = Path.cwd() / MODULE_FOLDER / task_name
-        self.assets_file = Path.cwd() / MODULE_FOLDER / task_name / ASSETS_FILE
 
-        self.class_name = f'\nclass {task_name}Assets: \n'
+        self.task_path = Path(task_path)
+        self.task_name = self.task_path.name
+        self.assets_file = self.task_path / ASSETS_FILE
+
+        self.class_name = f'\nclass {self.task_name}Assets: \n'
 
         self._result = ''
         for import_exp in IMPORT_EXP:
@@ -226,8 +279,8 @@ class AssetsExtractor:
         """
         with open(file, 'r', encoding='utf-8') as f:
             data = json.load(f)
-        if not isinstance(data, list):
-            logger.error(f'{file} 文件解析错误,不是list')
+        if not isinstance(data, list) and not isinstance(data, dict):
+            logger.error(f'{file} 文件解析错误,不是list 或者 dict')
             return None
         return data
 
@@ -289,6 +342,18 @@ class AssetsExtractor:
             return True
         return False
 
+    @classmethod
+    def is_list_file(cls, data) -> bool:
+        """
+
+        :param data:
+        :return:
+        """
+        if isinstance(data, dict) and 'name' in data:
+            return True
+        return False
+
+
     def write_file(self) -> None:
         """
         将自身的_resule写入文件
@@ -307,6 +372,10 @@ class AssetsExtractor:
             data = self.read_file(file)
             if not data:
                 continue
+
+            if self.is_list_file(data):
+                result += ListExtractor(file, data).result
+                continue
             if self.is_image_file(data):
                 result += ImageExtractor(file, data).result
             elif self.is_click_file(data):
@@ -335,16 +404,20 @@ class AllAssetsExtractor:
         logger.info('All assets extract')
         self.task_path = Path.cwd() / MODULE_FOLDER
         self.task_list = [x.name for x in self.task_path.iterdir() if x.is_dir()]
-        process_map(self.work, self.task_list, max_workers=4)
+
+        self.task_paths = [str(x) for x in self.task_path.iterdir() if x.is_dir()]
+        # 删除有Component的任务, 同时将其子路径加入任务列表
+        self.task_paths = [x for x in self.task_paths if 'Component' not in x]
+        self.task_paths.extend([str(x) for x in (self.task_path / 'Component').iterdir() if x.is_dir()])
+
+        process_map(self.work, self.task_paths, max_workers=4)
 
     @staticmethod
-    def work(task_name: str):
-        me = AssetsExtractor(task_name)
+    def work(task_path: str):
+        me = AssetsExtractor(task_path)
         me.extract()
 
 
 
 if __name__ == "__main__":
-    # c = AssetsExtractor('CoinChallenge')
-    # c.extract()
     AllAssetsExtractor()

+ 1 - 1
module/device/control.py

@@ -72,7 +72,7 @@ class Control(Minitouch, Adb, Scrcpy, Window):
             self.handle_control_check(control_name)
         x, y = ensure_int(x, y)
         logger.info(
-            'Click %s ' % (point2str(x, y))
+            'Click %s , name: %s' % (point2str(x, y), control_name)
         )
         method = self.click_methods.get(
             self.config.script.device.control_method,

+ 23 - 4
module/device/handle.py

@@ -78,7 +78,8 @@ class WindowNode(NodeMixin):
 
 
 class Handle:
-    emulator_list = ['MuMu',
+    emulator_list = ['MuMu12',
+                     'MuMu',
                      '雷电',
                      '夜神',
                      '蓝叠',
@@ -186,13 +187,31 @@ class Handle:
         if windows is None:
             logger.error("handle_auto not get all wnidow")
 
+        emu_list = []
         for window_title in windows:
             for item in Handle.emulator_list:
                 if window_title.find(item) != -1:
-                    logger.info(f'handle auto seclect to find {window_title} and use it as root_title')
-                    return window_title
+                    emu_list.append(window_title)
 
-        return None
+        if not len(emu_list):
+            logger.error('Can not find emulator handle, please check your emulator is running')
+            return None
+
+        emulator_title = ''
+        # 测试mumu12的时候发现 获取的全部的窗体标题有这样的: 'MuMuPlayer', 'MuMuPlayer', 'MuMuPlayer', 'MuMu模拟器12'
+        # 事实上 我们只需要最后一个 'MuMu模拟器12',其他的不重要
+        if 'MuMu模拟器12' in emu_list and 'MuMuPlayer' in emu_list:
+            emulator_title = 'MuMu模拟器12'
+
+        if len(emu_list) > 1 and emulator_title == '':
+            logger.warning(f'Find more than one emulator handle, oas will use the first one {emu_list[0]}')
+            emulator_title = emu_list[0]
+
+        if len(emu_list) == 1:
+            emulator_title = emu_list[0]
+
+        logger.info(f'Handle auto seclect to find {emulator_title} and use it as root_title')
+        return emulator_title
 
     @staticmethod
     def handle_tree(hwnd, node: WindowNode, level: int =0) -> None:

+ 21 - 10
module/device/method/window.py

@@ -111,6 +111,26 @@ class Window(Handle):
         elif self.emulator_family == 'bluestacks_family':
             pass
 
+    @cached_property
+    def mumu_head_height(self):
+        """
+        不同mumu模拟器的头部高度不同
+        :return:
+        """
+        father_win_Rect = GetWindowRect(self.control_handle_list[0])
+        father_height: int = father_win_Rect[3] - father_win_Rect[1]  # 下y - 上y 计算高度
+        children_win_Rect = GetWindowRect(self.control_handle_list[1])
+        children_height: int = children_win_Rect[3] - children_win_Rect[1]  # 下y - 上y 计算高度
+        height = father_height - children_height
+        if int(height * self.window_scale_rate) == 37:
+            # 说明是mumu模拟器 不做处理
+            pass
+        if int(height * self.window_scale_rate) == 45:
+            # 说明是mumu12模拟器 不做处理
+            pass
+        logger.info(f"Mumu emulator head height: {height}")
+        return height
+
     def click_window_message(self, x: int, y: int):
         """
 
@@ -118,25 +138,16 @@ class Window(Handle):
         :param y:
         :return:
         """
-        # if x >= 1280:
-        #     x = 1280
-        # if x <= 0:
-        #     x = 0
-        # if y >= 720:
-        #     y = 720
-        # if y <= 0:
-        #     y = 0
         # 我不知道为什么的使用的pywin32==306的版本会导致获取的图片的是(1024, 576)
         # 所有我在点击的时候会除以这个缩放比例
         # 但是后面发现又不是影响的很奇怪
 
         x = int(x / self.window_scale_rate)
         y = int(y / self.window_scale_rate)
-        mumu_head_height = int(36/self.window_scale_rate)
         # print(f"我点击的x:{x}, y:{y}")
         emulator_type = len(self.control_handle_list)
         if emulator_type == 2:  # mumu模拟器
-            SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, MAKELONG(x, y+mumu_head_height))  # 模拟鼠标按下 先是父窗口 上面的框高度是57
+            SendMessage(self.control_handle_list[0], WM_LBUTTONDOWN, 0, MAKELONG(x, y+self.mumu_head_height))  # 模拟鼠标按下 先是父窗口 上面的框高度是57
             time.sleep((random.randint(100, 200)) / 1000.0)  # 点击弹起改为随机,时间100ms-200ms
             SendMessage(self.control_handle_list[1], WM_LBUTTONUP, 0, MAKELONG(x, y))  # 模拟鼠标弹起 后是子窗口
         elif emulator_type > 2:  # 夜神模拟器

+ 2 - 0
module/gui/qml.qrc

@@ -31,5 +31,7 @@
         <file>qml/Component/MirrorImage.qml</file>
         <file>qml/Component/ResizableRectangle.qml</file>
         <file>qml/Component/RuleFile.qml</file>
+        <file>qml/Content/ListRule.qml</file>
+        <file>qml/Component/RuleFile2.qml</file>
     </qresource>
 </RCC>

+ 40 - 11
module/gui/qml/Component/Overview.qml

@@ -35,6 +35,7 @@ Item {
             height: 50
             RowLayout{
                 anchors.fill: parent
+                property int scriptState: 0  // 0是
                 FluText{
                     text: 'Scheduler'
                     Layout.leftMargin: 16
@@ -48,27 +49,39 @@ Item {
                     onClicked: {
                         showSuccess("Restart"+" "+configName)
                         process_manager.restart(configName)
-                        startStart.selected = true
-                        textLog.text = ""
+                        setStatus(MainEvent.RunStatus.Free)
+                        textLog.text = ''
+                        textLog.currentLine = 0
                     }
                 }
                 FluToggleButton{
                     id: startStart
                     Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
                     Layout.rightMargin: 16
-                    text:"Start"
-                    selected: true
+                    text: {if(overStatus.runStatus === MainEvent.RunStatus.Run){return "Stop"}
+                           else{return "Start"}}
+                    selected: {if(overStatus.runStatus === MainEvent.RunStatus.Free){return true}
+                                else{return false}}
+                    disabled: {if(overStatus.runStatus === MainEvent.RunStatus.Error ||
+                                  overStatus.runStatus === MainEvent.RunStatus.Empty){return true}
+                               else{return false}
+                    }
                     onClicked: {
-                        selected = !selected
-                        if(selected){
-                            text = "Start"                          
-                            process_manager.stop_script(root.configName)
-                        }else{
-                            // 如果按键颜色变灰色
-                            text = "Stop"
+                        console.debug(overStatus.runStatus)
+                        if(overStatus.runStatus === MainEvent.RunStatus.Free){
+                            //如果这个时候初始化好了但是还没有运行脚本
+                            setStatus(MainEvent.RunStatus.Run)
                             process_manager.start_script(root.configName)
+                            return
+                        }
+                        if(overStatus.runStatus === MainEvent.RunStatus.Run){
+                            // 如果这个时候运行中
+                            setStatus(MainEvent.RunStatus.Empty)
+                            process_manager.stop_script(root.configName)
+                            return
                         }
                     }
+
                 }
             }
         }
@@ -300,6 +313,8 @@ Item {
             padding: 10
             clip: true
             wrapMode: Text.WordWrap // 设置自动换行模式
+            maximumLineCount: 100
+            property int currentLine: 0
             textFormat: Text.RichText
             text: ''
 
@@ -307,7 +322,21 @@ Item {
                 if(config !== root.configName){
                     return
                 }
+                if(log.includes('ERROR') || log.includes('CRITICAL')){
+                    setStatus(MainEvent.RunStatus.Error)
+                }
+
+
+                if (currentLine > maximumLineCount) {
+                    var index = textLog.text.indexOf("<br>"); //找到第一个<br>的位置
+                    if (index !== -1) {
+                        textLog.text = textLog.text.substring(index + 4); //从<br>之后开始截取字符串
+                        currentLine -= 1
+                    }
+                }
+                currentLine += 1
                 textLog.text += log
+
             }
 
             Component.onCompleted:{

+ 1 - 2
module/gui/qml/Component/RuleFile.qml

@@ -157,7 +157,7 @@ FluArea {
         //表格视图
         Item{
             width: coi.width
-            height: 400
+            height: 370
             ListView{
                 id: listView
                 width: 200
@@ -213,7 +213,6 @@ FluArea {
         for(let item of data){
             listModel.append(item)
         }
-
     }
 
 }

+ 242 - 0
module/gui/qml/Component/RuleFile2.qml

@@ -0,0 +1,242 @@
+import QtQuick
+import QtQuick.Controls
+import FluentUI
+import QtQuick.Dialogs
+import Oas
+
+FluArea {
+    id: root
+    property string file: ""  //完整的文件路径带后缀
+    property alias folder: folderButton.text
+    property alias list_model: listModel
+    property alias rule_file: ruleFile
+
+    property var currentItem: listModel.get(0)
+    property var addFunc: function(){}
+    property var editFunc: function(){}
+    property var saveFunc: function(){}
+
+    // 这些是针对ruleList的
+    property string name: ""
+    property string direction: ""
+    property string type: ""
+    property string roiBack: ""
+    property string description: ""
+
+    ListModel{
+        id: listModel
+    }
+
+    RuleFile{
+        id: ruleFile
+    }
+
+    Column{
+        id: coi
+        anchors{
+            top: parent.top
+//            topMargin: 10
+            bottom: parent.bottom
+            left: parent.left
+            leftMargin: 20
+            right: parent.right
+            rightMargin: 20
+        }
+
+        spacing: 5
+        // 头
+        Item{
+            width: coi.width
+            height: 40
+            FluText{
+                anchors.left: parent.left
+                anchors.verticalCenter: parent.verticalCenter
+                text: "Select rule"
+                font: FluTextStyle.BodyStrong
+            }
+        }
+        //路径
+        Item{
+            width: coi.width
+            height: 40
+            FluText{
+                anchors.left: parent.left
+                anchors.verticalCenter: parent.verticalCenter
+                text: "Folder"
+                font: FluTextStyle.BodyStrong
+            }
+            FluButton{
+                id: folderButton
+                anchors{
+                    right: parent.right
+                    verticalCenter: parent.verticalCenter
+                }
+                disabled: true
+                text:"Select folder"
+                width: 200
+                onClicked: {
+
+                }
+            }
+        }
+        // 文件名
+        Item{
+            width: coi.width
+            height: 40
+            FluText{
+                anchors.left: parent.left
+                anchors.verticalCenter: parent.verticalCenter
+                text: "File"
+                font: FluTextStyle.BodyStrong
+            }
+            FluButton{
+                id: fileButton
+                anchors{
+                    right: parent.right
+                    verticalCenter: parent.verticalCenter
+                }
+                text:"Select file"
+                width: 200
+                onClicked: {
+                    jsonFileDialog.open()
+                }
+            }
+            FileDialog{
+                   id: jsonFileDialog
+                   title: "select your json file"
+                   nameFilters: ["(*.json)"]
+                   onAccepted: {
+                       const selectedUrl = jsonFileDialog.selectedFile.toString()
+                       if(!selectedUrl.startsWith("file:///")){
+                           console.error("请你选择正确的文件路径")
+                           return
+                       }
+                       const filePath = selectedUrl.substring("file:///".length)
+                       const lastSlashIndex = filePath.lastIndexOf("/"); // 获取最后一个斜杠的索引
+                       const secondLastSlashIndex = filePath.lastIndexOf("/", lastSlashIndex - 1); // 获取倒数第二个斜杠的索引
+
+                       const filename = filePath.substring(lastSlashIndex + 1); // 获取文件名(带后缀)
+                       const directory = filePath.substring(secondLastSlashIndex+1, lastSlashIndex); // 获取文件所在的目录
+
+                       root.file = filePath
+                       folderButton.text = directory
+                       fileButton.text = filename
+                       listModel.clear()
+                       loadFile()
+                   }
+               }
+        }
+        // new
+        Item{
+            width: coi.width
+            height: 40
+            FluFilledButton{
+                id: saveItemButton
+                anchors{
+                    right: parent.right
+                    verticalCenter: parent.verticalCenter
+                }
+                text:"New"
+                disabled: root.file === ""? true : false
+                width: parent.width
+                onClicked: {
+                    listModel.append(addFunc())
+                }
+            }
+        }
+        // 保存 文件
+        Item{
+            width: coi.width
+            height: 40
+            FluFilledButton{
+                id: saveFileButton
+                anchors{
+                    right: parent.right
+                    verticalCenter: parent.verticalCenter
+                }
+                text:"Save file"
+                width: parent.width
+                disabled: root.file === ""? true : false
+                onClicked: {
+                    root.saveFunc()
+                }
+            }
+        }
+        //表格视图
+        Item{
+            width: coi.width
+            height: 370
+            ListView{
+                id: listView
+                width: 200
+                height: parent.height
+                anchors{
+                    right: parent.right
+                }
+                model: listModel
+                delegate: listDelegate
+            }
+            Component{
+                id: listDelegate
+                Item{
+                    width: 200
+                    height: 40
+                FluTextBox{
+                    id: itemName
+                    width: parent.width
+                    anchors{
+                        verticalCenter: parent.verticalCenter
+                    }
+                    placeholderText:"item name"
+                    text: model.itemName
+//                    validator: RegularExpressionValidator { regularExpression: /^[a-z0-9_]*$/ }
+                    onActiveFocusChanged: {
+                        if(activeFocus){
+                            currentItem = listModel.get(index)
+                        }
+                    }
+                    onEditingFinished: {
+                        model.itemName = text
+                        root.editFunc(model)
+                    }
+                }
+                }
+            }
+        }
+    }
+
+    // 加载文件,前提是文件的路径是加载好的
+    function loadFile(){
+        const getData = ruleFile.read_file(file)
+        var data = {}
+        if (getData === "" || typeof getData === "undefined") {
+            console.log("String is empty or undefined.")
+            // 如果是空的表示这个是一个刚刚建立的rule文件
+            data["name"] = "name"
+            data["direction"] = "vertical"
+            data["type"] = "image"
+            data["roiBack"] = "0,0,100,100"
+            data["description"] = "description"
+            data["list"] = []
+        }else{
+            data = JSON.parse(getData)
+        }
+
+        if (!'name' in data){
+            return
+        }
+        if(!'list' in data){
+            return
+        }
+        root.name = data["name"]
+        root.direction = data["direction"]
+        root.type = data["type"]
+        root.roiBack = data["roiBack"]
+        root.description = data["description"]
+
+        for(let item of data["list"]){
+            listModel.append(item)
+        }
+    }
+
+}

+ 2 - 0
module/gui/qml/Component/SplitPanel.qml

@@ -82,11 +82,13 @@ Item {
     function showDefalut(){
         contentDefalut.visible = true
         contentLoader.visible = false
+        contentDefalut.focus = true
     }
     //显示不固定的
     function showLoader(){
         contentDefalut.visible = false
         contentLoader.visible = true
+        contentLoader.focus = true
     }
 
     //设置固定的部分的具体内容  主要是传一个组件

+ 336 - 0
module/gui/qml/Content/ListRule.qml

@@ -0,0 +1,336 @@
+import QtQuick
+import QtQuick.Controls
+import FluentUI
+import "../Component"
+
+Item {
+
+    MirrorImage{
+        id: mirrorImage
+        anchors{
+            left: parent.left
+            top: parent.top
+        }
+        width: 1280
+        height: 720 + 50
+        imageWidth: 1280
+        imageHeight: 720
+
+        onRoi_red_changed: function(roi){
+            if(typeof ruleFile.currentItem === "undefined"){
+                return
+            }
+            ruleFile.currentItem.roiFront = roi
+        }
+
+        onRoi_green_changed: function(roi){
+            if(typeof ruleFile.currentItem === "undefined"){
+                return
+            }
+//            ruleFile.currentItem.roiBack = roi
+            ruleFile.roiBack = roi
+        }
+    }
+    RuleFile2{
+        id: ruleFile
+        anchors{
+            left: mirrorImage.right
+            leftMargin: 10
+            right: parent.right
+            top: parent.top
+        }
+        height: 600
+        addFunc: add
+        editFunc: edit
+        saveFunc: save
+
+        onCurrentItemChanged: {
+            if(currentItem === "" || typeof currentItem === "undefined"){
+                return
+            }
+            var [x, y, width, height] = currentItem.roiFront.split(',')
+            mirrorImage.roiRed_x = parseInt(x)
+            mirrorImage.roiRed_y = parseInt(y)
+            mirrorImage.roiRed_width = parseInt(width)
+            mirrorImage.roiRed_height = parseInt(height)
+        }
+        onRoiBackChanged: {
+            var [x, y, width, height] = ruleFile.roiBack.split(',')
+            mirrorImage.roiGreen_x = parseInt(x)
+            mirrorImage.roiGreen_y = parseInt(y)
+            mirrorImage.roiGreen_width = parseInt(width)
+            mirrorImage.roiGreen_height = parseInt(height)
+        }
+    }
+
+    FluArea {
+        id: ruleArea
+        anchors{
+            left: mirrorImage.right
+            leftMargin: 10
+            right: parent.right
+            top: ruleFile.bottom
+            topMargin: 12
+            bottom: parent.bottom
+        }
+        Column{
+            id: coi
+            anchors{
+                top: parent.top
+                bottom: parent.bottom
+                left: parent.left
+                leftMargin: 20
+                right: parent.right
+                rightMargin: 20
+            }
+            spacing: 5
+            //头
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Editing rule"
+                    font: FluTextStyle.Subtitle
+                }
+            }
+            // name 这个参数项的名称
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "List name"
+                    font: FluTextStyle.BodyStrong
+                }
+                FluTextBox{
+                    id: itemName
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    placeholderText:"itemName"
+                    disabled: false
+                    text: ruleFile.name
+                    width: 200
+                    onEditingFinished: {
+                        ruleFile.name = text
+                    }
+                }
+            }
+            // roi front
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Roi front"
+                    font: FluTextStyle.BodyStrong
+                }
+                FluTextBox{
+                    id: roiFront
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    disabled: true
+                    text:(typeof ruleFile.currentItem === "undefined")? "" : ruleFile.currentItem.roiFront
+                    placeholderText:"0,0,100,100"
+                    width: 200
+                }
+            }
+            //roi back
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Roi Back"
+                    font: FluTextStyle.BodyStrong
+                }
+                FluTextBox{
+                    id: roiBack
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    disabled: true
+                    text: ruleFile.roiBack
+                    placeholderText:"0,0,100,100"
+                    width: 200
+
+
+                }
+            }
+            //水平还是竖直方向
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Direction"
+                    font: FluTextStyle.BodyStrong
+                }
+                FComboBox{
+                    id: direction
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    width: 200
+                    currentIndex: if(ruleFile.direction === "vertical"){
+                                      return 0
+                                  }else{
+                                      return 1
+                                  }
+                    model: ["vertical", "horizontal"]
+
+                    onActivated: {
+                        if(currentIndex === 0){
+                            ruleFile.direction = "vertical"
+                        }
+                        else{
+                            ruleFile.direction = "horizontal"
+                        }
+                    }
+                }
+            }
+            // 类型 图片还是ocr
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Type"
+                    font: FluTextStyle.BodyStrong
+                }
+                FComboBox{
+                    id: type
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    width: 200
+                    model: ["image", "ocr"]
+                    currentIndex: {if(ruleFile.type === "image"){
+                                      return 0
+                                  }else{
+                                      return 1
+                                  }}
+
+                    onActivated: {
+                        if(currentIndex === 0){
+                            ruleFile.type = "image"
+                        }
+                        else{
+                            ruleFile.type = "ocr"
+                        }
+                    }
+                }
+            }
+            //描述 description
+            Item{
+                width: coi.width
+                height: 40
+                FluText{
+                    anchors.left: parent.left
+                    anchors.verticalCenter: parent.verticalCenter
+                    text: "Description"
+                    font: FluTextStyle.BodyStrong
+                }
+                FluTextBox{
+                    id: description
+                    anchors{
+                        right: parent.right
+                        verticalCenter: parent.verticalCenter
+                    }
+                    width: 200
+                    text:ruleFile.description
+                    placeholderText:"input your description"
+                    onEditingFinished: {
+                        ruleFile.description = text
+                    }
+                }
+            }
+
+        }
+
+    }
+
+    // 帮助
+    FluArea{
+        id: ruleHelp
+        anchors{
+            left: parent.left
+            right: ruleArea.left
+            rightMargin: 10
+            top: mirrorImage.bottom
+            topMargin: 10
+            bottom: parent.bottom
+        }
+        FluText{
+            leftPadding: 12
+            topPadding: 12
+            text: "红色的框(Roi front)表示这一个项要匹配的图片,绿色的框(Roi back)表示匹配的范围。
+在移动边框时右边的roi并不会实时显示,当切换软件的焦点时更新显示。但是具体的数值是更新的,可以放心的保存截图"
+        }
+        FluFilledButton{
+            anchors{
+                right: parent.right
+                rightMargin: 10
+                top: parent.top
+                topMargin: 10
+            }
+
+            text:"Save image"
+            onClicked: {
+                const i = ruleFile.file.lastIndexOf("/")
+                const imagepath = ruleFile.file.substring(0, i)
+                mirrorImage.save_target_image(ruleFile.currentItem.roiFront, imagepath +"/"+ruleFile.currentItem.itemName+'.png')
+                showSuccess("Save target image")
+            }
+        }
+    }
+
+    function add(){
+        const item ={}
+        item["itemName"] = "new"
+        item["roiFront"] = "0,0,100,100"
+        showSuccess("Add new item")
+        return item
+    }
+
+    function edit(model){
+
+    }
+
+    function save(){
+        const data = {}
+        const list = []
+        for(var i=0; i<ruleFile.list_model.count; i++){
+            const item = ruleFile.list_model.get(i)
+            const itemData = {}
+            itemData["itemName"] = item["itemName"]
+            itemData["roiFront"] = item["roiFront"]
+            list.push(itemData)
+        }
+        data["name"] = ruleFile.name
+        data["direction"] = ruleFile.direction
+        data["type"] = ruleFile.type
+        data["roiBack"] = ruleFile.roiBack
+        data["description"] = ruleFile.description
+        data["list"] = list
+
+        ruleFile.rule_file.write_file(ruleFile.file, JSON.stringify(data, null, "  "))
+        showSuccess("Save file")
+
+    }
+
+
+}

+ 8 - 0
module/gui/qml/Page/ScriptView.qml

@@ -66,6 +66,14 @@ SplitPanel{
             }
             setLoader(component)
         }
+        else if(title === "List Rule"){
+            const component = Qt.createComponent("../../qml/Content/ListRule.qml")
+            if(component.status !== Component.Ready){
+                console.error("ListRule rule component is not ready")
+                return
+            }
+            setLoader(component)
+        }
         //最后才是一般的参数页面
         else{
             const component = Qt.createComponent("../../qml/Component/Args.qml")

+ 3 - 3
script.py

@@ -203,7 +203,7 @@ class Script:
             task["next_run"] = str(self.config.task.next_run)
         data["task"] = task
 
-        for p in self.config.pending_task:
+        for p in self.config.pending_task[1:]:
             item = {"name": p.command, "next_run": str(p.next_run)}
             pending.append(item)
 
@@ -271,7 +271,7 @@ class Script:
             if task.next_run > datetime.now():
                 logger.info(f'Wait until {task.next_run} for task `{task.command}`')
                 # self.is_first_task = False
-                method = self.config.optimization.when_task_queue_empty
+                method = self.config.script.optimization.when_task_queue_empty
                 if method == 'close_game':
                     logger.info('Close game during wait')
                     self.device.app_stop()
@@ -443,6 +443,6 @@ class Script:
 
 if __name__ == "__main__":
     script = Script("oas1")
-    print(script.get_next_task())
+    # print(script.get_next_task())
     script.run("AreaBoss")
     # script.run('RealmRaid')

+ 1 - 0
tasks/AreaBoss/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 1
tasks/AreaBoss/config.py

@@ -3,7 +3,7 @@
 # github https://github.com/runhey
 from pydantic import BaseModel, Field
 
-from tasks.AreaBoss.config_scheduler import Scheduler
+from tasks.Utils.config_scheduler import Scheduler
 from tasks.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.AreaBoss.config_boss import Boss
 

+ 9 - 0
tasks/AreaBoss/config_scheduler.py

@@ -13,3 +13,12 @@ class Scheduler(BaseModel):
     interval_hours: int = Field(default=0, description='[间隔小时]:默认为0\n 可选0-23')
     interval_minutes: int = Field(default=0, description='[间隔分钟]:默认为0\n 可选0-59')
 
+    @validator('next_run')
+    def parse_next_run(cls, value):
+        if isinstance(value, str):
+            try:
+                return datetime.fromisoformat(value)
+            except ValueError:
+                raise ValueError('Invalid next_run value. Expected format: YYYY-MM-DD HH:MM:SS')
+        return value
+

+ 1 - 0
tasks/CoinChallenge/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 97 - 0
tasks/Component/GeneralBattle/assets.py

@@ -0,0 +1,97 @@
+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 module/dev_tools/assets_extract.py.
+# Don't modify it manually.
+class GeneralBattleAssets: 
+
+
+	# Click Rule Assets
+	# 预设队伍1 
+	C_PRESET_TEAM_1 = RuleClick(roi_front=(196,234,464,114), roi_back=(196,234,464,114), name="preset_team_1")
+	# 预设队伍2 
+	C_PRESET_TEAM_2 = RuleClick(roi_front=(197,358,465,103), roi_back=(197,358,465,103), name="preset_team_2")
+	# 预设队伍3 
+	C_PRESET_TEAM_3 = RuleClick(roi_front=(195,480,462,100), roi_back=(195,480,462,100), name="preset_team_3")
+	# 预设队伍4 
+	C_PRESET_TEAM_4 = RuleClick(roi_front=(193,596,464,35), roi_back=(193,596,464,35), name="preset_team_4")
+	# 预设组1 
+	C_PRESET_GROUP_1 = RuleClick(roi_front=(28,238,134,56), roi_back=(28,238,134,56), name="preset_group_1")
+	# 预设组2 
+	C_PRESET_GROUP_2 = RuleClick(roi_front=(31,298,132,60), roi_back=(31,298,132,60), name="preset_group_2")
+	# 预设组3 
+	C_PRESET_GROUP_3 = RuleClick(roi_front=(31,362,135,59), roi_back=(31,362,135,59), name="preset_group_3")
+	# 预设组4 
+	C_PRESET_GROUP_4 = RuleClick(roi_front=(29,427,133,57), roi_back=(29,427,133,57), name="preset_group_4")
+	# 预设组5 
+	C_PRESET_GROUP_5 = RuleClick(roi_front=(31,489,133,60), roi_back=(31,489,133,60), name="preset_group_5")
+	# 预设组6 
+	C_PRESET_GROUP_6 = RuleClick(roi_front=(31,549,132,63), roi_back=(31,549,132,63), name="preset_group_6")
+	# 预设组7 
+	C_PRESET_GROUP_7 = RuleClick(roi_front=(29,615,137,63), roi_back=(29,615,137,63), name="preset_group_7")
+	# 从左开始第一个绿标 
+	C_GREEN_LEFT_1 = RuleClick(roi_front=(128,433,90,150), roi_back=(128,433,90,150), name="green_left_1")
+	# 从左开始第二个绿标 
+	C_GREEN_LEFT_2 = RuleClick(roi_front=(371,385,81,145), roi_back=(371,385,81,145), name="green_left_2")
+	# 从左开始第三个绿标 
+	C_GREEN_LEFT_3 = RuleClick(roi_front=(586,328,100,76), roi_back=(586,328,100,76), name="green_left_3")
+	# 从左开始第四个绿标 
+	C_GREEN_LEFT_4 = RuleClick(roi_front=(817,379,77,133), roi_back=(817,379,77,133), name="green_left_4")
+	# 从左开始第五个绿标 
+	C_GREEN_LEFT_5 = RuleClick(roi_front=(1059,416,85,145), roi_back=(1059,416,85,145), name="green_left_5")
+	# 绿标阴阳师 
+	C_GREEN_MAIN = RuleClick(roi_front=(590,454,88,178), roi_back=(590,454,88,178), name="green_main")
+	# 战斗的时候有一定的概率随机点击 
+	C_RANDOM_CLICK = RuleClick(roi_front=(104,79,1050,507), roi_back=(255,65,100,100), name="random_click")
+
+
+	# Image Rule Assets
+	# 奖励,就是那个魂 
+	I_REWARD = RuleImage(roi_front=(547,518,172,96), roi_back=(547,518,172,96), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_reward.png")
+	# 预设的小图标 
+	I_PRESET = RuleImage(roi_front=(32,650,47,45), roi_back=(32,650,47,45), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_preset.png")
+	# 准备 
+	I_PREPARE_HIGHLIGHT = RuleImage(roi_front=(1128,536,100,100), roi_back=(1128,536,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_prepare_highlight.png")
+	# 战斗胜利 
+	I_WIN = RuleImage(roi_front=(427,135,100,100), roi_back=(427,135,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_win.png")
+	# 准备但是界面还未加载这个时候是黑色的 
+	I_PREPARE_DARK = RuleImage(roi_front=(1131,538,100,100), roi_back=(1131,538,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_prepare_dark.png")
+	# 失败 
+	I_FALSE = RuleImage(roi_front=(413,124,100,100), roi_back=(413,124,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_false.png")
+	# 确认预设的队伍 
+	I_PRESET_ENSURE = RuleImage(roi_front=(354,641,141,50), roi_back=(354,641,141,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_preset_ensure.png")
+	# 选择buff 
+	I_BUFF = RuleImage(roi_front=(113,653,44,62), roi_back=(113,653,44,62), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff.png")
+	# 觉醒加成 
+	I_BUFF_AWAKEN = RuleImage(roi_front=(373,126,383,53), roi_back=(373,126,383,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_awaken.png")
+	# 御魂加成 
+	I_BUFF_SOUL = RuleImage(roi_front=(377,192,371,56), roi_back=(377,192,371,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_soul.png")
+	# 金币加成50 
+	I_BUFF_GOLD_50 = RuleImage(roi_front=(375,259,373,56), roi_back=(375,259,373,56), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_gold_50.png")
+	# 金币加成100 
+	I_BUFF_GOLD_100 = RuleImage(roi_front=(371,329,389,54), roi_back=(371,329,389,54), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_gold_100.png")
+	# 经验加成50 
+	I_BUFF_EXP_50 = RuleImage(roi_front=(378,400,370,50), roi_back=(378,400,370,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_exp_50.png")
+	# 经验加成100 
+	I_BUFF_EXP_100 = RuleImage(roi_front=(372,463,386,50), roi_back=(372,463,386,50), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_buff_exp_100.png")
+	# 左下角的位置指针 
+	I_LOCAL = RuleImage(roi_front=(25,563,30,34), roi_back=(25,563,30,34), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_local.png")
+	# description 
+	I_STATISTICS = RuleImage(roi_front=(61,644,33,28), roi_back=(61,644,33,28), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_statistics.png")
+	# 左上角的退出 
+	I_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_exit.png")
+	# 退出确认 
+	I_EXIT_ENSURE = RuleImage(roi_front=(674,388,135,63), roi_back=(674,388,135,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/res_exit_ensure.png")
+
+
+	# Swipe Rule Assets
+	# description 
+	S_BATTLE_RANDOM_LEFT = RuleSwipe(roi_front=(122,155,480,426), roi_back=(667,147,461,427), mode="default", name="battle_random_left")
+	# description 
+	S_BATTLE_RANDOM_RIGHT = RuleSwipe(roi_front=(719,138,417,392), roi_back=(237,163,387,394), mode="default", name="battle_random_right")
+
+

+ 110 - 0
tasks/Component/GeneralBattle/click.json

@@ -0,0 +1,110 @@
+[
+    {
+        "itemName": "preset_team_1",
+        "roiFront": "196,234,464,114",
+        "roiBack": "196,234,464,114",
+        "description": "预设队伍1"
+    },
+    {
+        "itemName": "preset_team_2",
+        "roiFront": "197,358,465,103",
+        "roiBack": "197,358,465,103",
+        "description": "预设队伍2"
+    },
+    {
+        "itemName": "preset_team_3",
+        "roiFront": "195,480,462,100",
+        "roiBack": "195,480,462,100",
+        "description": "预设队伍3"
+    },
+    {
+        "itemName": "preset_team_4",
+        "roiFront": "193,596,464,35",
+        "roiBack": "193,596,464,35",
+        "description": "预设队伍4"
+    },
+    {
+        "itemName": "preset_group_1",
+        "roiFront": "28,238,134,56",
+        "roiBack": "28,238,134,56",
+        "description": "预设组1"
+    },
+    {
+        "itemName": "preset_group_2",
+        "roiFront": "31,298,132,60",
+        "roiBack": "31,298,132,60",
+        "description": "预设组2"
+    },
+    {
+        "itemName": "preset_group_3",
+        "roiFront": "31,362,135,59",
+        "roiBack": "31,362,135,59",
+        "description": "预设组3"
+    },
+    {
+        "itemName": "preset_group_4",
+        "roiFront": "29,427,133,57",
+        "roiBack": "29,427,133,57",
+        "description": "预设组4"
+    },
+    {
+        "itemName": "preset_group_5",
+        "roiFront": "31,489,133,60",
+        "roiBack": "31,489,133,60",
+        "description": "预设组5"
+    },
+    {
+        "itemName": "preset_group_6",
+        "roiFront": "31,549,132,63",
+        "roiBack": "31,549,132,63",
+        "description": "预设组6"
+    },
+    {
+        "itemName": "preset_group_7",
+        "roiFront": "29,615,137,63",
+        "roiBack": "29,615,137,63",
+        "description": "预设组7"
+    },
+    {
+        "itemName": "green_left_1",
+        "roiFront": "128,433,90,150",
+        "roiBack": "128,433,90,150",
+        "description": "从左开始第一个绿标"
+    },
+    {
+        "itemName": "green_left_2",
+        "roiFront": "371,385,81,145",
+        "roiBack": "371,385,81,145",
+        "description": "从左开始第二个绿标"
+    },
+    {
+        "itemName": "green_left_3",
+        "roiFront": "586,328,100,76",
+        "roiBack": "586,328,100,76",
+        "description": "从左开始第三个绿标"
+    },
+    {
+        "itemName": "green_left_4",
+        "roiFront": "817,379,77,133",
+        "roiBack": "817,379,77,133",
+        "description": "从左开始第四个绿标"
+    },
+    {
+        "itemName": "green_left_5",
+        "roiFront": "1059,416,85,145",
+        "roiBack": "1059,416,85,145",
+        "description": "从左开始第五个绿标"
+    },
+    {
+        "itemName": "green_main",
+        "roiFront": "590,454,88,178",
+        "roiBack": "590,454,88,178",
+        "description": "绿标阴阳师"
+    },
+    {
+        "itemName": "random_click",
+        "roiFront": "104,79,1050,507",
+        "roiBack": "255,65,100,100",
+        "description": "战斗的时候有一定的概率随机点击"
+    }
+]

+ 164 - 0
tasks/Component/GeneralBattle/image.json

@@ -0,0 +1,164 @@
+[
+  {
+    "itemName": "reward",
+    "imageName": "res_reward.png",
+    "roiFront": "547,518,172,96",
+    "roiBack": "547,518,172,96",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "奖励,就是那个魂"
+  },
+  {
+    "itemName": "preset",
+    "imageName": "res_preset.png",
+    "roiFront": "32,650,47,45",
+    "roiBack": "32,650,47,45",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "预设的小图标"
+  },
+  {
+    "itemName": "prepare_highlight",
+    "imageName": "res_prepare_highlight.png",
+    "roiFront": "1128,536,100,100",
+    "roiBack": "1128,536,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "准备"
+  },
+  {
+    "itemName": "win",
+    "imageName": "res_win.png",
+    "roiFront": "427,135,100,100",
+    "roiBack": "427,135,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗胜利"
+  },
+  {
+    "itemName": "prepare_dark",
+    "imageName": "res_prepare_dark.png",
+    "roiFront": "1131,538,100,100",
+    "roiBack": "1131,538,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "准备但是界面还未加载这个时候是黑色的"
+  },
+  {
+    "itemName": "false",
+    "imageName": "res_false.png",
+    "roiFront": "413,124,100,100",
+    "roiBack": "413,124,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "失败"
+  },
+  {
+    "itemName": "preset_ensure",
+    "imageName": "res_preset_ensure.png",
+    "roiFront": "354,641,141,50",
+    "roiBack": "354,641,141,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "确认预设的队伍"
+  },
+  {
+    "itemName": "buff",
+    "imageName": "res_buff.png",
+    "roiFront": "113,653,44,62",
+    "roiBack": "113,653,44,62",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "选择buff"
+  },
+  {
+    "itemName": "buff_awaken",
+    "imageName": "res_buff_awaken.png",
+    "roiFront": "373,126,383,53",
+    "roiBack": "373,126,383,53",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "觉醒加成"
+  },
+  {
+    "itemName": "buff_soul",
+    "imageName": "res_buff_soul.png",
+    "roiFront": "377,192,371,56",
+    "roiBack": "377,192,371,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "御魂加成"
+  },
+  {
+    "itemName": "buff_gold_50",
+    "imageName": "res_buff_gold_50.png",
+    "roiFront": "375,259,373,56",
+    "roiBack": "375,259,373,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "金币加成50"
+  },
+  {
+    "itemName": "buff_gold_100",
+    "imageName": "res_buff_gold_100.png",
+    "roiFront": "371,329,389,54",
+    "roiBack": "371,329,389,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "金币加成100"
+  },
+  {
+    "itemName": "buff_exp_50",
+    "imageName": "res_buff_exp_50.png",
+    "roiFront": "378,400,370,50",
+    "roiBack": "378,400,370,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "经验加成50"
+  },
+  {
+    "itemName": "buff_exp_100",
+    "imageName": "res_buff_exp_100.png",
+    "roiFront": "372,463,386,50",
+    "roiBack": "372,463,386,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "经验加成100"
+  },
+  {
+    "itemName": "local",
+    "imageName": "res_local.png",
+    "roiFront": "25,563,30,34",
+    "roiBack": "25,563,30,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左下角的位置指针"
+  },
+  {
+    "itemName": "statistics",
+    "imageName": "res_statistics.png",
+    "roiFront": "61,644,33,28",
+    "roiBack": "61,644,33,28",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "exit",
+    "imageName": "res_exit.png",
+    "roiFront": "14,12,43,41",
+    "roiBack": "14,12,43,41",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角的退出"
+  },
+  {
+    "itemName": "exit_ensure",
+    "imageName": "res_exit_ensure.png",
+    "roiFront": "674,388,135,63",
+    "roiBack": "674,388,135,63",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "退出确认"
+  }
+]

BIN
tasks/Component/GeneralBattle/res_buff.png


BIN
tasks/Component/GeneralBattle/res_buff_awaken.png


BIN
tasks/Component/GeneralBattle/res_buff_exp_100.png


BIN
tasks/Component/GeneralBattle/res_buff_exp_50.png


BIN
tasks/Component/GeneralBattle/res_buff_gold_100.png


BIN
tasks/Component/GeneralBattle/res_buff_gold_50.png


BIN
tasks/Component/GeneralBattle/res_buff_soul.png


BIN
tasks/Component/GeneralBattle/res_exit.png


BIN
tasks/Component/GeneralBattle/res_exit_ensure.png


BIN
tasks/Component/GeneralBattle/res_false.png


BIN
tasks/Component/GeneralBattle/res_local.png


BIN
tasks/Component/GeneralBattle/res_prepare_dark.png


BIN
tasks/Component/GeneralBattle/res_prepare_highlight.png


BIN
tasks/Component/GeneralBattle/res_preset.png


BIN
tasks/Component/GeneralBattle/res_preset_ensure.png


BIN
tasks/Component/GeneralBattle/res_reward.png


BIN
tasks/Component/GeneralBattle/res_statistics.png


BIN
tasks/Component/GeneralBattle/res_win.png


+ 16 - 0
tasks/Component/GeneralBattle/swipe.json

@@ -0,0 +1,16 @@
+[
+    {
+        "itemName": "battle_random_left",
+        "roiFront": "122,155,480,426",
+        "roiBack": "667,147,461,427",
+        "mode": "default",
+        "description": "description"
+    },
+    {
+        "itemName": "battle_random_right",
+        "roiFront": "719,138,417,392",
+        "roiBack": "237,163,387,394",
+        "mode": "default",
+        "description": "description"
+    }
+]

+ 1 - 0
tasks/DemonEncounter/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/EternitySea/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/ExperienceYoukai/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/FallenSun/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/GameUi/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/General/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/GeneralBattle/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/GlobalGame/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/GoldYoukai/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/Hunt/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/Nian/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 8 - 1
tasks/Orochi/assets.py

@@ -3,9 +3,16 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.
 class OrochiAssets: 
-	pass
+
+
+	# List Rule Assets
+	# 这个是御魂界面选择不同层数的 
+	L_N33AME = RuleList(folder="./tasks/Orochi/res", direction="vertical", mode="ocr", roi_back=(160,130,317,500), size=(301, 86), 
+					 array=["壹层", "贰层", "叁层", "肆层", "伍层", "陆层", "柒层", "捌层", "玖层", "拾层", "悲鸣", "神罚"])
+
 

+ 57 - 0
tasks/Orochi/res/list.json

@@ -0,0 +1,57 @@
+{
+  "name": "n33ame",
+  "direction": "vertical",
+  "type": "ocr",
+  "roiBack": "160,130,317,500",
+  "description": "这个是御魂界面选择不同层数的",
+  "list": [
+    {
+      "itemName": "壹层",
+      "roiFront": "169,142,303,86"
+    },
+    {
+      "itemName": "贰层",
+      "roiFront": "168,253,300,85"
+    },
+    {
+      "itemName": "叁层",
+      "roiFront": "165,422,306,93"
+    },
+    {
+      "itemName": "肆层",
+      "roiFront": "167,312,304,90"
+    },
+    {
+      "itemName": "伍层",
+      "roiFront": "168,425,299,82"
+    },
+    {
+      "itemName": "陆层",
+      "roiFront": "166,316,298,89"
+    },
+    {
+      "itemName": "柒层",
+      "roiFront": "171,312,298,93"
+    },
+    {
+      "itemName": "捌层",
+      "roiFront": "169,203,302,89"
+    },
+    {
+      "itemName": "玖层",
+      "roiFront": "167,206,302,81"
+    },
+    {
+      "itemName": "拾层",
+      "roiFront": "166,315,298,84"
+    },
+    {
+      "itemName": "悲鸣",
+      "roiFront": "167,427,305,85"
+    },
+    {
+      "itemName": "神罚",
+      "roiFront": "165,534,305,86"
+    }
+  ]
+}

+ 1 - 0
tasks/OrochiJudgement/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/OrochiMoans/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 5 - 0
tasks/RealmRaid/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.
@@ -40,6 +41,10 @@ class RealmRaidAssets:
 	I_SOUL_RAID = RuleImage(roi_front=(577,502,100,100), roi_back=(577,502,100,100), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_soul_raid.png")
 	# 刷新确认 
 	I_FRESH_ENSURE = RuleImage(roi_front=(672,403,173,59), roi_back=(672,403,173,59), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_fresh_ensure.png")
+	# 没有锁图片,适配呱太入侵 
+	I_UNLOCK_2 = RuleImage(roi_front=(1002,643,30,41), roi_back=(1002,643,30,41), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_unlock_2.png")
+	# 以锁图片,适配呱太 
+	I_LOCK_2 = RuleImage(roi_front=(1002,645,34,38), roi_back=(1002,645,34,38), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_lock_2.png")
 
 
 	# Ocr Rule Assets

+ 1 - 1
tasks/RealmRaid/config.py

@@ -4,7 +4,7 @@
 from pydantic import BaseModel, Field
 from enum import Enum
 
-from tasks.RealmRaid.config_scheduler import Scheduler
+from tasks.Utils.config_scheduler import Scheduler
 from tasks.GeneralBattle.config_general_battle import GeneralBattleConfig
 
 

+ 10 - 0
tasks/RealmRaid/config_scheduler.py

@@ -12,3 +12,13 @@ class Scheduler(BaseModel):
     interval_hours: int = Field(default=0, description='[间隔小时]:默认为0\n 可选0-23')
     interval_minutes: int = Field(default=0, description='[间隔分钟]:默认为0\n 可选0-59')
 
+    @validator('next_run', pre=True, always=True)
+    def parse_next_run(cls, value):
+        if isinstance(value, str):
+            print('parse_next_run')
+            try:
+                return datetime.fromisoformat(value)
+            except ValueError:
+                raise ValueError('Invalid next_run value. Expected format: YYYY-MM-DD HH:MM:SS')
+        return value
+

+ 18 - 0
tasks/RealmRaid/res/image.json

@@ -133,5 +133,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "刷新确认"
+  },
+  {
+    "itemName": "unlock_2",
+    "imageName": "res_unlock_2.png",
+    "roiFront": "1002,643,30,41",
+    "roiBack": "1002,643,30,41",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "没有锁图片,适配呱太入侵"
+  },
+  {
+    "itemName": "lock_2",
+    "imageName": "res_lock_2.png",
+    "roiFront": "1002,645,34,38",
+    "roiBack": "1002,645,34,38",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "以锁图片,适配呱太"
   }
 ]

BIN
tasks/RealmRaid/res/res_lock_2.png


BIN
tasks/RealmRaid/res/res_unlock_2.png


+ 8 - 0
tasks/RealmRaid/script_task.py

@@ -36,6 +36,10 @@ class ScriptTask(GeneralBattle, GameUi, RealmRaidAssets):
                 self.screenshot()
                 if self.appear_then_click(self.I_UNLOCK, interval=1):
                     continue
+                if self.appear_then_click(self.I_UNLOCK_2, interval=1):
+                    continue
+                if self.appear(self.I_LOCK_2, threshold=0.9):
+                    break
                 if self.appear(self.I_LOCK, threshold=0.9):
                     break
             logger.info(f'Click {self.I_UNLOCK.name}')
@@ -44,6 +48,10 @@ class ScriptTask(GeneralBattle, GameUi, RealmRaidAssets):
                 self.screenshot()
                 if self.appear_then_click(self.I_LOCK, interval=1):
                     continue
+                if self.appear_then_click(self.I_LOCK_2, interval=1):
+                    continue
+                if self.appear(self.I_UNLOCK_2, threshold=0.9):
+                    break
                 if self.appear(self.I_UNLOCK, threshold=0.9):
                     break
             logger.info(f'Click {self.I_LOCK.name}')

+ 1 - 0
tasks/Restart/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/Script/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 1 - 0
tasks/Sougenbi/assets.py

@@ -3,6 +3,7 @@ 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 module/dev_tools/assets_extract.py.
 # Don't modify it manually.

+ 12 - 0
tasks/Utils/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 module/dev_tools/assets_extract.py.
+# Don't modify it manually.
+class UtilsAssets: 
+	pass
+

+ 24 - 0
tasks/Utils/config_scheduler.py

@@ -0,0 +1,24 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from enum import Enum
+from datetime import datetime, timedelta
+from pydantic import BaseModel, ValidationError, validator, Field
+
+class Scheduler(BaseModel):
+    enable: bool = Field(default=False, description='[是否启用]:默认为False')
+    next_run: datetime = Field(default="2023-01-01 00:00:00", description='[下次执行时间]:默认为2023-01-01 00:00:00\n 清空后回车设置当前的时间')
+    interval_days: int = Field(default=1, description='[间隔天数]:默认为1\n 可选0-7')
+    interval_hours: int = Field(default=0, description='[间隔小时]:默认为0\n 可选0-23')
+    interval_minutes: int = Field(default=0, description='[间隔分钟]:默认为0\n 可选0-59')
+
+    @validator('next_run', pre=True, always=True)
+    def parse_next_run(cls, value):
+        if isinstance(value, str):
+            print('parse_next_run')
+            try:
+                return datetime.fromisoformat(value)
+            except ValueError:
+                raise ValueError('Invalid next_run value. Expected format: YYYY-MM-DD HH:MM:SS')
+        return value
+

+ 51 - 23
tasks/base_task.py

@@ -12,6 +12,7 @@ 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
 from module.ocr.base_ocr import OcrMode, OcrMethod
 from module.logger import logger
 from module.base.timer import Timer
@@ -29,7 +30,6 @@ class BaseTask:
 
     limit_time: datetime  # 限制运行的时间,是软时间,不是硬时间
 
-
     def __init__(self, config: Config, device: Device) -> None:
         self.config = config
         self.device = device
@@ -38,9 +38,6 @@ class BaseTask:
 
         self.start_time = datetime.now()  # 启动的时间
 
-
-
-
     def screenshot(self):
         """
         截图 引入中间函数的目的是 为了解决如协作的这类突发的事件
@@ -48,7 +45,7 @@ class BaseTask:
         """
         return self.device.screenshot()
 
-    def appear(self, target: RuleImage, interval: float =None, threshold: float =None):
+    def appear(self, target: RuleImage, interval: float = None, threshold: float = None):
         """
 
         :param target: 匹配的目标可以是RuleImage, 也可以是RuleOcr
@@ -77,10 +74,10 @@ class BaseTask:
 
     def appear_then_click(self,
                           target: RuleImage,
-                          action: Union[RuleClick, RuleLongClick]=None,
-                          interval: float=None,
-                          threshold: float=None,
-                          duration: float=None):
+                          action: Union[RuleClick, RuleLongClick] = None,
+                          interval: float = None,
+                          threshold: float = None,
+                          duration: float = None):
         """
         出现了就点击,默认点击图片的位置,如果添加了click参数,就点击click的位置
         :param duration: 如果是长按,可以手动指定duration,不指定默认.单位是ms!!!!
@@ -102,9 +99,9 @@ class BaseTask:
             x, y = action.coord()
             if isinstance(action, RuleLongClick):
                 if duration is None:
-                    self.device.long_click(x, y, duration=action.duration/1000, control_name=target.name)
+                    self.device.long_click(x, y, duration=action.duration / 1000, control_name=target.name)
                 else:
-                    self.device.long_click(x, y, duration=duration/1000, control_name=target.name)
+                    self.device.long_click(x, y, duration=duration / 1000, control_name=target.name)
             elif isinstance(action, RuleClick):
                 self.device.click(x, y, control_name=target.name)
 
@@ -129,7 +126,7 @@ class BaseTask:
 
     def wait_until_appear_then_click(self,
                                      target: RuleImage,
-                                     action: Union[RuleClick, RuleLongClick]=None) -> None:
+                                     action: Union[RuleClick, RuleLongClick] = None) -> None:
         """
         等待直到出现目标,然后点击
         :param action:
@@ -140,7 +137,7 @@ class BaseTask:
         if action is None:
             self.device.click(target.coord(), control_name=target.name)
         elif isinstance(action, RuleLongClick):
-            self.device.long_click(target.coord(), duration=action.duration/1000, control_name=target.name)
+            self.device.long_click(target.coord(), duration=action.duration / 1000, control_name=target.name)
         elif isinstance(action, RuleClick):
             self.device.click(target.coord(), control_name=target.name)
 
@@ -186,7 +183,7 @@ class BaseTask:
                 logger.warning(f'wait_until_stable({target}) timeout')
                 break
 
-    def swipe(self, swipe: RuleSwipe, interval: float =None) -> None:
+    def swipe(self, swipe: RuleSwipe, interval: float = None) -> None:
         """
 
         :param interval:
@@ -216,7 +213,7 @@ class BaseTask:
             # logger.info(f'Swipe {swipe.name}')
             self.interval_timer[swipe.name].reset()
 
-    def click(self, click: Union[RuleClick, RuleLongClick]=None, interval: float =None) -> None:
+    def click(self, click: Union[RuleClick, RuleLongClick] = None, interval: float = None) -> None:
         """
         点击或者长按
         :param interval:
@@ -240,7 +237,7 @@ class BaseTask:
 
         x, y = click.coord()
         if isinstance(click, RuleLongClick):
-            self.device.long_click(x=x, y=y, duration=click.duration/1000, control_name=click.name)
+            self.device.long_click(x=x, y=y, duration=click.duration / 1000, control_name=click.name)
         elif isinstance(click, RuleClick):
             self.device.click(x=x, y=y, control_name=click.name)
 
@@ -248,7 +245,7 @@ class BaseTask:
         if interval:
             self.interval_timer[click.name].reset()
 
-    def ocr_appear(self, target: RuleOcr, interval: float=None) -> bool:
+    def ocr_appear(self, target: RuleOcr, interval: float = None) -> bool:
         """
         ocr识别目标
         :param interval:
@@ -274,7 +271,6 @@ class BaseTask:
         result = target.ocr(self.device.image)
         appear = False
 
-
         if not target.keyword or target.keyword == '':
             appear = False
         match target.mode:
@@ -296,8 +292,8 @@ class BaseTask:
 
     def ocr_appear_click(self,
                          target: RuleOcr,
-                         action: Union[RuleClick, RuleLongClick]=None,
-                         interval: float=None,
+                         action: Union[RuleClick, RuleLongClick] = None,
+                         interval: float = None,
                          duration: float = None) -> bool:
         """
         ocr识别目标,如果目标存在,则触发动作
@@ -319,8 +315,41 @@ class BaseTask:
             x, y = target.coord()
             self.device.click(x=x, y=y, control_name=target.name)
 
+    def list_find(self, target: RuleList, name: str | list[str]) -> bool:
+        """
+        会一致在列表寻找目标,找到了就退出。
+        如果是图片列表会一直往下找
+        如果是纯文字的,会自动识别自己的位置,根据位置选择向前还是向后翻
+        :param target:
+        :param name:
+        :return:
+        """
+        if target.is_image:
+            while True:
+                self.screenshot()
+                result = target.image_appear(self.device.image, name=name)
+                if result is not None:
+                    return result
+                x1, y1, x2, y2 = target.swipe_pos()
+                self.device.swipe(p1=(x1, y1), p2=(x2, y2))
+
+        elif target.is_ocr:
+            while True:
+                self.screenshot()
+                result = target.ocr_appear(self.device.image, name=name)
+                if isinstance(result, tuple):
+                    return result
+
+                after = True
+                if isinstance(result, int) and result > 0:
+                    after = True
+                elif isinstance(result, int) and result < 0:
+                    after = False
+
+                x1, y1, x2, y2 = target.swipe_pos(after=after)
+                self.device.swipe(p1=(x1, y1), p2=(x2, y2))
 
-    def set_next_run(self, task: str, finish: bool=False) -> None:
+    def set_next_run(self, task: str, finish: bool = False) -> None:
         """
         设置下次运行时间  当然这个也是可以重写的
         :param task: 任务名称,大驼峰的
@@ -339,9 +368,8 @@ class BaseTask:
             start_time = self.start_time
         delta = timedelta(days=task_object.scheduler.interval_days,
                           hours=task_object.scheduler.interval_hours,
-                          minutes=task_object.scheduler.interval_minutes,)
+                          minutes=task_object.scheduler.interval_minutes, )
         next_run = start_time + delta
 
         task_object.scheduler.next_run = next_run
         self.config.save()
-