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

Merge branch 'runhey:dev' into dev

TripleEarth 3 лет назад
Родитель
Сommit
070edc5c7d
64 измененных файлов с 814 добавлено и 160 удалено
  1. 2 0
      dev_tools/README.md
  2. BIN
      dev_tools/Spyxx/spyxx.exe
  3. BIN
      dev_tools/Spyxx/spyxx_amd64.exe
  4. BIN
      dev_tools/Spyxx/spyxxhk.dll
  5. BIN
      dev_tools/Spyxx/spyxxhk_amd64.dll
  6. 0 11
      dev_tools/ViewWizard2/Settings.ini
  7. 0 100
      dev_tools/ViewWizard3/Help.txt
  8. 0 35
      dev_tools/ViewWizard3/Set.ini
  9. BIN
      dev_tools/ViewWizard3/VB6CHS.DLL
  10. BIN
      dev_tools/ViewWizard3/ViewWizard.exe
  11. BIN
      dev_tools/ViewWizard3/mscomctl.ocx
  12. BIN
      dev_tools/ViewWizard3/msvbvm60.dll
  13. 1 1
      dev_tools/assets_extract.py
  14. 1 1
      module/device/method/window.py
  15. 2 1
      requirements-in.txt
  16. 2 3
      requirements.txt
  17. 3 2
      tasks/Component/GeneralBattle/general_battle.py
  18. 2 0
      tasks/Component/ReplaceShikigami/assets.py
  19. 92 0
      tasks/Component/ReplaceShikigami/replace_shikigami.py
  20. 9 0
      tasks/Component/ReplaceShikigami/rs/image.json
  21. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_level_max.png
  22. 87 1
      tasks/KekkaiUtilize/assets.py
  23. 14 2
      tasks/KekkaiUtilize/config.py
  24. 65 0
      tasks/KekkaiUtilize/ku/image.json
  25. BIN
      tasks/KekkaiUtilize/ku/ku_guild_ap.png
  26. BIN
      tasks/KekkaiUtilize/ku/ku_guild_assets.png
  27. BIN
      tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png
  28. BIN
      tasks/KekkaiUtilize/ku/ku_guild_info.png
  29. BIN
      tasks/KekkaiUtilize/ku/ku_guild_realm.png
  30. BIN
      tasks/KekkaiUtilize/ku/ku_guild_shirne.png
  31. BIN
      tasks/KekkaiUtilize/ku/ku_guild_wish.png
  32. 92 0
      tasks/KekkaiUtilize/realm/image.json
  33. BIN
      tasks/KekkaiUtilize/realm/realm_ap_extract.png
  34. BIN
      tasks/KekkaiUtilize/realm/realm_box_ap.png
  35. BIN
      tasks/KekkaiUtilize/realm/realm_box_exp.png
  36. BIN
      tasks/KekkaiUtilize/realm/realm_card_exp.png
  37. BIN
      tasks/KekkaiUtilize/realm/realm_exp_extract.png
  38. BIN
      tasks/KekkaiUtilize/realm/realm_realm_shin.png
  39. BIN
      tasks/KekkaiUtilize/realm/realm_shi_card.png
  40. BIN
      tasks/KekkaiUtilize/realm/realm_shi_defense.png
  41. BIN
      tasks/KekkaiUtilize/realm/realm_shi_grown.png
  42. BIN
      tasks/KekkaiUtilize/realm/realm_utilize_exp.png
  43. 235 2
      tasks/KekkaiUtilize/script_task.py
  44. 173 0
      tasks/KekkaiUtilize/utilize/image.json
  45. 11 0
      tasks/KekkaiUtilize/utilize/ocr.json
  46. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_add_1.png
  47. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_add_2.png
  48. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_big_3.png
  49. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_big_4.png
  50. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_big_5.png
  51. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_big_6.png
  52. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_confirm_small.png
  53. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_enter_realm.png
  54. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_fish_3.png
  55. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_fish_4.png
  56. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_fish_5.png
  57. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_fish_6.png
  58. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_3.png
  59. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_4.png
  60. BIN
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_5.png
  61. BIN
      tasks/KekkaiUtilize/utilize/utilize_utilize_add.png
  62. BIN
      tasks/KekkaiUtilize/utilize/utilize_utilize_friend_group.png
  63. BIN
      tasks/KekkaiUtilize/utilize/utilize_utilize_zones_group.png
  64. 23 1
      tasks/base_task.py

+ 2 - 0
dev_tools/README.md

@@ -1,5 +1,7 @@
 ### 这三个都是窗口的管理工具
 
+塞进仓库并不是一个很好的选择,现已移出,已链接形式提供,请查阅文档[**模拟器支持**](https://runhey.github.io/OnmyojiAutoScript-website/docs/user-manual/emulator-support)
+
 - Spyxx (微软自家的)
 - ViewWizard2(简易版本)
 - ViewWizard3

BIN
dev_tools/Spyxx/spyxx.exe


BIN
dev_tools/Spyxx/spyxx_amd64.exe


BIN
dev_tools/Spyxx/spyxxhk.dll


BIN
dev_tools/Spyxx/spyxxhk_amd64.dll


+ 0 - 11
dev_tools/ViewWizard2/Settings.ini

@@ -1,11 +0,0 @@
-[Settings]
-NormalSize=1
-AlwaysOnTop=1
-EnableWin=0
-ShowHideWin=0
-OpenSound=1
-NotFindHideWin=1
-AutoFindWin=0
-OpenHideMode=0
-OnTopDraw=1
-DrawType=1

+ 0 - 100
dev_tools/ViewWizard3/Help.txt

@@ -1,100 +0,0 @@
-				ViewWizard 3.5
-
-句柄精灵是一个窗口辅助工具,用于获得窗口各种信息和属性。其中包括窗口类,大小,样式,状态,字体等相关内容。此外,它可以控制一个窗口的状态,比如显示或隐藏,置顶,透明,更改样式等等。
-
-具体介绍:
-
-窗口样式编辑器:用于修改窗口样式和扩展样式。
-窗口创建监视器:监视顶层窗口的创建和销毁。
-系统窗口列表:查看系统所有窗口,其中包括不可见的Message窗口以及内核挂钩的隐藏窗口。
-自动显示隐藏控件:选择该项后,当前活动窗口中的隐藏的控件(子窗口)会全部显示出来。
-自动激活无效控件:选择该项后,当前活动窗口中的无效的控件(呈灰色)会变为有效。
-取色器:功能强大的屏幕取色器。
-屏幕抓图工具:可抓取桌面、窗口和区域图像。
-
-软件设置:
-
-搜索隐藏窗口:搜索隐藏的控件,不包括顶层窗口。
-搜索透明窗口:搜索穿透的窗口,这种窗口不接受鼠标点击。
-搜索挂起窗口:搜索被挂起线程的窗口,容易死锁,除非特殊情况,否则不要选择。
-暴力搜索窗口:强制遍历系统所有窗口
-透视搜索窗口:搜索前先把自己设为穿透,以便能够看到下面的窗口。
-Shift键搜索:按下Shift键自动捕获窗口。
-搜索模式:精确搜索将搜索最内层的可见的子窗口,标准Z序搜索将搜索最上层的窗口。
-
-其它选项:
-
-鼠标链接:关系一栏所列出的相关窗口以及文件路径栏,单击以便快速捕获窗口或定位文件。
-附加栏:列出基本控件的专项信息。
-窗口文本查看功能:该项会列出窗口的标题或控件的文字内容,对于特殊类型的窗口,比如ListView,则会列出它的列表项数据。
-窗口菜单查看功能:列出窗口包含的菜单内容。
-*内容:代表该项不可用或者获取失败。
-终极模式:拖动搜索屏幕上能看到的所有窗口
-
-3.5
-增加定位
-增加搜索挂起窗口
-增加暴力搜索窗口及暴力模式
-密码框判断不对
-加强总在最前问题
-通过数值编辑窗口样式
-
-3.4.8
-总在最前后不再被Win+D最小化
-
-3.4.6
-加强总在最前时右键菜单无法弹出
-
-3.4.5
-增加设置还原密码框字符
-增加加强总在最前
-密码掩码有时获取不对
-
-3.4:
-窗口列表图标换掉
-增加进程部分信息
-增加设置窗口视界
-修正系统窗口列表功能
-增加窗口最大化坐标/最小最大尺寸
-增加窗口透明度显示
-修正设置窗口透明/穿透功能
-光标和画刷描述
-
-3.3:
-增加ListView修改器,可编辑任意ListView控件内容
-增加部分热键
-样式窗口选定项高亮显示
-
-3.2:
-增加查看进程窗口功能
-win8以上无法获取消息窗口问题
-菜单布局等
-其它问题
-
-3.1.1:
-控件显示状态不正确问题,不再随父窗口的状态而改变
-
-3.1更新:
-1.增加窗口坐标功能
-2.修复窗口坐标显示不准确问题
-3.修复编辑窗口坐标窗口
-4.增加智能调整窗口大小
-5.增加直接复制句柄
-6.非标准类不能保存问题
-
-
-	yuanfang235
-
-E-mail:369823808@qq.com
-
-博客:http://zzmzzff.blog.163.com
-
-官网:http://www.yuanfang235.icoc.cc/
-
-
-	2014年3月
-
-
-
-
-

+ 0 - 35
dev_tools/ViewWizard3/Set.ini

@@ -1,35 +0,0 @@
-[Set]
-AlwaysOnTop=1
-ForceOnTop=0
-SearchHidden=0
-SearchThrough=0
-SearchSuspended=0
-ForceSearch=0
-ThroughSearch=0
-ShowIcons=1
-Sound=1
-WarnDestroy=1
-WinBKGround=0
-KeyMode=0
-SearchAll=0
-SearchType=0
-PaintType=0
-OnTopPaint=1
-AutoUpdate=0
-AttrMask=8191
-ClickGet=0
-[Font]
-FontName=ËÎÌå
-FontSize=9
-FontBold=400
-FontItalic=0
-FontCharset=0
-[Window]
-Maximized=0
-Width=14595
-Height=8685
-Left=2580
-Top=1890
-[Column]
-Col0=2000
-Col1=10110

BIN
dev_tools/ViewWizard3/VB6CHS.DLL


BIN
dev_tools/ViewWizard3/ViewWizard.exe


BIN
dev_tools/ViewWizard3/mscomctl.ocx


BIN
dev_tools/ViewWizard3/msvbvm60.dll


+ 1 - 1
dev_tools/assets_extract.py

@@ -20,7 +20,7 @@ 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.
+# This file was automatically generated by ./dev_tools/assets_extract.py.
 # Don't modify it manually.
 """
 IMPORT_EXP = IMPORT_EXP.strip().split('MODULE_FOLDER') + ['']

+ 1 - 1
module/device/method/window.py

@@ -225,7 +225,7 @@ class Window(Handle):
             handleNum = self.control_handle_list[1]
         elif emulator_type > 2:  # 夜神模拟器
             handleNum = self.control_handle_list[3]
-        PostMessage(handleNum, WM_ACTIVATE, WA_ACTIVE, 0)  # 激活窗口
+        # PostMessage(handleNum, WM_ACTIVATE, WA_ACTIVE, 0)  # 激活窗口
         # 先移动到第一个点
         tmpPos = MAKELONG(trace[0][0], trace[0][1])
         SendMessage(handleNum, WM_NCHITTEST, 0, tmpPos)

+ 2 - 1
requirements-in.txt

@@ -15,4 +15,5 @@ wrapt==1.15.0
 pydantic==1.10.7
 inflection==0.5.1
 tqdm==4.65.0
-ppocr-onnx==0.0.3.9
+ppocr-onnx==0.0.3.9
+onepush==1.2.0

+ 2 - 3
requirements.txt

@@ -4,8 +4,6 @@
 #
 #    pip-compile --annotation-style=line --output-file=requirements.txt requirements-in.txt
 #
---index-url https://pypi.tuna.tsinghua.edu.cn/simple
---trusted-host pypi.tuna.tsinghua.edu.cn
 
 adbutils==0.11.0          # via -r requirements-in.txt, uiautomator2
 anytree==2.8.0            # via -r requirements-in.txt
@@ -35,6 +33,7 @@ mdurl==0.1.2              # via markdown-it-py
 mpmath==1.3.0             # via sympy
 msgpack==1.0.5            # via zerorpc
 numpy==1.24.3             # via -r requirements-in.txt, onnxruntime, opencv-python, ppocr-onnx, shapely
+onepush==1.2.0            # via -r requirements-in.txt
 onnxruntime==1.15.0       # via ppocr-onnx
 opencv-python==4.7.0.72   # via -r requirements-in.txt, ppocr-onnx
 packaging==20.9           # via deprecation, onnxruntime, uiautomator2
@@ -56,7 +55,7 @@ pyside6-essentials==6.4.3  # via pyside6, pyside6-addons
 pywin32==306              # via -r requirements-in.txt
 pyyaml==6.0               # via -r requirements-in.txt
 pyzmq==25.0.2             # via zerorpc
-requests==2.30.0          # via adbutils, ppocr-onnx, uiautomator2
+requests==2.30.0          # via adbutils, onepush, ppocr-onnx, uiautomator2
 retry==0.9.2              # via adbutils, uiautomator2
 rich==13.3.5              # via -r requirements-in.txt
 shapely==2.0.1            # via ppocr-onnx

+ 3 - 2
tasks/Component/GeneralBattle/general_battle.py

@@ -266,10 +266,11 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
         # 点击预设按钮
         while 1:
             self.screenshot()
-            if self.appear_then_click(self.I_PRESET, threshold=0.8):
-                continue
+
             if self.appear(self.I_PRESET_ENSURE):
                 break
+            if self.appear_then_click(self.I_PRESET, threshold=0.8, interval=1):
+                continue
         logger.info("Click preset button")
 
         # 选择预设组

+ 2 - 0
tasks/Component/ReplaceShikigami/assets.py

@@ -60,5 +60,7 @@ class ReplaceShikigamiAssets:
 	I_RS_SP_SELECTED = RuleImage(roi_front=(31,622,62,59), roi_back=(31,622,62,59), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_sp_selected.png")
 	# description 
 	I_RS_RECORDS_SHIKI = RuleImage(roi_front=(1148,548,49,43), roi_back=(1148,548,49,43), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_records_shiki.png")
+	# 检测到已经满级了 
+	I_RS_LEVEL_MAX = RuleImage(roi_front=(487,248,23,21), roi_back=(52,238,1118,37), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_level_max.png")
 
 

+ 92 - 0
tasks/Component/ReplaceShikigami/replace_shikigami.py

@@ -1,3 +1,95 @@
 # 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
+
+from tasks.base_task import BaseTask
+from tasks.Utils.config_enum import ShikigamiClass
+from tasks.Component.ReplaceShikigami.assets import ReplaceShikigamiAssets
+
+
+class ReplaceShikigami(BaseTask, ReplaceShikigamiAssets):
+
+
+    def in_shikigami_growth(self, screenshot=False) -> bool:
+        # 判定是否在式神育成界面
+        # 判定的依据是是否出现了 式神录 这个图片
+        if screenshot:
+            self.screenshot()
+        return self.appear(self.I_RS_RECORDS_SHIKI, interval=0.5)
+
+    def switch_shikigami_class(self, shikigami_class: ShikigamiClass = ShikigamiClass.N):
+        """
+        要求在式神育成的界面
+        切换分类
+        :param shikigami_class:
+        :param shikigami_order:
+        :return:
+        """
+        match_selected = {ShikigamiClass.MATERIAL: self.I_RS_MATERIAL_SELECTED,
+                          ShikigamiClass.N: self.I_RS_N_SELECTED,
+                          ShikigamiClass.R: self.I_RS_R_SELECTED,
+                          ShikigamiClass.SR: self.I_RS_SR_SELECTED,
+                          ShikigamiClass.SSR: self.I_RS_SSR_SELECTED,
+                          ShikigamiClass.SP: self.I_RS_SP_SELECTED}
+        match_click = {ShikigamiClass.MATERIAL: self.I_RS_MATERIAL,
+                       ShikigamiClass.N: self.I_RS_N,
+                       ShikigamiClass.R: self.I_RS_R,
+                       ShikigamiClass.SR: self.I_RS_SR,
+                       ShikigamiClass.SSR: self.I_RS_SSR,
+                       ShikigamiClass.SP: self.I_RS_SP}
+        check_selected = match_selected[shikigami_class]
+        check_click = match_click[shikigami_class]
+        # 选择式神的种类
+        while 1:
+            self.screenshot()
+
+            if self.appear(check_selected):
+                break
+            if self.appear_then_click(check_click, interval=0.5):
+                continue
+            if self.click(self.C_SHIKIGAMI_SWITCH_1, interval=3):
+                continue
+        logger.info('Select shikigami class: %s' % shikigami_class)
+
+    def unset_shikigami_max_lv(self):
+        """
+        要求在式神育成的界面
+        拉下满级的式神,留空位置
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_RS_LEVEL_MAX):
+                break
+            else:
+                self.appear_then_click(self.I_RS_LEVEL_MAX, interval=0.5)
+        logger.info('Unset all shikigami max lv')
+
+    def set_shikigami(self, shikigami_order: int = 7, stop_image: RuleImage = None):
+        """
+        要求在式神育成的界面
+        选择式神 1-7
+        :param stop_image:  结束的图片,如果不出现就结束
+        :param shikigami_order:
+        :return:
+        """
+        # 选择式神
+        click_match = {1: self.C_SHIKIGAMI_LEFT_1,
+                       2: self.C_SHIKIGAMI_LEFT_2,
+                       3: self.C_SHIKIGAMI_LEFT_3,
+                       4: self.C_SHIKIGAMI_LEFT_4,
+                       5: self.C_SHIKIGAMI_LEFT_5,
+                       6: self.C_SHIKIGAMI_LEFT_6,
+                       7: self.C_SHIKIGAMI_LEFT_7}
+        click_match = click_match[shikigami_order]
+        while 1:
+            self.screenshot()
+
+            if not self.appear(stop_image):
+                break
+            if self.click(click_match, interval=1.5):
+                continue
+        logger.info('Set shikigami: %d' % shikigami_order)

+ 9 - 0
tasks/Component/ReplaceShikigami/rs/image.json

@@ -124,5 +124,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "rs_level_max",
+    "imageName": "rs_rs_level_max.png",
+    "roiFront": "487,248,23,21",
+    "roiBack": "52,238,1118,37",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "检测到已经满级了"
   }
 ]

BIN
tasks/Component/ReplaceShikigami/rs/rs_rs_level_max.png


+ 87 - 1
tasks/KekkaiUtilize/assets.py

@@ -8,5 +8,91 @@ from module.atom.list import RuleList
 # This file was automatically generated by module/dev_tools/assets_extract.py.
 # Don't modify it manually.
 class KekkaiUtilizeAssets: 
-	pass
+
+
+	# Image Rule Assets
+	# 寮信息 
+	I_GUILD_INFO = RuleImage(roi_front=(1157,599,97,91), roi_back=(1157,599,97,91), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_info.png")
+	# 寮结界 
+	I_GUILD_REALM = RuleImage(roi_front=(1065,620,67,61), roi_back=(1065,620,67,61), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_realm.png")
+	# 祈愿 
+	I_GUILD_WISH = RuleImage(roi_front=(965,622,60,63), roi_back=(965,622,60,63), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_wish.png")
+	# 神灶 
+	I_GUILD_SHIRNE = RuleImage(roi_front=(872,624,60,62), roi_back=(872,624,60,62), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_shirne.png")
+	# description 
+	I_GUILD_AP = RuleImage(roi_front=(483,314,22,22), roi_back=(297,232,229,132), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_ap.png")
+	# description 
+	I_GUILD_ASSETS = RuleImage(roi_front=(315,311,23,28), roi_back=(304,301,50,50), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_assets.png")
+	# 领取寮资金 
+	I_GUILD_ASSETS_RECEIVE = RuleImage(roi_front=(565,426,144,63), roi_back=(565,426,144,63), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png")
+
+
+	# Image Rule Assets
+	# 育成 
+	I_SHI_GROWN = RuleImage(roi_front=(595,291,35,38), roi_back=(540,264,155,167), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_grown.png")
+	# 结界卡 
+	I_SHI_CARD = RuleImage(roi_front=(886,290,44,56), roi_back=(806,271,183,128), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_card.png")
+	# description 
+	I_SHI_DEFENSE = RuleImage(roi_front=(294,298,49,56), roi_back=(255,262,131,146), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_defense.png")
+	# 收取经验(没有满的图) 
+	I_CARD_EXP = RuleImage(roi_front=(889,151,57,54), roi_back=(863,118,124,121), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_card_exp.png")
+	# 收取体力(没有满) 
+	I_BOX_AP = RuleImage(roi_front=(815,435,57,51), roi_back=(778,411,130,100), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_box_ap.png")
+	# 收取盒子的经验(没有满) 
+	I_BOX_EXP = RuleImage(roi_front=(894,433,50,55), roi_back=(866,407,100,100), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_box_exp.png")
+	# 结界皮肤 
+	I_REALM_SHIN = RuleImage(roi_front=(175,460,54,58), roi_back=(147,443,100,100), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_realm_shin.png")
+	# 寄养别人的经验 
+	I_UTILIZE_EXP = RuleImage(roi_front=(583,144,58,43), roi_back=(531,112,156,123), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_utilize_exp.png")
+	# 取出 
+	I_AP_EXTRACT = RuleImage(roi_front=(592,501,100,75), roi_back=(592,501,100,75), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_ap_extract.png")
+	# 提取 
+	I_EXP_EXTRACT = RuleImage(roi_front=(592,448,100,73), roi_back=(592,448,100,73), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_exp_extract.png")
+
+
+	# Image Rule Assets
+	# 右上角的放置好友寄养 
+	I_UTILIZE_ADD = RuleImage(roi_front=(1149,54,74,67), roi_back=(1149,54,74,67), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_utilize_add.png")
+	# 好友这组 
+	I_UTILIZE_FRIEND_GROUP = RuleImage(roi_front=(216,92,109,70), roi_back=(216,92,109,70), threshold=0.9, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_utilize_friend_group.png")
+	# 跨区 
+	I_UTILIZE_ZONES_GROUP = RuleImage(roi_front=(337,92,109,66), roi_back=(337,92,109,66), threshold=0.9, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_utilize_zones_group.png")
+	# description 
+	I_U_TAIKO_3 = RuleImage(roi_front=(548,424,47,44), roi_back=(541,183,75,398), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_taiko_3.png")
+	# description 
+	I_U_TAIKO_4 = RuleImage(roi_front=(543,316,60,43), roi_back=(541,171,73,438), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_taiko_4.png")
+	# description 
+	I_U_TAIKO_5 = RuleImage(roi_front=(544,201,59,52), roi_back=(538,179,79,426), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_taiko_5.png")
+	# description 
+	I_U_TAIKO_6 = RuleImage(roi_front=(0,0,100,100), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_taiko_6.png")
+	# description 
+	I_U_FISH_3 = RuleImage(roi_front=(551,325,41,33), roi_back=(543,178,69,412), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_fish_3.png")
+	# description 
+	I_U_FISH_4 = RuleImage(roi_front=(549,310,51,50), roi_back=(542,177,73,401), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_fish_4.png")
+	# description 
+	I_U_FISH_5 = RuleImage(roi_front=(552,529,45,41), roi_back=(541,183,71,403), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_fish_5.png")
+	# description 
+	I_U_FISH_6 = RuleImage(roi_front=(544,201,59,52), roi_back=(530,184,82,416), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_fish_6.png")
+	# 进入结界 
+	I_U_ENTER_REALM = RuleImage(roi_front=(792,531,178,67), roi_back=(792,531,178,67), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_enter_realm.png")
+	# 右侧大的图片 
+	I_U_BIG_3 = RuleImage(roi_front=(835,321,100,25), roi_back=(835,321,100,25), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_big_3.png")
+	# description 
+	I_U_BIG_4 = RuleImage(roi_front=(836,322,100,25), roi_back=(836,322,100,25), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_big_4.png")
+	# description 
+	I_U_BIG_5 = RuleImage(roi_front=(834,320,100,26), roi_back=(834,320,100,26), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_big_5.png")
+	# description 
+	I_U_BIG_6 = RuleImage(roi_front=(833,320,100,27), roi_back=(833,320,100,27), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_big_6.png")
+	# 右上,右数第一个 
+	I_U_ADD_1 = RuleImage(roi_front=(1144,59,86,69), roi_back=(1144,59,86,69), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_add_1.png")
+	# 右上,右数第二个 
+	I_U_ADD_2 = RuleImage(roi_front=(979,52,76,69), roi_back=(979,52,76,69), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_add_2.png")
+	# description 
+	I_U_CONFIRM_SMALL = RuleImage(roi_front=(672,513,131,60), roi_back=(672,513,131,60), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/utilize/utilize_u_confirm_small.png")
+
+
+	# Ocr Rule Assets
+	# 这个寄养的剩余时间 
+	O_UTILIZE_RES_TIME = RuleOcr(roi=(1140,117,100,30), area=(1140,117,100,30), mode="Duration", method="Default", keyword="", name="utilize_res_time")
+
 

+ 14 - 2
tasks/KekkaiUtilize/config.py

@@ -9,14 +9,26 @@ from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, TimeDelta
 from tasks.Utils.config_enum import ShikigamiClass
 
+class SelectFriendList(str, Enum):
+    SAME_SERVER = 'same_server'
+    DIFFERENT_SERVER = 'different_server'
+
+class UtilizeRule(str, Enum):
+    DEFAULT = 'default'  # 默认就好
+    TAIKO = 'kaiko'  # 太鼓优先
+    FISH = 'fish'  # 斗鱼优先
+    AUTO = 'auto'  # 自动 兼容代码罢了
+
+
+
 class UtilizeScheduler(Scheduler):
     priority = Field(default=2, description='priority_help')
     success_interval: TimeDelta = Field(default=TimeDelta(hours=6), description='success_interval_help')
     failure_interval: TimeDelta = Field(default=TimeDelta(hours=6), description='failure_interval_help')
 
 class UtilizeConfig(BaseModel):
-    utilize_rule: str = Field(default='auto', description='utilize_rule_help')
-    auto_switch_sort: bool = Field(default=True, description='auto_switch_sort_help')
+    utilize_rule: UtilizeRule = Field(default=UtilizeRule.DEFAULT, description='utilize_rule_help')
+    select_friend_list: SelectFriendList = Field(default=SelectFriendList.SAME_SERVER, description='select_friend_list_help')
     shikigami_class: ShikigamiClass = Field(default=ShikigamiClass.N, description='shikigami_class_help')
     shikigami_order: int = Field(default=4, description='shikigami_order_help')
     guild_ap_enable: bool = Field(default=True, description='guild_ap_enable_help')

+ 65 - 0
tasks/KekkaiUtilize/ku/image.json

@@ -0,0 +1,65 @@
+[
+  {
+    "itemName": "guild_info",
+    "imageName": "ku_guild_info.png",
+    "roiFront": "1157,599,97,91",
+    "roiBack": "1157,599,97,91",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮信息"
+  },
+  {
+    "itemName": "guild_realm",
+    "imageName": "ku_guild_realm.png",
+    "roiFront": "1065,620,67,61",
+    "roiBack": "1065,620,67,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮结界"
+  },
+  {
+    "itemName": "guild_wish",
+    "imageName": "ku_guild_wish.png",
+    "roiFront": "965,622,60,63",
+    "roiBack": "965,622,60,63",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "祈愿"
+  },
+  {
+    "itemName": "guild_shirne",
+    "imageName": "ku_guild_shirne.png",
+    "roiFront": "872,624,60,62",
+    "roiBack": "872,624,60,62",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "神灶"
+  },
+  {
+    "itemName": "guild_ap",
+    "imageName": "ku_guild_ap.png",
+    "roiFront": "483,314,22,22",
+    "roiBack": "297,232,229,132",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "guild_assets",
+    "imageName": "ku_guild_assets.png",
+    "roiFront": "315,311,23,28",
+    "roiBack": "304,301,50,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "guild_assets_receive",
+    "imageName": "ku_guild_assets_receive.png",
+    "roiFront": "565,426,144,63",
+    "roiBack": "565,426,144,63",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "领取寮资金"
+  }
+]

BIN
tasks/KekkaiUtilize/ku/ku_guild_ap.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_assets.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_info.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_realm.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_shirne.png


BIN
tasks/KekkaiUtilize/ku/ku_guild_wish.png


+ 92 - 0
tasks/KekkaiUtilize/realm/image.json

@@ -0,0 +1,92 @@
+[
+  {
+    "itemName": "shi_grown",
+    "imageName": "realm_shi_grown.png",
+    "roiFront": "595,291,35,38",
+    "roiBack": "540,264,155,167",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "育成"
+  },
+  {
+    "itemName": "shi_card",
+    "imageName": "realm_shi_card.png",
+    "roiFront": "886,290,44,56",
+    "roiBack": "806,271,183,128",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结界卡"
+  },
+  {
+    "itemName": "shi_defense",
+    "imageName": "realm_shi_defense.png",
+    "roiFront": "294,298,49,56",
+    "roiBack": "255,262,131,146",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "card_exp",
+    "imageName": "realm_card_exp.png",
+    "roiFront": "889,151,57,54",
+    "roiBack": "863,118,124,121",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "收取经验(没有满的图)"
+  },
+  {
+    "itemName": "box_ap",
+    "imageName": "realm_box_ap.png",
+    "roiFront": "815,435,57,51",
+    "roiBack": "778,411,130,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "收取体力(没有满)"
+  },
+  {
+    "itemName": "box_exp",
+    "imageName": "realm_box_exp.png",
+    "roiFront": "894,433,50,55",
+    "roiBack": "866,407,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "收取盒子的经验(没有满)"
+  },
+  {
+    "itemName": "realm_shin",
+    "imageName": "realm_realm_shin.png",
+    "roiFront": "175,460,54,58",
+    "roiBack": "147,443,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结界皮肤"
+  },
+  {
+    "itemName": "utilize_exp",
+    "imageName": "realm_utilize_exp.png",
+    "roiFront": "583,144,58,43",
+    "roiBack": "531,112,156,123",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寄养别人的经验"
+  },
+  {
+    "itemName": "ap_extract",
+    "imageName": "realm_ap_extract.png",
+    "roiFront": "592,501,100,75",
+    "roiBack": "592,501,100,75",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "取出"
+  },
+  {
+    "itemName": "exp_extract",
+    "imageName": "realm_exp_extract.png",
+    "roiFront": "592,448,100,73",
+    "roiBack": "592,448,100,73",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "提取"
+  }
+]

BIN
tasks/KekkaiUtilize/realm/realm_ap_extract.png


BIN
tasks/KekkaiUtilize/realm/realm_box_ap.png


BIN
tasks/KekkaiUtilize/realm/realm_box_exp.png


BIN
tasks/KekkaiUtilize/realm/realm_card_exp.png


BIN
tasks/KekkaiUtilize/realm/realm_exp_extract.png


BIN
tasks/KekkaiUtilize/realm/realm_realm_shin.png


BIN
tasks/KekkaiUtilize/realm/realm_shi_card.png


BIN
tasks/KekkaiUtilize/realm/realm_shi_defense.png


BIN
tasks/KekkaiUtilize/realm/realm_shi_grown.png


BIN
tasks/KekkaiUtilize/realm/realm_utilize_exp.png


+ 235 - 2
tasks/KekkaiUtilize/script_task.py

@@ -1,17 +1,250 @@
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # github https://github.com/runhey
+import time
+from cached_property import cached_property
 
-
+from module.base.timer import Timer
+from module.atom.image_grid import ImageGrid
 from module.logger import logger
 from module.exception import TaskEnd
 
 from tasks.GameUi.game_ui import GameUi
+from tasks.Utils.config_enum import ShikigamiClass
+from tasks.KekkaiUtilize.assets import KekkaiUtilizeAssets
+from tasks.KekkaiUtilize.config import UtilizeRule, SelectFriendList
+from tasks.Component.ReplaceShikigami.replace_shikigami import ReplaceShikigami
 
 
-class ScriptTask(GameUi):
+class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
 
     def run(self):
         pass
 
 
+    def check_guild_ap_or_assets(self, ap_enable: bool=True, assets_enable: bool=True) -> bool:
+        """
+        在寮的主界面 检查是否有收取体力或者是收取寮资金
+        如果有就顺带收取
+        :return:
+        """
+        if ap_enable or assets_enable:
+            self.screenshot()
+            if not self.appear(self.I_GUILD_AP) and not self.appear(self.I_GUILD_ASSETS):
+                return False
+        else:
+            return False
+
+        # 如果有就收取
+        timer_check = Timer(2)
+        timer_check.start()
+        while 1:
+            self.screenshot()
+
+            # 获得奖励
+            if self.ui_reward_appear_click():
+                timer_check.reset()
+                continue
+            # 资金收取确认
+            if self.appear_then_click(self.I_GUILD_ASSETS_RECEIVE, interval=0.5):
+                timer_check.reset()
+                continue
+
+            # 收体力
+            if self.appear_then_click(self.I_GUILD_AP, interval=0.5):
+                timer_check.reset()
+                continue
+            # 收资金
+            if self.appear_then_click(self.I_GUILD_ASSETS, interval=0.5):
+                timer_check.reset()
+                continue
+
+            if timer_check.reached():
+                break
+        return True
+
+    def goto_realm(self):
+        """
+        从寮的主界面进入寮结界
+        :return:
+        """
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_REALM_SHIN):
+                break
+            if self.appear(self.I_SHI_DEFENSE):
+                break
+
+            if self.appear_then_click(self.I_GUILD_REALM, interval=1):
+                continue
+
+    def check_box_ap_or_exp(self, ap_enable: bool=True, exp_enable: bool=True) -> bool:
+        """
+        顺路检查盒子
+        :param ap_enable:
+        :param exp_enable:
+        :return:
+        """
+
+        # 退出到寮结界
+        def _exit_to_realm():
+            # 右上方关闭红色
+            while 1:
+                self.screenshot()
+                if self.appear(self.I_REALM_SHIN):
+                    break
+                if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
+                    continue
+
+        # 先是体力盒子
+        def _check_ap_box():
+            self.screenshot()
+            appear = False
+            if self.appear(self.I_BOX_AP):
+                appear = True
+            if not appear:
+                return False
+            # 点击盒子
+            while 1:
+                self.screenshot()
+
+                if self.ui_reward_appear_click():
+                    while 1:
+                        # 等待动画结束
+                        if not self.appear(self.I_UI_REWARD):
+                            break
+                    break
+                if self.appear_then_click(self.I_BOX_AP, interval=1):
+                    continue
+                if self.appear_then_click(self.I_AP_EXTRACT, interval=2):
+                    continue
+            logger.info('Extract AP box finished')
+            _exit_to_realm()
+
+
+        # 经验盒子
+        def _check_exp_box():
+            self.screenshot()
+            appear = False
+            if self.appear(self.I_BOX_EXP):
+                appear = True
+            if not appear:
+                return False
+
+            while 1:
+                self.screenshot()
+
+                if self.appear_then_click(self.I_BOX_EXP, interval=1):
+                    continue
+                if self.appear_then_click(self.I_EXP_EXTRACT, interval=1):
+                    continue
+
+                # 如果出现结界皮肤, 表示收取好了
+                if self.appear(self.I_REALM_SHIN) and not self.appear(self.I_BOX_EXP):
+                    break
+            _exit_to_realm()
+
+        if ap_enable:
+            _check_ap_box()
+        if exp_enable:
+            _check_exp_box()
+
+    def check_utilize_harvest(self) -> bool:
+        """
+        在寮结界界面检查是否有收获
+        :return: 如果没有返回False, 如果有就收菜返回True
+        """
+        self.screenshot()
+        appear = self.appear(self.I_UTILIZE_EXP)
+        if not appear:
+            logger.info('No utilize harvest')
+            return False
+
+        # 收获
+        self.ui_get_reward(self.I_UTILIZE_EXP)
+        return True
+
+    def realm_goto_grown(self):
+        """
+        进入式神育成界面
+        :return:
+        """
+        while 1:
+            self.screenshot()
+
+            if self.in_shikigami_growth():
+                break
+
+            if self.appear_then_click(self.I_SHI_GROWN, interval=1):
+                continue
+        logger.info('Enter shikigami grown')
+
+    def grown_goto_utilize(self):
+        """
+        从式神育成界面到 蹭卡界面
+        :return:
+        """
+        self.screenshot()
+        if not self.appear(self.I_UTILIZE_ADD):
+            logger.info('No utilize add')
+            return False
+
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_U_ENTER_REALM):
+                break
+            if self.appear_then_click(self.I_UTILIZE_ADD, interval=1):
+                continue
+        logger.info('Enter utilize')
+
+    def switch_friend_list(self, friend: SelectFriendList = SelectFriendList.SAME_SERVER) -> bool:
+        """
+        切换不同的服务区
+        :param friend:
+        :return:
+        """
+        if friend == SelectFriendList.SAME_SERVER:
+            check_image = self.I_UTILIZE_FRIEND_GROUP
+        else:
+            check_image = self.I_UTILIZE_ZONES_GROUP
+
+        timer_click = Timer(1)
+        timer_click.start()
+        while 1:
+            self.screenshot()
+            if self.appear(check_image):
+                break
+            if timer_click.reached():
+                timer_click.reset()
+                x, y = check_image.coord()
+                self.device.click(x=x, y=y, control_name=check_image.name)
+        time.sleep(0.5)
+
+    @cached_property
+    def order_targets(self) -> ImageGrid:
+        rule = self.config.kekkai_utilize.utilize_config.utilize_rule
+        if rule == UtilizeRule.DEFAULT:
+            return ImageGrid([self.I_U_TAIKO_6, self.I_U_FISH_6, self.I_U_TAIKO_5, self.I_U_FISH_5,
+                              self.I_U_TAIKO_4, self.I_U_FISH_4, self.I_U_TAIKO_3, self.I_U_FISH_3])
+        elif rule == UtilizeRule.FISH:
+            return ImageGrid([self.I_U_FISH_6, self.I_U_FISH_5, self.I_U_FISH_4, self.I_U_FISH_3,
+                              self.I_U_TAIKO_6, self.I_U_TAIKO_5, self.I_U_TAIKO_4, self.I_U_TAIKO_3])
+        elif rule == UtilizeRule.TAIKO:
+            return ImageGrid([self.I_U_TAIKO_6, self.I_U_TAIKO_5, self.I_U_TAIKO_4, self.I_U_TAIKO_3,
+                              self.I_U_FISH_6, self.I_U_FISH_5, self.I_U_FISH_4, self.I_U_FISH_3])
+        else:
+            logger.error('Unknown utilize rule')
+            raise ValueError('Unknown utilize rule')
+
+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.switch_friend_list(SelectFriendList.DIFFERENT_SERVER)
+
+

+ 173 - 0
tasks/KekkaiUtilize/utilize/image.json

@@ -0,0 +1,173 @@
+[
+  {
+    "itemName": "utilize_add",
+    "imageName": "utilize_utilize_add.png",
+    "roiFront": "1149,54,74,67",
+    "roiBack": "1149,54,74,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右上角的放置好友寄养"
+  },
+  {
+    "itemName": "utilize_friend_group",
+    "imageName": "utilize_utilize_friend_group.png",
+    "roiFront": "216,92,109,70",
+    "roiBack": "216,92,109,70",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "好友这组"
+  },
+  {
+    "itemName": "utilize_zones_group",
+    "imageName": "utilize_utilize_zones_group.png",
+    "roiFront": "337,92,109,66",
+    "roiBack": "337,92,109,66",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "跨区"
+  },
+  {
+    "itemName": "u_taiko_3",
+    "imageName": "utilize_u_taiko_3.png",
+    "roiFront": "548,424,47,44",
+    "roiBack": "541,183,75,398",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_taiko_4",
+    "imageName": "utilize_u_taiko_4.png",
+    "roiFront": "543,316,60,43",
+    "roiBack": "541,171,73,438",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_taiko_5",
+    "imageName": "utilize_u_taiko_5.png",
+    "roiFront": "544,201,59,52",
+    "roiBack": "538,179,79,426",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_taiko_6",
+    "imageName": "utilize_u_taiko_6.png",
+    "roiFront": "0,0,100,100",
+    "roiBack": "0,0,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_fish_3",
+    "imageName": "utilize_u_fish_3.png",
+    "roiFront": "551,325,41,33",
+    "roiBack": "543,178,69,412",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_fish_4",
+    "imageName": "utilize_u_fish_4.png",
+    "roiFront": "549,310,51,50",
+    "roiBack": "542,177,73,401",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_fish_5",
+    "imageName": "utilize_u_fish_5.png",
+    "roiFront": "552,529,45,41",
+    "roiBack": "541,183,71,403",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_fish_6",
+    "imageName": "utilize_u_fish_6.png",
+    "roiFront": "544,201,59,52",
+    "roiBack": "530,184,82,416",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_enter_realm",
+    "imageName": "utilize_u_enter_realm.png",
+    "roiFront": "792,531,178,67",
+    "roiBack": "792,531,178,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入结界"
+  },
+  {
+    "itemName": "u_big_3",
+    "imageName": "utilize_u_big_3.png",
+    "roiFront": "835,321,100,25",
+    "roiBack": "835,321,100,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右侧大的图片"
+  },
+  {
+    "itemName": "u_big_4",
+    "imageName": "utilize_u_big_4.png",
+    "roiFront": "836,322,100,25",
+    "roiBack": "836,322,100,25",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_big_5",
+    "imageName": "utilize_u_big_5.png",
+    "roiFront": "834,320,100,26",
+    "roiBack": "834,320,100,26",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_big_6",
+    "imageName": "utilize_u_big_6.png",
+    "roiFront": "833,320,100,27",
+    "roiBack": "833,320,100,27",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "u_add_1",
+    "imageName": "utilize_u_add_1.png",
+    "roiFront": "1144,59,86,69",
+    "roiBack": "1144,59,86,69",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右上,右数第一个"
+  },
+  {
+    "itemName": "u_add_2",
+    "imageName": "utilize_u_add_2.png",
+    "roiFront": "979,52,76,69",
+    "roiBack": "979,52,76,69",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "右上,右数第二个"
+  },
+  {
+    "itemName": "u_confirm_small",
+    "imageName": "utilize_u_confirm_small.png",
+    "roiFront": "672,513,131,60",
+    "roiBack": "672,513,131,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

+ 11 - 0
tasks/KekkaiUtilize/utilize/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "utilize_res_time",
+    "roiFront": "1140,117,100,30",
+    "roiBack": "1140,117,100,30",
+    "mode": "Duration",
+    "method": "Default",
+    "keyword": "",
+    "description": "这个寄养的剩余时间"
+  }
+]

BIN
tasks/KekkaiUtilize/utilize/utilize_u_add_1.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_add_2.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_big_3.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_big_4.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_big_5.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_big_6.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_confirm_small.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_enter_realm.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_fish_3.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_fish_4.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_fish_5.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_fish_6.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_taiko_3.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_taiko_4.png


BIN
tasks/KekkaiUtilize/utilize/utilize_u_taiko_5.png


BIN
tasks/KekkaiUtilize/utilize/utilize_utilize_add.png


BIN
tasks/KekkaiUtilize/utilize/utilize_utilize_friend_group.png


BIN
tasks/KekkaiUtilize/utilize/utilize_utilize_zones_group.png


+ 23 - 1
tasks/base_task.py

@@ -437,4 +437,26 @@ class BaseTask(GlobalGameAssets):
         """
         if screenshot:
             self.screenshot()
-        return self.appear_then_click(self.I_UI_REWARD, action=self.C_UI_REWARD, interval=1)
+        return self.appear_then_click(self.I_UI_REWARD, action=self.C_UI_REWARD, interval=0.4, threshold=0.6)
+
+    def ui_get_reward(self, click_image: RuleImage):
+        """
+        传进来一个点击图片, 会点击这个图片,然后等待‘获得奖励’,
+        最后当获得奖励消失后 退出
+        :param click_image:
+        :return:
+        """
+        while 1:
+            self.screenshot()
+
+            if self.ui_reward_appear_click():
+                while 1:
+                    # 等待动画结束
+                    if not self.appear(self.I_UI_REWARD):
+                        break
+                break
+
+            if self.appear_then_click(click_image, interval=0.8):
+                continue
+
+        return True