瀏覽代碼

Merge pull request #41 from runhey/dev

Dev
huangrunheng 3 年之前
父節點
當前提交
ab25ff81ac
共有 100 個文件被更改,包括 1359 次插入 和 200 次删除
  1. 31 1
      config/template.json
  2. 2 0
      dev_tools/README.md
  3. 二進制
      dev_tools/Spyxx/spyxx.exe
  4. 二進制
      dev_tools/Spyxx/spyxx_amd64.exe
  5. 二進制
      dev_tools/Spyxx/spyxxhk.dll
  6. 二進制
      dev_tools/Spyxx/spyxxhk_amd64.dll
  7. 0 11
      dev_tools/ViewWizard2/Settings.ini
  8. 二進制
      dev_tools/ViewWizard2/ViewWizard2.exe
  9. 0 100
      dev_tools/ViewWizard3/Help.txt
  10. 0 35
      dev_tools/ViewWizard3/Set.ini
  11. 二進制
      dev_tools/ViewWizard3/VB6CHS.DLL
  12. 二進制
      dev_tools/ViewWizard3/ViewWizard.exe
  13. 二進制
      dev_tools/ViewWizard3/mscomctl.ocx
  14. 二進制
      dev_tools/ViewWizard3/msvbvm60.dll
  15. 1 1
      dev_tools/assets_extract.py
  16. 9 0
      module/config/config.py
  17. 1 1
      module/config/config_manual.py
  18. 1 1
      module/config/config_menu.py
  19. 2 0
      module/config/config_model.py
  20. 二進制
      module/config/i18n/zh_CN.qm
  21. 8 1
      module/config/i18n/zh_CN.ts
  22. 1 1
      module/config/scheduler.py
  23. 1 1
      module/device/method/window.py
  24. 12 1
      module/gui/context/utils.py
  25. 1 0
      module/gui/qml.qrc
  26. 84 0
      module/gui/qml/Component/Args.qml
  27. 81 0
      module/gui/qml/Content/NotifyTest.qml
  28. 15 8
      module/gui/qml/Page/O_Home.qml
  29. 102 0
      module/notify/notify.py
  30. 2 1
      requirements-in.txt
  31. 2 3
      requirements.txt
  32. 11 11
      script.py
  33. 1 1
      tasks/Component/GeneralBattle/assets.py
  34. 2 2
      tasks/Component/GeneralBattle/finish_click.json
  35. 3 2
      tasks/Component/GeneralBattle/general_battle.py
  36. 5 0
      tasks/Component/GeneralBuff/assets.py
  37. 9 0
      tasks/Component/GeneralBuff/gb/swipe.json
  38. 12 4
      tasks/Component/GeneralBuff/general_buff.py
  39. 2 0
      tasks/Component/ReplaceShikigami/assets.py
  40. 92 0
      tasks/Component/ReplaceShikigami/replace_shikigami.py
  41. 9 0
      tasks/Component/ReplaceShikigami/rs/image.json
  42. 二進制
      tasks/Component/ReplaceShikigami/rs/rs_rs_level_max.png
  43. 21 1
      tasks/Component/config_base.py
  44. 9 2
      tasks/GameUi/game_ui.py
  45. 1 1
      tasks/GameUi/page.py
  46. 87 1
      tasks/KekkaiUtilize/assets.py
  47. 14 2
      tasks/KekkaiUtilize/config.py
  48. 65 0
      tasks/KekkaiUtilize/ku/image.json
  49. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_ap.png
  50. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_assets.png
  51. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png
  52. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_info.png
  53. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_realm.png
  54. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_shirne.png
  55. 二進制
      tasks/KekkaiUtilize/ku/ku_guild_wish.png
  56. 92 0
      tasks/KekkaiUtilize/realm/image.json
  57. 二進制
      tasks/KekkaiUtilize/realm/realm_ap_extract.png
  58. 二進制
      tasks/KekkaiUtilize/realm/realm_box_ap.png
  59. 二進制
      tasks/KekkaiUtilize/realm/realm_box_exp.png
  60. 二進制
      tasks/KekkaiUtilize/realm/realm_card_exp.png
  61. 二進制
      tasks/KekkaiUtilize/realm/realm_exp_extract.png
  62. 二進制
      tasks/KekkaiUtilize/realm/realm_realm_shin.png
  63. 二進制
      tasks/KekkaiUtilize/realm/realm_shi_card.png
  64. 二進制
      tasks/KekkaiUtilize/realm/realm_shi_defense.png
  65. 二進制
      tasks/KekkaiUtilize/realm/realm_shi_grown.png
  66. 二進制
      tasks/KekkaiUtilize/realm/realm_utilize_exp.png
  67. 235 2
      tasks/KekkaiUtilize/script_task.py
  68. 173 0
      tasks/KekkaiUtilize/utilize/image.json
  69. 11 0
      tasks/KekkaiUtilize/utilize/ocr.json
  70. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_add_1.png
  71. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_add_2.png
  72. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_big_3.png
  73. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_big_4.png
  74. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_big_5.png
  75. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_big_6.png
  76. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_confirm_small.png
  77. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_enter_realm.png
  78. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_fish_3.png
  79. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_fish_4.png
  80. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_fish_5.png
  81. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_fish_6.png
  82. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_3.png
  83. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_4.png
  84. 二進制
      tasks/KekkaiUtilize/utilize/utilize_u_taiko_5.png
  85. 二進制
      tasks/KekkaiUtilize/utilize/utilize_utilize_add.png
  86. 二進制
      tasks/KekkaiUtilize/utilize/utilize_utilize_friend_group.png
  87. 二進制
      tasks/KekkaiUtilize/utilize/utilize_utilize_zones_group.png
  88. 4 4
      tasks/Orochi/script_task.py
  89. 2 0
      tasks/Restart/assets.py
  90. 二進制
      tasks/Restart/harvest/harvest_harvest_chat_close.png
  91. 9 0
      tasks/Restart/harvest/image.json
  92. 5 1
      tasks/Restart/login.py
  93. 32 0
      tasks/RyouToppa/assets.py
  94. 33 0
      tasks/RyouToppa/config.py
  95. 8 0
      tasks/RyouToppa/res/click.json
  96. 56 0
      tasks/RyouToppa/res/image.json
  97. 二進制
      tasks/RyouToppa/res/res_guild_orders_rewards.png
  98. 二進制
      tasks/RyouToppa/res/res_ryou_reward.png
  99. 二進制
      tasks/RyouToppa/res/res_ryou_toppa.png
  100. 二進制
      tasks/RyouToppa/res/res_select_ryou_button.png

+ 31 - 1
config/template.json

@@ -12,7 +12,9 @@
     "error": {
       "handle_error": true,
       "save_error": true,
-      "screenshot_length": 1
+      "screenshot_length": 1,
+      "notify_enable": false,
+      "notify_config": "provider: null"
     },
     "optimization": {
       "screenshot_interval": 0.3,
@@ -115,6 +117,34 @@
       "raid_mode": "retreat_four_attack_nine",
       "attack_number": "all"
     },
+    "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
+    },
+    "switch_soul_config": {
+      "enable": false,
+      "switch_group_team": "-1,-1"
+    }
+  },
+  "ryou_toppa": {
+    "scheduler": {
+      "enable": false,
+      "next_run": "2023-01-01 00:00:00",
+      "priority": 5,
+      "success_interval": "01 00:00:00",
+      "failure_interval": "01 00:00:00",
+      "server_update": "09:00:00"
+    },
+    "raid_config": {
+      "raid_mode": "attack_all",
+      "attack_number": "all",
+      "ryou_access": "yes"
+    },
     "general_battle_config": {
       "lock_team_enable": false,
       "preset_enable": false,

+ 2 - 0
dev_tools/README.md

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

二進制
dev_tools/Spyxx/spyxx.exe


二進制
dev_tools/Spyxx/spyxx_amd64.exe


二進制
dev_tools/Spyxx/spyxxhk.dll


二進制
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

二進制
dev_tools/ViewWizard2/ViewWizard2.exe


+ 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

二進制
dev_tools/ViewWizard3/VB6CHS.DLL


二進制
dev_tools/ViewWizard3/ViewWizard.exe


二進制
dev_tools/ViewWizard3/mscomctl.ocx


二進制
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') + ['']

+ 9 - 0
module/config/config.py

@@ -7,6 +7,7 @@ import operator
 import threading
 
 from datetime import datetime
+from cached_property import cached_property
 
 from module.base.filter import Filter
 from module.config.config_updater import ConfigUpdater
@@ -17,6 +18,7 @@ from module.config.config_model import ConfigModel
 from module.config.config_state import ConfigState
 from module.config.scheduler import TaskScheduler
 from module.config.utils import *
+from module.notify.notify import Notifier
 
 from module.exception import RequestHumanTakeover, ScriptError
 from module.logger import logger
@@ -313,6 +315,13 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         scheduler.next_run = next_run
         self.save()
 
+    @cached_property
+    def notifier(self):
+        notifier = Notifier(self.model.script.error.notify_config, enable=self.model.script.error.notify_enable)
+        notifier.config_name = self.config_name.upper()
+        logger.info(f'Notifier: {notifier.config_name}')
+        return notifier
+
 if __name__ == '__main__':
     config = Config(config_name='oas1')
     config.update_scheduler()

+ 1 - 1
module/config/config_manual.py

@@ -10,7 +10,7 @@ class ConfigManual:
     SCHEDULER_PRIORITY = """
         Restart
         >KekkaiUtilize > KekkaiActivation > DemonEncounter
-        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid
+        > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > RealmRaid > RyouToppa
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea
         > ActivityShikigami
         > BondlingFairyland

+ 1 - 1
module/config/config_menu.py

@@ -19,7 +19,7 @@ class ConfigMenu:
         # 刷御魂
         self.menu["Soul Zones"] = ['Orochi', 'Sougenbi', 'FallenSun', 'EternitySea']
         # 日常的任务
-        self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid',
+        self.menu["Daily Task"] = ['AreaBoss', 'GoldYoukai', 'ExperienceYoukai', 'Nian', 'RealmRaid', 'RyouToppa',
                                    'KekkaiUtilize', 'KekkaiActivation', 'DemonEncounter']
         # 活动的任务
         self.menu["Activity Task"] = ['ActivityShikigami']

+ 2 - 0
module/config/config_model.py

@@ -11,6 +11,7 @@ from module.logger import logger
 
 # 导入配置的Python文件
 from tasks.Component.config_base import ConfigBase
+from tasks.RyouToppa.config import RyouToppa
 from tasks.Script.config import Script
 from tasks.Restart.config import Restart
 from tasks.GlobalGame.config import GlobalGame
@@ -54,6 +55,7 @@ class ConfigModel(ConfigBase):
     gold_youkai: GoldYoukai = Field(default_factory=GoldYoukai)
     nian: Nian = Field(default_factory=Nian)
     realm_raid: RealmRaid = Field(default_factory=RealmRaid)
+    ryou_toppa: RyouToppa = Field(default_factory=RyouToppa)
     kekkai_utilize: KekkaiUtilize = Field(default_factory=KekkaiUtilize)
     kekkai_activation: KekkaiActivation = Field(default_factory=KekkaiActivation)
     demon_encounter: DemonEncounter = Field(default_factory=DemonEncounter)

二進制
module/config/i18n/zh_CN.qm


+ 8 - 1
module/config/i18n/zh_CN.ts

@@ -216,6 +216,7 @@
     </message>
 	<message><source>GlobalGame</source><translation>全局游戏设置</translation></message>
 	<message><source>RealmRaid</source><translation>个人突破</translation></message>
+	<message><source>RyouToppa</source><translation>寮突破</translation></message>
 	<message><source>List Rule</source><translation>列表规则</translation></message>
 	<message><source>Activity Task</source><translation>限时活动</translation></message>
 	<message><source>ActivityShikigami</source><translation>当期式神爬塔</translation></message>
@@ -518,5 +519,11 @@ mode_3策略是刷到五个契灵后开始结契,选择高级、中级盘来
 "1,2"表示第一个预设组,第二个队伍
 请使用英文输入法下的逗号
 预设组支持[1-7], 预设队伍支持[1-4]</translation></message>	
-</context>	
+</context>
+<context>
+    <name>Args</name>
+	<message><source>Notify Enable</source><translation>启用消息推送</translation></message>	
+	<message><source>Notify Config</source><translation>推送配置</translation></message>	
+	<message><source>notify_config_help</source><translation>输入为yaml格式,":"冒号后有一个空格,具体请翻阅文档[消息推送]</translation></message>	
+</context>		
 </TS>

+ 1 - 1
module/config/scheduler.py

@@ -26,7 +26,7 @@ class TaskScheduler:
         :param pending:
         :return:
         """
-        if isinstance(rule, ScheduleRule) is False:
+        if rule != ScheduleRule.FILTER and rule != ScheduleRule.FIFO and rule != ScheduleRule.PRIORITY:
             logger.error(f"Invalid rule: {rule}")
             return pending
         if isinstance(pending, list) is False:

+ 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)

+ 12 - 1
module/gui/context/utils.py

@@ -22,7 +22,18 @@ class Utils(QObject):
         """
         return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
 
-
+    @Slot(str, str, str, result="QString")
+    def test_notify(self, _config: str, title: str, content: str) -> bool:
+        from module.notify.notify import Notifier
+        try:
+            notifier = Notifier(_config)
+            if notifier.push(title=title, content=content):
+                return "true"
+            else:
+                return "false"
+        except Exception as e:
+            logger.exception(e)
+            return "false"
 
 
 

+ 1 - 0
module/gui/qml.qrc

@@ -33,5 +33,6 @@
         <file>qml/Component/RuleFile.qml</file>
         <file>qml/Content/ListRule.qml</file>
         <file>qml/Component/RuleFile2.qml</file>
+        <file>qml/Content/NotifyTest.qml</file>
     </qresource>
 </RCC>

+ 84 - 0
module/gui/qml/Component/Args.qml

@@ -106,6 +106,14 @@ Item {
                         return
                     }
                 }
+                else if(arg.type === "multi_line"){
+                    object = multi_line_item.createObject(group_column)
+                    if(object === null){
+                        console.error("can not create component multi_line_item", arg.title)
+                        return
+                    }
+                }
+
 
                 if(object === null){
                     console.error("can not create component ", arg.title)
@@ -452,7 +460,83 @@ Item {
             }
         }
     }
+    Component{
+        id: multi_line_item
+        Item{
+            id: multiLineItem
+            property var modelData: null
+            width: parent.width
+            implicitHeight: string_title.implicitHeight + string_description.implicitHeight
+            height: if(string_text.height > (string_title.implicitHeight + string_description.implicitHeight)){
+                        return string_text.height
+                    }else{
+                        return string_title.implicitHeight + string_description.implicitHeight
+                    }
+
+            Layout.fillHeight: true
+            FluMultilineTextBox{
+                id: string_text
+                anchors{
+                    top: parent.top
+                    topMargin: 2
+                    right: parent.right
+                }
+                placeholderText: ""
+                onEditingFinished: {
+                    if(set_task(multiLineItem.parent.parent.parent.groupName, modelData.name, text)){
+                        showSuccess( qsTr("Successful setting"))
+                    }
+                }
+//                onTextChanged: {
+//                    if(set_task(multiLineItem.parent.parent.parent.groupName, modelData.name, text)){
+//                        showSuccess( qsTr("Successful setting"))
+//                    }
+//                }
+            }
+
+            FluText{
+                // 设置的名称
+                id: string_title
+                anchors{
+                    top: parent.top
+                    left: parent.left
+                    right: string_text.left
+                }
+                text: ""
+                font: FluTextStyle.BodyStrong
+                wrapMode: Text.WrapAnywhere
+                topPadding: 6
+            }
+            FluText{
+                //描述
+                id: string_description
+                anchors{
+                    top: string_title.bottom
+                    left: parent.left
+                }
+                width: string_title.width
+                text: ""
+                font: FluTextStyle.Caption
+                wrapMode: Text.WordWrap
+                topPadding: 6
+                rightPadding: 6
+            }
+            onModelDataChanged: {
+                if(modelData === null){
+                    console.error("string model is null")
+                    return
+                }
+                string_text.text = modelData.value
+                string_text.placeholderText = modelData["default"]
 
+                string_title.text = qsTr(modelData.title)
+                if( typeof modelData.description === 'undefined'){
+                    return
+                }
+                string_description.text = qsTr(modelData.description.replace("\\n","\n"))
+            }
+        }
+    }
     onArgsDataChanged: {
 
     }

+ 81 - 0
module/gui/qml/Content/NotifyTest.qml

@@ -0,0 +1,81 @@
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import FluentUI
+
+
+FluScrollablePage{
+    leftPadding:10
+    rightPadding:10
+    bottomPadding:20
+    spacing: 6
+
+    FluText{
+        text: '消息推送测试'
+        font: FluTextStyle.Title
+    }
+    FluArea{
+        Layout.fillWidth: true
+        height: 500
+        paddings: 10
+
+        ColumnLayout{
+            id: yyyyy
+            spacing: 10
+            anchors{
+                top: parent.top
+                left: parent.left
+            }
+            width: parent.width
+            property int conentWith: 300
+            FluText{
+                text: '推送配置'
+                font: FluTextStyle.BodyStrong
+            }
+            FluMultilineTextBox{
+                id: notifyConfig
+                implicitWidth: yyyyy.conentWith
+                placeholderText: 'Please input your notify config'
+                text: 'provider: null'
+
+            }
+            FluText{
+                text: '请翻阅文档[消息推送]进行填写上方的参数设置。 \n请填写下方的Title和Conent后点击发送消息测试 \n注意这并不会在当前界面有任何反馈'
+            }
+            FluText{
+                text: '主题'
+                font: FluTextStyle.BodyStrong
+            }
+            FluTextBox{
+                id: notifyTitle
+                implicitWidth: yyyyy.conentWith
+                placeholderText: 'Title'
+                text: 'TEST TITLE'
+            }
+            FluText{
+                text: '内容'
+                font: FluTextStyle.BodyStrong
+            }
+            FluMultilineTextBox{
+                id: notifyConent
+                implicitWidth: yyyyy.conentWith
+                placeholderText: 'Conent'
+                text: 'TEST conent'
+            }
+            FluFilledButton{
+                id: testSend
+                implicitWidth: yyyyy.conentWith
+                text: '测试发送'
+                onClicked: {
+                    const result = utils.test_notify(notifyConfig.text, notifyTitle.text, notifyConent.text)
+                    console.debug(result)
+                    if(result === "true"){
+                        showSuccess('Successful')
+                    }else{
+                        showError('Failure')
+                    }
+                }
+            }
+        }
+    }
+}

+ 15 - 8
module/gui/qml/Page/O_Home.qml

@@ -12,20 +12,27 @@ SplitPanel{
     property string configName: ""
 
     onTitleChanged: {
-        if(title === qsTr("Home")){
-            var comp = Qt.createComponent("../../qml/Page/Home.qml")
-            if (comp.status === Component.Ready) {
-                setLoader(comp)
-            }
-        }else if(title === qsTr("Update")){
-            var updater = Qt.createComponent("../../qml/Page/Update.qml")
+        if(title === "Home"){
+//            const comp = Qt.createComponent("../../qml/Page/Home.qml")
+//            if (comp.status === Component.Ready) {
+//                setLoader(comp)
+
+//            }
+            showDefalut()
+        }else if(title === "Update"){
+            const updater = Qt.createComponent("../../qml/Page/Update.qml")
             if (updater.status === Component.Ready) {
                 setLoader(updater)
             }
+        }else if(title === "NotifyTest"){
+            const notify_test = Qt.createComponent("../../qml/Content/NotifyTest.qml")
+            if (notify_test.status === Component.Ready) {
+                setLoader(notify_test)
+            }
         }
     }
     Component.onCompleted:{
-        var data = { "Home":[], 'Update': []}
+        var data = { "Home":[], 'Update': [], 'NotifyTest':[]}
         create(data)
 
         var comp = Qt.createComponent("../../qml/Page/Home.qml")

+ 102 - 0
module/notify/notify.py

@@ -1,3 +1,105 @@
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # github https://github.com/runhey
+
+import onepush.core
+import yaml
+from onepush import get_notifier
+from onepush.core import Provider
+from onepush.exceptions import OnePushException
+from onepush.providers.custom import Custom
+from requests import Response
+
+from module.logger import logger
+onepush.core.log = logger
+
+
+class Notifier:
+    def __init__(self, _config: str, enable: bool=False) -> None:
+        self.config_name: str = ""
+        self.enable: bool = enable
+
+        if not self.enable:
+            return
+        try:
+            config = {}
+            for item in yaml.safe_load_all(_config):
+                config.update(item)
+        except Exception:
+            logger.error("Fail to load onepush config, skip sending")
+            return
+        self.config = config
+        try:
+            # 获取provider
+            self.provider_name: str = self.config.pop("provider", None)
+            if self.provider_name is None:
+                logger.info("No provider specified, skip sending")
+                return
+            # 获取notifier
+            self.notifier: Provider = get_notifier(self.provider_name)
+            # 获取notifier的必填参数
+            self.required: list[str] = self.notifier.params["required"]
+        except OnePushException:
+            logger.exception("Init notifier failed")
+            return
+        except Exception as e:
+            logger.exception(e)
+            return
+
+    def push(self, **kwargs) -> bool:
+        if not self.enable:
+            return False
+        # 更新配置
+        kwargs["title"] = f"{self.config_name} {kwargs['title']}"
+        self.config.update(kwargs)
+        # pre check
+        for key in self.required:
+            if key not in self.config:
+                logger.warning(
+                    f"Notifier {self.notifier} require param '{key}' but not provided"
+                )
+
+
+        if isinstance(self.notifier, Custom):
+            if "method" not in self.config or self.config["method"] == "post":
+                self.config["datatype"] = "json"
+            if not ("data" in self.config or isinstance(self.config["data"], dict)):
+                self.config["data"] = {}
+            if "title" in kwargs:
+                self.config["data"]["title"] = kwargs["title"]
+            if "content" in kwargs:
+                self.config["data"]["content"] = kwargs["content"]
+
+        if self.provider_name.lower() == "gocqhttp":
+            access_token = self.config.get("access_token")
+            if access_token:
+                self.config["token"] = access_token
+
+
+        try:
+            resp = self.notifier.notify(**self.config)
+            if isinstance(resp, Response):
+                if resp.status_code != 200:
+                    logger.warning("Push notify failed!")
+                    logger.warning(f"HTTP Code:{resp.status_code}")
+                    return False
+                else:
+                    if self.provider_name.lower() == "gocqhttp":
+                        return_data: dict = resp.json()
+                        if return_data["status"] == "failed":
+                            logger.warning("Push notify failed!")
+                            logger.warning(
+                                f"Return message:{return_data['wording']}")
+                            return False
+        except OnePushException:
+            logger.exception("Push notify failed")
+            return False
+        except Exception as e:
+            logger.exception(e)
+            return False
+
+        logger.info("Push notify success")
+        return True
+
+
+

+ 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

+ 11 - 11
script.py

@@ -69,8 +69,6 @@ class Script:
             logger.exception(e)
             exit(1)
 
-
-
     @cached_property
     def checker(self):
         """
@@ -325,6 +323,7 @@ class Script:
             self.save_error_log()
             logger.warning(f'Game stuck, {self.device.package} will be restarted in 10 seconds')
             logger.warning('If you are playing by hand, please stop Alas')
+            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> GameStuckError or GameTooManyClickError")
             self.config.task_call('Restart')
             self.device.sleep(10)
             return False
@@ -338,24 +337,25 @@ class Script:
             return False
         except GamePageUnknownError:
             logger.info('Game server may be under maintenance or network may be broken, check server status now')
-            self.checker.check_now()
-            if self.checker.is_available():
-                logger.critical('Game page unknown')
-                self.save_error_log()
-                exit(1)
-            else:
-                self.checker.wait_until_available()
-                return False
+            # 这个还不重要 留着坑填
+            logger.critical('Game page unknown')
+            self.save_error_log()
+            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> GamePageUnknownError")
+            exit(1)
+            return False
         except ScriptError as e:
             logger.critical(e)
             logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
+            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> ScriptError")
             exit(1)
         except RequestHumanTakeover:
             logger.critical('Request human takeover')
+            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> RequestHumanTakeover")
             exit(1)
         except Exception as e:
             logger.exception(e)
             self.save_error_log()
+            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> Exception occured")
             exit(1)
 
     def loop(self):
@@ -427,7 +427,7 @@ class Script:
             elif self.config.script.error.handle_error:
                 # self.config.task_delay(success=False)
                 del_cached_property(self, 'config')
-                self.checker.check_now()
+                # self.checker.check_now()
                 continue
             else:
                 break

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

@@ -18,7 +18,7 @@ class GeneralBattleAssets:
 	# description 
 	C_WIN_3 = RuleClick(roi_front=(1059,114,206,468), roi_back=(1059,114,206,468), name="win_3")
 	# description 
-	C_REWARD_1 = RuleClick(roi_front=(546,546,385,144), roi_back=(546,546,385,144), name="reward_1")
+	C_REWARD_1 = RuleClick(roi_front=(606,603,325,87), roi_back=(606,603,325,87), name="reward_1")
 	# description 
 	C_REWARD_2 = RuleClick(roi_front=(25,134,224,472), roi_back=(25,134,224,472), name="reward_2")
 	# description 

+ 2 - 2
tasks/Component/GeneralBattle/finish_click.json

@@ -19,8 +19,8 @@
   },
   {
     "itemName": "reward_1",
-    "roiFront": "546,546,385,144",
-    "roiBack": "546,546,385,144",
+    "roiFront": "606,603,325,87",
+    "roiBack": "606,603,325,87",
     "description": "description"
   },
   {

+ 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")
 
         # 选择预设组

+ 5 - 0
tasks/Component/GeneralBuff/assets.py

@@ -44,3 +44,8 @@ class GeneralBuffAssets:
 	O_EXP_100 = RuleOcr(roi=(421,127,342,388), area=(0,0,100,100), mode="Full", method="Default", keyword="战斗胜利获得的经验增加100%", name="exp_100")
 
 
+	# Swipe Rule Assets
+	# description 
+	S_BUFF_UP = RuleSwipe(roi_front=(397,124,456,35), roi_back=(447,457,386,37), mode="default", name="buff_up")
+
+

+ 9 - 0
tasks/Component/GeneralBuff/gb/swipe.json

@@ -0,0 +1,9 @@
+[
+  {
+    "itemName": "buff_up",
+    "roiFront": "397,124,456,35",
+    "roiBack": "447,457,386,37",
+    "mode": "default",
+    "description": "description"
+  }
+]

+ 12 - 4
tasks/Component/GeneralBuff/general_buff.py

@@ -28,6 +28,14 @@ class GeneralBuff(BaseTask, GeneralBuffAssets):
             if self.appear_then_click(self.I_BUFF_1, interval=2):
                 continue
 
+        check_image = self.I_AWAKE
+        while 1:
+            self.screenshot()
+            if self.appear(check_image):
+                break
+
+            self.swipe(self.S_BUFF_UP, interval=2)
+
     def close_buff(self):
         """
         关闭buff的总界面, 但是要确保buff界面已经打开了
@@ -281,10 +289,10 @@ if __name__ == '__main__':
     t = GeneralBuff(c, d)
 
     t.open_buff()
-    t.screenshot()
-
-    t.awake(is_open=True)
-    t.soul(is_open=True)
+    # t.screenshot()
+    #
+    # t.awake(is_open=True)
+    # t.soul(is_open=True)
     # t.gold_50(is_open=False)
     # t.gold_100(is_open=False)
     # t.exp_50(is_open=False)

+ 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": "检测到已经满级了"
   }
 ]

二進制
tasks/Component/ReplaceShikigami/rs/rs_rs_level_max.png


+ 21 - 1
tasks/Component/config_base.py

@@ -1,9 +1,12 @@
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # github https://github.com/runhey
-
+from typing import Any
+from collections.abc import Callable, Generator
 from datetime import timedelta
+
 from pydantic import BaseModel, datetime_parse
+from pydantic.fields import ModelField
 
 
 
@@ -28,3 +31,20 @@ class ConfigBase(BaseModel):
 
 
 
+class MultiLine(str):
+    # @classmethod
+    # def __get_validators__(cls) -> Generator[Callable, None, None]:
+    #     yield cls.validate
+    #
+    # @classmethod
+    # def validate(cls, value: str, field: ModelField):
+    #     return cls(value)
+
+    @classmethod
+    def __modify_schema__(
+        cls, field_schema: dict[str, Any], field: ModelField | None
+    ):
+        if field:
+            field_schema['type'] = 'multi_line'
+
+

+ 9 - 2
tasks/GameUi/game_ui.py

@@ -26,7 +26,10 @@ class GameUi(BaseTask, GameUiAssets):
                 # 庭院里面的
                 page_shikigami_records, page_onmyodo, page_friends, page_daily, page_mall, page_guild, page_team, page_collection
                 ]
-
+    ui_close = [GameUiAssets.I_BACK_BLUE, GameUiAssets.I_BACK_YOLLOW, GameUiAssets.I_BACK_Y, GameUiAssets.I_BACK_MALL,
+                GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY, GameUiAssets.I_BACK_BL,
+                GameUiAssets.I_BONDLING_GOTO_EXPLORATION, GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION, GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, GameUiAssets.I_SUMMON_GOTO_MAIN
+                ]
     def home_explore(self) -> bool:
         """
         使用ocr识别到探索按钮并点击
@@ -116,7 +119,11 @@ class GameUi(BaseTask, GameUiAssets):
                     logger.attr("UI", page.name)
                     self.ui_current = page
                     return page
-
+            # Try to close unknown page
+            for close in self.ui_close:
+                if self.appear_then_click(close, interval=1):
+                    logger.info('Trying to switch to supported page')
+                    timeout = Timer(10, count=20).start()
             # Unknown page but able to handle
             # logger.info("Unknown ui page")
             # if self.appear_then_click(GOTO_MAIN, offset=(30, 30), interval=2) or self.ui_additional():

+ 1 - 1
tasks/GameUi/page.py

@@ -132,7 +132,7 @@ page_daily.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
 # 商店 mall
 page_mall = Page(G.I_CHECK_MALL)
-page_mall.link(button=G.I_BACK_Y, destination=page_main)
+page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 # 阴阳寮 guild
 page_guild = Page(G.I_CHECK_GUILD)

+ 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": "领取寮资金"
+  }
+]

二進制
tasks/KekkaiUtilize/ku/ku_guild_ap.png


二進制
tasks/KekkaiUtilize/ku/ku_guild_assets.png


二進制
tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png


二進制
tasks/KekkaiUtilize/ku/ku_guild_info.png


二進制
tasks/KekkaiUtilize/ku/ku_guild_realm.png


二進制
tasks/KekkaiUtilize/ku/ku_guild_shirne.png


二進制
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": "提取"
+  }
+]

二進制
tasks/KekkaiUtilize/realm/realm_ap_extract.png


二進制
tasks/KekkaiUtilize/realm/realm_box_ap.png


二進制
tasks/KekkaiUtilize/realm/realm_box_exp.png


二進制
tasks/KekkaiUtilize/realm/realm_card_exp.png


二進制
tasks/KekkaiUtilize/realm/realm_exp_extract.png


二進制
tasks/KekkaiUtilize/realm/realm_realm_shin.png


二進制
tasks/KekkaiUtilize/realm/realm_shi_card.png


二進制
tasks/KekkaiUtilize/realm/realm_shi_defense.png


二進制
tasks/KekkaiUtilize/realm/realm_shi_grown.png


二進制
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": "这个寄养的剩余时间"
+  }
+]

二進制
tasks/KekkaiUtilize/utilize/utilize_u_add_1.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_add_2.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_big_3.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_big_4.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_big_5.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_big_6.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_confirm_small.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_enter_realm.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_fish_3.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_fish_4.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_fish_5.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_fish_6.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_taiko_3.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_taiko_4.png


二進制
tasks/KekkaiUtilize/utilize/utilize_u_taiko_5.png


二進制
tasks/KekkaiUtilize/utilize/utilize_utilize_add.png


二進制
tasks/KekkaiUtilize/utilize/utilize_utilize_friend_group.png


二進制
tasks/KekkaiUtilize/utilize/utilize_utilize_zones_group.png


+ 4 - 4
tasks/Orochi/script_task.py

@@ -53,7 +53,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         else:
             self.set_next_run('Orochi', finish=False, success=False)
 
-        raise TaskEnd
+        # raise TaskEnd
 
 
 
@@ -264,6 +264,9 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         while 1:
             self.screenshot()
 
+            if not is_in_orochi():
+                continue
+
             if self.current_count >= self.limit_count:
                 logger.info('Orochi count limit out')
                 break
@@ -271,9 +274,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                 logger.info('Orochi time limit out')
                 break
 
-            if not is_in_orochi():
-                continue
-
             # 点击挑战
             while 1:
                 self.screenshot()

+ 2 - 0
tasks/Restart/assets.py

@@ -33,6 +33,8 @@ class RestartAssets:
 	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")
+	# 打开聊天频道会自动关闭 
+	I_HARVEST_CHAT_CLOSE = RuleImage(roi_front=(639,309,35,100), roi_back=(639,309,35,100), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_chat_close.png")
 
 
 	# Image Rule Assets

二進制
tasks/Restart/harvest/harvest_harvest_chat_close.png


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

@@ -97,5 +97,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "harvest_chat_close",
+    "imageName": "harvest_harvest_chat_close.png",
+    "roiFront": "639,309,35,100",
+    "roiBack": "639,309,35,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "打开聊天频道会自动关闭"
   }
 ]

+ 5 - 1
tasks/Restart/login.py

@@ -117,7 +117,11 @@ class LoginHandler(BaseTask, RestartAssets):
                 timer_harvest.reset()
                 continue
             # 获得奖励
-            if self.appear_then_click(self.I_UI_AWARD, interval=1):
+            if self.appear_then_click(self.I_UI_AWARD, interval=0.2):
+                timer_harvest.reset()
+                continue
+            # 偶尔会打开到聊天频道
+            if self.appear_then_click(self.I_HARVEST_CHAT_CLOSE, interval=1):
                 timer_harvest.reset()
                 continue
 

+ 32 - 0
tasks/RyouToppa/assets.py

@@ -0,0 +1,32 @@
+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 RyouToppaAssets: 
+
+
+	# Click Rule Assets
+	# 选择第一个寮 
+	C_SELECT_FIRST_RYOU = RuleClick(roi_front=(1148,138,21,22), roi_back=(1148,138,21,22), name="select_first_ryou")
+
+
+	# Image Rule Assets
+	# 寮突 
+	I_RYOU_TOPPA = RuleImage(roi_front=(1191,352,78,116), roi_back=(1191,352,78,116), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_toppa.png")
+	# 寮突选择阴阳寮按钮 
+	I_SELECT_RYOU_BUTTON = RuleImage(roi_front=(560,577,156,46), roi_back=(560,577,156,46), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_select_ryou_button.png")
+	# 开始寮突按钮 
+	I_START_TOPPA_BUTTON = RuleImage(roi_front=(812,497,171,55), roi_back=(812,497,171,55), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_start_toppa_button.png")
+	# 寮击破奖励 
+	I_RYOU_REWARD = RuleImage(roi_front=(134,417,241,40), roi_back=(134,417,241,40), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_reward.png")
+	# 勋章奖励标题 
+	I_GUILD_ORDERS_REWARDS = RuleImage(roi_front=(1123,31,115,56), roi_back=(1123,31,115,56), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_guild_orders_rewards.png")
+	# 攻破阴阳寮 
+	I_SUCCESS_PENETRATION = RuleImage(roi_front=(206,149,100,100), roi_back=(206,149,100,100), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_success_penetration.png")
+
+

+ 33 - 0
tasks/RyouToppa/config.py

@@ -0,0 +1,33 @@
+from pydantic import BaseModel, Field
+from enum import Enum
+from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
+from tasks.Component.config_base import ConfigBase
+from tasks.Component.config_scheduler import Scheduler
+
+
+class RaidMode(str, Enum):
+    ATTACK_ALL = 'attack_all'
+
+
+class AttackNumber(str, Enum):
+    ALL = 'all'
+
+
+class HaveManageAccess(str, Enum):
+    YES = 'yes'
+    NO = 'no'
+
+
+class RaidConfig(BaseModel):
+    raid_mode: RaidMode = Field(title='Raid Mode', default=RaidMode.ATTACK_ALL,
+                                description='raid_mode_help')
+    attack_number: AttackNumber = Field(title='Attack Number', default=AttackNumber.ALL,
+                                        description='')
+    ryou_access: HaveManageAccess = Field(title='Ryou Access', default=HaveManageAccess.YES,
+                                          description='是否是寮管理')
+
+
+class RyouToppa(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    raid_config: RaidConfig = Field(default_factory=RaidConfig)
+    general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)

+ 8 - 0
tasks/RyouToppa/res/click.json

@@ -0,0 +1,8 @@
+[
+  {
+    "itemName": "select_first_ryou",
+    "roiFront": "1148,138,21,22",
+    "roiBack": "1148,138,21,22",
+    "description": "选择第一个寮"
+  }
+]

+ 56 - 0
tasks/RyouToppa/res/image.json

@@ -0,0 +1,56 @@
+[
+  {
+    "itemName": "ryou_toppa",
+    "imageName": "res_ryou_toppa.png",
+    "roiFront": "1191,352,78,116",
+    "roiBack": "1191,352,78,116",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮突"
+  },
+  {
+    "itemName": "select_ryou_button",
+    "imageName": "res_select_ryou_button.png",
+    "roiFront": "560,577,156,46",
+    "roiBack": "560,577,156,46",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮突选择阴阳寮按钮"
+  },
+  {
+    "itemName": "start_toppa_button",
+    "imageName": "res_start_toppa_button.png",
+    "roiFront": "812,497,171,55",
+    "roiBack": "812,497,171,55",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "开始寮突按钮"
+  },
+  {
+    "itemName": "ryou_reward",
+    "imageName": "res_ryou_reward.png",
+    "roiFront": "134,417,241,40",
+    "roiBack": "134,417,241,40",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮击破奖励"
+  },
+  {
+    "itemName": "guild_orders_rewards",
+    "imageName": "res_guild_orders_rewards.png",
+    "roiFront": "1123,31,115,56",
+    "roiBack": "1123,31,115,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "勋章奖励标题"
+  },
+  {
+    "itemName": "success_penetration",
+    "imageName": "res_success_penetration.png",
+    "roiFront": "206,149,100,100",
+    "roiBack": "206,149,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "攻破阴阳寮"
+  }
+]

二進制
tasks/RyouToppa/res/res_guild_orders_rewards.png


二進制
tasks/RyouToppa/res/res_ryou_reward.png


二進制
tasks/RyouToppa/res/res_ryou_toppa.png


二進制
tasks/RyouToppa/res/res_select_ryou_button.png


Some files were not shown because too many files changed in this diff