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

Merge pull request #24 from runhey/dev

Dev
huangrunheng 3 лет назад
Родитель
Сommit
aa740c76d1
81 измененных файлов с 1077 добавлено и 101 удалено
  1. 6 4
      .gitignore
  2. 57 1
      config/template.json
  3. 5 0
      dev_tools/README.md
  4. BIN
      dev_tools/Spyxx/spyxx.exe
  5. BIN
      dev_tools/Spyxx/spyxx_amd64.exe
  6. BIN
      dev_tools/Spyxx/spyxxhk.dll
  7. BIN
      dev_tools/Spyxx/spyxxhk_amd64.dll
  8. 11 0
      dev_tools/ViewWizard2/Settings.ini
  9. BIN
      dev_tools/ViewWizard2/ViewWizard2.exe
  10. 100 0
      dev_tools/ViewWizard3/Help.txt
  11. 35 0
      dev_tools/ViewWizard3/Set.ini
  12. BIN
      dev_tools/ViewWizard3/VB6CHS.DLL
  13. BIN
      dev_tools/ViewWizard3/ViewWizard.exe
  14. BIN
      dev_tools/ViewWizard3/mscomctl.ocx
  15. BIN
      dev_tools/ViewWizard3/msvbvm60.dll
  16. 1 0
      module/config/config_manual.py
  17. 2 1
      module/config/config_menu.py
  18. 6 0
      module/config/config_model.py
  19. BIN
      module/config/i18n/zh_CN.qm
  20. 23 7
      module/config/i18n/zh_CN.ts
  21. 117 50
      module/device/handle.py
  22. 6 6
      module/device/method/window.py
  23. 3 2
      module/gui/context/add.py
  24. 39 9
      module/ocr/base_ocr.py
  25. 2 1
      script.py
  26. 1 1
      tasks/Component/GeneralInvite/assets.py
  27. 1 1
      tasks/Component/GeneralInvite/general_invite.py
  28. BIN
      tasks/Component/GeneralInvite/gi/gi_matching.png
  29. 2 2
      tasks/Component/GeneralInvite/gi/image.json
  30. 1 1
      tasks/Component/GeneralRoom/assets.py
  31. BIN
      tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png
  32. 2 2
      tasks/Component/GeneralRoom/gr/image.json
  33. 64 0
      tasks/Component/ReplaceShikigami/assets.py
  34. 3 0
      tasks/Component/ReplaceShikigami/replace_shikigami.py
  35. 56 0
      tasks/Component/ReplaceShikigami/rs/click.json
  36. 128 0
      tasks/Component/ReplaceShikigami/rs/image.json
  37. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_material.png
  38. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_material_selected.png
  39. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_n.png
  40. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_n_selected.png
  41. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_no_add.png
  42. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_r.png
  43. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_r_selected.png
  44. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_records_shiki.png
  45. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_sp.png
  46. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_sp_selected.png
  47. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_sr.png
  48. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_sr_selected.png
  49. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_ssr.png
  50. BIN
      tasks/Component/ReplaceShikigami/rs/rs_rs_ssr_selected.png
  51. 12 0
      tasks/GotoMain/assets.py
  52. 12 0
      tasks/KekkaiActivation/assets.py
  53. 12 0
      tasks/KekkaiUtilize/assets.py
  54. 2 2
      tasks/Orochi/assets.py
  55. 4 4
      tasks/Orochi/o/image.json
  56. BIN
      tasks/Orochi/o/o_orochi_matching.png
  57. 6 1
      tasks/Orochi/script_task.py
  58. 4 0
      tasks/Restart/assets.py
  59. 2 0
      tasks/Restart/config.py
  60. BIN
      tasks/Restart/harvest/harvest_harvest_ap.png
  61. BIN
      tasks/Restart/harvest/harvest_harvest_mail_title.png
  62. 18 0
      tasks/Restart/harvest/image.json
  63. 32 6
      tasks/Restart/login.py
  64. 58 0
      tasks/TrueOrochi/assets.py
  65. 37 0
      tasks/TrueOrochi/config.py
  66. 35 0
      tasks/TrueOrochi/script_task.py
  67. 50 0
      tasks/TrueOrochi/st/click.json
  68. 110 0
      tasks/TrueOrochi/st/image.json
  69. BIN
      tasks/TrueOrochi/st/st_find_ts.png
  70. BIN
      tasks/TrueOrochi/st/st_st_auto_false.png
  71. BIN
      tasks/TrueOrochi/st/st_st_auto_true.png
  72. BIN
      tasks/TrueOrochi/st/st_st_fire.png
  73. BIN
      tasks/TrueOrochi/st/st_st_fire_confirm.png
  74. BIN
      tasks/TrueOrochi/st/st_st_fire_prepare.png
  75. BIN
      tasks/TrueOrochi/st/st_st_green_1.png
  76. BIN
      tasks/TrueOrochi/st/st_st_green_2.png
  77. BIN
      tasks/TrueOrochi/st/st_st_green_3.png
  78. BIN
      tasks/TrueOrochi/st/st_st_green_4.png
  79. BIN
      tasks/TrueOrochi/st/st_st_green_5.png
  80. BIN
      tasks/TrueOrochi/st/st_st_green_6.png
  81. 12 0
      tasks/ui/assets.py

+ 6 - 4
.gitignore

@@ -26,9 +26,12 @@ test/
 build-fluentui-Desktop_*/
 build-fluentui-Desktop_*/
 module/config/argument/setting.json
 module/config/argument/setting.json
 !fluentui/*
 !fluentui/*
-
-
-
+*.exe
+!dev_tools/*
+!dev_tools/Spyxx/spyxx.exe
+!dev_tools/Spyxx/spyxx_amd64.exe
+!dev_tools/ViewWizard2/ViewWizard2.exe
+!dev_tools/ViewWizard3/ViewWizard.exe
 
 
 
 
 
 
@@ -257,7 +260,6 @@ $RECYCLE.BIN/
 *.lnk
 *.lnk
 adb_port.txt
 adb_port.txt
 adb_port.ini
 adb_port.ini
-*.exe
 !popup.exe
 !popup.exe
 *.zip
 *.zip
 console.bat
 console.bat

+ 57 - 1
config/template.json

@@ -36,7 +36,8 @@
       "enable_sign": true,
       "enable_sign": true,
       "enable_sign_999": true,
       "enable_sign_999": true,
       "enable_mail": true,
       "enable_mail": true,
-      "enable_soul": true
+      "enable_soul": true,
+      "enable_ap": true
     }
     }
   },
   },
   "global_game": {
   "global_game": {
@@ -123,6 +124,61 @@
       "random_click_swipt_enable": false
       "random_click_swipt_enable": false
     }
     }
   },
   },
+  "kekkai_utilize": {
+    "scheduler": {
+      "enable": false,
+      "next_run": "2023-01-01 00:00:00",
+      "priority": 2,
+      "success_interval": "00 06:00:00",
+      "failure_interval": "00 06:00:00",
+      "server_update": "09:00:00"
+    },
+    "utilize_config": {
+      "utilize_rule": "auto",
+      "auto_switch_sort": true,
+      "shikigami_class": "N",
+      "shikigami_order": 4,
+      "guild_ap_enable": true,
+      "guild_assets_enable": true,
+      "box_ap_enable": true,
+      "box_exp_enable": true
+    }
+  },
+  "kekkai_activation": {
+    "scheduler": {
+      "enable": false,
+      "next_run": "2023-01-01 00:00:00",
+      "priority": 2,
+      "success_interval": "00 10:00:00",
+      "failure_interval": "00 10:00:00",
+      "server_update": "09:00:00"
+    },
+    "activation_config": {
+      "card_rule": "auto",
+      "exchange_before": true,
+      "exchange_max": true,
+      "shikigami_class": "N"
+    }
+  },
+  "demon_encounter": {
+    "scheduler": {
+      "enable": false,
+      "next_run": "2023-01-01 00:00:00",
+      "priority": 2,
+      "success_interval": "01 00:00:00",
+      "failure_interval": "01 00:00:00",
+      "server_update": "09:00:00"
+    },
+    "general_battle_config": {
+      "lock_team_enable": false,
+      "preset_enable": false,
+      "preset_group": 1,
+      "preset_team": 1,
+      "green_enable": false,
+      "green_mark": "green_left1",
+      "random_click_swipt_enable": false
+    }
+  },
   "orochi": {
   "orochi": {
     "scheduler": {
     "scheduler": {
       "enable": false,
       "enable": false,

+ 5 - 0
dev_tools/README.md

@@ -0,0 +1,5 @@
+### 这三个都是窗口的管理工具
+
+- 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


+ 11 - 0
dev_tools/ViewWizard2/Settings.ini

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

BIN
dev_tools/ViewWizard2/ViewWizard2.exe


+ 100 - 0
dev_tools/ViewWizard3/Help.txt

@@ -0,0 +1,100 @@
+				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月
+
+
+
+
+

+ 35 - 0
dev_tools/ViewWizard3/Set.ini

@@ -0,0 +1,35 @@
+[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 - 0
module/config/config_manual.py

@@ -14,6 +14,7 @@ class ConfigManual:
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami
         > ActivityShikigami
         > BondlingFairyland
         > BondlingFairyland
+        > TrueOrochi
         """
         """
 
 
     DEVICE_OVER_HTTP = False
     DEVICE_OVER_HTTP = False

+ 2 - 1
module/config/config_menu.py

@@ -25,7 +25,8 @@ class ConfigMenu:
         self.menu["Activity Task"] = ['ActivityShikigami']
         self.menu["Activity Task"] = ['ActivityShikigami']
         # 很肝的任务
         # 很肝的任务
         self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
         self.menu["Liver Emperor Exclusive"] = ['BondlingFairyland']
-
+        # 每周任务
+        self.menu["Weekly Task"] = ['TrueOrochi']
         # 开发工具
         # 开发工具
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
         self.menu["Tools"] = ['Image Rule', 'Ocr Rule', 'Click Rule', 'Long Click Rule', 'Swipe Rule', 'List Rule']
 
 

+ 6 - 0
module/config/config_model.py

@@ -38,6 +38,10 @@ from tasks.ActivityShikigami.config import ActivityShikigami
 from tasks.BondlingFairyland.config import BondlingFairyland
 from tasks.BondlingFairyland.config import BondlingFairyland
 # ----------------------------------------------------------------------------------------------------------------------
 # ----------------------------------------------------------------------------------------------------------------------
 
 
+# 每周任务---------------------------------------------------------------------------------------------------------------
+from tasks.TrueOrochi.config import TrueOrochi
+# ----------------------------------------------------------------------------------------------------------------------
+
 class ConfigModel(ConfigBase):
 class ConfigModel(ConfigBase):
     config_name: str = "oas"
     config_name: str = "oas"
     script: Script = Field(default_factory=Script)
     script: Script = Field(default_factory=Script)
@@ -67,6 +71,8 @@ class ConfigModel(ConfigBase):
     # 这些是肝帝专属
     # 这些是肝帝专属
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)
     bondling_fairyland: BondlingFairyland = Field(default_factory=BondlingFairyland)
 
 
+    # 这些是每周任务
+    true_orochi: TrueOrochi = Field(default_factory=TrueOrochi)
 
 
     # @validator('script')
     # @validator('script')
     # def script_validator(cls, v):
     # def script_validator(cls, v):

BIN
module/config/i18n/zh_CN.qm


+ 23 - 7
module/config/i18n/zh_CN.ts

@@ -263,23 +263,27 @@
 	<message>
 	<message>
         <source>handle_help</source>
         <source>handle_help</source>
         <translation>填 "auto" 自动检测模拟器,多个模拟器正在运行或使用不支持自动检测的模拟器时无法使用 "auto",必须手动填写
         <translation>填 "auto" 自动检测模拟器,多个模拟器正在运行或使用不支持自动检测的模拟器时无法使用 "auto",必须手动填写
-输入为句柄标题或者是句柄号,每次启动模拟器时句柄号会变化
+输入为句柄标题或者是句柄号,每次启动模拟器时句柄号会变化。清空表示不使用window的操作方式。
 
 
 句柄标题 Handle:
 句柄标题 Handle:
 [MuMu模拟器12]: "MuMu模拟器12"
 [MuMu模拟器12]: "MuMu模拟器12"
-[MuMu模拟器]: "MuMu模拟器" "\n"
+[MuMu模拟器]: "MuMu模拟器" 
 [雷电模拟器](全系列通用): "雷电模拟器"
 [雷电模拟器](全系列通用): "雷电模拟器"
 
 
 句柄号 Handle:
 句柄号 Handle:
-!!!占位符</translation>
+某些模拟器多开时具有相同的句柄标题(说的就是MuMu),此时需要手动获取模拟器的句柄号手动设置。
+获取工具请查阅文档:[模拟器支持] </translation>
     </message>
     </message>
 	<message>
 	<message>
         <source>screenshot_method_help</source>
         <source>screenshot_method_help</source>
-        <translation>目前只支持window_background, 其他还未完整的测试</translation>
+        <translation>使用自动选择时,将执行一次性能测试并自动更改为最快的截图方案。一般情况下的速度: 
+window_background >>> DroidCast_raw >  ADB_nc >> DroidCast > uiautomator2 ~= ADB
+使用window_background来截图是10ms左右,对比DroidCast_raw是100ms左右(仅限作者的电脑)。但是window_background有一个致命的缺点是模拟器不可以最小化,望周知</translation>
     </message>
     </message>
 	<message>
 	<message>
         <source>control_method_help</source>
         <source>control_method_help</source>
-        <translation>目前只支持window_message, 其他还未完整的测试</translation>
+        <translation>速度: window_message ~= minitouch > Hermit >>> uiautomator2 ~= ADB
+控制方式是模拟人类的速度,也不是越快越好 使用(window_message)会偶尔出现失效的情况</translation>
     </message>
     </message>
 	<message>
 	<message>
         <source>Adb Restart</source>
         <source>Adb Restart</source>
@@ -455,7 +459,7 @@ mode_3策略是刷到五个契灵后开始结契,选择高级、中级盘来
 </context>	
 </context>	
 <context>
 <context>
     <name>Args</name>
     <name>Args</name>
-	<message><source>UtilizeScheduler</source><translation>调度</translation></message>
+	<message><source>UtilizeScheduler</source><translation>任务调度</translation></message>
 	<message><source>UtilizeConfig</source><translation>寄养</translation></message>
 	<message><source>UtilizeConfig</source><translation>寄养</translation></message>
 	<message><source>Utilize Rule</source><translation>寄养规则</translation></message>
 	<message><source>Utilize Rule</source><translation>寄养规则</translation></message>
 	<message><source>Auto Switch Sort</source><translation>切换好友列表以游戏刷新高星排序</translation></message>
 	<message><source>Auto Switch Sort</source><translation>切换好友列表以游戏刷新高星排序</translation></message>
@@ -477,7 +481,7 @@ mode_3策略是刷到五个契灵后开始结契,选择高级、中级盘来
 </context>	
 </context>	
 <context>
 <context>
     <name>Args</name>
     <name>Args</name>
-	<message><source>ActivationScheduler</source><translation>调度</translation></message>
+	<message><source>ActivationScheduler</source><translation>任务调度</translation></message>
 	<message><source>ActivationConfig</source><translation>寄养</translation></message>
 	<message><source>ActivationConfig</source><translation>寄养</translation></message>
 	<message><source>Card Rule</source><translation>放卡规则</translation></message>
 	<message><source>Card Rule</source><translation>放卡规则</translation></message>
 	<message><source>Exchange Max</source><translation>收取经验后更换下来满级的式神</translation></message>
 	<message><source>Exchange Max</source><translation>收取经验后更换下来满级的式神</translation></message>
@@ -485,5 +489,17 @@ mode_3策略是刷到五个契灵后开始结契,选择高级、中级盘来
 	<message><source>card_rule_help</source><translation>规则还没想好</translation></message>
 	<message><source>card_rule_help</source><translation>规则还没想好</translation></message>
 	<message><source>exchange_before_help</source><translation>必选项</translation></message>
 	<message><source>exchange_before_help</source><translation>必选项</translation></message>
 	<message><source>exchange_max_help</source><translation>必选项</translation></message>
 	<message><source>exchange_max_help</source><translation>必选项</translation></message>
+</context>	
+<context>
+    <name>Args</name>
+	<message><source>TrueOrochiScheduler</source><translation>任务调度</translation></message>
+	<message><source>TrueOrochiConfig</source><translation>任务</translation></message>
+	<message><source>Find True Orochi</source><translation>挑战御魂十层触发真蛇</translation></message>
+	<message><source>Green Mark Type</source><translation>绿标哪一个</translation></message>
+	<message><source>find_true_orochi_help</source><translation>启用这一项,没有出现八岐大蛇时会单独挑战十层十次,如果还不出现判断失败,将会设置失败时的间隔到下一次来进行开启任务
+如果不启用这一项,没有发现真蛇时直接判定运行失败</translation></message>
+	<message><source>green_mark_type_help</source><translation> </translation></message>
+	<message><source>Current Success</source><translation>本周已经挑战成功的次数</translation></message>
+	<message><source>current_success_help</source><translation>请不要手动修改这一项,是为了给机器计数的,机器会自动修改</translation></message>
 </context>		
 </context>		
 </TS>
 </TS>

+ 117 - 50
module/device/handle.py

@@ -3,6 +3,7 @@
 # github https://github.com/runhey
 # github https://github.com/runhey
 import re
 import re
 
 
+from enum import Enum
 from cached_property import cached_property
 from cached_property import cached_property
 from anytree import NodeMixin, RenderTree, PreOrderIter
 from anytree import NodeMixin, RenderTree, PreOrderIter
 from win32api import GetSystemMetrics, SendMessage, MAKELONG, PostMessage
 from win32api import GetSystemMetrics, SendMessage, MAKELONG, PostMessage
@@ -46,7 +47,8 @@ def is_handle_valid(num: int) -> bool:
     """
     """
     return IsWindow(num)
     return IsWindow(num)
 
 
-def handle_num2pid(num :int) -> int:
+
+def handle_num2pid(num: int) -> int:
     """
     """
     通过句柄号获取句柄进程id,如果句柄号非法则返回0
     通过句柄号获取句柄进程id,如果句柄号非法则返回0
     :param num:
     :param num:
@@ -54,6 +56,7 @@ def handle_num2pid(num :int) -> int:
     """
     """
     return 0 if num is None or num == 0 or num == '' else GetWindowThreadProcessId(num)[1]
     return 0 if num is None or num == 0 or num == '' else GetWindowThreadProcessId(num)[1]
 
 
+
 def window_scale_rate() -> float:
 def window_scale_rate() -> float:
     """
     """
     获取window的系统缩放 一遍是1
     获取window的系统缩放 一遍是1
@@ -69,6 +72,7 @@ def window_scale_rate() -> float:
     # print(wReal, wAfter)
     # print(wReal, wAfter)
     return round(wReal / wAfter, 2)
     return round(wReal / wAfter, 2)
 
 
+
 class WindowNode(NodeMixin):
 class WindowNode(NodeMixin):
     def __init__(self, name, num, parent=None):
     def __init__(self, name, num, parent=None):
         super().__init__()
         super().__init__()
@@ -77,6 +81,46 @@ class WindowNode(NodeMixin):
         self.parent = parent
         self.parent = parent
 
 
 
 
+class EmulatorFamily(Enum):
+    FAMILY_MUMU = 10  # mumu模拟器
+    FAMILY_NOX = 20  # 夜神模拟器
+    FAMILY_LD = 30  # 雷电模拟器
+    FAMILY_MEMU = 40  # 逍遥模拟器
+    FAMILY_BLUESTACKS = 50  # 蓝叠模拟器
+    FAMILY_OTHER = 60  # 其他模拟器 待定
+
+
+# 各个模拟器的句柄树*******************************************************************************************************
+""""
+<MuMu>系列
+模拟器的窗口名字
+----MuMuPlayer      (!如果是mumu12是MuMuPlayer, 否则是NemuPlayer)
+--------nemudisplay
+
+<雷电模拟器系列>
+雷电模拟器的窗口名字
+----TheRender
+--------sub
+
+<夜神模拟器系列>  =====> 这个模拟器窗口很复杂,而且有的时候还会变化
+夜神模拟器的窗口名字
+----Nox
+----Nox
+--------toolbar_nox
+--------Nox
+------------Nox
+----------------sub
+---Nox
+--------Nox
+--------Nox    ==> 妈的太多了自己用spy++看吧
+
+<蓝叠模拟器>
+蓝叠模拟器的窗口名字
+----HD-Player
+--------_ctl.W
+"""""
+# **********************************************************************************************************************
+
 class Handle:
 class Handle:
     emulator_list = ['MuMu12',
     emulator_list = ['MuMu12',
                      'MuMu',
                      'MuMu',
@@ -89,7 +133,7 @@ class Handle:
         # 夜神
         # 夜神
         'nox_player': ['root_handle_title', 'Nox'],
         'nox_player': ['root_handle_title', 'Nox'],
         'nox_player_64': ['root_handle_title', 'Nox'],
         'nox_player_64': ['root_handle_title', 'Nox'],
-        'nox_player_family':['root_handle_title', 'Nox'],
+        'nox_player_family': ['root_handle_title', 'Nox'],
         # 雷电
         # 雷电
         'ld_player': ['TheRender'],
         'ld_player': ['TheRender'],
         'ld_player_4': ['TheRender'],
         'ld_player_4': ['TheRender'],
@@ -119,47 +163,53 @@ class Handle:
                 self.config = Config(config, task=None)
                 self.config = Config(config, task=None)
             else:
             else:
                 self.config = config
                 self.config = config
+        if not self.config.script.device.handle:
+            logger.info('Handle is empty. oas not use handle')
+            return
+        if self.config.script.device.handle == '':
+            logger.info('Handle is empty. oas not use handle')
+            return
 
 
         # 获取根的句柄
         # 获取根的句柄
         self.root_handle_title = ''
         self.root_handle_title = ''
         self.root_handle_num = 0
         self.root_handle_num = 0
         self.root_handle = self.config.script.device.handle
         self.root_handle = self.config.script.device.handle
         if self.root_handle == "auto":
         if self.root_handle == "auto":
-            logger.info('handle is auto. oas will find window emulator')
+            logger.info('Handle is auto. oas will find window emulator')
             window_list = Handle.all_windows()
             window_list = Handle.all_windows()
             self.root_handle_title = self.auto_handle_title(window_list)
             self.root_handle_title = self.auto_handle_title(window_list)
             self.root_handle_num = handle_title2num(self.root_handle_title)
             self.root_handle_num = handle_title2num(self.root_handle_title)
-        elif isinstance(self.root_handle, int):
-            logger.info('handle is handle num. oas use it as root handle num')
-            if is_handle_valid(self.root_handle):
-                logger.info(f'handle number {self.root_handle} is valid')
-                self.root_handle_title = handle_num2title(self.root_handle)
-                self.root_handle_num = self.root_handle
-        elif isinstance(self.root_handle, str):
-            logger.info('handle is handle string. oas use it as root handle title')
-            if handle_title2num(self.root_handle) != 0:
-                self.root_handle_num = handle_title2num(self.root_handle)
-                self.root_handle_title = self.root_handle
-        logger.info(f'the root handle title is {self.root_handle_title} and num is {self.root_handle_num}')
+        if isinstance(self.root_handle, str):
+            try:
+                self.root_handle_num = int(self.root_handle)
+                logger.info('Handle is handle num. oas use it as root handle num')
+                if is_handle_valid(self.root_handle_num):
+                    logger.info(f'Handle number {self.root_handle_num} is valid')
+                    self.root_handle_title = handle_num2title(self.root_handle_num)
+            except ValueError:
+                logger.info('Handle is handle string. oas use it as root handle title')
+                if handle_title2num(self.root_handle) != 0:
+                    self.root_handle_num = handle_title2num(self.root_handle)
+                    self.root_handle_title = self.root_handle
+        logger.info(f'The root handle title is {self.root_handle_title} and num is {self.root_handle_num}')
 
 
         # 获取句柄树
         # 获取句柄树
         self.root_node = WindowNode(name=self.root_handle_title, num=self.root_handle_num)
         self.root_node = WindowNode(name=self.root_handle_title, num=self.root_handle_num)
         Handle.handle_tree(self.root_handle_num, self.root_node)
         Handle.handle_tree(self.root_handle_num, self.root_node)
-        logger.info('the emulator handle structure is')
+        logger.info('Emulator handle structure:')
         for pre, fill, node in RenderTree(self.root_node):
         for pre, fill, node in RenderTree(self.root_node):
             logger.info("%s%s" % (pre, node.name))
             logger.info("%s%s" % (pre, node.name))
         for pre, fill, node in RenderTree(self.root_node):
         for pre, fill, node in RenderTree(self.root_node):
             logger.info("%s%s" % (pre, node.num))
             logger.info("%s%s" % (pre, node.num))
 
 
-        # 判断是哪一个模拟器
-        logger.info(f'the emulator family is {self.emulator_family}')
+        # 判断是哪一个模拟器 通过句柄树结构
+        logger.info(f'Emulator family: {self.emulator_family}')
 
 
         # window系统的缩放
         # window系统的缩放
-        logger.info(f'your window screen scale rate is {window_scale_rate()}')
+        logger.info(f'Your window screen scale rate: {window_scale_rate()}')
         _ = self.screenshot_handle_num
         _ = self.screenshot_handle_num
-        logger.info(f'screenshot handle num is {self.screenshot_handle_num}')
-        logger.info(f'the emulator screenshot size is {self.screenshot_size}')
-
+        logger.info(f'Screenshot handle num: {self.screenshot_handle_num}')
+        logger.info(f'Emulator screenshot size: {self.screenshot_size}')
 
 
     @staticmethod
     @staticmethod
     def all_windows() -> list:
     def all_windows() -> list:
@@ -214,7 +264,7 @@ class Handle:
         return emulator_title
         return emulator_title
 
 
     @staticmethod
     @staticmethod
-    def handle_tree(hwnd, node: WindowNode, level: int =0) -> None:
+    def handle_tree(hwnd, node: WindowNode, level: int = 0) -> None:
         """
         """
         生成一个窗口的句柄树
         生成一个窗口的句柄树
         :param hwnd:
         :param hwnd:
@@ -236,23 +286,41 @@ class Handle:
                 Handle.handle_tree(child_hwnd, child_node, level + 1)
                 Handle.handle_tree(child_hwnd, child_node, level + 1)
 
 
     @cached_property
     @cached_property
-    def emulator_family(self) -> str:
+    def emulator_family(self) -> EmulatorFamily:
         """
         """
-        通过句柄标题来判断这个是那个模拟器大类
+        通过句柄树来判断这个是那个模拟器大类
         :return:
         :return:
         """
         """
+        children_num = len(self.root_node.children)
+        if children_num == 1:  #
+            name = self.root_node.children[0].name
+            if name == 'MuMuPlayer':
+                return EmulatorFamily.FAMILY_MUMU
+            elif name == 'NemuPlayer':
+                return EmulatorFamily.FAMILY_MUMU
+            elif name == 'TheRender':
+                return EmulatorFamily.FAMILY_LD
+            elif name == 'HD-Player':
+                return EmulatorFamily.FAMILY_BLUESTACKS
+        elif children_num >= 3:
+            name = self.root_node.children[0].name
+            if name == 'Nox':
+                return EmulatorFamily.FAMILY_NOX
+
+        # 基于句柄标题的判定
         for emu in Handle.emulator_list:
         for emu in Handle.emulator_list:
             if self.root_handle_title.find(emu) != -1:
             if self.root_handle_title.find(emu) != -1:
                 if emu == 'MuMu':
                 if emu == 'MuMu':
-                    return 'mumu_player_family'
+                    return EmulatorFamily.FAMILY_MUMU
                 elif emu == '雷电':
                 elif emu == '雷电':
-                    return 'ld_player_family'
+                    return EmulatorFamily.FAMILY_LD
                 elif emu == '夜神':
                 elif emu == '夜神':
-                    return 'nox_player_family'
+                    return EmulatorFamily.FAMILY_NOX
                 elif emu == '蓝叠':
                 elif emu == '蓝叠':
-                    return 'bluestacks_player_family'
+                    return EmulatorFamily.FAMILY_BLUESTACKS
                 elif emu == '逍遥':
                 elif emu == '逍遥':
-                    return 'memu_player_family'
+                    return EmulatorFamily.FAMILY_MEMU
+        return EmulatorFamily.FAMILY_OTHER
 
 
     @cached_property
     @cached_property
     def screenshot_handle_num(self) -> int:
     def screenshot_handle_num(self) -> int:
@@ -260,39 +328,38 @@ class Handle:
         截屏的句柄其实并不是根句柄
         截屏的句柄其实并不是根句柄
         :return:  出错返回None
         :return:  出错返回None
         """
         """
-        if self.emulator_family == 'mumu_player_family':
-            if re.match(string=self.root_handle_title, pattern=r".*12$"):
-                logger.info('is mumu12')
-                for node in PreOrderIter(self.root_node):
-                    if node.name == Handle.emulator_handle['mumu_player_12'][1]:
-                        return node.num
-            else:
-                logger.info('is mumu')
-                for node in PreOrderIter(self.root_node):
-                    if node.name == Handle.emulator_handle['mumu_player'][1]:
-                        return node.num
+        if self.emulator_family == EmulatorFamily.FAMILY_MUMU:
+            # 使用正则匹配12 来判定是不是mumu12这并不是一个好的方法
+            name = self.root_node.children[0].name
+            num = self.root_node.children[0].num
+            if name == 'MuMuPlayer':
+                logger.info('The emulator is MuMu模拟器12')
+                return num
+            elif name == 'NemuPlayer':
+                logger.info('The emulator is MuMu模拟器')
+                return num
         # 夜神
         # 夜神
-        elif self.emulator_family == 'nox_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_NOX:
             try:
             try:
                 return self.root_node.children[1].children[1].num
                 return self.root_node.children[1].children[1].num
             except:
             except:
                 return self.root_node.children[2].children[1].num
                 return self.root_node.children[2].children[1].num
 
 
-        elif self.emulator_family == 'ld_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_LD:
             for node in PreOrderIter(self.root_node):
             for node in PreOrderIter(self.root_node):
                 if node.name == Handle.emulator_handle['ld_player_family'][0]:
                 if node.name == Handle.emulator_handle['ld_player_family'][0]:
                     return node.num
                     return node.num
 
 
-        elif self.emulator_family == 'memu_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_MEMU:
             for node in PreOrderIter(self.root_node):
             for node in PreOrderIter(self.root_node):
                 if node.name == Handle.emulator_handle['memu_player_family']:
                 if node.name == Handle.emulator_handle['memu_player_family']:
                     return node.num
                     return node.num
 
 
-        elif self.emulator_family == 'bluestacks_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_BLUESTACKS:
             for node in PreOrderIter(self.root_node):
             for node in PreOrderIter(self.root_node):
                 if node.name == Handle.emulator_handle['bluestacks_family']:
                 if node.name == Handle.emulator_handle['bluestacks_family']:
                     return node.num
                     return node.num
-        return None
+        return self.root_node.num
 
 
     @cached_property
     @cached_property
     def screenshot_size(self) -> tuple or None:
     def screenshot_size(self) -> tuple or None:
@@ -331,9 +398,9 @@ class Handle:
         # print(wReal, wAfter)
         # print(wReal, wAfter)
         return round(wReal / wAfter, 2)
         return round(wReal / wAfter, 2)
 
 
+
 if __name__ == '__main__':
 if __name__ == '__main__':
     h = Handle(config='oas1')
     h = Handle(config='oas1')
-    logger.info(h.auto_handle_title(h.all_windows()))
-    logger.info(h.root_handle_num)
-    logger.info(h.emulator_family)
-
+    # logger.info(h.auto_handle_title(h.all_windows()))
+    # logger.info(h.root_handle_num)
+    # logger.info(h.emulator_family)

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

@@ -24,7 +24,7 @@ from module.exception import RequestHumanTakeover, ScriptError
 from module.base.decorator import Config
 from module.base.decorator import Config
 from module.base.timer import timer
 from module.base.timer import timer
 from module.logger import logger
 from module.logger import logger
-from module.device.handle import Handle, window_scale_rate
+from module.device.handle import Handle, window_scale_rate, EmulatorFamily
 
 
 
 
 class Window(Handle):
 class Window(Handle):
@@ -85,11 +85,11 @@ class Window(Handle):
         :return:
         :return:
         """
         """
         result = []
         result = []
-        if self.emulator_family == "mumu_player_family":
+        if self.emulator_family == EmulatorFamily.FAMILY_MUMU:
             result.append(self.root_node.num)
             result.append(self.root_node.num)
             result.append(self.root_node.children[0].num)
             result.append(self.root_node.children[0].num)
             return result
             return result
-        elif self.emulator_family == 'nox_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_NOX:
             result.append(self.root_node.num)
             result.append(self.root_node.num)
             try:
             try:
                 result.append(self.root_node.children[1].num)
                 result.append(self.root_node.children[1].num)
@@ -100,12 +100,12 @@ class Window(Handle):
                 result.append(self.root_node.children[2].children[1].num)
                 result.append(self.root_node.children[2].children[1].num)
                 result.append(self.root_node.children[2].children[1].children[0].num)
                 result.append(self.root_node.children[2].children[1].children[0].num)
             return result
             return result
-        elif self.emulator_family == 'ld_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_LD:
             result.append(self.root_node.children[0].num)
             result.append(self.root_node.children[0].num)
             return result
             return result
-        elif self.emulator_family == 'memu_player_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_MEMU:
             pass
             pass
-        elif self.emulator_family == 'bluestacks_family':
+        elif self.emulator_family == EmulatorFamily.FAMILY_BLUESTACKS:
             pass
             pass
 
 
     @cached_property
     @cached_property

+ 3 - 2
module/gui/context/add.py

@@ -64,9 +64,10 @@ class Add(QObject):
         if file_path.exists():
         if file_path.exists():
             logger.error(f'{file_path} is exists')
             logger.error(f'{file_path} is exists')
             return
             return
-        with open(template_path, 'r') as f:
+
+        with open(template_path, 'r', encoding='utf-8') as f:
             template_content = f.read()
             template_content = f.read()
-        with open(file_path, 'w') as f:
+        with open(file_path, 'w', encoding='utf-8') as f:
             f.write(template_content)
             f.write(template_content)
         logger.info(f'copy {template_path} to {file_path}')
         logger.info(f'copy {template_path} to {file_path}')
 
 

+ 39 - 9
module/ocr/base_ocr.py

@@ -181,7 +181,7 @@ class BaseCor:
             return self.keyword == result
             return self.keyword == result
 
 
 
 
-    def filter(self, boxed_results: list[BoxedResult], keyword: str=None) -> list:
+    def filter(self, boxed_results: list[BoxedResult], keyword: str=None) -> list or None:
         """
         """
         使用ocr获取结果后和keyword进行匹配. 返回匹配的index list
         使用ocr获取结果后和keyword进行匹配. 返回匹配的index list
         :param keyword: 如果不指定默认适用对象的keyword
         :param keyword: 如果不指定默认适用对象的keyword
@@ -205,18 +205,48 @@ class BaseCor:
 
 
         # 如果适用顺序拼接还是没有匹配到,那可能是竖排的,使用单个字节的keyword进行匹配
         # 如果适用顺序拼接还是没有匹配到,那可能是竖排的,使用单个字节的keyword进行匹配
         indices = []
         indices = []
+        # 对于keyword中的每一个字符,都要在strings中进行匹配
+        # 如果这个字符在strings中的某一个string中,那么就记录这个string的index
+        max_index = len(strings) - 1
         for index, char in enumerate(keyword):
         for index, char in enumerate(keyword):
             for i, string in enumerate(strings):
             for i, string in enumerate(strings):
                 if char not in string:
                 if char not in string:
+                    continue
+                if i <= max_index:
+                    indices.append(i)
                     break
                     break
-                if i == len(strings) - 1:
-                    indices.append(index)
         if indices:
         if indices:
+            # 剔除掉重复的index
+            indices = list(set(indices))
             return indices
             return indices
         else:
         else:
-            indices = None
-            return indices
-
-
-
-
+            return None
+
+
+
+
+# def test():
+#     # strings = ["探", "索"]
+#     # keyword = "探索"
+#     # strings是截图ocr的结果,keyword是要匹配的关键字
+#     strings = ['123', '456', '789', '101112', '131415', '456']
+#     keyword = '123456'
+#
+#     indices = []
+#     # 对于keyword中的每一个字符,都要在strings中进行匹配
+#     # 如果这个字符在strings中的某一个string中,那么就记录这个string的index
+#     max_index = len(strings) - 1
+#     for index, char in enumerate(keyword):
+#         for i, string in enumerate(strings):
+#             if char not in string:
+#                 continue
+#             if i <= max_index:
+#                 indices.append(i)
+#                 break
+#     if indices:
+#         # 剔除掉重复的index
+#         indices = list(set(indices))
+#         return indices
+#     else:
+#         return None
+# print(test())

+ 2 - 1
script.py

@@ -186,6 +186,7 @@ class Script:
         """
         """
         # return msgpack.packb(cv2.imencode('.jpg', self.device.screenshot())[1].tobytes())
         # return msgpack.packb(cv2.imencode('.jpg', self.device.screenshot())[1].tobytes())
         img = cv2.cvtColor(self.device.screenshot(), cv2.COLOR_RGB2BGR)
         img = cv2.cvtColor(self.device.screenshot(), cv2.COLOR_RGB2BGR)
+        self.device.stuck_record_clear()
         ret, buffer = cv2.imencode('.jpg', img)
         ret, buffer = cv2.imencode('.jpg', img)
         yield buffer.tobytes()
         yield buffer.tobytes()
 
 
@@ -392,7 +393,7 @@ class Script:
             # Skip first restart
             # Skip first restart
             if self.is_first_task and task == 'Restart':
             if self.is_first_task and task == 'Restart':
                 logger.info('Skip task `Restart` at scheduler start')
                 logger.info('Skip task `Restart` at scheduler start')
-                self.config.task_delay(task='Restart', finish=True, success=True, server=True)
+                self.config.task_delay(task='Restart', success=True, server=True)
                 del_cached_property(self, 'config')
                 del_cached_property(self, 'config')
                 continue
                 continue
 
 

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

@@ -24,7 +24,7 @@ class GeneralInviteAssets:
 	# 还没有锁定阵容 
 	# 还没有锁定阵容 
 	I_UNLOCK = RuleImage(roi_front=(30,647,23,30), roi_back=(30,647,23,30), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_unlock.png")
 	I_UNLOCK = RuleImage(roi_front=(30,647,23,30), roi_back=(30,647,23,30), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_unlock.png")
 	# 如果是到时间会退出房间,这个右边显示一个匹配的图片 
 	# 如果是到时间会退出房间,这个右边显示一个匹配的图片 
-	I_MATCHING = RuleImage(roi_front=(1200,110,52,114), roi_back=(1200,110,52,114), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_matching.png")
+	I_MATCHING = RuleImage(roi_front=(51,574,52,114), roi_back=(51,574,52,114), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_matching.png")
 	# 永生之海挑战(还未有队友的图片) 
 	# 永生之海挑战(还未有队友的图片) 
 	I_FIRE_FAIL_SEA = RuleImage(roi_front=(1160,585,100,100), roi_back=(1160,585,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_fire_fail_sea.png")
 	I_FIRE_FAIL_SEA = RuleImage(roi_front=(1160,585,100,100), roi_back=(1160,585,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_fire_fail_sea.png")
 	# description 
 	# description 

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

@@ -645,5 +645,5 @@ if __name__ == '__main__':
 
 
     # t.run_invite(c.orochi.invite_config, is_first=True)
     # t.run_invite(c.orochi.invite_config, is_first=True)
     t.screenshot()
     t.screenshot()
-    print(t.check_and_invite(True))
+    print(t.detect_select('我是真的天秀'))
 
 

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


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

@@ -56,8 +56,8 @@
   {
   {
     "itemName": "matching",
     "itemName": "matching",
     "imageName": "gi_matching.png",
     "imageName": "gi_matching.png",
-    "roiFront": "1200,110,52,114",
-    "roiBack": "1200,110,52,114",
+    "roiFront": "51,574,52,114",
+    "roiBack": "51,574,52,114",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "如果是到时间会退出房间,这个右边显示一个匹配的图片"
     "description": "如果是到时间会退出房间,这个右边显示一个匹配的图片"

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

@@ -26,7 +26,7 @@ class GeneralRoomAssets:
 	# description 
 	# description 
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	# description 
 	# description 
-	I_GR_MATCHING_NEW = RuleImage(roi_front=(1204,102,42,121), roi_back=(1204,102,42,121), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png")
+	I_GR_MATCHING_NEW = RuleImage(roi_front=(62,571,42,121), roi_back=(62,571,42,121), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png")
 	# description 
 	# description 
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 
 

BIN
tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png


+ 2 - 2
tasks/Component/GeneralRoom/gr/image.json

@@ -65,8 +65,8 @@
   {
   {
     "itemName": "gr_matching_new",
     "itemName": "gr_matching_new",
     "imageName": "gr_gr_matching_new.png",
     "imageName": "gr_gr_matching_new.png",
-    "roiFront": "1204,102,42,121",
-    "roiBack": "1204,102,42,121",
+    "roiFront": "62,571,42,121",
+    "roiBack": "62,571,42,121",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

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

@@ -0,0 +1,64 @@
+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 ReplaceShikigamiAssets: 
+
+
+	# Click Rule Assets
+	# description 
+	C_SHIKIGAMI_SWITCH_1 = RuleClick(roi_front=(31,618,66,64), roi_back=(31,618,66,64), name="shikigami_switch_1")
+	# description 
+	C_SHIKIGAMI_LEFT_1 = RuleClick(roi_front=(163,487,100,179), roi_back=(163,487,100,179), name="shikigami_left_1")
+	# description 
+	C_SHIKIGAMI_LEFT_2 = RuleClick(roi_front=(295,487,100,178), roi_back=(295,487,100,178), name="shikigami_left_2")
+	# description 
+	C_SHIKIGAMI_LEFT_3 = RuleClick(roi_front=(436,492,100,178), roi_back=(436,492,100,178), name="shikigami_left_3")
+	# description 
+	C_SHIKIGAMI_LEFT_4 = RuleClick(roi_front=(571,493,100,174), roi_back=(571,493,100,174), name="shikigami_left_4")
+	# description 
+	C_SHIKIGAMI_LEFT_5 = RuleClick(roi_front=(704,492,100,176), roi_back=(704,492,100,176), name="shikigami_left_5")
+	# description 
+	C_SHIKIGAMI_LEFT_6 = RuleClick(roi_front=(839,487,100,182), roi_back=(839,487,100,182), name="shikigami_left_6")
+	# description 
+	C_SHIKIGAMI_LEFT_7 = RuleClick(roi_front=(977,493,100,171), roi_back=(977,493,100,171), name="shikigami_left_7")
+	# description 
+	C_SHIKIGAMI_LEFT_8 = RuleClick(roi_front=(1033,490,100,180), roi_back=(1033,490,100,180), name="shikigami_left_8")
+
+
+	# Image Rule Assets
+	# description 
+	I_RS_NO_ADD = RuleImage(roi_front=(276,222,100,212), roi_back=(28,181,1232,293), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_no_add.png")
+	# 素材 
+	I_RS_MATERIAL = RuleImage(roi_front=(32,283,59,56), roi_back=(32,283,59,56), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_material.png")
+	# description 
+	I_RS_N = RuleImage(roi_front=(138,299,57,59), roi_back=(138,299,57,59), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_n.png")
+	# description 
+	I_RS_R = RuleImage(roi_front=(230,344,64,61), roi_back=(230,344,64,61), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_r.png")
+	# description 
+	I_RS_SR = RuleImage(roi_front=(307,421,62,58), roi_back=(307,421,62,58), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_sr.png")
+	# description 
+	I_RS_SSR = RuleImage(roi_front=(354,517,63,58), roi_back=(354,517,63,58), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_ssr.png")
+	# description 
+	I_RS_SP = RuleImage(roi_front=(372,621,58,60), roi_back=(372,621,58,60), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_sp.png")
+	# description 
+	I_RS_MATERIAL_SELECTED = RuleImage(roi_front=(27,620,68,65), roi_back=(27,620,68,65), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_material_selected.png")
+	# description 
+	I_RS_N_SELECTED = RuleImage(roi_front=(30,620,66,60), roi_back=(30,620,66,60), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_n_selected.png")
+	# description 
+	I_RS_R_SELECTED = RuleImage(roi_front=(26,617,72,60), roi_back=(26,617,72,60), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_r_selected.png")
+	# description 
+	I_RS_SR_SELECTED = RuleImage(roi_front=(32,623,59,55), roi_back=(32,623,59,55), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_sr_selected.png")
+	# description 
+	I_RS_SSR_SELECTED = RuleImage(roi_front=(29,622,66,59), roi_back=(29,622,66,59), threshold=0.8, method="Template matching", file="./tasks/Component/ReplaceShikigami/rs/rs_rs_ssr_selected.png")
+	# description 
+	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")
+
+

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

@@ -0,0 +1,3 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey

+ 56 - 0
tasks/Component/ReplaceShikigami/rs/click.json

@@ -0,0 +1,56 @@
+[
+  {
+    "itemName": "shikigami_switch_1",
+    "roiFront": "31,618,66,64",
+    "roiBack": "31,618,66,64",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_1",
+    "roiFront": "163,487,100,179",
+    "roiBack": "163,487,100,179",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_2",
+    "roiFront": "295,487,100,178",
+    "roiBack": "295,487,100,178",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_3",
+    "roiFront": "436,492,100,178",
+    "roiBack": "436,492,100,178",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_4",
+    "roiFront": "571,493,100,174",
+    "roiBack": "571,493,100,174",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_5",
+    "roiFront": "704,492,100,176",
+    "roiBack": "704,492,100,176",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_6",
+    "roiFront": "839,487,100,182",
+    "roiBack": "839,487,100,182",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_7",
+    "roiFront": "977,493,100,171",
+    "roiBack": "977,493,100,171",
+    "description": "description"
+  },
+  {
+    "itemName": "shikigami_left_8",
+    "roiFront": "1033,490,100,180",
+    "roiBack": "1033,490,100,180",
+    "description": "description"
+  }
+]

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

@@ -0,0 +1,128 @@
+[
+  {
+    "itemName": "rs_no_add",
+    "imageName": "rs_rs_no_add.png",
+    "roiFront": "276,222,100,212",
+    "roiBack": "28,181,1232,293",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_material",
+    "imageName": "rs_rs_material.png",
+    "roiFront": "32,283,59,56",
+    "roiBack": "32,283,59,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "素材"
+  },
+  {
+    "itemName": "rs_n",
+    "imageName": "rs_rs_n.png",
+    "roiFront": "138,299,57,59",
+    "roiBack": "138,299,57,59",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_r",
+    "imageName": "rs_rs_r.png",
+    "roiFront": "230,344,64,61",
+    "roiBack": "230,344,64,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_sr",
+    "imageName": "rs_rs_sr.png",
+    "roiFront": "307,421,62,58",
+    "roiBack": "307,421,62,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_ssr",
+    "imageName": "rs_rs_ssr.png",
+    "roiFront": "354,517,63,58",
+    "roiBack": "354,517,63,58",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_sp",
+    "imageName": "rs_rs_sp.png",
+    "roiFront": "372,621,58,60",
+    "roiBack": "372,621,58,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_material_selected",
+    "imageName": "rs_rs_material_selected.png",
+    "roiFront": "27,620,68,65",
+    "roiBack": "27,620,68,65",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_n_selected",
+    "imageName": "rs_rs_n_selected.png",
+    "roiFront": "30,620,66,60",
+    "roiBack": "30,620,66,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_r_selected",
+    "imageName": "rs_rs_r_selected.png",
+    "roiFront": "26,617,72,60",
+    "roiBack": "26,617,72,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_sr_selected",
+    "imageName": "rs_rs_sr_selected.png",
+    "roiFront": "32,623,59,55",
+    "roiBack": "32,623,59,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_ssr_selected",
+    "imageName": "rs_rs_ssr_selected.png",
+    "roiFront": "29,622,66,59",
+    "roiBack": "29,622,66,59",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_sp_selected",
+    "imageName": "rs_rs_sp_selected.png",
+    "roiFront": "31,622,62,59",
+    "roiBack": "31,622,62,59",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "rs_records_shiki",
+    "imageName": "rs_rs_records_shiki.png",
+    "roiFront": "1148,548,49,43",
+    "roiBack": "1148,548,49,43",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

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


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


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


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


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


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


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


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


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


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


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


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


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


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


+ 12 - 0
tasks/GotoMain/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 GotoMainAssets: 
+	pass
+

+ 12 - 0
tasks/KekkaiActivation/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 KekkaiActivationAssets: 
+	pass
+

+ 12 - 0
tasks/KekkaiUtilize/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 KekkaiUtilizeAssets: 
+	pass
+

+ 2 - 2
tasks/Orochi/assets.py

@@ -18,13 +18,13 @@ class OrochiAssets:
 	# description 
 	# description 
 	I_OROCHI_LOCK = RuleImage(roi_front=(558,562,31,33), roi_back=(558,562,31,33), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_lock.png")
 	I_OROCHI_LOCK = RuleImage(roi_front=(558,562,31,33), roi_back=(558,562,31,33), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_lock.png")
 	# description 
 	# description 
-	I_OROCHI_UNLOCK = RuleImage(roi_front=(560,564,26,29), roi_back=(560,564,26,29), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_unlock.png")
+	I_OROCHI_UNLOCK = RuleImage(roi_front=(560,564,26,29), roi_back=(560,564,26,29), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_unlock.png")
 	# 点击挑战 
 	# 点击挑战 
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_fire.png")
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_fire.png")
 	# 式神录 
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	# description 
 	# description 
-	I_OROCHI_MATCHING = RuleImage(roi_front=(1205,106,44,114), roi_back=(1205,106,44,114), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_matching.png")
+	I_OROCHI_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_matching.png")
 
 
 
 
 	# List Rule Assets
 	# List Rule Assets

+ 4 - 4
tasks/Orochi/o/image.json

@@ -28,7 +28,7 @@
   },
   },
   {
   {
     "itemName": "orochi_unlock",
     "itemName": "orochi_unlock",
-    "imageName": "o_unlock.png",
+    "imageName": "o_orochi_unlock.png",
     "roiFront": "560,564,26,29",
     "roiFront": "560,564,26,29",
     "roiBack": "560,564,26,29",
     "roiBack": "560,564,26,29",
     "method": "Template matching",
     "method": "Template matching",
@@ -55,9 +55,9 @@
   },
   },
   {
   {
     "itemName": "orochi_matching",
     "itemName": "orochi_matching",
-    "imageName": "o_matching.png",
-    "roiFront": "1205,106,44,114",
-    "roiBack": "1205,106,44,114",
+    "imageName": "o_orochi_matching.png",
+    "roiFront": "62,568,44,114",
+    "roiBack": "62,568,44,114",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

BIN
tasks/Orochi/o/o_orochi_matching.png


+ 6 - 1
tasks/Orochi/script_task.py

@@ -1,6 +1,7 @@
 # This Python file uses the following encoding: utf-8
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # @author runhey
 # github https://github.com/runhey
 # github https://github.com/runhey
+from time import sleep
 from datetime import time, datetime, timedelta
 from datetime import time, datetime, timedelta
 
 
 from tasks.base_task import BaseTask
 from tasks.base_task import BaseTask
@@ -149,7 +150,11 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
             # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
             # 要结束任务
             # 要结束任务
             if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
             if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
-                break
+                sleep(0.5)
+                if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
+                    logger.warning('Orochi task failed')
+                    success = False
+                    break
             if self.current_count >= self.limit_count:
             if self.current_count >= self.limit_count:
                 if self.is_in_room():
                 if self.is_in_room():
                     logger.info('Orochi count limit out')
                     logger.info('Orochi count limit out')

+ 4 - 0
tasks/Restart/assets.py

@@ -29,6 +29,10 @@ class RestartAssets:
 	I_HARVEST_MAIL_CONFIRM = RuleImage(roi_front=(687,543,168,64), roi_back=(687,543,168,64), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_confirm.png")
 	I_HARVEST_MAIL_CONFIRM = RuleImage(roi_front=(687,543,168,64), roi_back=(687,543,168,64), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_confirm.png")
 	# description 
 	# description 
 	I_HARVEST_SOUL = RuleImage(roi_front=(241,497,38,36), roi_back=(68,480,930,72), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul.png")
 	I_HARVEST_SOUL = RuleImage(roi_front=(241,497,38,36), roi_back=(68,480,930,72), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul.png")
+	# description 
+	I_HARVEST_MAIL_TITLE = RuleImage(roi_front=(520,48,245,41), roi_back=(520,48,245,41), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_title.png")
+	# description 
+	I_HARVEST_AP = RuleImage(roi_front=(721,486,31,38), roi_back=(206,462,999,81), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_ap.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 2 - 0
tasks/Restart/config.py

@@ -21,6 +21,8 @@ class HarvestConfig(BaseModel):
     enable_mail: bool = Field(default=True)
     enable_mail: bool = Field(default=True)
     # 御魂加成
     # 御魂加成
     enable_soul: bool = Field(default=True)
     enable_soul: bool = Field(default=True)
+    # 体力
+    enable_ap: bool = Field(default=True)
 
 
 
 
 
 

BIN
tasks/Restart/harvest/harvest_harvest_ap.png


BIN
tasks/Restart/harvest/harvest_harvest_mail_title.png


+ 18 - 0
tasks/Restart/harvest/image.json

@@ -79,5 +79,23 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
+  },
+  {
+    "itemName": "harvest_mail_title",
+    "imageName": "harvest_harvest_mail_title.png",
+    "roiFront": "520,48,245,41",
+    "roiBack": "520,48,245,41",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "harvest_ap",
+    "imageName": "harvest_harvest_ap.png",
+    "roiFront": "721,486,31,38",
+    "roiBack": "206,462,999,81",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
   }
 ]
 ]

+ 32 - 6
tasks/Restart/login.py

@@ -105,35 +105,61 @@ class LoginHandler(BaseTask, RestartAssets):
 
 
             # 点击'获得奖励'
             # 点击'获得奖励'
             if self.ui_reward_appear_click():
             if self.ui_reward_appear_click():
+                timer_harvest.reset()
                 continue
                 continue
             # 获得奖励
             # 获得奖励
             if self.appear_then_click(self.I_UI_AWARD, interval=1):
             if self.appear_then_click(self.I_UI_AWARD, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
 
 
             # 勾玉
             # 勾玉
             if self.appear_then_click(self.I_HARVEST_JADE, interval=1):
             if self.appear_then_click(self.I_HARVEST_JADE, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
             # 签到
             # 签到
             if self.appear_then_click(self.I_HARVEST_SIGN, interval=1):
             if self.appear_then_click(self.I_HARVEST_SIGN, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
             if self.appear_then_click(self.I_HARVEST_SIGN_2, interval=1):
             if self.appear_then_click(self.I_HARVEST_SIGN_2, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
             # 999天的签到福袋
             # 999天的签到福袋
             if self.appear_then_click(self.I_HARVEST_SIGN_999, interval=1):
             if self.appear_then_click(self.I_HARVEST_SIGN_999, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
             # 邮件
             # 邮件
             if self.appear_then_click(self.I_HARVEST_MAIL, interval=1):
             if self.appear_then_click(self.I_HARVEST_MAIL, interval=1):
-                continue
-            if self.appear_then_click(self.I_HARVEST_MAIL_ALL, interval=1):
-                continue
-            if self.appear_then_click(self.I_HARVEST_MAIL_CONFIRM, interval=1):
-                continue
-            if self.appear_then_click(self.I_HARVEST_MAIL_OPEN, interval=1):
+                timer_harvest.reset()
+                continue
+            if self.appear(self.I_HARVEST_MAIL_TITLE, interval=0.2):
+                while 1:
+                    self.screenshot()
+                    if self.appear_then_click(self.I_HARVEST_MAIL_ALL, interval=2):
+                        timer_harvest.reset()
+                        pass
+                    if self.appear_then_click(self.I_HARVEST_MAIL_CONFIRM, interval=1):
+                        continue
+
+                    # 如果一直出现收取全部,那就说明还在进行中
+                    if self.appear(self.I_HARVEST_MAIL_ALL):
+                        pass
+                    # 如果没有出现 ‘收取全部’ 也没有出现 ‘还未读的邮件’ 那就可以退出了
+                    if not self.appear(self.I_HARVEST_MAIL_ALL) and not self.appear(self.I_HARVEST_MAIL_OPEN):
+                        logger.info('Mail has been harvested')
+                        logger.info('Exit mail')
+                        break
+                    if self.appear_then_click(self.I_HARVEST_MAIL_OPEN, interval=1):
+                        timer_harvest.reset()
+                        continue
+            # 体力
+            if self.appear_then_click(self.I_HARVEST_AP, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
 
 
 
 
             # 红色的关闭
             # 红色的关闭
             if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
             if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
+                timer_harvest.reset()
                 continue
                 continue
 
 
             # 三秒内没有发现任何奖励,退出
             # 三秒内没有发现任何奖励,退出

+ 58 - 0
tasks/TrueOrochi/assets.py

@@ -0,0 +1,58 @@
+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 TrueOrochiAssets: 
+
+
+	# Click Rule Assets
+	# description 
+	C_ST_GREEN_1 = RuleClick(roi_front=(210,395,46,66), roi_back=(210,395,46,66), name="st_green_1")
+	# description 
+	C_ST_GREEN_2 = RuleClick(roi_front=(291,481,46,63), roi_back=(291,481,46,63), name="st_green_2")
+	# description 
+	C_ST_GREEN_3 = RuleClick(roi_front=(459,426,53,59), roi_back=(459,426,53,59), name="st_green_3")
+	# description 
+	C_ST_GREEN_4 = RuleClick(roi_front=(687,391,43,57), roi_back=(687,391,43,57), name="st_green_4")
+	# description 
+	C_ST_GREEN_5 = RuleClick(roi_front=(814,490,41,60), roi_back=(814,490,41,60), name="st_green_5")
+	# description 
+	C_ST_GREEN_6 = RuleClick(roi_front=(921,386,48,59), roi_back=(921,386,48,59), name="st_green_6")
+	# description 
+	C_ST_GREEN_7 = RuleClick(roi_front=(0,0,100,100), roi_back=(0,0,100,100), name="st_green_7")
+	# description 
+	C_ST_GREEN_MAIN = RuleClick(roi_front=(611,541,40,66), roi_back=(611,541,40,66), name="st_green_main")
+
+
+	# Image Rule Assets
+	# 出现真蛇 
+	I_FIND_TS = RuleImage(roi_front=(1,613,100,93), roi_back=(1,613,100,93), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_find_ts.png")
+	# 点击挑战60体力 
+	I_ST_FIRE = RuleImage(roi_front=(960,485,100,100), roi_back=(960,485,100,100), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_fire.png")
+	# 确认挑战 
+	I_ST_FIRE_CONFIRM = RuleImage(roi_front=(671,406,176,53), roi_back=(671,406,176,53), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_fire_confirm.png")
+	# 十个式神的准备 
+	I_ST_FIRE_PREPARE = RuleImage(roi_front=(1118,548,100,100), roi_back=(1118,548,100,100), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_fire_prepare.png")
+	# description 
+	I_ST_AUTO_FALSE = RuleImage(roi_front=(1112,463,33,34), roi_back=(1112,463,33,34), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_auto_false.png")
+	# description 
+	I_ST_AUTO_TRUE = RuleImage(roi_front=(1112,461,34,37), roi_back=(1112,461,34,37), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_auto_true.png")
+	# description 
+	I_ST_GREEN_1 = RuleImage(roi_front=(209,216,22,48), roi_back=(188,192,69,87), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_1.png")
+	# description 
+	I_ST_GREEN_2 = RuleImage(roi_front=(294,311,21,46), roi_back=(273,282,70,91), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_2.png")
+	# description 
+	I_ST_GREEN_3 = RuleImage(roi_front=(473,269,21,49), roi_back=(457,245,56,89), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_3.png")
+	# description 
+	I_ST_GREEN_4 = RuleImage(roi_front=(690,258,27,49), roi_back=(662,235,83,83), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_4.png")
+	# description 
+	I_ST_GREEN_5 = RuleImage(roi_front=(841,335,26,44), roi_back=(814,302,100,100), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_5.png")
+	# description 
+	I_ST_GREEN_6 = RuleImage(roi_front=(930,247,24,47), roi_back=(894,224,100,100), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_green_6.png")
+
+

+ 37 - 0
tasks/TrueOrochi/config.py

@@ -0,0 +1,37 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from pydantic import BaseModel, Field
+from enum import Enum
+from datetime import datetime, time
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase, TimeDelta
+from tasks.Utils.config_enum import ShikigamiClass
+
+class GreenMarkType(str, Enum):
+    LEFT_1 = 'left_1'
+    LEFT_2 = 'left_2'
+    LEFT_3 = 'left_3'
+    LEFT_4 = 'left_4'
+    LEFT_5 = 'left_5'
+    LEFT_6 = 'left_6'
+    MAIN = 'main'
+
+
+
+class TrueOrochiScheduler(Scheduler):
+    priority = Field(default=10, description='priority_help')
+    success_interval: TimeDelta = Field(default=TimeDelta(days=7), description='success_interval_help')
+    failure_interval: TimeDelta = Field(default=TimeDelta(days=1), description='failure_interval_help')
+
+class TrueOrochiConfig(BaseModel):
+    find_true_orochi: bool = Field(default=True, description='find_true_orochi_help')
+    green_enable: bool = Field(default=False, description='green_enable_help')
+    green_mark_type: GreenMarkType = Field(default=GreenMarkType.LEFT_1, description='green_mark_type_help')
+    current_success: int = Field(default=0, description='current_success_help')
+
+class TrueOrochi(ConfigBase):
+    scheduler: TrueOrochiScheduler = Field(default_factory=TrueOrochiScheduler)
+    true_orochi_config: TrueOrochiConfig = Field(default_factory=TrueOrochiConfig)
+

+ 35 - 0
tasks/TrueOrochi/script_task.py

@@ -0,0 +1,35 @@
+# This Python file uses the following encoding: utf-8
+# @author runhey
+# github https://github.com/runhey
+from module.logger import logger
+from module.exception import TaskEnd
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.Component.GeneralBattle.general_battle import GeneralBattle
+from tasks.Component.GeneralInvite.general_invite import GeneralInvite
+from tasks.Component.GeneralRoom.general_room import GeneralRoom
+from tasks.Orochi.script_task import ScriptTask as OrochiScriptTask
+from tasks.GameUi.page import page_main, page_soul_zones
+
+
+class ScriptTask(GameUi, OrochiScriptTask, GeneralBattle, GeneralInvite, GeneralRoom):
+
+    def run(self):
+        config = self.config.ture_orochi
+        self.ui_get_current_page()
+        self.ui_goto(page_soul_zones)
+        self.orochi_enter()
+
+
+    def check_true_orochi(self, screenshot=False) -> bool:
+        """
+        检查是否出现真蛇(要求当前的界面必须是在御魂挑战的界面)
+        :return:
+        """
+        if screenshot:
+            self.screenshot()
+        return self.appear(self.I_FIND_TS)
+
+    def run_true_orochi(self) -> bool:
+        pass
+

+ 50 - 0
tasks/TrueOrochi/st/click.json

@@ -0,0 +1,50 @@
+[
+  {
+    "itemName": "st_green_1",
+    "roiFront": "210,395,46,66",
+    "roiBack": "210,395,46,66",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_2",
+    "roiFront": "291,481,46,63",
+    "roiBack": "291,481,46,63",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_3",
+    "roiFront": "459,426,53,59",
+    "roiBack": "459,426,53,59",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_4",
+    "roiFront": "687,391,43,57",
+    "roiBack": "687,391,43,57",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_5",
+    "roiFront": "814,490,41,60",
+    "roiBack": "814,490,41,60",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_6",
+    "roiFront": "921,386,48,59",
+    "roiBack": "921,386,48,59",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_7",
+    "roiFront": "0,0,100,100",
+    "roiBack": "0,0,100,100",
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_main",
+    "roiFront": "611,541,40,66",
+    "roiBack": "611,541,40,66",
+    "description": "description"
+  }
+]

+ 110 - 0
tasks/TrueOrochi/st/image.json

@@ -0,0 +1,110 @@
+[
+  {
+    "itemName": "find_ts",
+    "imageName": "st_find_ts.png",
+    "roiFront": "1,613,100,93",
+    "roiBack": "1,613,100,93",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "出现真蛇"
+  },
+  {
+    "itemName": "st_fire",
+    "imageName": "st_st_fire.png",
+    "roiFront": "960,485,100,100",
+    "roiBack": "960,485,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击挑战60体力"
+  },
+  {
+    "itemName": "st_fire_confirm",
+    "imageName": "st_st_fire_confirm.png",
+    "roiFront": "671,406,176,53",
+    "roiBack": "671,406,176,53",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "确认挑战"
+  },
+  {
+    "itemName": "st_fire_prepare",
+    "imageName": "st_st_fire_prepare.png",
+    "roiFront": "1118,548,100,100",
+    "roiBack": "1118,548,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "十个式神的准备"
+  },
+  {
+    "itemName": "st_auto_false",
+    "imageName": "st_st_auto_false.png",
+    "roiFront": "1112,463,33,34",
+    "roiBack": "1112,463,33,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_auto_true",
+    "imageName": "st_st_auto_true.png",
+    "roiFront": "1112,461,34,37",
+    "roiBack": "1112,461,34,37",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_1",
+    "imageName": "st_st_green_1.png",
+    "roiFront": "209,216,22,48",
+    "roiBack": "188,192,69,87",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_2",
+    "imageName": "st_st_green_2.png",
+    "roiFront": "294,311,21,46",
+    "roiBack": "273,282,70,91",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_3",
+    "imageName": "st_st_green_3.png",
+    "roiFront": "473,269,21,49",
+    "roiBack": "457,245,56,89",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_4",
+    "imageName": "st_st_green_4.png",
+    "roiFront": "690,258,27,49",
+    "roiBack": "662,235,83,83",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_5",
+    "imageName": "st_st_green_5.png",
+    "roiFront": "841,335,26,44",
+    "roiBack": "814,302,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "st_green_6",
+    "imageName": "st_st_green_6.png",
+    "roiFront": "930,247,24,47",
+    "roiBack": "894,224,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

BIN
tasks/TrueOrochi/st/st_find_ts.png


BIN
tasks/TrueOrochi/st/st_st_auto_false.png


BIN
tasks/TrueOrochi/st/st_st_auto_true.png


BIN
tasks/TrueOrochi/st/st_st_fire.png


BIN
tasks/TrueOrochi/st/st_st_fire_confirm.png


BIN
tasks/TrueOrochi/st/st_st_fire_prepare.png


BIN
tasks/TrueOrochi/st/st_st_green_1.png


BIN
tasks/TrueOrochi/st/st_st_green_2.png


BIN
tasks/TrueOrochi/st/st_st_green_3.png


BIN
tasks/TrueOrochi/st/st_st_green_4.png


BIN
tasks/TrueOrochi/st/st_st_green_5.png


BIN
tasks/TrueOrochi/st/st_st_green_6.png


+ 12 - 0
tasks/ui/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 uiAssets: 
+	pass
+