ソースを参照

Merge pull request #732 from runhey/dev

Dev
huangrunheng 1 年間 前
親
コミット
f5a5723da1
74 ファイル変更、741 行追加、152 行削除
  1. 1 1
      module/atom/image.py
  2. 1 9
      module/config/config.py
  3. 1 1
      module/config/config_manual.py
  4. 1 1
      module/config/config_menu.py
  5. 9 3
      module/config/config_model.py
  6. 2 2
      tasks/AbyssShadows/assets.py
  7. 13 1
      tasks/AbyssShadows/config.py
  8. 9 9
      tasks/AbyssShadows/res/image.json
  9. BIN
      tasks/AbyssShadows/res/res_equipping.png
  10. 146 37
      tasks/AbyssShadows/script_task.py
  11. BIN
      tasks/ActivityShikigami/as/as_antivity_win.png
  12. BIN
      tasks/ActivityShikigami/as/as_battle.png
  13. BIN
      tasks/ActivityShikigami/as/as_battle_org.png
  14. BIN
      tasks/ActivityShikigami/as/as_fire.png
  15. BIN
      tasks/ActivityShikigami/as/as_fire_org.png
  16. BIN
      tasks/ActivityShikigami/as/as_shi.png
  17. BIN
      tasks/ActivityShikigami/as/as_shi_org.png
  18. 2 2
      tasks/ActivityShikigami/as/image.json
  19. 1 1
      tasks/ActivityShikigami/assets.py
  20. 26 19
      tasks/ActivityShikigami/script_task.py
  21. 2 0
      tasks/AreaBoss/assets.py
  22. BIN
      tasks/AreaBoss/res/ab_num_challenge_rail.png
  23. 9 0
      tasks/AreaBoss/res/image.json
  24. 5 5
      tasks/AreaBoss/script_task.py
  25. 4 2
      tasks/Component/BaseActivity/config_activity.py
  26. 13 0
      tasks/Component/Costume/assets.py
  27. 2 0
      tasks/Component/Costume/config.py
  28. 10 0
      tasks/Component/Costume/costume_base.py
  29. 3 3
      tasks/Component/Costume/costume_test.py
  30. 47 0
      tasks/Component/Costume/main11/image.json
  31. BIN
      tasks/Component/Costume/main11/main11_check_main_11.png
  32. BIN
      tasks/Component/Costume/main11/main11_main_goto_exploration_11.png
  33. BIN
      tasks/Component/Costume/main11/main11_main_goto_summon_11.png
  34. BIN
      tasks/Component/Costume/main11/main11_main_goto_town_11.png
  35. BIN
      tasks/Component/Costume/main11/main11_pet_house_11.png
  36. 10 1
      tasks/Component/CostumeBattle/assets.py
  37. BIN
      tasks/Component/CostumeBattle/battle10/battle10_exit_10.png
  38. BIN
      tasks/Component/CostumeBattle/battle10/battle10_friends_10.png
  39. BIN
      tasks/Component/CostumeBattle/battle10/battle10_local_10.png
  40. 29 0
      tasks/Component/CostumeBattle/battle10/image.json
  41. 1 1
      tasks/Component/CostumeBattle/battle7/image.json
  42. 3 3
      tasks/Component/GeneralBattle/general_battle.py
  43. 15 1
      tasks/Component/config_base.py
  44. 1 1
      tasks/FloatParade/assets.py
  45. BIN
      tasks/FloatParade/fp/fp_fp_getall0.png
  46. BIN
      tasks/FloatParade/fp/fp_fp_getall1.png
  47. 2 2
      tasks/FloatParade/fp/image.json
  48. 1 1
      tasks/GameUi/assets.py
  49. BIN
      tasks/GameUi/page/page_check_mall.png
  50. 2 2
      tasks/GameUi/page/page_img_3.json
  51. 17 0
      tasks/GuildBanquet/assets.py
  52. 43 0
      tasks/GuildBanquet/config.py
  53. 11 0
      tasks/GuildBanquet/res/image.json
  54. BIN
      tasks/GuildBanquet/res/res_flag.png
  55. 202 0
      tasks/GuildBanquet/script_task.py
  56. 4 2
      tasks/HeroTest/script_task.py
  57. 7 0
      tasks/Hyakkiyakou/config.py
  58. 1 1
      tasks/Hyakkiyakou/script_task.py
  59. 6 3
      tasks/Hyakkiyakou/slave/hya_device.py
  60. 4 4
      tasks/RealmRaid/script_task.py
  61. 2 0
      tasks/Restart/assets.py
  62. 5 0
      tasks/Restart/login.py
  63. 9 0
      tasks/Restart/login/image.json
  64. BIN
      tasks/Restart/login/login_create_account.png
  65. 3 3
      tasks/RichMan/assets.py
  66. 1 1
      tasks/RichMan/guild.py
  67. 3 1
      tasks/RichMan/mall/scales.py
  68. 3 3
      tasks/RichMan/mall/scales/ocr.json
  69. 1 1
      tasks/Script/config_device.py
  70. 5 0
      tasks/TrueOrochi/assets.py
  71. 1 1
      tasks/TrueOrochi/config.py
  72. 27 21
      tasks/TrueOrochi/script_task.py
  73. 11 0
      tasks/TrueOrochi/st/ocr.json
  74. 4 3
      tasks/WantedQuests/script_task.py

+ 1 - 1
module/atom/image.py

@@ -74,7 +74,7 @@ class RuleImage:
         if height != self.roi_front[3] or width != self.roi_front[2]:
             self.roi_front[2] = width
             self.roi_front[3] = height
-            logger.info(f"roi_front size changed to {width}x{height}")
+            logger.info(f"{self.name} roi_front size changed to {width}x{height}")
 
     def load_kp_des(self) -> None:
         if self._kp is not None and self._des is not None:

+ 1 - 9
module/config/config.py

@@ -290,11 +290,6 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         :param finish: 是完成任务后的时间为基准还是开始任务的时间为基准
         :return:
         """
-        # 获取真蛇成功次数
-        global current_success, true_orochi_config
-        if task == 'TrueOrochi':
-            current_success = self.model.true_orochi.true_orochi_config.current_success
-
         # 加载配置文件
         self.reload()
         # 任务预处理
@@ -344,7 +339,7 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         run = min(run).replace(microsecond=0)
         next_run = run
 
-        if server and hasattr(scheduler, 'server_update') and target is None:
+        if server and hasattr(scheduler, 'server_update'):
             # 加入随机延迟时间
             float_seconds = (scheduler.float_time.hour * 3600 +
                              scheduler.float_time.minute * 60 +
@@ -371,9 +366,6 @@ class Config(ConfigState, ConfigManual, ConfigWatcher, ConfigMenu):
         self.lock_config.acquire()
         try:
             scheduler.next_run = next_run
-            if task == 'true_orochi':
-                true_orochi_config = getattr(task_object, 'true_orochi_config', None)
-                true_orochi_config.current_success = current_success
             self.save()
         finally:
             self.lock_config.release()

+ 1 - 1
module/config/config_manual.py

@@ -11,7 +11,7 @@ class ConfigManual:
         Restart > SoulsTidy
         > KekkaiUtilize > KekkaiActivation > DemonEncounter
         > AreaBoss > GoldYoukai > ExperienceYoukai > Nian > Tako > RealmRaid > RyouToppa > DailyTrifles > Exploration
-        > Dokan > AbyssShadows > Hunt 
+        > Dokan > AbyssShadows > Hunt > GuildBanquet
         > Orochi > OrochiMoans > OrochiJudgement > Sougenbi > FallenSun > EternitySea > SixRealms
         > ActivityShikigami > WantedQuests
         > BondlingFairyland > EvoZone > GoryouRealm > HeroTest

+ 1 - 1
module/config/config_menu.py

@@ -36,7 +36,7 @@ class ConfigMenu:
         ]
         # 阴阳寮
         self.menu["Guild"] = ['KekkaiUtilize', 'KekkaiActivation', 'RealmRaid', 'RyouToppa', 'Dokan', 'CollectiveMissions',
-                              'Hunt' , 'AbyssShadows']
+                              'Hunt' , 'AbyssShadows', 'GuildBanquet']
         # 每周任务
         self.menu["Weekly Task"] = ['TrueOrochi', 'RichMan', 'Secret', 'WeeklyTrifles', 'MysteryShop', 'Duel']
         # 活动的任务

+ 9 - 3
module/config/config_model.py

@@ -46,6 +46,7 @@ from tasks.RealmRaid.config import RealmRaid
 from tasks.CollectiveMissions.config import CollectiveMissions
 from tasks.Hunt.config import Hunt
 from tasks.AbyssShadows.config import AbyssShadows
+from tasks.GuildBanquet.config import GuildBanquet
 
 # 这一部分是活动的配置-----------------------------------------------------------------------------------------------------
 from tasks.ActivityShikigami.config import ActivityShikigami
@@ -137,7 +138,7 @@ class ConfigModel(ConfigBase):
     hunt: Hunt = Field(default_factory=Hunt)
     dokan: Dokan = Field(default_factory=Dokan)
     abyss_shadows: AbyssShadows = Field(default_factory=AbyssShadows)
-
+    guild_banquet: GuildBanquet = Field(default_factory=GuildBanquet)
 
     def __init__(self, config_name: str=None) -> None:
         """
@@ -307,6 +308,10 @@ class ConfigModel(ConfigBase):
             # 将 groups的参数,同导出的json一起合并, 用于前端显示
             result = []
             for key, value in groups["properties"].items():
+                # deal with exclude 
+                if key in jsons and jsons[key] == 0xABCDEF:
+                    continue
+
                 item = {}
                 item["name"] = key
                 item["title"] = value["title"] if "title" in value else inflection.underscore(key)
@@ -329,7 +334,7 @@ class ConfigModel(ConfigBase):
         groups_value = groups.copy()
 
         result: dict[str, list] = {}
-        for key, value in task.model_dump().items():
+        for key, value in task.model_dump(context={'hide': True}).items():
             if key not in groups:
                 for group_name in groups.keys():
                     if group_name in key:
@@ -435,4 +440,5 @@ if __name__ == "__main__":
         print(e)
         c = ConfigModel()
 
-    c.script_set_arg('Duel', 'test_list_2', 'switch_all_soul', 'false')
+    print(c.script_task('GuildBanquet'))
+

+ 2 - 2
tasks/AbyssShadows/assets.py

@@ -73,8 +73,6 @@ class AbyssShadowsAssets:
 	# 前往 
 	I_ABYSS_GOTO_ENEMY = RuleImage(roi_front=(1120,610,75,45), roi_back=(1120,610,75,45), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_abyss_goto_enemy.png")
 	# description 
-	I_CHANGE_AREA = RuleImage(roi_front=(993,610,63,61), roi_back=(993,610,63,61), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_change_area.png")
-	# description 
 	I_ENSURE_BUTTON = RuleImage(roi_front=(672,405,169,55), roi_back=(672,405,169,55), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_ensure_button.png")
 	# 进攻中 
 	I_IS_ATTACK = RuleImage(roi_front=(586,62,73,27), roi_back=(586,62,73,27), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_is_attack.png")
@@ -90,6 +88,8 @@ class AbyssShadowsAssets:
 	I_DRAGON_AREA = RuleImage(roi_front=(584,15,111,34), roi_back=(584,15,111,34), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_dragon_area.png")
 	# description 
 	I_WAIT_TO_START = RuleImage(roi_front=(588,64,70,26), roi_back=(588,64,70,26), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_wait_to_start.png")
+	# description 
+	I_EQUIPPING = RuleImage(roi_front=(1126,545,100,83), roi_back=(1126,545,100,83), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_equipping.png")
 
 
 	# List Rule Assets

+ 13 - 1
tasks/AbyssShadows/config.py

@@ -5,6 +5,10 @@
 # github    https://github.com/roarhill/oas
 
 from pydantic import BaseModel, Field
+from pygments.lexer import default
+from scripts.regsetup import description
+from sympy.testing.pytest import Failed
+
 from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
 from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 from tasks.Component.config_base import ConfigBase, Time
@@ -16,8 +20,16 @@ class AbyssShadowsTime(ConfigBase):
     custom_run_time_saturday: Time = Field(default=Time(hour=19, minute=0, second=0))
     custom_run_time_sunday: Time = Field(default=Time(hour=19, minute=0, second=0))
 
+class AbyssShadowsCombatTime(BaseModel):
+    # 设置战斗时间
+    CombatTime_enable: bool = Field(default=False, description="开启智能伤害")
+    boss_combat_time: int = Field(default=60, description="以秒为单位设置首领战斗时间,请合理设置")
+    general_combat_time: int = Field(default=60, description="以秒为单位设置副将战斗时间,请合理设置")
+    elite_combat_time: int = Field(default=60, description="以秒为单位设置精英战斗时间,请合理设置")
+
 class AbyssShadows(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     abyss_shadows_time: AbyssShadowsTime = Field(default_factory=AbyssShadowsTime)
+    abyss_shadows_combat_time: AbyssShadowsCombatTime = Field(default_factory=AbyssShadowsCombatTime)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
-    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)

+ 9 - 9
tasks/AbyssShadows/res/image.json

@@ -125,15 +125,6 @@
     "threshold": 0.8,
     "description": "前往"
   },
-  {
-    "itemName": "change_area",
-    "imageName": "res_change_area.png",
-    "roiFront": "993,610,63,61",
-    "roiBack": "993,610,63,61",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
     "itemName": "ensure_button",
     "imageName": "res_ensure_button.png",
@@ -205,5 +196,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "equipping",
+    "imageName": "res_equipping.png",
+    "roiFront": "1126,545,100,83",
+    "roiBack": "1126,545,100,83",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

BIN
tasks/AbyssShadows/res/res_equipping.png


+ 146 - 37
tasks/AbyssShadows/script_task.py

@@ -7,6 +7,7 @@
 from datetime import datetime, timedelta
 import random
 import numpy as np
+import time
 from enum import Enum
 from cached_property import cached_property
 from time import sleep
@@ -124,42 +125,82 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
         self.wait_until_disappear(self.I_WAIT_TO_START)
         self.device.stuck_record_clear()
 
-        # 准备攻打精英、副将、首领
-        while 1:
-            # 点击战报按钮
-            find_list = [EmemyType.BOSS, EmemyType.GENERAL, EmemyType.ELITE]
-            for enemy_type in find_list:
-                # 寻找敌人并开始战斗,
-                if not self.find_enemy(enemy_type):
-                    logger.warning(f"Failed to find {enemy_type.name} enemy, exit")
+        # 未开启智能伤害准备攻打精英、副将、首领
+        if not cfg.abyss_shadows_combat_time.CombatTime_enable:
+            while 1:
+                # 点击战报按钮
+                find_list = [EmemyType.BOSS, EmemyType.GENERAL, EmemyType.ELITE]
+                for enemy_type in find_list:
+                    # 寻找敌人并开始战斗,
+                    if not self.find_enemy(enemy_type):
+                        logger.warning(f"Failed to find {enemy_type.name} enemy, exit")
+                        break
+                logger.info(f"Current fight times: boss {self.boss_fight_count} times, general {self.general_fight_count}  times, elite {self.elite_fight_count} times")
+                # 正常应该打完一个区域了,检查攻打次数,如没打够则切换到下一个区域,默认神龙 -> 孔雀 -> 白藏主 -> 黑豹
+                if self.boss_fight_count >= 2 and self.general_fight_count >= 4 and self.elite_fight_count >= 6:
+                    success = True
+                    break
+                else:
+                    #切换区域之前关闭战报
+                    self.appear_then_click(self.I_ABYSS_MAP_EXIT, interval=1)
+                    current_area = self.check_current_area()
+                    logger.info(f"Current area is {current_area}, switch to next area")
+                    if current_area == AreaType.DRAGON:
+                        self.change_area(AreaType.PEACOCK)
+                        continue
+                    elif current_area == AreaType.PEACOCK:
+                        self.change_area(AreaType.FOX)
+                        continue
+                    elif current_area == AreaType.FOX:
+                        self.change_area(AreaType.LEOPARD)
+                        continue
+                    else:
+                        logger.warning("All enemy types have been defeated, but not enough emeny to fight, exit")
+                        break
+
+        # 开启智能伤害
+        if cfg.abyss_shadows_combat_time.CombatTime_enable:
+            while True:
+                # 1. 先攻打 1 个 BOSS
+                if self.boss_fight_count < 2:
+                    self.boss_fight_count = self.fight_and_switch(EmemyType.BOSS, 2, self.boss_fight_count,
+                                                             lambda: self.switch_area())
+
+                # 2. 攻打 2 个 GENERAL
+                if self.general_fight_count < 4:
+                    self.general_fight_count = self.fight_and_switch(EmemyType.GENERAL, 4, self.general_fight_count,
+                                                                lambda: self.switch_area())
+
+                # 3. 攻打 3 个 ELITE
+                if self.elite_fight_count < 6:
+                    self.elite_fight_count = self.fight_and_switch(EmemyType.ELITE, 6, self.elite_fight_count,
+                                                              lambda: self.switch_area())
+
+                # 检查是否已完成所有任务
+                print(f"Current fight times: boss {self.boss_fight_count} times, general {self.general_fight_count} times, elite {self.elite_fight_count} times")
+                if self.boss_fight_count >= 2 and self.general_fight_count >= 4 and self.elite_fight_count >= 6:
+                    logger.info("All fights completed")
+                    success = True
                     break
-            logger.info(f"Current fight times: boss {self.boss_fight_count} times, general {self.general_fight_count}  times, elite {self.elite_fight_count} times")
-            # 正常应该打完一个区域了,检查攻打次数,如没打够则切换到下一个区域,默认神龙 -> 孔雀 -> 白藏主 -> 黑豹
-            if self.boss_fight_count >= 2 and self.general_fight_count >= 4 and self.elite_fight_count >= 6:
-                success = True
-                break
-            else:
-                current_area = self.check_current_area()
-                logger.info(f"Current area is {current_area}, switch to next area")
-                if current_area == AreaType.DRAGON:
-                    self.change_area(AreaType.PEACOCK)
-                    continue
-                elif current_area == AreaType.PEACOCK:
-                    self.change_area(AreaType.FOX)
-                    continue
-                elif current_area == AreaType.FOX:  
-                    self.change_area(AreaType.LEOPARD)
-                    continue
                 else:
+                    #没打满我也没办法就最后一张图,看看有没有剩余的吧没有也不想跑了
+                    find_list = [EmemyType.BOSS, EmemyType.GENERAL, EmemyType.ELITE]
+                    for enemy_type in find_list:
+                        # 寻找敌人并开始战斗,
+                        if not self.find_enemy(enemy_type):
+                            logger.warning(f"Failed to find {enemy_type.name} enemy, exit")
+                            break
+                    logger.info(f"Current fight times: boss {self.boss_fight_count} times, general {self.general_fight_count}  times, elite {self.elite_fight_count} times")
                     logger.warning("All enemy types have been defeated, but not enough emeny to fight, exit")
+                    success = True
                     break
-        
 
         # 保持好习惯,一个任务结束了就返回到庭院,方便下一任务的开始
         self.goto_main()
 
         # 设置下次运行时间
         if success:
+            print("我要重新设置时间了")
             if today == 4:
                 # 周五推迟到周六
                 logger.info(f"The next abyss shadows day is Saturday")
@@ -176,6 +217,47 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
             self.set_next_run(task='AbyssShadows', finish=True, server=True, success=False)
         raise TaskEnd
 
+
+
+    #攻击并进行区域切换
+    def fight_and_switch(self, enemy_type, required_count, fight_count, next_area_func):
+        while fight_count < required_count: # 0-2
+            if not self.find_enemy(enemy_type):
+                logger.warning(f"Failed to find {enemy_type.name} enemy, exit")
+                return fight_count
+            else:
+                if enemy_type == EmemyType.BOSS:
+                    fight_count += 1
+                elif enemy_type == EmemyType.GENERAL:
+                    fight_count += 2
+                elif enemy_type == EmemyType.ELITE:
+                    fight_count += 3
+            logger.info(
+                f"Current fight times: boss {self.boss_fight_count} times, general {self.general_fight_count} times, elite {self.elite_fight_count} times")
+
+            # 完成攻打后切换区域
+            current_area = self.check_current_area()
+            if fight_count < required_count and current_area != AreaType.LEOPARD:
+                next_area_func()
+        return fight_count
+
+    def switch_area(self):
+        #确保没有战报页面
+        self.appear_then_click(self.I_ABYSS_MAP_EXIT, interval=1)
+        current_area = self.check_current_area()
+        logger.info(f"Current area is {current_area}, switch to next area")
+        if current_area == AreaType.DRAGON:
+            self.change_area(AreaType.PEACOCK)
+        elif current_area == AreaType.PEACOCK:
+            self.change_area(AreaType.FOX)
+        elif current_area == AreaType.FOX:
+            self.change_area(AreaType.LEOPARD)
+        else:
+            logger.warning("All areas have been completed, exit")
+            raise StopIteration  # 退出循环
+
+
+
     def check_current_area(self) -> AreaType:
         ''' 获取当前区域
         :return AreaType
@@ -198,6 +280,9 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
         :return 
         '''
         while 1:
+            # 确保切换区域前不在战报页面
+            if self.appear_then_click(self.I_ABYSS_MAP_EXIT, interval=1):
+                continue
             self.screenshot()
             # 判断当前区域是否正确
             current_area = self.check_current_area()
@@ -208,7 +293,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
                 self.select_boss(area_name)
                 logger.info(f"Switch to {area_name.name}")
                 continue      
-            # 点击战报按钮
+            # 点击更换领域按钮
             if self.appear_then_click(self.I_CHANGE_AREA,interval=4):
                 logger.info(f"Click {self.I_CHANGE_AREA.name}")
                 continue
@@ -222,8 +307,6 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
         logger.info("Exiting abyss_shadows")
         self.ui_goto(page_main)
 
-       
-
     def goto_abyss_shadows(self) -> bool:
         ''' 进入狭间
         :return bool
@@ -307,7 +390,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
         logger.info(f"Run boss fight") 
         if self.click_emeny_area(CilckArea.BOSS):
             logger.info(f"Click {CilckArea.BOSS.name}")
-            self.run_general_battle_back()
+            self.run_general_battle_back(Monster_type="BOSS")
             self.boss_fight_count += 1
             logger.info(f'Fight, boss_fight_count {self.boss_fight_count} times')
         else:
@@ -328,7 +411,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
             if self.click_emeny_area(general):
                 logger.info(f"Click {general.name}")
                 self.general_fight_count += 1
-                self.run_general_battle_back()
+                self.run_general_battle_back(Monster_type="GENERAL")
                 logger.info(f'Fight, general_fight_count {self.general_fight_count} times')
         return True
 
@@ -347,7 +430,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
             if self.click_emeny_area(elite):
                 logger.info(f"Click {elite.name}")
                 self.elite_fight_count += 1
-                self.run_general_battle_back()
+                self.run_general_battle_back(Monster_type="ELITE")
                 logger.info(f'Fight, elite_fight_count {self.elite_fight_count} times')
         return True
 
@@ -418,20 +501,46 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
             
         return suceess
 
-    def run_general_battle_back(self) -> bool:
+    def run_general_battle_back(self, Monster_type: str) -> bool:
         """
         重写父类方法,因为狭间暗域的准备和战斗流程不一样
         进入挑战然后直接返回
         :param config:
         :return:
         """
+        cfg: AbyssShadows = self.config.abyss_shadows
         while 1:
+            #确保进入战斗
             self.screenshot()
-            if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
-                continue
-            if not self.appear(self.I_PRESET):
+            if self.wait_until_appear(self.I_EQUIPPING, wait_time=4):
+                self.click(self.I_EQUIPPING, interval=1.5)
+            if not self.appear(self.I_EQUIPPING):
                 break
-        logger.info(f"Click {self.I_PREPARE_HIGHLIGHT.name}")
+        logger.info(f"Click {self.I_EQUIPPING.name}")
+        logger.info(f"点击准备了")
+
+        # 进入战斗后,开始计时
+        start_time = time.time()
+        if cfg.abyss_shadows_combat_time.CombatTime_enable:
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+            if Monster_type == "BOSS":  # BOSS战斗
+                combat_time = cfg.abyss_shadows_combat_time.boss_combat_time
+            elif Monster_type == "GENERAL":  # 是副将战斗
+                combat_time = cfg.abyss_shadows_combat_time.general_combat_time
+            elif Monster_type == "ELITE":  #  精英战斗
+                combat_time = cfg.abyss_shadows_combat_time.elite_combat_time
+            else:
+                combat_time = 60  # 默认为 60 秒
+            # 等待设定的战斗时间
+            while time.time() - start_time < combat_time:
+                self.screenshot()
+                if self.appear_then_click(self.I_WIN, interval=1.5):
+                    break
+            logger.info("Combat time ended, proceeding to exit.")
+            self.device.stuck_record_clear()
+        # 战斗提前结束这时没有返回按钮
+        if self.appear_then_click(self.I_WIN, interval=1.5):
+            return True
 
         # 点击返回
         while 1:

BIN
tasks/ActivityShikigami/as/as_antivity_win.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_battle_org.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_fire_org.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_shi_org.png


+ 2 - 2
tasks/ActivityShikigami/as/image.json

@@ -20,8 +20,8 @@
   {
     "itemName": "battle",
     "imageName": "as_battle.png",
-    "roiFront": "641,148,35,145",
-    "roiBack": "583,75,153,315",
+    "roiFront": "375,285,35,135",
+    "roiBack": "300,200,153,315",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "进入爬塔"

+ 1 - 1
tasks/ActivityShikigami/assets.py

@@ -49,7 +49,7 @@ class ActivityShikigamiAssets:
 	# 左上角返回 
 	I_BACK_GREEN = RuleImage(roi_front=(23,27,44,44), roi_back=(23,27,44,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(641,148,35,145), roi_back=(583,75,153,315), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(375,285,35,135), roi_back=(300,200,153,315), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(327,627,145,28), roi_back=(256,462,301,232), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 

+ 26 - 19
tasks/ActivityShikigami/script_task.py

@@ -44,29 +44,34 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
 
         self.ui_get_current_page()
         self.ui_goto(page_main)
+
+        self.open_buff()
+        self.soul(is_open=True)
+        self.close_buff()
+
         self.home_main()
 
         # 选择是游戏的体力还是活动的体力
         current_ap = config.general_climb.ap_mode
-        self.switch(current_ap)
+        #self.switch(current_ap)
 
         # 设定是否锁定阵容
-        if config.general_battle.lock_team_enable:
-            logger.info("Lock team")
-            while 1:
-                self.screenshot()
-                if self.appear_then_click(self.I_UNLOCK, interval=1):
-                    continue
-                if self.appear(self.I_LOCK):
-                    break
-        else:
-            logger.info("Unlock team")
-            while 1:
-                self.screenshot()
-                if self.appear_then_click(self.I_LOCK, interval=1):
-                    continue
-                if self.appear(self.I_UNLOCK):
-                    break
+        # if config.general_battle.lock_team_enable:
+        #     logger.info("Lock team")
+        #     while 1:
+        #         self.screenshot()
+        #         if self.appear_then_click(self.I_UNLOCK, interval=1):
+        #             continue
+        #         if self.appear(self.I_LOCK):
+        #             break
+        # else:
+        #     logger.info("Unlock team")
+        #     while 1:
+        #         self.screenshot()
+        #         if self.appear_then_click(self.I_LOCK, interval=1):
+        #             continue
+        #         if self.appear(self.I_UNLOCK):
+        #             break
 
         # 流程应该是 在页面处:
         # 1. 判定计数是否超了,时间是否超了
@@ -122,6 +127,9 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 logger.info("General battle success")
 
         self.main_home()
+        self.open_buff()
+        self.soul(is_open=False)
+        self.close_buff()
         if config.general_climb.active_souls_clean:
             self.set_next_run(task='SoulsTidy', success=False, finish=False, target=datetime.now())
         self.set_next_run(task="ActivityShikigami", success=True)
@@ -140,8 +148,7 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 break
             if self.appear_then_click(self.I_SHI, interval=1):
                 continue
-            if self.appear_then_click(self.I_DRUM, interval=1):
-                continue
+
             if self.appear_then_click(self.I_BATTLE, interval=1):
                 continue
 

+ 2 - 0
tasks/AreaBoss/assets.py

@@ -101,6 +101,8 @@ class AreaBossAssets:
 	I_AB_JI_FLOOR_TEN = RuleImage(roi_front=(390,370,60,40), roi_back=(390,370,60,40), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_ji_floor_ten.png")
 	# 小组内未取得名次 
 	I_AB_GROUP_RANK_NONE = RuleImage(roi_front=(890,415,95,85), roi_back=(890,415,95,85), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_rank_none.png")
+	# 挑战数进度条
+	I_AB_NUM_CHALLENGE_RAIL = RuleImage(roi_front=(895,639,14,27), roi_back=(895,639,14,27), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/ab_num_challenge_rail.png")
 
 
 	# Ocr Rule Assets

BIN
tasks/AreaBoss/res/ab_num_challenge_rail.png


+ 9 - 0
tasks/AreaBoss/res/image.json

@@ -196,5 +196,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "小组内未取得名次"
+  },
+  {
+    "itemName": "ab_num_challenge_rail",
+    "imageName": "ab_num_challenge_rail.png",
+    "roiFront": "895,639,14,27",
+    "roiBack": "895,639,14,27",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "挑战数进度条"
   }
 ]

+ 5 - 5
tasks/AreaBoss/script_task.py

@@ -302,7 +302,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_1)
         #如果num为0则不再进行nameOcr
         if num:
-            if num >= 20000:
+            if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                 logger.info("The number of challenges is enough")
                 return filter_open_flag, str("direct_attack")
             name = self.get_bossName(self.C_AB_BOSS_REWARD_PHOTO_1)
@@ -315,7 +315,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.open_filter()
         num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_2)
         if num:
-            if num >= 20000:
+            if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                 logger.info("The number of challenges is enough")
                 return filter_open_flag, str("direct_attack")
             name = self.get_bossName(self.C_AB_BOSS_REWARD_PHOTO_1)
@@ -328,7 +328,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.open_filter()
         num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_3)
         if num:
-            if num >= 20000:
+            if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                 logger.info("The number of challenges is enough")
                 return filter_open_flag, str("direct_attack")
             name = self.get_bossName(self.C_AB_BOSS_REWARD_PHOTO_1)
@@ -344,7 +344,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.wait_until_appear(self.C_AB_BOSS_REWARD_PHOTO_MINUS_2, wait_time=1)
         num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_MINUS_2)
         if num:
-            if num >= 20000:
+            if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                 logger.info("The number of challenges is enough")
                 return filter_open_flag, str("direct_attack")
             name = self.get_bossName(self.C_AB_BOSS_REWARD_PHOTO_1)
@@ -360,7 +360,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.wait_until_appear(self.C_AB_BOSS_REWARD_PHOTO_MINUS_1, wait_time=1)
         num = self.get_num_challenge(self.C_AB_BOSS_REWARD_PHOTO_MINUS_1)
         if num:
-            if num >= 20000:
+            if num >= 20000 and not self.appear(self.I_AB_NUM_CHALLENGE_RAIL):
                 logger.info("The number of challenges is enough")
                 return filter_open_flag, str("direct_attack")
             name = self.get_bossName(self.C_AB_BOSS_REWARD_PHOTO_1)

+ 4 - 2
tasks/Component/BaseActivity/config_activity.py

@@ -2,7 +2,7 @@
 # @author runhey
 # github https://github.com/runhey
 from datetime import time, timedelta
-from pydantic import BaseModel, Field, validator
+from pydantic import BaseModel, Field, validator, field_validator
 from enum import Enum
 
 from module.logger import logger
@@ -65,4 +65,6 @@ class GeneralClimb(ConfigBase):
             return def_value
         return def_value
 
-
+    @field_validator('ap_mode', mode='after')
+    def check_mode(cls, value):
+        return ApMode.AP_GAME

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

@@ -36,6 +36,19 @@ class CostumeAssets:
 	I_PET_HOUSE_10 = RuleImage(roi_front=(954,425,40,35), roi_back=(737,401,440,69), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main10/main10_pet_house_10.png")
 
 
+	# Image Rule Assets
+	# description 
+	I_CHECK_MAIN_11 = RuleImage(roi_front=(521,570,53,24), roi_back=(131,514,1099,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main11/main11_check_main_11.png")
+	# description 
+	I_MAIN_GOTO_EXPLORATION_11 = RuleImage(roi_front=(522,113,21,34), roi_back=(192,105,904,66), threshold=0.6, method="Template matching", file="./tasks/Component/Costume/main11/main11_main_goto_exploration_11.png")
+	#  
+	I_MAIN_GOTO_SUMMON_11 = RuleImage(roi_front=(946,111,20,37), roi_back=(500,102,623,68), threshold=0.6, method="Template matching", file="./tasks/Component/Costume/main11/main11_main_goto_summon_11.png")
+	# 町中 
+	I_MAIN_GOTO_TOWN_11 = RuleImage(roi_front=(703,169,35,20), roi_back=(262,145,999,78), threshold=0.7, method="Template matching", file="./tasks/Component/Costume/main11/main11_main_goto_town_11.png")
+	# 宠物室 
+	I_PET_HOUSE_11 = RuleImage(roi_front=(966,323,29,29), roi_back=(724,295,440,69), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main11/main11_pet_house_11.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_CHECK_MAIN_2 = RuleImage(roi_front=(1090,146,48,55), roi_back=(880,108,271,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main2/main2_check_main_2.png")

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

@@ -17,6 +17,7 @@ class MainType(str, Enum):
     COSTUME_MAIN_8 = 'costume_main_8'  # 远海航船
     COSTUME_MAIN_9 = 'costume_main_9'  # 结缘神社
     COSTUME_MAIN_10 = 'costume_main_10'  # 望月幽庭
+    COSTUME_MAIN_11 = 'costume_main_11'  # 鏖刀禁府
 
 # 结界皮肤
 class RealmType(str, Enum):
@@ -50,6 +51,7 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_7 = 'costume_battle_7'  # 笼梦之境
     COSTUME_BATTLE_8 = 'costume_battle_8'  # 藏金台阁
     COSTUME_BATTLE_9 = 'costume_battle_9'  # 莲华圣域
+    COSTUME_BATTLE_10 = 'costume_battle_10'  # 流焰蝶舞
 
 
 

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

@@ -63,6 +63,11 @@ main_costume_model = {
                                'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_10',
                                'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_10',
                                'I_PET_HOUSE': 'I_PET_HOUSE_10', },
+    MainType.COSTUME_MAIN_11: {'I_CHECK_MAIN': 'I_CHECK_MAIN_11',
+                               'I_MAIN_GOTO_EXPLORATION': 'I_MAIN_GOTO_EXPLORATION_11',
+                               'I_MAIN_GOTO_SUMMON': 'I_MAIN_GOTO_SUMMON_11',
+                               'I_MAIN_GOTO_TOWN': 'I_MAIN_GOTO_TOWN_11',
+                               'I_PET_HOUSE': 'I_PET_HOUSE_11', },
 }
 
 # 结界皮肤
@@ -126,6 +131,11 @@ battle_theme_model = {
         'I_EXIT': 'I_EXIT_9',
         'I_FRIENDS': 'I_FRIENDS_9',
     },
+    BattleType.COSTUME_BATTLE_10: {
+        'I_LOCAL': 'I_LOCAL_10',
+        'I_EXIT': 'I_EXIT_10',
+        'I_FRIENDS': 'I_FRIENDS_10',
+    },
 }
 
 

+ 3 - 3
tasks/Component/Costume/costume_test.py

@@ -15,12 +15,12 @@ from module.logger import logger
 class ScriptTask(GeneralBattle, GameUi, SwitchSoul, PetsAssets, ):
 
     def run(self):
-        # 探索测试
-        self.ui_click(self.I_MAIN_GOTO_EXPLORATION, self.I_CHECK_EXPLORATION)
-        self.ui_click(self.I_UI_BACK_BLUE, self.I_CHECK_MAIN)
         # 町中测试
         self.ui_click(self.I_MAIN_GOTO_TOWN, self.I_CHECK_TOWN)
         self.ui_click(self.I_TOWN_GOTO_MAIN, self.I_CHECK_MAIN)
+        # 探索测试
+        self.ui_click(self.I_MAIN_GOTO_EXPLORATION, self.I_CHECK_EXPLORATION)
+        self.ui_click(self.I_UI_BACK_BLUE, self.I_CHECK_MAIN)
         # 召唤测试
         self.ui_click(self.I_MAIN_GOTO_SUMMON, self.I_CHECK_SUMMON)
         self.ui_click(self.I_SUMMON_GOTO_MAIN, self.I_CHECK_MAIN)

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

@@ -0,0 +1,47 @@
+[
+  {
+    "itemName": "check_main_11",
+    "imageName": "main11_check_main_11.png",
+    "roiFront": "521,570,53,24",
+    "roiBack": "131,514,1099,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "main_goto_exploration_11",
+    "imageName": "main11_main_goto_exploration_11.png",
+    "roiFront": "522,113,21,34",
+    "roiBack": "192,105,904,66",
+    "method": "Template matching",
+    "threshold": 0.6,
+    "description": "description"
+  },
+  {
+    "itemName": "main_goto_summon_11",
+    "imageName": "main11_main_goto_summon_11.png",
+    "roiFront": "946,111,20,37",
+    "roiBack": "500,102,623,68",
+    "method": "Template matching",
+    "threshold": 0.6,
+    "description": ""
+  },
+  {
+    "itemName": "main_goto_town_11",
+    "imageName": "main11_main_goto_town_11.png",
+    "roiFront": "703,169,35,20",
+    "roiBack": "262,145,999,78",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "町中"
+  },
+  {
+    "itemName": "pet_house_11",
+    "imageName": "main11_pet_house_11.png",
+    "roiFront": "966,323,29,29",
+    "roiBack": "724,295,440,69",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "宠物室"
+  }
+]

BIN
tasks/Component/Costume/main11/main11_check_main_11.png


BIN
tasks/Component/Costume/main11/main11_main_goto_exploration_11.png


BIN
tasks/Component/Costume/main11/main11_main_goto_summon_11.png


BIN
tasks/Component/Costume/main11/main11_main_goto_town_11.png


BIN
tasks/Component/Costume/main11/main11_pet_house_11.png


+ 10 - 1
tasks/Component/CostumeBattle/assets.py

@@ -19,6 +19,15 @@ class CostumeBattleAssets:
 	I_FRIENDS_1 = RuleImage(roi_front=(88,18,35,34), roi_back=(88,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle1/battle1_friends_1.png")
 
 
+	# Image Rule Assets
+	# 左上角退出 
+	I_EXIT_10 = RuleImage(roi_front=(16,15,38,36), roi_back=(16,15,38,36), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle10/battle10_exit_10.png")
+	# 左上角好友 
+	I_FRIENDS_10 = RuleImage(roi_front=(90,14,35,37), roi_back=(90,14,35,37), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle10/battle10_friends_10.png")
+	# 指针 
+	I_LOCAL_10 = RuleImage(roi_front=(29,566,23,26), roi_back=(29,566,23,26), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle10/battle10_local_10.png")
+
+
 	# Image Rule Assets
 	# description 
 	I_LOCAL_2 = RuleImage(roi_front=(30,569,21,22), roi_back=(30,569,21,22), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle2/battle2_local_2.png")
@@ -70,7 +79,7 @@ class CostumeBattleAssets:
 	# 左上角退出 
 	I_EXIT_7 = RuleImage(roi_front=(22,17,27,31), roi_back=(22,17,27,31), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle7_exit_7.png")
 	# 左上角好友 
-	I_FRIENDS_7 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle6_friends_7.png")
+	I_FRIENDS_7 = RuleImage(roi_front=(89,18,35,34), roi_back=(89,18,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle7/battle7_friends_7.png")
 
 
 	# Image Rule Assets

BIN
tasks/Component/CostumeBattle/battle10/battle10_exit_10.png


BIN
tasks/Component/CostumeBattle/battle10/battle10_friends_10.png


BIN
tasks/Component/CostumeBattle/battle10/battle10_local_10.png


+ 29 - 0
tasks/Component/CostumeBattle/battle10/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "exit_10",
+    "imageName": "battle10_exit_10.png",
+    "roiFront": "16,15,38,36",
+    "roiBack": "16,15,38,36",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_10",
+    "imageName": "battle10_friends_10.png",
+    "roiFront": "90,14,35,37",
+    "roiBack": "90,14,35,37",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  },
+  {
+    "itemName": "local_10",
+    "imageName": "battle10_local_10.png",
+    "roiFront": "29,566,23,26",
+    "roiBack": "29,566,23,26",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  }
+]

+ 1 - 1
tasks/Component/CostumeBattle/battle7/image.json

@@ -19,7 +19,7 @@
   },
   {
     "itemName": "friends_7",
-    "imageName": "battle6_friends_7.png",
+    "imageName": "battle7_friends_7.png",
     "roiFront": "89,18,35,34",
     "roiBack": "89,18,35,34",
     "method": "Template matching",

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

@@ -73,14 +73,14 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
         else:
             return False
 
-    def run_general_battle_back(self, config: GeneralBattleConfig = None) -> bool:
+    def run_general_battle_back(self, config: GeneralBattleConfig = None, exit_four: bool = False) -> bool:
         """
         进入挑战然后直接返回
         :param config:
         :return:
         """
-        # 如果没有锁定队伍那么在点击准备后才退出的
-        if not config.lock_team_enable:
+        # 如果没有锁定队伍那么在点击准备后才退出的,退四的话就直接退出
+        if not config.lock_team_enable and not exit_four:
             # 点击准备按钮
             self.wait_until_appear(self.I_PREPARE_HIGHLIGHT)
             while 1:

+ 15 - 1
tasks/Component/config_base.py

@@ -8,7 +8,9 @@ from typing import Any
 from pydantic import BaseModel
 from pydantic import (BeforeValidator,
                       PlainSerializer,
-                      WithJsonSchema)
+                      WithJsonSchema,
+                      field_serializer,
+                      SerializationInfo)
 from typing_extensions import Annotated
 
 
@@ -65,5 +67,17 @@ Time = Annotated[time,
                  WithJsonSchema({'type': 'time'}),]
 
 # ---------------------------------------------------------------------------------------------------------------------
+
+@classmethod
+def serializer_exclude(cls, value: any, info: SerializationInfo):
+    if info.context and info.context.get('hide', False):
+        return 0xABCDEF
+    return value
+
+
+def dynamic_hide(*fields: str,):
+    return field_serializer(*fields)(serializer_exclude)
+
+
 class ConfigBase(BaseModel):
     pass

+ 1 - 1
tasks/FloatParade/assets.py

@@ -18,7 +18,7 @@ class FloatParadeAssets:
 	# description 
 	I_FP_RED_POINT0 = RuleImage(roi_front=(1242,604,22,21), roi_back=(1225,585,53,54), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_point0.png")
 	# description 
-	I_FP_GETALL1 = RuleImage(roi_front=(1155,560,53,54), roi_back=(1128,507,113,164), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
+	I_FP_GETALL1 = RuleImage(roi_front=(1198,555,53,54), roi_back=(1163,506,113,164), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_getall1.png")
 	# description 
 	I_FP_RED_POINT1 = RuleImage(roi_front=(1249,155,21,21), roi_back=(1223,138,56,62), threshold=0.8, method="Template matching", file="./tasks/FloatParade/fp/fp_fp_red_point1.png")
 	# description 

BIN
tasks/FloatParade/fp/fp_fp_getall0.png


BIN
tasks/FloatParade/fp/fp_fp_getall1.png


+ 2 - 2
tasks/FloatParade/fp/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "fp_getall1",
     "imageName": "fp_fp_getall1.png",
-    "roiFront": "1155,560,53,54",
-    "roiBack": "1128,507,113,164",
+    "roiFront": "1198,555,53,54",
+    "roiBack": "1163,506,113,164",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 1 - 1
tasks/GameUi/assets.py

@@ -153,7 +153,7 @@ class GameUiAssets:
 	# description 
 	I_CHECK_DAILY = RuleImage(roi_front=(27,515,69,62), roi_back=(1,489,155,127), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_daily.png")
 	# description 
-	I_CHECK_MALL = RuleImage(roi_front=(239,502,100,100), roi_back=(239,502,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
+	I_CHECK_MALL = RuleImage(roi_front=(147,527,82,82), roi_back=(147,527,82,82), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
 	# description 
 	I_CHECK_GUILD = RuleImage(roi_front=(1072,630,49,46), roi_back=(1072,630,49,46), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_guild.png")
 	# description 

BIN
tasks/GameUi/page/page_check_mall.png


+ 2 - 2
tasks/GameUi/page/page_img_3.json

@@ -110,8 +110,8 @@
   {
     "itemName": "check_mall",
     "imageName": "page_check_mall.png",
-    "roiFront": "239,502,100,100",
-    "roiBack": "239,502,100,100",
+    "roiFront": "147,527,82,82",
+    "roiBack": "147,527,82,82",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

+ 17 - 0
tasks/GuildBanquet/assets.py

@@ -0,0 +1,17 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class GuildBanquetAssets: 
+
+
+	# Image Rule Assets
+	# description 
+	I_FLAG = RuleImage(roi_front=(1035,12,33,60), roi_back=(1035,12,33,60), threshold=0.8, method="Template matching", file="./tasks/GuildBanquet/res/res_flag.png")
+
+

+ 43 - 0
tasks/GuildBanquet/config.py

@@ -0,0 +1,43 @@
+# This Python file uses the following encoding: utf-8
+# @author ohspecial
+# github https://github.com/ohspecial
+from enum import Enum  
+
+from pydantic import Field, BaseModel, SerializationInfo, field_serializer
+
+from tasks.Component.config_scheduler import Scheduler
+from tasks.Component.config_base import ConfigBase, Time, dynamic_hide
+
+
+class Weekday(str,Enum):
+    Monday: str = "星期一"
+    Tuesday: str = "星期二" 
+    Wednesday: str = "星期三"
+    Thursday: str = "星期四"
+    Friday: str = "星期五"
+    Saturday: str = "星期六"
+    Sunday: str = "星期日"
+
+class GuildBanquetTime(BaseModel):
+    # 自定义运行时间
+    day_1: Weekday = Field(
+        default=Weekday.Wednesday,
+        description="每周第1次运行时间设置,注意第一次时间要比第二次时间早",
+    )
+    run_time_1: Time = Field(default=Time(hour=19, minute=0, second=0))
+    day_2: Weekday = Field(
+        default=Weekday.Saturday,
+        description="每周第2次运行时间设置",
+    )
+    run_time_2: Time = Field(
+        default=Time(hour=19, minute=0, second=0), 
+        description="每周第2次运行时间设置"
+    )
+
+    hide_fileds = dynamic_hide('run_time_1', 'run_time_2')
+
+
+class GuildBanquet(ConfigBase):
+    scheduler: Scheduler = Field(default_factory=Scheduler)
+    guild_banquet_time: GuildBanquetTime = Field(default_factory=GuildBanquetTime)
+

+ 11 - 0
tasks/GuildBanquet/res/image.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "flag",
+    "imageName": "res_flag.png",
+    "roiFront": "1035,12,33,60",
+    "roiBack": "1035,12,33,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  }
+]

BIN
tasks/GuildBanquet/res/res_flag.png


+ 202 - 0
tasks/GuildBanquet/script_task.py

@@ -0,0 +1,202 @@
+# This Python file uses the following encoding: utf-8
+# @author ohspecial
+# github https://github.com/ohspecial
+from datetime import datetime ,timedelta
+from enum import Enum
+import time
+
+from module.exception import TaskEnd
+from module.logger import logger
+from module.base.timer import Timer
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_guild, page_main
+from tasks.GuildBanquet.assets import GuildBanquetAssets
+
+WEEKDAYDICT = {
+    0: '星期一',
+    1: '星期二',
+    2: '星期三',
+    3: '星期四',
+    4: '星期五',
+    5: '星期六',
+    6: '星期日'
+}
+
+class Weekday(str,Enum):
+    Monday: str = "星期一"
+    Tuesday: str = "星期二" 
+    Wednesday: str = "星期三"
+    Thursday: str = "星期四"
+    Friday: str = "星期五"
+    Saturday: str = "星期六"
+    Sunday: str = "星期日"
+    
+class ScriptTask(GameUi, GuildBanquetAssets):
+
+    def run(self):
+        self.run_time = self.config.guild_banquet.guild_banquet_time
+        # 第一天宴会日期及时间
+        self.banquet_day_1 = self.get_key_from_value(WEEKDAYDICT, self.run_time.day_1.value)
+        self.banquet_day_1_start_time = self.run_time.run_time_1
+        
+        # 第二天宴会日期及时间
+        self.banquet_day_2 = self.get_key_from_value(WEEKDAYDICT, self.run_time.day_2.value)
+        self.banquet_day_2_start_time = self.run_time.run_time_2
+        
+        
+        self.ui_get_current_page()
+        self.ui_goto(page_guild)
+        
+        if self.appear(self.I_FLAG):
+            wait_count = 0
+            wait_timer = Timer(230)
+            wait_timer.start()
+            logger.info("Start guild banquet!")
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+        else:
+            # 如果没有找到FLAG,并且没超过晚上10点,可能是宴会时间没开始,5分钟后尝试再次查找,超过10点则直接退出
+            if self.check_runtime():
+                time_now = datetime.now()
+                time_later = time_now + timedelta(minutes=5)
+                self.set_next_run(task='GuildBanquet',
+                              finish=True,
+                              target=time_later)
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            raise TaskEnd
+
+        last_check_time = 0  # 记录上次实际检测时间
+        last_log_time = 0  # 记录上次日志输出时间
+        last_flag_status = False  # 记录上次真实检测结果
+
+        while True:
+            self.screenshot()
+            # 条件1: 强制检测间隔管理
+            current_time = time.time()
+            if current_time - last_check_time >= 10:
+                # 达到间隔要求时执行真实检测
+                actual_status = self.appear(self.I_FLAG)
+                last_flag_status = actual_status
+                last_check_time = current_time
+                logger.debug(f"Actual detection at {current_time}, status: {actual_status}")
+                
+                # 重置日志计时器
+                last_log_time = current_time
+            else:
+                # 未达间隔时沿用上次结果
+                logger.debug(f"Using cached status: {last_flag_status}")
+                
+                
+            # 条件2: 状态判断逻辑
+            if last_flag_status:
+                if current_time - last_log_time >= 10:
+                    logger.info("Banquet ongoing, waiting...")
+                    last_log_time = current_time
+            else:
+                logger.info("Guild banquet end")
+                break  # 退出循环
+
+            # 条件3: 超时保护
+            if wait_timer.reached():
+                wait_timer.reset()
+                if wait_count >= 3:
+                    # 宴会最长15分钟
+                    logger.info('Guild banquet timeout')
+                    break
+                wait_count += 1
+                logger.info(f'Banquet ongoing, waiting... (Count: {wait_count})')
+                self.device.stuck_record_clear()
+                self.device.stuck_record_add('BATTLE_STATUS_S')
+        self.device.stuck_record_clear()
+        self.set_config()
+        self.ui_get_current_page()
+        self.ui_goto(page_main)
+        self.plan_next_run()
+        raise TaskEnd
+    
+    def check_runtime(self) -> bool:
+        """
+        检查时间, 一般寮不会晚上10点再开吧。。。。。
+        """
+
+        # 如果当日时间超过22点,说明配置时间可能出错,设置下次失败运行时间
+        if datetime.now().hour >= 22:
+            self.set_next_run(task="GuildBanquet", success=False)
+            logger.error("Guild banquet time config error, set next run fail")
+            return False
+        return True
+
+    def plan_next_run(self):
+        # 安排次日宴会,便于复用
+        today = datetime.now().weekday()
+        
+        if today < self.banquet_day_1:
+            logger.info(f"Plan next run: {self.banquet_day_1_start_time}")
+            self.custom_next_run(task='GuildBanquet', custom_time=self.banquet_day_1_start_time, time_delta=self.banquet_day_1 - today) 
+        elif self.banquet_day_1 <= today < self.banquet_day_2:
+            logger.info(f"Plan next run: {self.banquet_day_2_start_time}")
+            self.custom_next_run(task='GuildBanquet', custom_time=self.banquet_day_2_start_time, time_delta=self.banquet_day_2 - today)
+        elif self.banquet_day_2 <= today:
+            logger.info(f"Plan next run: {self.banquet_day_1_start_time}")
+            self.custom_next_run(task='GuildBanquet', custom_time=self.banquet_day_1_start_time, time_delta=7 - today + self.banquet_day_1) 
+    
+    def get_key_from_value(self, dict, value):
+        return [k for k, v in dict.items() if v == value][0]
+    
+    def get_weekday_enum(self, value: str) -> Weekday:
+        for day in Weekday:
+            if day.value == value:
+                return day
+        
+    def set_config(self):
+        """
+        修改周几配置时会出现警告
+        UserWarning: Pydantic serializer warnings:
+  Expected `enum` but got `Weekday` with value `<Weekday.Thursday: '星期四'>` - serialized value may not be as expected
+        """
+        
+        try:
+            # 当结束宴会时,设置宴会时间的日期及时间,宴会时间设置为运行结束时间提前15分钟(因识图问题,宴会可能被认为提前关闭几秒钟)
+            next_time = datetime.now() - timedelta(minutes=14, seconds=55)
+            next_time = next_time.replace(second=0, microsecond=0)
+            # 计算下次运行时间
+            next_time = datetime.time(next_time)
+            
+            today = datetime.now().weekday()          
+            
+            # 修改配置文件
+            if today == self.banquet_day_1:
+                self.run_time.run_time_1 = next_time
+            elif today == self.banquet_day_2:
+                self.run_time.run_time_2 = next_time
+            elif today < self.banquet_day_1:
+                self.run_time.day_1 = self.get_weekday_enum(WEEKDAYDICT.get(today))
+                self.run_time.run_time_1 = next_time
+            elif today > self.banquet_day_2:
+                self.run_time.day_2 = self.get_weekday_enum(WEEKDAYDICT.get(today))    
+                self.run_time.run_time_2 = next_time
+            else:
+                # 如果当前时间在两个配置时间之间,则默认把工作日设置第一天,周末设为第二天
+                if today <= 4:  # 工作日
+                    self.run_time.day_1 = self.get_weekday_enum(WEEKDAYDICT.get(today))
+                    self.run_time.run_time_1 = next_time
+                else:  # 周末
+                    self.run_time.day_2 = self.get_weekday_enum(WEEKDAYDICT.get(today))       
+                    self.run_time.run_time_2 = next_time
+            logger.info(f"Set next run time: {self.run_time}")
+            
+            self.config.save()
+        except Exception as e:
+            logger.error(f"Error setting banquet config: {e}")
+            raise TaskEnd
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+    t.run()
+

+ 4 - 2
tasks/HeroTest/script_task.py

@@ -193,7 +193,8 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
             self.screenshot()
             if win:
                 # 点击赢了
-                action_click = random.choice([self.C_WIN_1, self.C_WIN_2, self.C_WIN_3])
+                # self.C_WIN_2 在掉落物品过多的时候可能会点击到物品,导致脚本卡死
+                action_click = random.choice([self.C_WIN_1, self.C_WIN_3])
                 if self.appear_then_click(
                     self.I_WIN, action=action_click, interval=0.5
                 ):
@@ -236,8 +237,9 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
         while 1:
             self.screenshot()
             # 如果出现领奖励
+            # self.C_REWARD_2 在掉落物品过多的时候可能会点击到物品,导致脚本卡死
             action_click = random.choice(
-                [self.C_REWARD_1, self.C_REWARD_2, self.C_REWARD_3]
+                [self.C_REWARD_1, self.C_REWARD_3]
             )
             if self.appear_then_click(
                 self.I_REWARD, action=action_click, interval=1.5

+ 7 - 0
tasks/Hyakkiyakou/config.py

@@ -17,6 +17,10 @@ class ScreenshotMethod(str, Enum):
     WINDOW_BACKGROUND = 'window_background'
     NEMU_IPC = 'nemu_ipc'
 
+class ControlMethod(str, Enum):
+    MINITOUCH = 'minitouch'
+    WINDOW_MESSAGE = 'window_message'
+
 
 class HyakkiyakouConfig(ConfigBase):
     hya_limit_time: Time = Field(default=Time(minute=20), description='hya_limit_time_help')
@@ -59,6 +63,9 @@ class DebugConfig(ConfigBase):
     # 单独的截屏设置
     hya_screenshot_method: ScreenshotMethod = Field(default=ScreenshotMethod.WINDOW_BACKGROUND,
                                                     description='hya_screenshot')
+    # 单独的点击
+    hya_control_method: ControlMethod = Field(default=ControlMethod.WINDOW_MESSAGE,
+                                              description='hya_control_method')
 
     @field_validator('continuous_learning', mode='after')
     @classmethod

+ 1 - 1
tasks/Hyakkiyakou/script_task.py

@@ -224,7 +224,7 @@ class ScriptTask(GameUi, HyaSlave):
             return
         if state[0] <= 0:
             return
-        self.fast_click(x=x, y=y)
+        self.fast_click(x=x, y=y, control_method=self._config.debug_config.hya_control_method)
 
 
 if __name__ == '__main__':

+ 6 - 3
tasks/Hyakkiyakou/slave/hya_device.py

@@ -7,7 +7,7 @@ from module.base.utils import point2str
 from module.exception import RequestHumanTakeover, GameStuckError
 from tasks.base_task import BaseTask
 
-from tasks.Hyakkiyakou.config import ScreenshotMethod
+from tasks.Hyakkiyakou.config import ScreenshotMethod, ControlMethod
 
 def image_black(img) -> bool:
     for y, x in [(0, 0), (719, 1279), (719, 0), (0, 1279)]:
@@ -40,11 +40,14 @@ class HyaDevice(BaseTask):
             raise GameStuckError
         return self.device.image
 
-    def fast_click(self, x: int, y: int) -> None:
+    def fast_click(self, x: int, y: int, control_method: ControlMethod = ControlMethod.WINDOW_MESSAGE) -> None:
         logger.info(
             'Click %s @ %s' % (point2str(x, y), 'Click')
         )
-        self.device.click_window_message(x=x, y=y, fast=True)
+        if control_method == ControlMethod.MINITOUCH:
+            self.device.click_minitouch(x=x, y=y)
+        else:
+            self.device.click_window_message(x=x, y=y, fast=True)
 
     def set_fast_screenshot_interval(self, interval: float):
         """

+ 4 - 4
tasks/RealmRaid/script_task.py

@@ -184,13 +184,13 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
                 if con.raid_config.exit_four:
                     logger.info('Exit four enable')
                     self.fire(index)
-                    self.run_general_battle_back(con.general_battle_config)
+                    self.run_general_battle_back(con.general_battle_config, exit_four=True)
                     self.fire(index)
-                    self.run_general_battle_back(con.general_battle_config)
+                    self.run_general_battle_back(con.general_battle_config, exit_four=True)
                     self.fire(index)
-                    self.run_general_battle_back(con.general_battle_config)
+                    self.run_general_battle_back(con.general_battle_config, exit_four=True)
                     self.fire(index)
-                    self.run_general_battle_back(con.general_battle_config)
+                    self.run_general_battle_back(con.general_battle_config, exit_four=True)
             elif self.check_medal_is_frog(frog, medal, index):
                 # 如果挑战的这只是呱太的话,就要把锁定改为不锁定
                 con.general_battle_config.lock_team_enable = False

+ 2 - 0
tasks/Restart/assets.py

@@ -87,6 +87,8 @@ class RestartAssets:
 	I_LOGIN_LOGIN_ONMYOJI_GENIE = RuleImage(roi_front=(80,110,280,120), roi_back=(80,110,280,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_onmyoji_genie.png")
 	# 已有角色 
 	I_CHARACTARS = RuleImage(roi_front=(246,535,100,31), roi_back=(219,523,173,57), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_charactars.png")
+	# description 
+	I_CREATE_ACCOUNT = RuleImage(roi_front=(555,636,169,52), roi_back=(504,614,263,100), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_create_account.png")
 
 
 	# Ocr Rule Assets

+ 5 - 0
tasks/Restart/login.py

@@ -106,6 +106,11 @@ class LoginHandler(BaseTask, RestartAssets):
                     break
                 logger.info('login specific user')
                 continue
+            
+            # 创建角色, 误入新区直接重启
+            if self.appear(self.I_CREATE_ACCOUNT):
+                logger.warning('Appear create account')
+                raise GameStuckError('Appear create account')
             # 点击’进入游戏‘
             if not self.appear(self.I_LOGIN_8):
                 continue

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

@@ -115,5 +115,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "已有角色"
+  },
+  {
+    "itemName": "create_account",
+    "imageName": "login_create_account.png",
+    "roiFront": "555,636,169,52",
+    "roiBack": "504,614,263,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

BIN
tasks/Restart/login/login_create_account.png


+ 3 - 3
tasks/RichMan/assets.py

@@ -267,11 +267,11 @@ class RichManAssets:
 
 	# Ocr Rule Assets
 	# 蛇皮剩余可买的 
-	O_SCA_NUMBER_OROCHI = RuleOcr(roi=(46,318,27,25), area=(46,318,27,25), mode="Digit", method="Default", keyword="", name="sca_number_orochi")
+	O_SCA_NUMBER_OROCHI = RuleOcr(roi=(46,318,27,25), area=(46,318,27,25), mode="Quantity", method="Default", keyword="", name="sca_number_orochi")
 	# 首领御魂剩余可买的 
-	O_SCA_NUMBER_DEMON = RuleOcr(roi=(627,319,30,25), area=(627,319,30,25), mode="Digit", method="Default", keyword="", name="sca_number_demon")
+	O_SCA_NUMBER_DEMON = RuleOcr(roi=(627,319,30,25), area=(627,319,30,25), mode="Quantity", method="Default", keyword="", name="sca_number_demon")
 	# 永生之海 
-	O_SCA_NUMBER_SEA = RuleOcr(roi=(926,321,30,23), area=(926,321,30,23), mode="Digit", method="Default", keyword="", name="sca_number_sea")
+	O_SCA_NUMBER_SEA = RuleOcr(roi=(926,321,30,23), area=(926,321,30,23), mode="Quantity", method="Default", keyword="", name="sca_number_sea")
 	# 多少号位 
 	O_SCA_DEMON_POSTION = RuleOcr(roi=(960,244,88,41), area=(960,244,88,41), mode="Single", method="Default", keyword="", name="sca_demon_postion")
 	# 朴素的御魂 

+ 1 - 1
tasks/RichMan/guild.py

@@ -132,7 +132,7 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('mi')
+    c = Config('oas1')
     d = Device(c)
     t = Guild(c, d)
 

+ 3 - 1
tasks/RichMan/mall/scales.py

@@ -36,6 +36,8 @@ class Scales(Buy, MallNavbar):
             self.screenshot()
             if self.appear(self.I_BUY_PLUS):
                 break
+            if self.appear(self.I_SCA_SELECT_1) and self.appear(self.I_SCA_SELECT_2):
+                return
             if self.appear_then_click(start_click, interval=1):
                 continue
         # 设置购买的数量
@@ -355,7 +357,7 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('oas2')
+    c = Config('oas1')
     d = Device(c)
     t = Scales(c, d)
 

+ 3 - 3
tasks/RichMan/mall/scales/ocr.json

@@ -3,7 +3,7 @@
     "itemName": "sca_number_orochi",
     "roiFront": "46,318,27,25",
     "roiBack": "46,318,27,25",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "蛇皮剩余可买的"
@@ -12,7 +12,7 @@
     "itemName": "sca_number_demon",
     "roiFront": "627,319,30,25",
     "roiBack": "627,319,30,25",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "首领御魂剩余可买的"
@@ -21,7 +21,7 @@
     "itemName": "sca_number_sea",
     "roiFront": "926,321,30,23",
     "roiBack": "926,321,30,23",
-    "mode": "Digit",
+    "mode": "Quantity",
     "method": "Default",
     "keyword": "",
     "description": "永生之海"

+ 1 - 1
tasks/Script/config_device.py

@@ -3,7 +3,7 @@
 # github https://github.com/runhey
 from enum import Enum
 from typing import Union
-from pydantic import BaseModel, ValidationError, validator, Field
+from pydantic import BaseModel, ValidationError, Field
 
 from module.logger import logger
 

+ 5 - 0
tasks/TrueOrochi/assets.py

@@ -60,3 +60,8 @@ class TrueOrochiAssets:
 	I_ST_FRAME = RuleImage(roi_front=(571,442,135,65), roi_back=(571,442,135,65), threshold=0.8, method="Template matching", file="./tasks/TrueOrochi/st/st_st_frame.png")
 
 
+	# Ocr Rule Assets
+	# 本周剩余奖励次数 
+	O_TIMES = RuleOcr(roi=(461,388,40,26), area=(461,388,40,26), mode="DigitCounter", method="Default", keyword="", name="times")
+
+

+ 1 - 1
tasks/TrueOrochi/config.py

@@ -23,7 +23,7 @@ class GreenMarkType(str, Enum):
 
 class TrueOrochiScheduler(Scheduler):
     priority: int = Field(default=10, description='priority_help')
-    success_interval: TimeDelta = Field(default=TimeDelta(days=7), description='success_interval_help')
+    success_interval: TimeDelta = Field(default=TimeDelta(days=3), description='success_interval_help')
     failure_interval: TimeDelta = Field(default=TimeDelta(days=1), description='failure_interval_help')
 
 class TrueOrochiConfig(BaseModel):

+ 27 - 21
tasks/TrueOrochi/script_task.py

@@ -24,12 +24,6 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
     
         conf = self.config.true_orochi.true_orochi_config
 
-        # 周一重置真蛇次数
-        now = datetime.now()
-        day_of_week = now.weekday()
-        if day_of_week == 0:
-            conf.current_success = 0
-
         if conf.current_success >= 2:
             # 超过两次就说明这周打完了没有必要再打了
             logger.warning('This week is full')
@@ -51,6 +45,7 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         self.ui_get_current_page()
         self.ui_goto(page_soul_zones)
         self.orochi_enter()
+        sleep(0.5)
         battle = self.check_true_orochi(True)
         if not battle:
             logger.warning('Not find true orochi')
@@ -101,6 +96,13 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
             if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
                 continue
             if self.appear_then_click(self.I_ST_FIRE, interval=4):
+                # 修正已经挑战的次数, 注意这个是战斗开始之前的次数
+                current, current_success, total = self.O_TIMES.ocr(self.device.image)
+                if current_success < 0 or current_success > 2:
+                    continue
+                logger.info(f'current: {current}, current_success: {current_success}, total: {total}')
+                conf.current_success = current_success
+                self.config.save()
                 continue
             if self.appear_then_click(self.I_FIND_TS, interval=1):
                 continue
@@ -179,21 +181,25 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         :param current_success: 这周的成功次数
         :return:
         """
-        # now = datetime.now()
-        # now_year, now_week_number, now_weekday = now.isocalendar()
-        # if battle:
-        #     next_run = now + self.config.true_orochi.scheduler.success_interval
-        # else:
-        #     next_run = now + self.config.true_orochi.scheduler.failure_interval
-        # next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
-        # # 如果下次运行的时间是下一周,那么就重置成功次数
-        # if now_week_number != next_run_week_number:
-        #     self.config.true_orochi.true_orochi_config.current_success = 0
-        # else:
-        #     # 如果不是下一周,那么就加一
-        #     self.config.true_orochi.true_orochi_config.current_success += 1
-        # self.set_next_run(task='TrueOrochi', target=next_run)
-        self.set_next_run('TrueOrochi', finish=True, success=True)
+        now = datetime.now()
+        now_year, now_week_number, now_weekday = now.isocalendar()
+        if battle:
+            next_run = now + self.config.true_orochi.scheduler.success_interval
+        else:
+            next_run = now + self.config.true_orochi.scheduler.failure_interval
+        next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
+        # 如果下次运行的时间是下一周,那么就重置成功次数
+        if now_week_number != next_run_week_number:
+            logger.info('Reset current_success')
+            self.config.true_orochi.true_orochi_config.current_success = 0
+        else:
+            # 如果不是下一周,那么就加一
+            logger.info('Add current_success by 1')
+            self.config.true_orochi.true_orochi_config.current_success += 1
+            self.config.true_orochi.true_orochi_config.current_success = min(2, self.config.true_orochi.true_orochi_config.current_success)
+        self.config.save()
+        self.set_next_run(task='TrueOrochi', target=next_run)
+        # self.set_next_run('TrueOrochi', finish=True, success=True)
 
     def run_true_orochi(self) -> bool:
         pass

+ 11 - 0
tasks/TrueOrochi/st/ocr.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "times",
+    "roiFront": "461,388,40,26",
+    "roiBack": "461,388,40,26",
+    "mode": "DigitCounter",
+    "method": "Default",
+    "keyword": "",
+    "description": "本周剩余奖励次数"
+  }
+]

+ 4 - 3
tasks/WantedQuests/script_task.py

@@ -192,10 +192,11 @@ class ScriptTask(WQExplore, SecretScriptTask, WantedQuestsAssets):
             if self.special_main and self.click(self.C_SPECIAL_MAIN, interval=3):
                 logger.info('Click special main left to find wanted quests')
                 continue
+            if not (self.appear(self.I_WQ_INVITE_1) or self.appear(self.I_WQ_INVITE_2) or self.appear(
+                    self.I_WQ_INVITE_3)):
+                logger.info("there is no cooperation quest")
+                break
         #
-        if not (self.appear(self.I_WQ_INVITE_1) or self.appear(self.I_WQ_INVITE_2) or self.appear(self.I_WQ_INVITE_3)):
-            logger.info("there is no cooperation quest")
-            return False
 
         # if self.appear(self.I_WQ_INVITE_1):
         #     self.trace_one(self.I_WQ_INVITE_1)