Sfoglia il codice sorgente

Merge pull request #1859 from runhey/dev

Dev
huangrunheng 1 mese fa
parent
commit
9d9df4e543
40 ha cambiato i file con 385 aggiunte e 164 eliminazioni
  1. 1 1
      .github/workflows/issue-handle-bug.lock.yml
  2. 1 1
      .github/workflows/issue-handle-enhancement.lock.yml
  3. 1 1
      .github/workflows/issue-handle-other.lock.yml
  4. 1 1
      .github/workflows/issue-handle-question.lock.yml
  5. 1 1
      .github/workflows/issue-triage.lock.yml
  6. 1 1
      .github/workflows/pr-review-checklist.lock.yml
  7. 1 1
      .github/workflows/pr-review-intent.lock.yml
  8. 1 1
      .github/workflows/shared/engine.md
  9. 1 1
      .github/workflows/weekly-report.lock.yml
  10. 5 1
      assets/i18n/zh-CN.json
  11. 3 2
      config/template.json
  12. 6 1
      tasks/Component/Costume/config.py
  13. 40 6
      tasks/Component/Costume/costume_base.py
  14. 17 0
      tasks/Component/CostumeBattleScene/assets.py
  15. BIN
      tasks/Component/CostumeBattleScene/bs1/bs1_reward_1.png
  16. 11 0
      tasks/Component/CostumeBattleScene/bs1/image.json
  17. 16 6
      tasks/DemonEncounter/assets.py
  18. 32 8
      tasks/DemonEncounter/demon/click.json
  19. BIN
      tasks/DemonEncounter/demon/demon_de_box_center.png
  20. 10 1
      tasks/DemonEncounter/demon/image.json
  21. 1 1
      tasks/DemonEncounter/demon/ocr.json
  22. 85 46
      tasks/DemonEncounter/script_task.py
  23. 2 2
      tasks/Dokan/script_task.py
  24. 4 20
      tasks/EternitySea/script_task.py
  25. 1 1
      tasks/FallenSun/script_task.py
  26. 17 20
      tasks/GameUi/assets.py
  27. 14 0
      tasks/GameUi/default_pages.py
  28. 2 0
      tasks/GameUi/page.py
  29. 7 9
      tasks/GameUi/page/image_main.json
  30. 8 0
      tasks/Orochi/assets.py
  31. 36 0
      tasks/Orochi/o/image.json
  32. BIN
      tasks/Orochi/o/o_orochi_check_10.png
  33. BIN
      tasks/Orochi/o/o_orochi_check_11.png
  34. BIN
      tasks/Orochi/o/o_orochi_check_12.png
  35. BIN
      tasks/Orochi/o/o_orochi_check_13.png
  36. 16 0
      tasks/Orochi/page.py
  37. 7 19
      tasks/Orochi/script_task.py
  38. 4 5
      tasks/TrueOrochi/script_task.py
  39. 4 4
      tasks/WeeklyTrifles/script_task.py
  40. 28 3
      tasks/base_task.py

File diff suppressed because it is too large
+ 1 - 1
.github/workflows/issue-handle-bug.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/issue-handle-enhancement.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/issue-handle-other.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/issue-handle-question.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/issue-triage.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/pr-review-checklist.lock.yml


File diff suppressed because it is too large
+ 1 - 1
.github/workflows/pr-review-intent.lock.yml


+ 1 - 1
.github/workflows/shared/engine.md

@@ -7,7 +7,7 @@
 #     ANTHROPIC_API_KEY : ${{ secrets.DEEPSEEK_API_KEY  }}
 engine:
   id: codex
-  model: gpt-5.6-luna
+  model: gpt-6-luna
   env:
     OPENAI_BASE_URL: https://ai-pixel.online
     OPENAI_API_KEY : ${{ secrets.PIXEL_API_KEY }}

File diff suppressed because it is too large
+ 1 - 1
.github/workflows/weekly-report.lock.yml


+ 5 - 1
assets/i18n/zh-CN.json

@@ -138,7 +138,11 @@
   "enable_ap100_anti_detect": "100体爬塔防检测",
   "enable_ap100_anti_detect_help": "100体爬塔战斗过程是否随机点击或滑动",
   "costume_battle_15": "灵狐寄愿",
+  "costume_battle_scene_default": "默认",
+  "costume_battle_scene_1": "鎏金圣域",
+  "costume_battle_scene_type": "战斗场景",
+  "costume_battle_scene_type_help": "",
   "costume_shikigami_12": "拾光之窗",
   "save_touch_fish": "惠比寿的摸鱼行动",
   "save_touch_fish_help": "默认使用全部存储按钮,主要目的是为了配合真蛇每周打一次即可获得俩次奖励(并不会节省体力)"
-}
+}

+ 3 - 2
config/template.json

@@ -74,7 +74,8 @@
       "costume_theme_type": "costume_theme_default",
       "costume_shikigami_type": "costume_shikigami_default",
       "costume_sign_type": "costume_sign_default",
-      "costume_battle_type": "costume_battle_default"
+      "costume_battle_type": "costume_battle_default",
+      "costume_battle_scene_type": "costume_battle_scene_default"
     },
     "team_flow": {
       "enable": false,
@@ -1578,4 +1579,4 @@
       "team_name": ""
     }
   }
-}
+}

+ 6 - 1
tasks/Component/Costume/config.py

@@ -79,6 +79,11 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_14 = 'costume_battle_14'  # 茸茨跃动
     COSTUME_BATTLE_15 = 'costume_battle_15'  # 灵狐寄愿
 
+# 战斗场景
+class BattleSceneType(str, Enum):
+    COSTUME_BATTLE_SCENE_DEFAULT = 'costume_battle_scene_default'  # 默认
+    COSTUME_BATTLE_SCENE_1 = 'costume_battle_scene_1'  # 鎏金圣域
+
 
 class CostumeConfig(BaseModel):
     # 皮肤配置
@@ -89,6 +94,7 @@ class CostumeConfig(BaseModel):
     costume_shikigami_type: ShikigamiType = Field(default=ShikigamiType.COSTUME_SHIKIGAMI_DEFAULT, description='costume_shikigami_type_help')
     costume_sign_type: SignType = Field(default=SignType.COSTUME_SIGN_DEFAULT, description='costume_sign_type_help')
     costume_battle_type: BattleType = Field(default=BattleType.COSTUME_BATTLE_DEFAULT, description='costume_battle_type_help')
+    costume_battle_scene_type: BattleSceneType = Field(default=BattleSceneType.COSTUME_BATTLE_SCENE_DEFAULT, description='costume_battle_scene_type_help')
 
     @field_validator('costume_realm_type', mode='before')
     @classmethod
@@ -103,4 +109,3 @@ class CostumeConfig(BaseModel):
 
 
 
-

+ 40 - 6
tasks/Component/Costume/costume_base.py

@@ -5,13 +5,18 @@
 from module.atom.image import RuleImage
 from module.atom.gif import RuleGif
 from module.logger import logger
+from module.server.i18n import I18n
 
-from tasks.Component.Costume.config import (MainType, CostumeConfig, RealmType,
-                                            ThemeType, ShikigamiType, SignType, BattleType, CarpBannerType)
+from tasks.Component.Costume.config import (
+    MainType, CostumeConfig, RealmType,
+    ThemeType, ShikigamiType, SignType,
+    BattleType, BattleSceneType, CarpBannerType
+)
 from tasks.Component.Costume.assets import CostumeAssets
 from tasks.Component.CostumeBattle.assets import CostumeBattleAssets
 from tasks.Component.CostumeShikigami.assets import CostumeShikigamiAssets
 from tasks.Component.CostumeCarpBanner.assets import CostumeCarpBannerAssets
+from tasks.Component.CostumeBattleScene.assets import CostumeBattleSceneAssets
 
 # 庭院皮肤
 # 主界面皮肤(使用字典推导式动态生成)
@@ -66,6 +71,13 @@ battle_theme_model = {
     } for i in range(1, 16)
 }
 
+# 战斗场景皮肤。图片资源待补充,先保留空映射。
+battle_scene_model = {
+    BattleSceneType.COSTUME_BATTLE_SCENE_1: {
+        'I_REWARD': 'I_REWARD_1',
+    },
+}
+
 # 幕间主题
 shikigami_costume_model = {
     getattr(ShikigamiType, f"COSTUME_SHIKIGAMI_{i}"): {
@@ -93,9 +105,12 @@ class CostumeBase:
     def check_costume(self, config: CostumeConfig=None):
         if config is None:
             config: CostumeConfig = self.config.model.global_game.costume_config
+        current_task = self.get_task_name()
+        logger.info(f'Current task: {current_task}')
         self.check_costume_main(config.costume_main_type)
         self.check_costume_carpbanner(config.costume_carpbanner_type)
         self.check_costume_battle(config.costume_battle_type)
+        self.check_costume_battle_scene(config.costume_battle_scene_type)
         self.check_costume_shikigami(config.costume_shikigami_type)
 
     def replace_img(self,
@@ -115,7 +130,7 @@ class CostumeBase:
     def check_costume_main(self, main_type: MainType):
         if main_type == MainType.COSTUME_MAIN:
             return
-        logger.info(f'Switch main costume to {main_type}')
+        logger.info(f'Switch main costume to {main_type} ({I18n.trans_zh_cn(main_type)})')
         costume_assets = CostumeAssets()
         for key, value in main_costume_model[main_type].items():
             if isinstance(value, list):
@@ -130,7 +145,7 @@ class CostumeBase:
     def check_costume_carpbanner(self, carpbanner_type: CarpBannerType):
         if carpbanner_type == CarpBannerType.COSTUME_CARPBANNER_DEFAULT:
             return
-        logger.info(f'Switch carp banner theme {carpbanner_type} (override realm assets)')
+        logger.info(f'Switch carp banner theme {carpbanner_type} (override realm assets) ({I18n.trans_zh_cn(carpbanner_type)})')
         carpbanner_assets = CostumeCarpBannerAssets()
         model = carpbanner_costume_model.get(carpbanner_type, {})
         for key, value in model.items():
@@ -144,7 +159,7 @@ class CostumeBase:
     def check_costume_battle(self, battle_type: BattleType):
         if battle_type == BattleType.COSTUME_BATTLE_DEFAULT:
             return
-        logger.info(f'Switch battle theme {battle_type}')
+        logger.info(f'Switch battle theme {battle_type} ({I18n.trans_zh_cn(battle_type)})')
         costume_battle_assets = CostumeBattleAssets()
         for key, value in battle_theme_model[battle_type].items():
             if not hasattr(costume_battle_assets, value):
@@ -157,10 +172,29 @@ class CostumeBase:
             else:
                 self.replace_img(key, assert_value)
 
+    def check_costume_battle_scene(self, scene_type: BattleSceneType):
+        if scene_type == BattleSceneType.COSTUME_BATTLE_SCENE_DEFAULT:
+            return
+        logger.info(f'Switch battle scene skin {scene_type} ({I18n.trans_zh_cn(scene_type)})')
+        current_task = self.get_task_name()
+        allowed_tasks = {
+            'Orochi',
+        }
+        if current_task not in allowed_tasks:
+            return
+
+        costume_assets = CostumeBattleSceneAssets()
+        for key, value in battle_scene_model.get(scene_type, {}).items():
+            if not hasattr(costume_assets, value):
+                # 尚未采集完成的资产,跳过
+                continue
+            assert_value: RuleImage = getattr(costume_assets, value)
+            self.replace_img(key, assert_value)
+
     def check_costume_shikigami(self, shikigami_type: ShikigamiType):
         if shikigami_type == ShikigamiType.COSTUME_SHIKIGAMI_DEFAULT:
             return
-        logger.info(f'Switch shikigami theme {shikigami_type}')
+        logger.info(f'Switch shikigami theme {shikigami_type} ({I18n.trans_zh_cn(shikigami_type)})')
         shikigami_assets = CostumeShikigamiAssets()
         model = shikigami_costume_model.get(shikigami_type, {})
         for key, value in model.items():

+ 17 - 0
tasks/Component/CostumeBattleScene/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 CostumeBattleSceneAssets: 
+
+
+	# Image Rule Assets
+	#  
+	I_REWARD_1 = RuleImage(roi_front=(551,505,165,84), roi_back=(451,413,372,226), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattleScene/bs1/bs1_reward_1.png")
+
+

BIN
tasks/Component/CostumeBattleScene/bs1/bs1_reward_1.png


+ 11 - 0
tasks/Component/CostumeBattleScene/bs1/image.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "reward_1",
+    "imageName": "bs1_reward_1.png",
+    "roiFront": "551,505,165,84",
+    "roiBack": "451,413,372,226",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": ""
+  }
+]

+ 16 - 6
tasks/DemonEncounter/assets.py

@@ -60,14 +60,22 @@ class DemonEncounterAssets:
 
 
 	# Click Rule Assets
-	# 从下开始数第一个 
-	C_DE_1 = RuleClick(roi_front=(1211,478,61,58), roi_back=(1211,478,61,58), name="de_1")
+	# 从下开始数第一个(点击区已收缩, 仅包住内部图形)
+	C_DE_1 = RuleClick(roi_front=(1222,497,39,25), roi_back=(1222,497,39,25), name="de_1")
 	# 2 
-	C_DE_2 = RuleClick(roi_front=(1196,409,55,56), roi_back=(1196,409,55,56), name="de_2")
+	C_DE_2 = RuleClick(roi_front=(1204,424,39,31), roi_back=(1204,424,39,31), name="de_2")
 	# 3 
-	C_DE_3 = RuleClick(roi_front=(1225,344,53,55), roi_back=(1225,344,53,55), name="de_3")
+	C_DE_3 = RuleClick(roi_front=(1234,364,32,22), roi_back=(1234,364,32,22), name="de_3")
 	# 第四个 
-	C_DE_4 = RuleClick(roi_front=(1200,282,56,53), roi_back=(1200,282,56,53), name="de_4")
+	C_DE_4 = RuleClick(roi_front=(1214,297,34,27), roi_back=(1214,297,34,27), name="de_4")
+	# 灯笼1类型识别搜索区(须容纳完整灯笼图案, 仅供check_lantern匹配, 不用于点击)
+	C_DE_MATCH_1 = RuleClick(roi_front=(1211,478,61,58), roi_back=(1211,478,61,58), name="de_match_1")
+	# 灯笼2类型识别搜索区
+	C_DE_MATCH_2 = RuleClick(roi_front=(1196,409,55,56), roi_back=(1196,409,55,56), name="de_match_2")
+	# 灯笼3类型识别搜索区
+	C_DE_MATCH_3 = RuleClick(roi_front=(1225,344,53,55), roi_back=(1225,344,53,55), name="de_match_3")
+	# 灯笼4类型识别搜索区
+	C_DE_MATCH_4 = RuleClick(roi_front=(1200,282,56,53), roi_back=(1200,282,56,53), name="de_match_4")
 
 
 	# Image Rule Assets
@@ -96,6 +104,8 @@ class DemonEncounterAssets:
 	I_DE_BALLOON = RuleImage(roi_front=(1214,295,28,27), roi_back=(1198,269,81,266), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/demon/demon_de_balloon.png")
 	# 右侧的宝箱 
 	I_DE_BOX = RuleImage(roi_front=(1210,295,34,33), roi_back=(1183,278,96,277), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/demon/demon_de_box.png")
+	# 地图中央未购买的宝箱展示 
+	I_DE_BOX_CENTER = RuleImage(roi_front=(618,325,45,34), roi_back=(547,264,190,157), threshold=0.8, method="Template matching", file="./tasks/DemonEncounter/demon/demon_de_box_center.png")
 	# 挑战某一个后的封印图片 
 	I_DE_DEFEAT_2 = RuleImage(roi_front=(1211,422,28,35), roi_back=(1211,422,28,35), threshold=0.7, method="Template matching", file="./tasks/DemonEncounter/demon/demon_de_defeat_2.png")
 	# description 
@@ -126,7 +136,7 @@ class DemonEncounterAssets:
 	# 计数已经开启多少的 
 	O_DE_COUNTER = RuleOcr(roi=(1204,685,48,34), area=(1204,685,48,34), mode="DigitCounter", method="Default", keyword="", name="de_counter")
 	# 现世逢魔顶部今日挑战次数X/1的最小识别区, 0/1表示已打过直接结束 
-	O_DE_CHALLENGE_COUNT = RuleOcr(roi=(705,68,45,36), area=(705,68,45,36), mode="Full", method="Default", keyword="", name="de_challenge_count")
+	O_DE_CHALLENGE_COUNT = RuleOcr(roi=(705,68,45,36), area=(705,68,45,36), mode="DigitCounter", method="Default", keyword="", name="de_challenge_count")
 
 
 	# Click Rule Assets

+ 32 - 8
tasks/DemonEncounter/demon/click.json

@@ -1,26 +1,50 @@
 [
   {
     "itemName": "de_1",
-    "roiFront": "1211,478,61,58",
-    "roiBack": "1211,478,61,58",
+    "roiFront": "1222,497,39,25",
+    "roiBack": "1222,497,39,25",
     "description": "从下开始数第一个"
   },
   {
     "itemName": "de_2",
-    "roiFront": "1196,409,55,56",
-    "roiBack": "1196,409,55,56",
+    "roiFront": "1204,424,39,31",
+    "roiBack": "1204,424,39,31",
     "description": "2"
   },
   {
     "itemName": "de_3",
-    "roiFront": "1225,344,53,55",
-    "roiBack": "1225,344,53,55",
+    "roiFront": "1234,364,32,22",
+    "roiBack": "1234,364,32,22",
     "description": "3"
   },
   {
     "itemName": "de_4",
+    "roiFront": "1214,297,34,27",
+    "roiBack": "1214,297,34,27",
+    "description": "第四个"
+  },
+  {
+    "itemName": "de_match_1",
+    "roiFront": "1211,478,61,58",
+    "roiBack": "1211,478,61,58",
+    "description": "灯笼1类型识别搜索区(须容纳完整灯笼图案, 仅供check_lantern匹配, 不用于点击)"
+  },
+  {
+    "itemName": "de_match_2",
+    "roiFront": "1196,409,55,56",
+    "roiBack": "1196,409,55,56",
+    "description": "灯笼2类型识别搜索区"
+  },
+  {
+    "itemName": "de_match_3",
+    "roiFront": "1225,344,53,55",
+    "roiBack": "1225,344,53,55",
+    "description": "灯笼3类型识别搜索区"
+  },
+  {
+    "itemName": "de_match_4",
     "roiFront": "1200,282,56,53",
     "roiBack": "1200,282,56,53",
-    "description": "第四个"
+    "description": "灯笼4类型识别搜索区"
   }
-]
+]

BIN
tasks/DemonEncounter/demon/demon_de_box_center.png


+ 10 - 1
tasks/DemonEncounter/demon/image.json

@@ -79,5 +79,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "50勾玉购买"
+  },
+  {
+    "itemName": "de_box_center",
+    "imageName": "demon_de_box_center.png",
+    "roiFront": "618,325,45,34",
+    "roiBack": "547,264,190,157",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "地图中央未购买的宝箱展示"
   }
-]
+]

+ 1 - 1
tasks/DemonEncounter/demon/ocr.json

@@ -12,7 +12,7 @@
     "itemName": "de_challenge_count",
     "roiFront": "705,68,45,36",
     "roiBack": "705,68,45,36",
-    "mode": "Full",
+    "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",
     "description": "现世逢魔顶部今日挑战次数X/1的最小识别区, 0/1表示已打过直接结束"

+ 85 - 46
tasks/DemonEncounter/script_task.py

@@ -3,7 +3,6 @@
 # github https://github.com/runhey
 import time
 from time import sleep
-import re
 
 from enum import Enum
 from cached_property import cached_property
@@ -61,16 +60,16 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
 
     def check_challenge_done(self) -> bool:
         """
-        OCR识别现世逢魔顶部"今日挑战次数:X/1"
-        :return: True表示0/1今日已打过
+        OCR识别现世逢魔顶部"今日挑战次数:剩余/总", 支持老号X/1与新号X/2
+        DigitCounter 返回 (current, remain, total), current 即剩余次数
+        :return: True表示剩余=0, 今日已打过
         """
-        results = self.O_DE_CHALLENGE_COUNT.detect_and_ocr(self.device.image)
-        text = ''.join(r.ocr_text for r in results)
-        m = re.search(r'([01])\s*/\s*1', text)
-        if not m:
-            logger.warning(f'Challenge count not recognized: [{text}], continue by default')
-            return False
-        return m.group(1) == '0'
+        current, _remain, total = self.O_DE_CHALLENGE_COUNT.ocr(self.device.image)
+        if total > 0:
+            logger.info(f'Demon encounter challenge count: {current}/{total}')
+            return current == 0
+        logger.warning('Challenge count not recognized, assume attempts remain')
+        return False
 
     def checkout_soul(self):
         """
@@ -94,40 +93,77 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
         logger.hr('Start boss battle', 1)
 
         def find_boss():
-            find_btn_clicked = False
-            timer_find_boss = Timer(10 * 60)
-            timer_find_boss.start()
-            while 1:
+            search_button = self.I_DE_BOSS_BEST if self.best_demon_enable else self.I_DE_BOSS
+            boss_name = 'best boss' if self.best_demon_enable else 'normal boss'
+
+            # 每轮搜索前若中央有未购买的宝箱展示, 先点左下角定位(小指针)把它挪开;
+            # 一整轮(2次搜索)都没找到则重进逢魔之时清状态, 最多3轮。
+            for reenter_round in range(1, 4):
                 self.screenshot()
-                if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
-                    break
-                if timer_find_boss.reached():
-                    logger.warning('find boss timeout')
-                    self.set_next_run(task='DemonEncounter', success=False, finish=True, server=False)
-                    raise TaskEnd('DemonEncounter')
-                if self.appear(self.I_JADE_50):
-                    # 没找到boss但地图中央出现宝箱,导致点击宝箱出现50勾玉购买界面
-                    self.ui_click_until_smt_disappear(self.I_DE_FIND, self.I_JADE_50, interval=1)
-                    continue
-                if find_btn_clicked and self.click(self.C_DM_BOSS_CLICK, interval=5):
-                    find_btn_clicked = False
-                    continue
-                if self.best_demon_enable:
+                if self.appear(self.I_DE_BOX_CENTER):
+                    logger.info(
+                        f'Box display at map center, click location to reset view '
+                        f'(round {reenter_round}/3)'
+                    )
+                    self.appear_then_click(self.I_DE_LOCATION, interval=2)
+                    time.sleep(1)
+
+                # 最多重新执行两轮“逢魔/极逢魔 -> 地图中央首领”的完整流程。
+                for search_attempt in range(1, 3):
                     self.device.click_record_clear()
-                    if self.appear(self.I_DE_BOSS_BEST) and (not find_btn_clicked):
-                        self.device.click_record_remove(self.I_DE_BOSS_BEST)
-                        if self.click(self.I_DE_BOSS_BEST, interval=4):
-                            logger.info("Finding best boss...")
-                            find_btn_clicked = True
-                        continue
-                else:
-                    if self.appear(self.I_DE_BOSS) and (not find_btn_clicked):
-                        self.device.click_record_remove(self.I_DE_BOSS)
-                        if self.click(self.I_DE_BOSS, interval=4):
-                            logger.info("Finding normal boss...")
-                            find_btn_clicked = True
+                    self.screenshot()
+                    if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
+                        return True
+                    # 没找到boss但地图中央出现宝箱, 导致点击宝箱出现50勾玉购买界面(事后补救)
+                    if self.appear(self.I_JADE_50):
+                        self.ui_click_until_smt_disappear(self.I_DE_FIND, self.I_JADE_50, interval=1)
                         continue
-            return True
+                    if not self.appear_then_click(search_button, interval=2):
+                        raise GameStuckError(f'Cannot find {boss_name} search button')
+                    logger.info(
+                        f'Finding {boss_name}, attempt {search_attempt}/2 '
+                        f'(re-enter round {reenter_round}/3)...'
+                    )
+                    time.sleep(1)
+
+                    # 每轮点击地图中央框选的红色“集结”区域至多两次,
+                    # 每次等待集结挑战标志5秒。
+                    for center_attempt in range(1, 3):
+                        self.click(self.C_DM_BOSS_CLICK, interval=2)
+                        deadline = time.monotonic() + 5
+                        while time.monotonic() < deadline:
+                            self.screenshot()
+                            if self.appear(self.I_BOSS_FIRE) or self.appear(self.I_BEST_BOSS_FIRE):
+                                logger.info(
+                                    f'{boss_name} gather appeared after center click '
+                                    f'{center_attempt}/2'
+                                )
+                                return True
+                            time.sleep(0.2)
+                        logger.warning(
+                            f'{boss_name} gather did not appear after center click '
+                            f'{center_attempt}/2'
+                        )
+
+                    # 本轮失败,返回逢魔地图,重新点击逢魔/极逢魔进行下一轮搜寻。
+                    self.screenshot()
+                    if self.appear(self.I_UI_BACK_RED):
+                        self.appear_then_click(self.I_UI_BACK_RED, interval=2)
+                        deadline = time.monotonic() + 5
+                        while time.monotonic() < deadline:
+                            self.screenshot()
+                            if self.appear(search_button):
+                                break
+                            time.sleep(0.2)
+
+                # 2次搜索都没找到: 重进地图清状态, 最多3轮
+                logger.info(f'Boss not found, re-enter demon encounter map (round {reenter_round}/3)')
+                self.goto_page(page_demon_encounter)
+                self.goto_page(page_demon_encounter_realworld)
+
+            raise GameStuckError(
+                f'Cannot enter {boss_name} after 3 re-enter rounds'
+            )
 
         def enter_boss():
             logger.info('trying to enter boss...')
@@ -293,11 +329,13 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
         :param index: 四个灯笼,从1开始
         :return:
         """
+        # 分类模板的搜索区(须容纳完整灯笼图案), 与点击区 C_DE_* 分离:
+        # 点击区只包住内部图形, 模板放不进搜索区会全部误判成 battle
         match_roi = {
-            1: self.C_DE_1.roi_front,
-            2: self.C_DE_2.roi_front,
-            3: self.C_DE_3.roi_front,
-            4: self.C_DE_4.roi_front,
+            1: self.C_DE_MATCH_1.roi_front,
+            2: self.C_DE_MATCH_2.roi_front,
+            3: self.C_DE_MATCH_3.roi_front,
+            4: self.C_DE_MATCH_4.roi_front,
         }
         match_empty = {
             1: self.I_DE_DEFEAT_1,
@@ -422,9 +460,10 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets, SwitchSoul):
                     break
                 # 如果没有出现红色关闭按钮,说明答题结束
                 if not self.appear(self.I_LETTER_CLOSE):
-                    time.sleep(1.8)
+                    time.sleep(2.5)
                     self.screenshot()
                     if not self.appear(self.I_LETTER_CLOSE):
+                        self.ui_reward_appear_click()
                         logger.warning('Answer finish')
                         return
 

+ 2 - 2
tasks/Dokan/script_task.py

@@ -511,8 +511,8 @@ class ScriptTask(ExtendGreenMark, GameUi, SwitchSoul, DokanSceneDetector):
             if self.appear(self.I_RYOU_DOKAN_DOKAN_QUIT):
                 self.click(self.I_RYOU_DOKAN_DOKAN_QUIT, interval=3)
                 continue
-            if self.appear(self.I_BACK_BL):
-                self.click(self.I_BACK_BL, interval=3)
+            if self.appear(self.I_UI_BACK_BLUE):
+                self.click(self.I_UI_BACK_BLUE, interval=3)
                 continue
             if self.appear(self.I_BACK_Y):
                 self.click(self.I_BACK_Y, interval=3)

+ 4 - 20
tasks/EternitySea/script_task.py

@@ -7,7 +7,7 @@ from module.exception import TaskEnd
 from module.base.timer import Timer
 from module.logger import logger
 
-from tasks.GameUi.game_ui import GameUi, Page
+from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_soul_zones, page_shikigami_records
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
@@ -44,7 +44,7 @@ class ScriptTask(
             case UserStatus.MEMBER: success = self.run_member()
             case UserStatus.ALONE: success = self.run_alone()
             case _: logger.error('Unknown user status')
-
+        self.goto_page(page_main)
         if success:
             self.set_next_run(self.task_name, finish=True, success=True)
         else:
@@ -55,7 +55,7 @@ class ScriptTask(
 
     def run_leader(self):
         logger.info('Start run leader')
-        self._navigate_to_soul_zones()
+        self.goto_page(page_soul_zones)
         self._enter_eternity_sea()
         layer = self._task_config.eternity_sea_config.layer
         self.check_layer(layer)
@@ -224,7 +224,7 @@ class ScriptTask(
 
     def run_alone(self) -> bool:
         logger.info("Start run alone")
-        self._navigate_to_soul_zones()
+        self.goto_page(page_soul_zones)
         self._enter_eternity_sea()
 
         if self._task_config.general_battle_config.lock_team_enable == False:
@@ -266,16 +266,6 @@ class ScriptTask(
                 return True
         return False
 
-    def eternitysea_enter(self) -> bool:
-        logger.info('Enter EternitySea')
-        while True:
-            self.screenshot()
-            if self.appear(self.I_FORM_TEAM):
-                return True
-            if self.appear_then_click(self.I_ETERNITY_SEA, interval=1):
-                continue
-
-
     def _is_in_eternity_sea(self) -> bool:
         self.screenshot()
         return self.appear(self.I_ETERNITY_SEA_FIRE)
@@ -299,12 +289,6 @@ class ScriptTask(
             if self.appear_then_click(self.I_BACK_BOTTOM, interval=1):
                 continue
 
-    def _navigate_to_soul_zones(self) -> None:
-        self.goto_page(page_soul_zones)
-
-    def _navigate_to_game_page(self, destination: Page) -> None:
-        self.goto_page(destination)
-
     @property
     def _task_config(self) -> EternitySea:
         return self.config.model.eternity_sea

+ 1 - 1
tasks/FallenSun/script_task.py

@@ -284,7 +284,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             self.screenshot()
             if not self.appear(self.I_FORM_TEAM):
                 break
-            if self.appear_then_click(self.I_BACK_BL, interval=2):
+            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=2):
                 continue
             if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2):
                 continue

+ 17 - 20
tasks/GameUi/assets.py

@@ -10,8 +10,6 @@ from module.atom.list import RuleList
 class GameUiAssets: 
 
 
-
-
 	# Image Rule Assets
 	# description 
 	I_PAPER_DOLL_CLOSE = RuleImage(roi_front=(1253,102,25,62), roi_back=(1238,58,40,153), threshold=0.8, method="Template matching", file="./tasks/GameUi/additional/additional_paper_doll_close.png")
@@ -104,11 +102,13 @@ class GameUiAssets:
 	I_CHECK_MANTRA_TOWER = RuleImage(roi_front=(348,158,30,106), roi_back=(296,117,165,256), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mantra_tower.png")
 	# 孔雀国标志 
 	I_CHECK_PEACOCK_KINGDOM = RuleImage(roi_front=(348,158,30,106), roi_back=(296,117,165,256), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_peacock_kingdom.png")
+	# 六道之门检查(移植自mine) 
+	I_CHECK_SIX_GATES = RuleImage(roi_front=(411,297,21,21), roi_back=(395,262,54,85), threshold=0.85, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
 
 
 	# Image Rule Assets
 	# 庭院标志 
-	I_CHECK_MAIN = RuleImage(roi_front=(807,108,76,45), roi_back=(49,98,1033,61), threshold=0.95, method="Template matching", file="./tasks/GameUi/page/page_check_main.png")
+	I_CHECK_MAIN = RuleImage(roi_front=(807,108,76,45), roi_back=(49,98,1033,74), threshold=0.95, method="Template matching", file="./tasks/GameUi/page/page_check_main.png")
 	# 庭院卷轴关闭标识 
 	I_MAIN_SCROLL_CLOSE = RuleImage(roi_front=(1181,634,28,39), roi_back=(1162,595,77,112), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_scroll_close.png")
 	# 庭院探索标志 
@@ -163,6 +163,12 @@ class GameUiAssets:
 	I_CHECK_SHRIN = RuleImage(roi_front=(80,92,33,97), roi_back=(56,73,84,138), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_shrin.png")
 	# 阴阳寮前往神社 
 	I_GUILD_TO_SHRIN = RuleImage(roi_front=(877,629,49,53), roi_back=(840,602,302,113), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_guild_to_shrin.png")
+	# 黄色返回按钮 
+	I_BACK_Y = RuleImage(roi_front=(15,4,57,52), roi_back=(1,2,100,91), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_y.png")
+	# 黄色返回按钮-大 
+	I_BACK_YOLLOW = RuleImage(roi_front=(24,16,48,55), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_yollow.png")
+	# 召唤页返回主页 
+	I_SUMMON_GOTO_MAIN = RuleImage(roi_front=(27,5,49,51), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_summon_goto_main.png")
 
 
 	# Image Rule Assets
@@ -170,10 +176,6 @@ class GameUiAssets:
 	I_CHECK_TOWN = RuleImage(roi_front=(1026,106,68,82), roi_back=(765,98,402,96), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_town.png")
 	# description 
 	I_TOWN_GOTO_MAIN = RuleImage(roi_front=(1017,231,78,73), roi_back=(302,216,868,127), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_main.png")
-	# 町中前往娱乐区域
-	I_TOWN_GOTO_ENTERTAINMENT = RuleImage(roi_front=(201,144,35,26), roi_back=(201,144,35,26), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_entertainment.png")
-	# 娱乐区域页面标志
-	I_CHECK_ENTERTAINMENT = RuleImage(roi_front=(151,18,102,40), roi_back=(151,18,102,40), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_entertainment.png")
 	# description 
 	I_TOWN_GOTO_DUEL = RuleImage(roi_front=(756,142,48,68), roi_back=(357,126,657,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_duel.png")
 	# description 
@@ -198,22 +200,16 @@ class GameUiAssets:
 	I_TOWN_GOTO_HYAKKIYAKOU = RuleImage(roi_front=(880,165,53,69), roi_back=(827,149,148,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_hyakkiyakou.png")
 	# 百鬼夜行标志 
 	I_CHECK_KYAKKIYAKOU = RuleImage(roi_front=(1062,564,84,73), roi_back=(68,519,1185,141), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_kyakkiyakou.png")
-	# 逢魔之时新页面标志
+	# 逢魔之时新页面标志 
 	I_CHECK_DEMON_ENCOUNTER_2 = RuleImage(roi_front=(501,441,53,122), roi_back=(358,326,370,288), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_demon_encounter_2.png")
-	# 现世逢魔页面标志
+	# 町中前往娱乐区域 
+	I_TOWN_GOTO_ENTERTAINMENT = RuleImage(roi_front=(201,144,35,26), roi_back=(201,144,35,26), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_entertainment.png")
+	# 娱乐区域页面标志 
+	I_CHECK_ENTERTAINMENT = RuleImage(roi_front=(151,18,102,40), roi_back=(151,18,102,40), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_entertainment.png")
+	# 检查逢魔之时现世逢魔界面(移植自mine) 
 	I_CHECK_DEMON_ENCOUNTER_REALWORLD = RuleImage(roi_front=(26,658,42,43), roi_back=(2,619,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_demon_encounter_realworld.png")
-	# 现世逢魔入口
+	# 进入现世逢魔(移植自mine) 
 	I_DEMON_ENCOUNTER_REALWORLD_GOTO = RuleImage(roi_front=(994,485,106,30), roi_back=(994,485,106,30), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_demon_encounter_realworld.png")
-	# description
-	I_BACK_YOLLOW = RuleImage(roi_front=(24,16,48,55), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_yollow.png")
-	# description
-	I_BACK_Y = RuleImage(roi_front=(15,4,57,52), roi_back=(1,2,100,91), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_y.png")
-	# description
-	I_CHECK_SIX_GATES = RuleImage(roi_front=(411,297,21,21), roi_back=(395,262,54,85), threshold=0.85, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
-	# description
-	I_SUMMON_GOTO_MAIN = RuleImage(roi_front=(27,5,49,51), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_summon_goto_main.png")
-	# description
-	I_BACK_BL = RuleImage(roi_front=(32,31,50,53), roi_back=(1,2,139,120), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/ui/ui_ui_back_blue.png")
 
 
 	# List Rule Assets
@@ -227,3 +223,4 @@ class GameUiAssets:
 	L_ACT_LIST_OCR = RuleList(folder="./tasks/GameUi/page", direction="vertical", mode="ocr", roi_back=(50,123,49,553), size=(45, 69), 
 					 array=["版本"])
 
+

+ 14 - 0
tasks/GameUi/default_pages.py

@@ -21,6 +21,7 @@ from tasks.GameUi.page_definition import Page
 from tasks.KekkaiUtilize.assets import KekkaiUtilizeAssets
 from tasks.Restart.assets import RestartAssets
 from tasks.RyouToppa.assets import RyouToppaAssets
+from tasks.WeeklyTrifles.assets import WeeklyTriflesAssets
 
 
 def random_click(
@@ -113,6 +114,19 @@ page_guild.add_enter_failure_hooks(conditional_action(condition=GameUiAssets.I_C
 page_guild.connect(page_main, GlobalGameAssets.I_UI_BACK_YELLOW, key="page_guild->page_main")
 page_main.connect(page_guild, GameUiAssets.I_MAIN_GOTO_GUILD, key="page_main->page_guild")
 
+# 摸鱼行动页面。
+page_touch_fish = Page(WeeklyTriflesAssets.I_CHECK_TOUCH_FISH, category="global")
+page_guild.connect(
+    page_touch_fish,
+    WeeklyTriflesAssets.I_GUILD_GOTO_TF,
+    key="page_guild->page_touch_fish",
+)
+page_touch_fish.connect(
+    page_main,
+    WeeklyTriflesAssets.I_WT_TF_GOTO_MAIN,
+    key="page_touch_fish->page_main",
+)
+
 page_shirin = Page(GameUiAssets.I_CHECK_SHRIN, category="global")
 page_guild.connect(page_shirin, GameUiAssets.I_GUILD_TO_SHRIN, key="page_guild->page_shirin")
 page_shirin.connect(page_guild, GlobalGameAssets.I_UI_BACK_YELLOW, key="page_shirin->page_guild")

+ 2 - 0
tasks/GameUi/page.py

@@ -38,6 +38,7 @@ from tasks.GameUi.default_pages import (
     page_mall,
     page_mall_recommend,
     page_onmyodo,
+    page_touch_fish,
     page_realm_raid,
     page_reward,
     page_secret_zones,
@@ -104,6 +105,7 @@ __all__ = [
     "page_mall",
     "page_mall_recommend",
     "page_onmyodo",
+    "page_touch_fish",
     "page_realm_raid",
     "page_reward",
     "page_secret_zones",

+ 7 - 9
tasks/GameUi/page/image_main.json

@@ -3,7 +3,7 @@
     "itemName": "check_main",
     "imageName": "page_check_main.png",
     "roiFront": "807,108,76,45",
-    "roiBack": "49,98,1033,61",
+    "roiBack": "49,98,1033,74",
     "method": "Template matching",
     "threshold": 0.95,
     "description": "庭院标志"
@@ -258,9 +258,8 @@
     "roiBack": "1,2,100,91",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "黄色返回按钮(移植自mine)"
-  }
-,
+    "description": "黄色返回按钮"
+  },
   {
     "itemName": "back_yollow",
     "imageName": "page_back_yollow.png",
@@ -268,9 +267,8 @@
     "roiBack": "0,0,100,100",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "黄色返回按钮-大(移植自mine)"
-  }
-,
+    "description": "黄色返回按钮-大"
+  },
   {
     "itemName": "summon_goto_main",
     "imageName": "page_summon_goto_main.png",
@@ -278,6 +276,6 @@
     "roiBack": "0,0,100,100",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "召唤页返回主页(移植自mine)"
+    "description": "召唤页返回主页"
   }
-]
+]

+ 8 - 0
tasks/Orochi/assets.py

@@ -25,6 +25,14 @@ class OrochiAssets:
 	I_SHI_RECORDS = RuleImage(roi_front=(842,569,48,45), roi_back=(842,569,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_pet_present.png")
+	# 八岐大蛇标志 
+	I_OROCHI_CHECK_10 = RuleImage(roi_front=(929,123,203,39), roi_back=(896,100,269,84), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_check_10.png")
+	# 巫女大蛇标志 
+	I_OROCHI_CHECK_11 = RuleImage(roi_front=(929,123,203,39), roi_back=(896,100,269,84), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_check_11.png")
+	# 神罚标志 
+	I_OROCHI_CHECK_12 = RuleImage(roi_front=(929,116,100,46), roi_back=(896,100,269,84), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_check_12.png")
+	# 虚无大蛇标志 
+	I_OROCHI_CHECK_13 = RuleImage(roi_front=(929,121,211,41), roi_back=(896,100,269,84), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_check_13.png")
 
 
 	# List Rule Assets

+ 36 - 0
tasks/Orochi/o/image.json

@@ -61,5 +61,41 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "小小宠物,发现宝藏"
+  },
+  {
+    "itemName": "orochi_check_10",
+    "imageName": "o_orochi_check_10.png",
+    "roiFront": "929,123,203,39",
+    "roiBack": "896,100,269,84",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "八岐大蛇标志"
+  },
+  {
+    "itemName": "orochi_check_11",
+    "imageName": "o_orochi_check_11.png",
+    "roiFront": "929,123,203,39",
+    "roiBack": "896,100,269,84",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "巫女大蛇标志"
+  },
+  {
+    "itemName": "orochi_check_12",
+    "imageName": "o_orochi_check_12.png",
+    "roiFront": "929,116,100,46",
+    "roiBack": "896,100,269,84",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "神罚标志"
+  },
+  {
+    "itemName": "orochi_check_13",
+    "imageName": "o_orochi_check_13.png",
+    "roiFront": "929,121,211,41",
+    "roiBack": "896,100,269,84",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "虚无大蛇标志"
   }
 ]

BIN
tasks/Orochi/o/o_orochi_check_10.png


BIN
tasks/Orochi/o/o_orochi_check_11.png


BIN
tasks/Orochi/o/o_orochi_check_12.png


BIN
tasks/Orochi/o/o_orochi_check_13.png


+ 16 - 0
tasks/Orochi/page.py

@@ -0,0 +1,16 @@
+from tasks.GameUi.default_pages import page_exploration, page_soul_zones, page_shikigami_records
+from tasks.GameUi.matcher import any_of
+from tasks.GameUi.page_definition import Page
+from tasks.GlobalGame.assets import GlobalGameAssets
+from tasks.Orochi.assets import OrochiAssets
+
+# 御魂页面(魂1-魂10,魂11,12,13检查标志...)
+page_orochi = Page(any_of(OrochiAssets.I_OROCHI_CHECK_10, OrochiAssets.I_OROCHI_CHECK_11,
+                          OrochiAssets.I_OROCHI_CHECK_12, OrochiAssets.I_OROCHI_CHECK_13))
+page_orochi.connect(page_exploration, GlobalGameAssets.I_UI_BACK_YELLOW, key="page_orochi->page_exploration")
+page_soul_zones.connect(page_orochi, OrochiAssets.I_OROCHI, key="page_soul_zones->page_orochi")
+
+page_orochi.connect(page_shikigami_records, OrochiAssets.I_SHI_RECORDS,
+                    key="page_orochi->page_shikigami_records", cost=2)
+page_shikigami_records.connect(page_orochi, GlobalGameAssets.I_UI_BACK_YELLOW,
+                               key="page_shikigami_records->page_orochi", cost=2)

+ 7 - 19
tasks/Orochi/script_task.py

@@ -13,6 +13,7 @@ from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.Orochi.assets import OrochiAssets
+from tasks.Orochi.page import page_orochi
 from tasks.Orochi.config import Orochi, UserStatus, Layer
 from tasks.TrueOrochi.assets import TrueOrochiAssets
 from module.logger import logger
@@ -43,8 +44,8 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
         config: Orochi = self.config.orochi
         if not self.is_in_battle(True):
-            self.goto_page(page_main)
             if config.orochi_config.soul_buff_enable:
+                self.goto_page(page_main)
                 self.open_buff()
                 self.soul(is_open=True)
                 self.close_buff()
@@ -59,15 +60,14 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
         # 御魂结束后检测是否出现真蛇
         if config.orochi_config.check_true_orochi_enable:
-            self.goto_page(page_soul_zones)
-            self.orochi_enter()
+            self.goto_page(page_orochi)
             self.screenshot()
             if self.appear(self.I_FIND_TS):
                 logger.info('Find true orochi after orochi battle, set TrueOrochi task to run now')
                 self.set_next_run(task='TrueOrochi', success=False, finish=False, server=False, target=datetime.now())
-        self.goto_page(page_main)
         # 记得关掉
         if config.orochi_config.soul_buff_enable:
+            self.goto_page(page_main)
             self.open_buff()
             self.soul(is_open=False)
             self.close_buff()
@@ -79,14 +79,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
         raise TaskEnd
 
-    def orochi_enter(self) -> bool:
-        logger.info('Enter orochi')
-        while True:
-            self.screenshot()
-            if self.appear(self.I_FORM_TEAM):
-                return True
-            if self.appear_then_click(self.I_OROCHI, interval=1):
-                continue
 
     def check_layer(self, layer: str) -> bool:
         """
@@ -132,8 +124,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
     def run_leader(self):
         logger.info('Start run leader')
-        self.goto_page(page_soul_zones)
-        self.orochi_enter()
+        self.goto_page(page_orochi)
         layer = self.config.orochi.orochi_config.layer
         self.check_layer(layer)
         # https://github.com/runhey/OnmyojiAutoScript/issues/592
@@ -224,7 +215,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
     def run_member(self):
         logger.info('Start run member')
         # self.ui_goto(page_soul_zones)
-        # self.orochi_enter()
         # self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
 
         # 进入战斗流程
@@ -273,8 +263,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
     def run_alone(self):
         logger.info('Start run alone')
-        self.goto_page(page_soul_zones)
-        self.orochi_enter()
+        self.goto_page(page_orochi)
         layer = self.config.orochi.orochi_config.layer
         self.check_layer(layer)
         self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
@@ -326,8 +315,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
         # 已经在战斗中不必初始化,保证已经组队开始战斗的情况下可以自动执行后续任务
         if not self.is_in_battle(True):
-            self.goto_page(page_soul_zones)
-            self.orochi_enter()
+            self.goto_page(page_orochi)
             layer = self.config.orochi.orochi_config.layer
             self.check_layer(layer)
             self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)

+ 4 - 5
tasks/TrueOrochi/script_task.py

@@ -14,7 +14,8 @@ from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Orochi.script_task import ScriptTask as OrochiScriptTask
 from tasks.Orochi.config import Layer
-from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
+from tasks.Orochi.page import page_orochi
+from tasks.GameUi.page import page_main, page_shikigami_records
 from tasks.TrueOrochi.assets import TrueOrochiAssets
 
 
@@ -40,8 +41,7 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
             self.run_switch_soul_by_name(self.config.true_orochi.switch_soul.group_name,
                                          self.config.true_orochi.switch_soul.team_name)
 
-        self.goto_page(page_soul_zones)
-        self.orochi_enter()
+        self.goto_page(page_orochi)
         sleep(0.5)
         battle = self.check_true_orochi(True)
         if not battle:
@@ -89,8 +89,7 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
         self.check_times(True)
 
         # 检查是否还有真蛇入口,支持存储两次
-        self.goto_page(page_soul_zones)
-        self.orochi_enter()
+        self.goto_page(page_orochi)
         sleep(0.5)
         if conf.current_success < 2 and self.check_true_orochi(True):
             battle = True

+ 4 - 4
tasks/WeeklyTrifles/script_task.py

@@ -76,8 +76,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
         :return:
         """
         logger.hr('Touch fish start')
-        self.ui_get_current_page()
-        self.ui_goto(page_guild)
+        self.goto_page(page_guild)
         # 防止入口被折叠
         while 1:
             # 等个折叠窗口展开动画
@@ -88,7 +87,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
             if self.appear(self.I_WT_FOLD_WINDOW):
                 break
         # 保存次数,后续做了也会邮件返还福运御守
-        self.ui_goto(page_touch_fish)
+        self.goto_page(page_touch_fish)
         self.screenshot()
         if self.appear(self.I_WT_SAVE_ALL):
             cu_tickts, _, _ = self.O_WT_LUCKY_TICKETS.ocr(self.device.image)
@@ -126,7 +125,7 @@ class ScriptTask(GameUi, WeeklyTriflesAssets):
                     logger.warning('Touch fish timeout, exit!')
                     break
         logger.hr('Touch fish finished')
-        self.ui_goto(page_main)
+        self.goto_page(page_main)
 
     def _share_collect(self):
         """
@@ -369,6 +368,7 @@ if __name__ == '__main__':
     t = ScriptTask(c, d)
     t.screenshot()
 
+    t.run()
     # t._share_collect()
     t._share_area_boss()
     # t.click_share(t.I_WT_SE_WECHAT)

+ 28 - 3
tasks/base_task.py

@@ -2,10 +2,14 @@
 # @author runhey
 # github https://github.com/runhey
 
-from time import sleep, time
-
+import inspect
+import inflection
 import random
+from typing import Union
 from datetime import datetime, timedelta
+from pathlib import Path
+from time import sleep, time
+
 from module.atom.animate import RuleAnimate
 from module.atom.click import RuleClick
 from module.atom.gif import RuleGif
@@ -20,11 +24,12 @@ from module.device.device import Device
 from module.exception import ScriptError
 from module.logger import logger
 from module.ocr.base_ocr import OcrMode
+
 from tasks.Component.Costume.costume_base import CostumeBase
 from tasks.Component.config_base import Time
 from tasks.GlobalGame.assets import GlobalGameAssets
 from tasks.GlobalGame.config_emergency import FriendInvitation
-from typing import Union
+
 
 
 class BaseTask(GlobalGameAssets, CostumeBase):
@@ -61,6 +66,26 @@ class BaseTask(GlobalGameAssets, CostumeBase):
         self.current_count = 0  # 战斗次数
         self._boss_mark_flag = False
 
+    def get_task_name(self) -> str:
+        model_task_name = getattr(self.config.model, 'running_task', '')
+        class_file = inspect.getfile(type(self))
+        path_task_name = Path(class_file).parent.name
+
+        model_task_name = (
+            inflection.camelize(model_task_name, uppercase_first_letter=True)
+            if model_task_name else ''
+        )
+        path_task_name = inflection.camelize(
+            path_task_name,
+            uppercase_first_letter=True,
+        )
+
+        if model_task_name and model_task_name != path_task_name:
+            raise ScriptError(
+                f'Task name mismatch: model={model_task_name}, path={path_task_name}'
+            )
+        return model_task_name or path_task_name
+
     def _burst(self) -> bool:
         """
         游戏界面突发异常检测

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