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

Merge pull request #1707 from runhey/dev

Automated PR 2026.07.30
huangrunheng 3 месяцев назад
Родитель
Сommit
7000dfc0c0
36 измененных файлов с 310 добавлено и 185 удалено
  1. 2 3
      config/template.json
  2. 12 0
      module/atom/gif.py
  3. 1 0
      tasks/AbyssShadows/assets.py
  4. 3 6
      tasks/ActivityShikigami/assets.py
  5. 2 0
      tasks/AreaBoss/assets.py
  6. 9 10
      tasks/AreaBoss/config_boss.py
  7. 9 0
      tasks/AreaBoss/res/ocr.json
  8. 61 31
      tasks/AreaBoss/script_task.py
  9. 6 5
      tasks/Component/Costume/assets.py
  10. 0 15
      tasks/Component/CostumeBattle/assets.py
  11. 1 0
      tasks/Component/GeneralInvite/assets.py
  12. 7 5
      tasks/Component/SwitchAccount/assets.py
  13. 3 2
      tasks/Component/SwitchAccount/login_account.py
  14. 12 3
      tasks/Component/SwitchAccount/ocr.json
  15. 13 13
      tasks/Component/SwitchAccount/res/image.json
  16. BIN
      tasks/Component/SwitchAccount/res/res_sa_check_select_svr_1.png
  17. BIN
      tasks/Component/SwitchAccount/res/res_sa_check_select_svr_2.png
  18. BIN
      tasks/Component/SwitchAccount/res/res_sa_login_form_android.png
  19. BIN
      tasks/Component/SwitchAccount/res/res_sa_login_form_apple.png
  20. 4 2
      tasks/Exploration/assets.py
  21. 9 1
      tasks/Exploration/base.py
  22. 13 4
      tasks/Exploration/res/image.json
  23. BIN
      tasks/Exploration/res/res_swipe_end.png
  24. BIN
      tasks/Exploration/res/res_team_emoji_fight.png
  25. BIN
      tasks/Exploration/res/res_treasure_box_click.png
  26. 72 80
      tasks/Exploration/solo.py
  27. 7 1
      tasks/Exploration/version.py
  28. 1 0
      tasks/HeroTest/assets.py
  29. 9 1
      tasks/SoulsTidy/assets.py
  30. 12 1
      tasks/SoulsTidy/script_task.py
  31. 6 0
      tasks/SoulsTidy/simple/click.json
  32. 28 1
      tasks/SoulsTidy/simple/image.json
  33. BIN
      tasks/SoulsTidy/simple/simple_st_luck.png
  34. BIN
      tasks/SoulsTidy/simple/simple_st_small_luck.png
  35. BIN
      tasks/SoulsTidy/simple/simple_st_soul_stack_1.png
  36. 8 1
      tasks/WantedQuests/explore.py

+ 2 - 3
config/template.json

@@ -100,9 +100,8 @@
     "boss": {
       "boss_number": 3,
       "boss_reward": false,
-      "reward_floor": "一星",
-      "use_collect": false,
-      "Attack_60": false
+      "reward_floor": "不更改",
+      "use_collect": false
     },
     "general_battle": {
       "lock_team_enable": false,

+ 12 - 0
module/atom/gif.py

@@ -44,6 +44,18 @@ class RuleGif:
                 return True, target
         return False, None
 
+    def search_with_multi_scale(self, image, roi=None, threshold=None, scale_range=(0.8, 1.1, 0.05)):
+        image = self.pre_process(image)
+        threshold = self.targets[0].threshold if threshold is None else threshold
+        roi = self.targets[0].roi_back if roi is None else roi
+        for target in self.targets:
+            target.roi_back = roi
+            if target.match_multi_scale(image, threshold=threshold, scale_range=scale_range):
+                self.roi_front = target.roi_front
+                self.appear_target = target
+                return True, target
+        return False, None
+
     def match(self, image, threshold: float = None) -> bool:
         return self.search(image, threshold=threshold)[0]
 

+ 1 - 0
tasks/AbyssShadows/assets.py

@@ -102,3 +102,4 @@ class AbyssShadowsAssets:
 	# 滑到狭间 
 	S_TO_ABBSY_SHADOWS = RuleSwipe(roi_front=(752,395,62,66), roi_back=(758,193,62,48), mode="default", name="to_abbsy_shadows")
 
+

+ 3 - 6
tasks/ActivityShikigami/assets.py

@@ -93,13 +93,10 @@ class ActivityShikigamiAssets:
 	# Ocr Rule Assets
 	# 挑战 
 	O_FIRE = RuleOcr(roi=(1124,599,96,50), area=(1123,570,106,100), mode="Single", method="Default", keyword="挑战", name="fire")
-	# 20260725 缩小体力和活动体力的检测范围,范围太大,有可能把0识别为10的情况。
-	# 潜在风险1,超过1000的数字可能会只识别到最后的000,还有识别0的时候,score比较低,只有0.3,不知道怎么优化。
-	# 潜在风险2,部分数字,遇到过300等,会识别为0,之前没截上图,待后面遇到再处理这种情况。
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(793, 18, 44, 25), area=(793, 18, 44, 25), mode="DigitCounter", method="Default",           keyword="", name="remain_ap")
-	# 活动体力的剩余检测
-	O_REMAIN_PASS = RuleOcr(roi=(600, 18, 44, 25), area=(600, 18, 44, 25), mode="DigitCounter", method="Default",         keyword="", name="remain_pass")
+	O_REMAIN_AP = RuleOcr(roi=(777,17,63,30), area=(776,16,63,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	# 活动体力的剩余检测 
+	O_REMAIN_PASS = RuleOcr(roi=(599,15,50,29), area=(600,16,49,28), mode="DigitCounter", method="Default", keyword="", name="remain_pass")
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 	# 活动票数(没有百分比) 

+ 2 - 0
tasks/AreaBoss/assets.py

@@ -116,5 +116,7 @@ class AreaBossAssets:
 	O_AB_NUM_OF_CHALLENGE = RuleOcr(roi=(270,630,150,36), area=(270,630,150,36), mode="Digit", method="Default", keyword="", name="ab_num_of_challenge")
 	# 地鬼名字 
 	O_AB_BOSS_NAME = RuleOcr(roi=(114,36,248,69), area=(114,36,248,69), mode="Full", method="Default", keyword="", name="ab_boss_name")
+	# 声望值 
+	O_AB_REPUTATION = RuleOcr(roi=(1180,61,82,32), area=(1180,61,82,32), mode="Digit", method="Default", keyword="", name="ab_reputation")
 
 

+ 9 - 10
tasks/AreaBoss/config_boss.py

@@ -6,22 +6,21 @@ from datetime import datetime, time
 from pydantic import BaseModel, ValidationError, validator, Field
 
 class AreaBossFloor(str, Enum):
+    DEFAULT = '不更改'
     ONE = '一星'
     TEN = '十星'
-    DEFAULT = '不更改'
+    NORMAL_LV1 = '普通-1级'
+    NORMAL_LV60 = '普通-60级'
 
 class Boss(BaseModel):
-    boss_number: int = Field(title='Boss Number',
-                             default=3,
-                             description='默认为3 可选[1-3], 当你设置为三时默认你拥有全部的挑战资格,会挑战热门的前三个,\n'
-                                         '如果不是请将你可以挑战的boss进行收藏',
-                             ge=1, le=3)
+    # boss_number: int = Field(title='Boss Number',
+    #                          default=3,
+    #                          description='默认为3 可选[1-3], 当你设置为三时默认你拥有全部的挑战资格,会挑战热门的前三个,\n'
+    #                                      '如果不是请将你可以挑战的boss进行收藏',
+    #                          ge=1, le=3)
     # 是否查找当日悬赏鬼王
     boss_reward: bool = Field(default=False, description='boss_reward_help')
     # 悬赏默认打较简单的一星鬼王,若想要更高悬赏奖励可自行更改为十星或不更改(保留已勾选DEBUFF)
-    reward_floor: AreaBossFloor = Field(default=AreaBossFloor.ONE, description='reward_floor_help')
+    reward_floor: AreaBossFloor = Field(default=AreaBossFloor.DEFAULT, description='reward_floor_help')
     # 是否使用收藏的
     use_collect: bool = Field(default=False, description='use_collect_help')
-
-    # 没有开启极是否拉到60级进行攻打
-    Attack_60: bool = Field(default=False, description='没有开启极是否拉到60级进行攻打')

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

@@ -52,5 +52,14 @@
     "method": "Default",
     "keyword": "",
     "description": "地鬼名字"
+  },
+  {
+    "itemName": "ab_reputation",
+    "roiFront": "1180,61,82,32",
+    "roiBack": "1180,61,82,32",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "声望值"
   }
 ]

+ 61 - 31
tasks/AreaBoss/script_task.py

@@ -23,6 +23,21 @@ from typing import List
 
 class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
 
+    def _get_dynamic_boss_count(self) -> int:
+        """
+        从地域鬼王主界面 OCR 声望值,动态决定可挑战次数
+        :return: 可挑战鬼王数量 (1/2/3)
+        """
+        self.screenshot()
+        rep = self.O_AB_REPUTATION.ocr_digit(self.device.image)
+        logger.info(f"Area boss reputation: {rep}")
+        if rep >= 10000:
+            return 3
+        elif rep >= 2000:
+            return 2
+        else:
+            return 1
+
     def run(self) -> bool:
         """
         运行脚本
@@ -59,15 +74,18 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         else:
             self.switch_to_famous()
 
-        if con.boss_number - boss_fought == 3:
-            self.boss_fight(self.I_BATTLE_1, ultra=True)
-            self.boss_fight(self.I_BATTLE_2, ultra=True)
-            self.boss_fight(self.I_BATTLE_3, ultra=True)
-        elif con.boss_number - boss_fought == 2:
-            self.boss_fight(self.I_BATTLE_1, ultra=True)
-            self.boss_fight(self.I_BATTLE_2, ultra=True)
-        elif con.boss_number - boss_fought == 1:
-            self.boss_fight(self.I_BATTLE_1, ultra=True)
+        # 动态获取可挑战次数
+        dynamic_count = self._get_dynamic_boss_count()
+        available = dynamic_count - boss_fought
+        if available >= 3:
+            self.boss_fight(self.I_BATTLE_1)
+            self.boss_fight(self.I_BATTLE_2)
+            self.boss_fight(self.I_BATTLE_3)
+        elif available == 2:
+            self.boss_fight(self.I_BATTLE_1)
+            self.boss_fight(self.I_BATTLE_2)
+        elif available == 1:
+            self.boss_fight(self.I_BATTLE_1)
         # 退出
         self.go_back()
         self.set_next_run(task='AreaBoss', success=True, finish=False)
@@ -126,14 +144,12 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
         self.wait_until_appear(self.I_AB_CLOSE_RED)
         self.ui_click(self.I_AB_CLOSE_RED, self.I_FILTER)
 
-    def boss_fight(self, battle: RuleImage, ultra: bool = False, fileter_open: bool = True) -> bool:
+    def boss_fight(self, battle: RuleImage, fileter_open: bool = True) -> bool:
         """
             完成挑战一个鬼王的全流程
             从打开筛选界面开始 到关闭鬼王详情界面结束
         @param battle: 挑战按钮,鬼王头像也可,只要点击能进入详情界面
         @type battle:
-        @param ultra: 是否需要切换到极地鬼
-        @type ultra:
         @return:    True        挑战成功
                     False       挑战失败
         @rtype:
@@ -151,17 +167,19 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=3)
             return True
 
-        # 设置极模式
-        if ultra and self.setup_ultra():
-            pass
-        # 普通模式下的60级
-        elif self.config.area_boss.boss.Attack_60:
+        # 根据 reward_floor 决定模式
+        if reward_floor in (AreaBossFloor.ONE, AreaBossFloor.TEN):
+            # 极模式分支
+            if self.setup_ultra(reward_floor):
+                pass
+        elif reward_floor == AreaBossFloor.NORMAL_LV60:
+            # 普通模式-拉到60级
+            self.setup_normal()
             self.switch_to_level_60()
-            if not self.start_fight():
-                logger.warning("you are so weakness!")
-                self.wait_until_appear(self.I_AB_CLOSE_RED)
-                self.ui_click_until_disappear(self.I_AB_CLOSE_RED, interval=3)
-                return False
+        elif reward_floor == AreaBossFloor.NORMAL_LV1:
+            # 普通模式-保持1级
+            self.setup_normal()
+        # DEFAULT: 不更改,直接打
 
         result = True
         if not self.start_fight():
@@ -181,7 +199,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
 
         return self.run_general_battle(self.config.area_boss.general_battle)
 
-    def setup_ultra(self) -> bool:
+    def setup_ultra(self, floor: AreaBossFloor = AreaBossFloor.ONE) -> bool:
         # 确定进入鬼王界面
         self.wait_until_appear(self.I_AB_CLOSE_RED)
         # 尝试切换
@@ -192,15 +210,27 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             else:
                 logger.warning("Cannot switch difficulty")
                 return False
-        # 调整悬赏层数
-        reward_floor = self.config.area_boss.boss.reward_floor
-        match reward_floor:
+        # 调整极地鬼层数
+        match floor:
             case AreaBossFloor.ONE:
                 self.switch_to_floor_1()
             case AreaBossFloor.TEN:
                 self.switch_to_floor_10()
-            case AreaBossFloor.DEFAULT:
-                logger.info("Not change floor")
+        return True
+
+    def setup_normal(self) -> bool:
+        """
+        确保当前为普通地鬼模式
+        :return: True 成功(已处于普通模式),False 失败
+        """
+        self.wait_until_appear(self.I_AB_CLOSE_RED)
+        if self.get_difficulty():
+            # 当前是极地鬼,需要切回普通
+            if self.appear(self.I_AB_DIFFICULTY_JI):
+                self.switch_difficulty(False)
+            else:
+                logger.warning("Cannot switch to normal difficulty")
+                return False
         return True
 
     def switch_to_level_60(self):
@@ -280,7 +310,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             return False
         # 不需要打开筛选界面说明直接找到了目标boss, 直接挑战
         if not need_open_filter:
-            return self.boss_fight(photo, True, fileter_open=False)
+            return self.boss_fight(photo, fileter_open=False)
         # 滑动到最顶层
         logger.info("Swipe to top")
         for i in range(random.randint(1, 3)):
@@ -290,7 +320,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.open_filter()
             name = self.get_bossName(PHOTO)
             if self.check_common_chars(str(name), boss_name):
-                return self.boss_fight(PHOTO, True, fileter_open=False)
+                return self.boss_fight(PHOTO, fileter_open=False)
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
         # 倒数一和二
         for i in range(random.randint(1, 3)):
@@ -299,7 +329,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AreaBossAssets):
             self.open_filter()
             name = self.get_bossName(PHOTO)
             if self.check_common_chars(str(name), boss_name):
-                return self.boss_fight(PHOTO, True, fileter_open=False)
+                return self.boss_fight(PHOTO, fileter_open=False)
             self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
         self.ui_click_until_disappear(self.I_AB_CLOSE_RED)
 

+ 6 - 5
tasks/Component/Costume/assets.py

@@ -89,15 +89,15 @@ class CostumeAssets:
 
 
 	# Image Rule Assets
-	# 茨心乐园庭院判定
+	# 茨心乐园庭院判定 
 	I_CHECK_MAIN_15 = RuleImage(roi_front=(1017,365,71,48), roi_back=(900,270,300,220), threshold=0.75, method="Template matching", file="./tasks/Component/Costume/main15/main15_check_main_15.png")
-	# 探索
+	# 探索 
 	I_MAIN_GOTO_EXPLORATION_15 = RuleImage(roi_front=(590,190,30,50), roi_back=(520,130,190,180), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main15/main15_main_goto_exploration_15.png")
-	# 召唤屋
+	# 召唤屋 
 	I_MAIN_GOTO_SUMMON_15 = RuleImage(roi_front=(960,204,28,45), roi_back=(890,130,200,180), threshold=0.55, method="Template matching", file="./tasks/Component/Costume/main15/main15_main_goto_summon_15.png")
-	# 町中
+	# 町中 
 	I_MAIN_GOTO_TOWN_15 = RuleImage(roi_front=(838,324,24,49), roi_back=(760,250,200,190), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main15/main15_main_goto_town_15.png")
-	# 宠物屋
+	# 宠物屋 
 	I_PET_HOUSE_15 = RuleImage(roi_front=(951,383,31,50), roi_back=(900,330,150,150), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main15/main15_pet_house_15.png")
 
 
@@ -204,3 +204,4 @@ class CostumeAssets:
 	# description 
 	I_PET_HOUSE_9 = RuleImage(roi_front=(888,327,40,35), roi_back=(730,316,440,57), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main9/main9_pet_house_9.png")
 
+

+ 0 - 15
tasks/Component/CostumeBattle/assets.py

@@ -94,21 +94,6 @@ class CostumeBattleAssets:
 	I_BATTLE_INFO_14 = RuleImage(roi_front=(234,17,32,32), roi_back=(215,0,142,58), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle14/battle14_battle_info_14.png")
 
 
-	# Image Rule Assets
-	# 左上角退出 
-	I_EXIT_13 = RuleImage(roi_front=(25,21,24,24), roi_back=(16,10,40,44), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_exit_13.png")
-	# 左上角好友 
-	I_FRIENDS_13 = RuleImage(roi_front=(95,17,28,27), roi_back=(88,12,40,40), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_friends_13.png")
-	# 指针 
-	I_LOCAL_13 = RuleImage(roi_front=(115,491,30,32), roi_back=(107,479,48,50), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_local_13.png")
-	# 战斗胜利 
-	I_WIN_13 = RuleImage(roi_front=(590,152,87,129), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_win_13.png")
-	# 针对封魔的特殊 
-	I_DE_WIN_13 = RuleImage(roi_front=(590,152,87,129), roi_back=(390,30,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_de_win_13.png")
-	# 失败 
-	I_FALSE_13 = RuleImage(roi_front=(586,178,76,110), roi_back=(380,55,510,290), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle13/battle13_false_13.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")

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

@@ -128,3 +128,4 @@ class GeneralInviteAssets:
 	# Ocr-description 
 	O_ONLINE = RuleOcr(roi=(790,102,124,42), area=(0,0,100,100), mode="Single", method="Default", keyword="", name="online")
 
+

+ 7 - 5
tasks/Component/SwitchAccount/assets.py

@@ -41,13 +41,15 @@ class SwitchAccountAssets:
 	# 选择服务器界面 底部角色所属服务器名 列表 
 	O_SA_SELECT_SVR_SVR_LIST = RuleOcr(roi=(205,540,815,25), area=(205,540,815,25), mode="FULL", method="Default", keyword="", name="sa_select_svr_svr_list")
 	# 选择服务器界面 底部角色名 列表 
-	O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(205,570,815,40), area=(205,570,815,40), mode="FULL", method="Default", keyword="", name="sa_select_svr_character_list")
+	O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
 	# 选择账号界面 账号列表 
 	O_SA_ACCOUNT_ACCOUNT_LIST = RuleOcr(roi=(460,280,440,330), area=(460,280,440,330), mode="FULL", method="Default", keyword="", name="sa_account_account_list")
 	# 选择账号界面 已选择的账号 
 	O_SA_ACCOUNT_ACCOUNT_SELECTED = RuleOcr(roi=(460,280,370,50), area=(460,280,370,50), mode="SINGLE", method="Default", keyword="", name="sa_account_account_selected")
 	# 登录界面 用户中心(区别于游戏内用户中心) 账户名 
 	O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
+	# 判断是否在 选择服务器 界面的文本特质 
+	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
 
 
 	# Swipe Rule Assets
@@ -77,12 +79,12 @@ class SwitchAccountAssets:
 	# 登录界面-选取账号界面-账号下拉菜单-已经打开标志. 
 	I_SA_ACCOUNT_LOGIN_BTN = RuleImage(roi_front=(400,400,480,90), roi_back=(400,400,480,90), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_account_login_btn.png")
 	# 登录界面-选择手机类型为苹果. 
-	I_SA_LOGIN_FORM_APPLE = RuleImage(roi_front=(490,350,100,100), roi_back=(490,350,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_login_form_apple.png")
+	I_SA_LOGIN_FORM_APPLE = RuleImage(roi_front=(508,354,100,100), roi_back=(508,355,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_login_form_apple.png")
 	# 登录界面-选择手机类型为android 
-	I_SA_LOGIN_FORM_ANDROID = RuleImage(roi_front=(690,350,100,100), roi_back=(690,350,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_login_form_android.png")
+	I_SA_LOGIN_FORM_ANDROID = RuleImage(roi_front=(671,353,100,100), roi_back=(670,352,100,100), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_login_form_android.png")
 	# 判断是否在 选择服务器 界面的标志物 角色的服务器图标还未显示时 
-	I_SA_CHECK_SELECT_SVR_1 = RuleImage(roi_front=(240,530,120,40), roi_back=(240,530,120,40), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_check_select_svr.png")
+	I_SA_CHECK_SELECT_SVR_1 = RuleImage(roi_front=(213,133,181,60), roi_back=(210,128,185,68), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_check_select_svr_1.png")
 	# 判断是否在 选择服务器 界面的标志物 角色的服务器图标已经显示时 
-	I_SA_CHECK_SELECT_SVR_2 = RuleImage(roi_front=(240,410,120,40), roi_back=(240,410,120,40), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/sa_check_select_svr.png")
+	I_SA_CHECK_SELECT_SVR_2 = RuleImage(roi_front=(209,131,184,64), roi_back=(207,127,187,70), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchAccount/res/res_sa_check_select_svr_2.png")
 
 

+ 3 - 2
tasks/Component/SwitchAccount/login_account.py

@@ -89,7 +89,8 @@ class LoginAccount(BaseTask, SwitchAccountAssets):
         @rtype:
         """
         logger.info("start switch_character")
-        self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.I_SA_CHECK_SELECT_SVR_1)
+        # 改成对比是否出现 已有角色 
+        self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.O_SA_CHECK_SELCET_SVR)
         # 展开底部角色列表,显示角色所属服务器
         self.screenshot()
         while (not self.appear(self.I_SA_CHECK_SELECT_SVR_2)) and self.appear(self.I_SA_CHECK_SELECT_SVR_1):
@@ -134,7 +135,7 @@ class LoginAccount(BaseTask, SwitchAccountAssets):
                 break
             logger.info(f'{characterName} not found,start swipe')
             lastCharacterNameList = characterNameList
-            self.swipe(self.S_SA_SVR_SWIPE_LEFT)
+            self.swipe(self.S_SA_ACCOUNT_LIST_UP)
             # 等待滑动动画完成
             time.sleep(1.5)
 

+ 12 - 3
tasks/Component/SwitchAccount/ocr.json

@@ -19,9 +19,9 @@
   },
   {
     "itemName": "sa_select_svr_character_list",
-    "roiFront": "205,570,815,40",
-    "roiBack": "205,570,815,40",
-    "mode": "FULL",
+    "roiFront": "418,131,641,481",
+    "roiBack": "417,135,647,482",
+    "mode": "Full",
     "method": "Default",
     "keyword": "",
     "description": "选择服务器界面 底部角色名 列表"
@@ -52,5 +52,14 @@
     "method": "Default",
     "keyword": "",
     "description": "登录界面 用户中心(区别于游戏内用户中心) 账户名"
+  },
+  {
+    "itemName": "sa_check_select_svr",
+    "roiFront": "252,145,97,32",
+    "roiBack": "248,141,102,38",
+    "mode": "Single",
+    "method": "Default",
+    "keyword": "已有角色",
+    "description": "判断是否在 选择服务器 界面的文本特质"
   }
 ]

+ 13 - 13
tasks/Component/SwitchAccount/res/image.json

@@ -21,7 +21,7 @@
     "itemName": "sa_user_center_profile",
     "imageName": "sa_user_center_profile.png",
     "roiFront": "590,60,90,55",
-    "roiBack":  "590,60,90,55",
+    "roiBack": "590,60,90,55",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "游戏内-点击头像弹出的设置界面-顶部设置字样"
@@ -82,36 +82,36 @@
   },
   {
     "itemName": "sa_login_form_apple",
-    "imageName": "sa_login_form_apple.png",
-    "roiFront": "490,350,100,100",
-    "roiBack": "490,350,100,100",
+    "imageName": "res_sa_login_form_apple.png",
+    "roiFront": "508,354,100,100",
+    "roiBack": "508,355,100,100",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "登录界面-选择手机类型为苹果."
   },
   {
     "itemName": "sa_login_form_android",
-    "imageName": "sa_login_form_android.png",
-    "roiFront": "690,350,100,100",
-    "roiBack": "690,350,100,100",
+    "imageName": "res_sa_login_form_android.png",
+    "roiFront": "671,353,100,100",
+    "roiBack": "670,352,100,100",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "登录界面-选择手机类型为android"
   },
   {
     "itemName": "sa_check_select_svr_1",
-    "imageName": "sa_check_select_svr.png",
-    "roiFront": "240,530,120,40",
-    "roiBack": "240,530,120,40",
+    "imageName": "res_sa_check_select_svr_1.png",
+    "roiFront": "213,133,181,60",
+    "roiBack": "210,128,185,68",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "判断是否在 选择服务器 界面的标志物 角色的服务器图标还未显示时"
   },
   {
     "itemName": "sa_check_select_svr_2",
-    "imageName": "sa_check_select_svr.png",
-    "roiFront": "240,410,120,40",
-    "roiBack": "240,410,120,40",
+    "imageName": "res_sa_check_select_svr_2.png",
+    "roiFront": "209,131,184,64",
+    "roiBack": "207,127,187,70",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "判断是否在 选择服务器 界面的标志物 角色的服务器图标已经显示时"

BIN
tasks/Component/SwitchAccount/res/res_sa_check_select_svr_1.png


BIN
tasks/Component/SwitchAccount/res/res_sa_check_select_svr_2.png


BIN
tasks/Component/SwitchAccount/res/res_sa_login_form_android.png


BIN
tasks/Component/SwitchAccount/res/res_sa_login_form_apple.png


+ 4 - 2
tasks/Exploration/assets.py

@@ -110,9 +110,9 @@ class ExplorationAssets:
 	# description 
 	I_E_EXIT_CONFIRM = RuleImage(roi_front=(694,380,163,49), roi_back=(694,380,163,49), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_e_exit_confirm.png")
 	# 宝箱 
-	I_TREASURE_BOX_CLICK = RuleImage(roi_front=(34,386,47,37), roi_back=(2,130,135,406), threshold=0.65, method="Template matching", file="./tasks/Exploration/res/res_treasure_box_click.png")
+	I_TREASURE_BOX_CLICK = RuleImage(roi_front=(31,543,27,24), roi_back=(11,520,378,65), threshold=0.65, method="Template matching", file="./tasks/Exploration/res/res_treasure_box_click.png")
 	# 困28滚动到最后 
-	I_SWIPE_END = RuleImage(roi_front=(994,234,119,100), roi_back=(968,196,311,165), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_swipe_end.png")
+	I_SWIPE_END = RuleImage(roi_front=(1213,79,66,265), roi_back=(1213,79,66,265), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_swipe_end.png")
 	# 队伍的表情标志 
 	I_TEAM_EMOJI = RuleImage(roi_front=(36,437,44,46), roi_back=(4,407,100,100), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_team_emoji.png")
 	# 组队按钮 
@@ -123,6 +123,8 @@ class ExplorationAssets:
 	I_EXP_ARROW_RIGHT = RuleImage(roi_front=(1240,117,24,21), roi_back=(1178,74,100,100), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_exp_arrow_right.png")
 	# 箭头,打开 
 	I_EXP_ARROW_LEFT = RuleImage(roi_front=(1244,115,18,26), roi_back=(1178,78,100,100), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_exp_arrow_left.png")
+	# 战斗中的队友标识 
+	I_TEAM_EMOJI_FIGHT = RuleImage(roi_front=(38,405,37,37), roi_back=(18,386,74,75), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_team_emoji_fight.png")
 
 
 	# Long Click Rule Assets

+ 9 - 1
tasks/Exploration/base.py

@@ -57,6 +57,15 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
     def _match_end(self):
         return RuleAnimate(self.I_SWIPE_END)
 
+    def is_swipe_unchanged(self, before_image, after_image, threshold: float = 20) -> bool:
+        # 对比滑屏前后同一块区域,变化很小说明地图大概率没有移动,已经滑到尽头。
+        swipe_check_roi = (1216, 86, 64, 225)
+        before = self.I_SWIPE_END.corp(before_image, swipe_check_roi)
+        after = self.I_SWIPE_END.corp(after_image, swipe_check_roi)
+        diff = np.mean(np.abs(before.astype(np.int16) - after.astype(np.int16)))
+        logger.info(f'Swipe end area diff: {diff:.2f}')
+        return diff <= threshold
+
     def get_current_scene(self, reuse_screenshot: bool = True) -> Scene:
         if not reuse_screenshot:
             self.screenshot()
@@ -464,4 +473,3 @@ if __name__ == "__main__":
         print(t.get_current_scene())
     from PIL import Image
     # Image.fromarray(t.device.image.astype(np.uint8)).show()
-

+ 13 - 4
tasks/Exploration/res/image.json

@@ -173,8 +173,8 @@
   {
     "itemName": "treasure_box_click",
     "imageName": "res_treasure_box_click.png",
-    "roiFront": "34,386,47,37",
-    "roiBack": "2,130,135,406",
+    "roiFront": "31,543,27,24",
+    "roiBack": "11,520,378,65",
     "method": "Template matching",
     "threshold": 0.65,
     "description": "宝箱"
@@ -182,8 +182,8 @@
   {
     "itemName": "swipe_end",
     "imageName": "res_swipe_end.png",
-    "roiFront": "994,234,119,100",
-    "roiBack": "968,196,311,165",
+    "roiFront": "1213,79,66,265",
+    "roiBack": "1213,79,66,265",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "困28滚动到最后"
@@ -232,5 +232,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "箭头,打开"
+  },
+  {
+    "itemName": "team_emoji_fight",
+    "imageName": "res_team_emoji_fight.png",
+    "roiFront": "38,405,37,37",
+    "roiBack": "18,386,74,75",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗中的队友标识"
   }
 ]

BIN
tasks/Exploration/res/res_swipe_end.png


BIN
tasks/Exploration/res/res_team_emoji_fight.png


BIN
tasks/Exploration/res/res_treasure_box_click.png


+ 72 - 80
tasks/Exploration/solo.py

@@ -9,12 +9,14 @@ from module.base.timer import Timer
 
 from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode
 from tasks.Exploration.base import BaseExploration, UpType, Scene
-from tasks.Exploration.config import ChooseRarity, AutoRotate, UserStatus, ExplorationLevel
+from tasks.Exploration.config import ChooseRarity, AutoRotate, UserStatus
 
 
 class SoloExploration(BaseExploration):
     INVITE_FLAG_OFF = (157, 109, 83)
     INVITE_FLAG_ON = (227, 193, 153)
+    INVITE_TIMEOUT = 20
+    FRIEND_LEAVE_TIMEOUT = 3
     explore_init = False
 
     @cached_property
@@ -28,9 +30,38 @@ class SoloExploration(BaseExploration):
             default_invite=False
         )
 
+    def _handle_treasure_box(self) -> bool:
+        if self.appear(self.I_TREASURE_BOX_CLICK):
+            logger.info('Treasure box appear, get it.')
+            self.ui_click_until_disappear(self.I_TREASURE_BOX_CLICK)
+            return True
+        return False
+
+    def _check_mate_leave(self, friend_leave_timer: Timer) -> bool:
+
+        if self.appear(self.I_TEAM_EMOJI) or self.appear(self.I_TEAM_EMOJI_FIGHT):
+            # 再次出现则重新计时,进入对局标志消失
+            if friend_leave_timer.started():
+                logger.warning('Team emoji appear again, clear friend_leave_timer')
+                friend_leave_timer.clear()
+            return False
+
+        logger.warning('Team emoji not appear')
+        if not friend_leave_timer.started():
+            logger.warning('Mate leave, start timer')
+            friend_leave_timer.start()
+            return False
+        if not friend_leave_timer.reached():
+            return False
+
+        logger.warning('Mate leave timer reached')
+        logger.warning('Exit team')
+        self.quit_explore()
+        return True
+
     def run_solo(self):
         logger.hr('solo')
-        search_fail_cnt = 0
+        search_fail_timer = Timer(3.2)  # 这里设置的时间一定要大于S_SWIPE_BACKGROUND_RIGHT滑动的时间
 
         while 1:
             self.screenshot()
@@ -41,10 +72,6 @@ class SoloExploration(BaseExploration):
                 # 打开右边箭头
                 if not self.wait_world_stable():
                     continue
-                if self.appear(self.I_TREASURE_BOX_CLICK):
-                    # 宝箱
-                    logger.info('Treasure box appear, get it.')
-                    self.ui_click_until_disappear(self.I_TREASURE_BOX_CLICK)
                 if self.check_exit():
                     break
                 self.open_expect_level()
@@ -63,6 +90,8 @@ class SoloExploration(BaseExploration):
                     self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
                     self.explore_init = True
                     continue
+                if self._handle_treasure_box():
+                    continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
                     if self.ui_get_reward(self.I_BATTLE_REWARD):
@@ -79,17 +108,15 @@ class SoloExploration(BaseExploration):
                         logger.info(f'Fight, minions cnt {self.minions_cnt}')
                     continue
                 # 向后拉,寻找怪
-                if search_fail_cnt >= 4:
-                    search_fail_cnt = 0
-                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28\
-                        and self.appear(self.I_SWIPE_END))\
-                            or self._match_end.stable(self.device.image, refresh_after_stable=True):
+                if search_fail_timer.reached():
+                    search_fail_timer.reset()
+                    if self._match_end.stable(self.device.image, refresh_after_stable=True):
                         self.quit_explore()
                         continue
-                    if self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=3):
-                        continue
-                else:
-                    search_fail_cnt += 1
+                    self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=3)
+                    continue
+                if not search_fail_timer.started():
+                    search_fail_timer.start()
             #
             elif scene == Scene.BATTLE_PREPARE or scene == Scene.BATTLE_FIGHTING:
                 self.check_take_over_battle(is_screenshot=False, config=self._config.general_battle_config)
@@ -98,8 +125,8 @@ class SoloExploration(BaseExploration):
 
     def run_leader(self):
         logger.hr('leader')
-        search_fail_cnt = 0
-        friend_leave_timer = Timer(10)
+        search_fail_timer = Timer(3.2)  # 这里设置的时间一定要大于S_SWIPE_BACKGROUND_RIGHT滑动的时间
+        friend_leave_timer = Timer(self.FRIEND_LEAVE_TIMEOUT)
 
         while 1:
             self.screenshot()
@@ -110,22 +137,6 @@ class SoloExploration(BaseExploration):
                 # 打开右边箭头
                 if not self.wait_world_stable():
                     continue
-                if self.appear(self.I_TREASURE_BOX_CLICK):
-                    # 宝箱
-                    logger.info('Treasure box appear, get it.')
-                    self.wait_until_stable(self.I_UI_CANCEL, timer=Timer(0.6, 1))
-                    while 1:
-                        self.screenshot()
-                        if self.appear(self.I_REWARD):
-                            self.ui_click_until_disappear(self.I_REWARD)
-                            logger.info('Get reward.')
-                            break
-                        if self.ui_reward_appear_click():
-                            continue
-                        if self.appear_then_click(self.I_UI_CANCEL, interval=0.8):
-                            continue
-                        if self.appear_then_click(self.I_TREASURE_BOX_CLICK, interval=1):
-                            continue
                 if self.check_exit():
                     self.wait_until_stable(self.I_UI_CANCEL, timer=Timer(0.6, 2))
                     if self.appear(self.I_UI_CANCEL):
@@ -149,10 +160,11 @@ class SoloExploration(BaseExploration):
                         continue
                     if self.appear_then_click(self.I_ENSURE_PRIVATE_FALSE_2, interval=0.5):
                         continue
-                    if self.appear_then_click(self.I_EXP_CREATE_TEAM, interval=1):
-                        continue
+                    # 创建在组队前,组队蒙层后概率会被误识别
                     if self.appear_then_click(self.I_EXP_CREATE_ENSURE, interval=2):
                         continue
+                    if self.appear_then_click(self.I_EXP_CREATE_TEAM, interval=1):
+                        continue
             #
             elif scene == Scene.TEAM:
                 self.wait_until_stable(self.I_ADD_2, timer=Timer(0.8, 1))
@@ -180,27 +192,17 @@ class SoloExploration(BaseExploration):
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
                     self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
-                    friend_leave_timer = Timer(10)
                     self.explore_init = True
                     continue
+                if self._handle_treasure_box():
+                    continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
                     if self.ui_get_reward(self.I_BATTLE_REWARD):
                         continue
                 # 中途有人跑路
-                if not self.appear(self.I_TEAM_EMOJI):
-                    if not friend_leave_timer.started():
-                        logger.warning('Mate leave, start timer')
-                        friend_leave_timer = Timer(10)
-                        friend_leave_timer.start()
-                    elif friend_leave_timer.started() and friend_leave_timer.reached():
-                        logger.warning('Mate leave timer reached')
-                        logger.warning('Exit team')
-                        self.quit_explore()
-                        continue
-                else:
-                    logger.warning('Team emoji appear again, clear friend_leave_timer')
-                    friend_leave_timer = Timer(10)
+                if self._check_mate_leave(friend_leave_timer):
+                    continue
                 # boss
                 if self.appear(self.I_BOSS_BATTLE_BUTTON):
                     if self.fire(self.I_BOSS_BATTLE_BUTTON):
@@ -213,17 +215,15 @@ class SoloExploration(BaseExploration):
                         logger.info(f'Fight, minions cnt {self.minions_cnt}')
                     continue
                 # 向后拉,寻找怪
-                if search_fail_cnt >= 4:
-                    search_fail_cnt = 0
-                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28\
-                        and self.appear(self.I_SWIPE_END))\
-                            or self._match_end.stable(self.device.image, refresh_after_stable=True):
+                if search_fail_timer.reached():
+                    search_fail_timer.reset()
+                    if self._match_end.stable(self.device.image, refresh_after_stable=True):
                         self.quit_explore()
                         continue
-                    if self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=4.5):
-                        continue
-                else:
-                    search_fail_cnt += 1
+                    self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=3)
+                    continue
+                if not search_fail_timer.started():
+                    search_fail_timer.start()
             #
             elif scene == Scene.BATTLE_PREPARE or scene == Scene.BATTLE_FIGHTING:
                 self.check_take_over_battle(is_screenshot=False, config=self._config.general_battle_config)
@@ -233,7 +233,7 @@ class SoloExploration(BaseExploration):
     def run_member(self):
         logger.hr('member')
         wait_timer = Timer(50)
-        friend_leave_timer = Timer(10)
+        friend_leave_timer = Timer(self.FRIEND_LEAVE_TIMEOUT)
 
         while 1:
             self.screenshot()
@@ -244,14 +244,12 @@ class SoloExploration(BaseExploration):
                 # 打开右边箭头
                 if not self.wait_world_stable():
                     continue
-                if self.appear(self.I_TREASURE_BOX_CLICK):
-                    # 宝箱
-                    logger.info('Treasure box appear, get it.')
-                    self.ui_click_until_disappear(self.I_TREASURE_BOX_CLICK)
                 if self.check_exit():
                     break
                 if self.check_then_accept():
-                    pass
+                    # 接受邀请后清掉计时器
+                    wait_timer.clear()
+                    continue
                 if wait_timer.started() and wait_timer.reached():
                     logger.warning('Wait timer reached')
                     break
@@ -271,27 +269,16 @@ class SoloExploration(BaseExploration):
                     self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
                     self.explore_init = True
                     continue
+                if self._handle_treasure_box():
+                    continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
                     if self.ui_get_reward(self.I_BATTLE_REWARD):
                         continue
                 #
-                if not self.appear(self.I_TEAM_EMOJI):
-                    logger.warning('Team emoji not appear')
-                    if not friend_leave_timer.started():
-                        logger.warning('Mate leave, start timer')
-                        friend_leave_timer = Timer(10)
-                        friend_leave_timer.start()
-                    elif friend_leave_timer.started() and friend_leave_timer.reached():
-                        logger.warning('Mate leave timer reached')
-                        logger.warning('Exit team')
-                        self.quit_explore()
-                        wait_timer = Timer(50)
-                        wait_timer.start()
-                        continue
-                else:
-                    logger.warning('Team emoji appear again, clear friend_leave_timer')
-                    friend_leave_timer = Timer(10)
+                if self._check_mate_leave(friend_leave_timer):
+                    wait_timer.reset()
+                    continue
             #
             elif scene == Scene.BATTLE_PREPARE or scene == Scene.BATTLE_FIGHTING:
                 logger.info('[run_member] Handling scene: BATTLE')
@@ -312,6 +299,11 @@ class SoloExploration(BaseExploration):
                 continue
             if self.appear_then_click(self.I_ADD_5_4, interval=1):
                 continue
+            # 避免中途队友进来邀请死循环
+            if not self.appear(self.I_ADD_2) or not self.appear(self.I_ADD_5_4):
+                # 可能刚好点到人,点一下空地方
+                self.device.click(x=370, y=480, control_name='exploration_invite_friend_prevent')
+                return True
 
         friend_class = []
         class_ocr = [self.O_F_LIST_1, self.O_F_LIST_2, self.O_F_LIST_3, self.O_F_LIST_4]

+ 7 - 1
tasks/Exploration/version.py

@@ -56,11 +56,17 @@ class HighlightGif(RuleGif):
     def pre_process(self, image):
         return highlight(image)
 
+    def match_with_multi_scale(self, image, threshold=None, scale_range=(0.8, 1.1, 0.05)):
+        return self.search_with_multi_scale(image, threshold=threshold, scale_range=scale_range)[0]
+
+    def match_origin(self, image, threshold: float = None) -> bool:
+        return self.search(image, threshold=threshold)[0]
+
 
 class HighLight(BaseTask, ExplorationAssets):
 
     @cached_property
-    def TEMPLATE_GIF(self) -> RuleGif:
+    def TEMPLATE_GIF(self) -> HighlightGif:
         return HighlightGif(
             targets=[
                 self.I_LIGHT1, self.I_LIGHT2, self.I_LIGHT3, self.I_LIGHT4, self.I_LIGHT5,

+ 1 - 0
tasks/HeroTest/assets.py

@@ -111,3 +111,4 @@ class HeroTestAssets:
 	# 挑战按钮 
 	O_FIRE = RuleOcr(roi=(1130,585,92,55), area=(1126,576,100,99), mode="Single", method="Default", keyword="挑战", name="fire")
 
+

+ 9 - 1
tasks/SoulsTidy/assets.py

@@ -15,6 +15,8 @@ class SoulsTidyAssets:
 	C_ST_DETAIL = RuleClick(roi_front=(1188,318,87,74), roi_back=(1190,317,87,74), name="st_detail")
 	# 出现神赐 
 	C_ST_GOD_PRSENT = RuleClick(roi_front=(717,165,100,48), roi_back=(926,165,100,54), name="st_god_prsent")
+	# 御魂奉纳奖励 
+	C_ST_SOUL_OFFERING_REWARD = RuleClick(roi_front=(717,165,100,48), roi_back=(926,165,100,54), name="st_soul_offering_reward")
 
 
 	# Image Rule Assets
@@ -50,10 +52,16 @@ class SoulsTidyAssets:
 	I_ST_GOLD = RuleImage(roi_front=(170,100,950,500), roi_back=(170,100,950,500), threshold=0.9, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_gold.png")
 	# 御魂溢出 
 	I_ST_SOUL_OVERFLOW = RuleImage(roi_front=(447,260,384,42), roi_back=(447,260,384,42), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_soul_overflow.png")
-	# 狗粮御魂的堆叠标识 
+	# 5星御魂的堆叠标识_大于1个 
 	I_ST_SOUL_STACK = RuleImage(roi_front=(142,234,20,16), roi_back=(142,234,20,16), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_soul_stack.png")
 	# 御魂关闭状态 
 	I_ST_SOULS_CLOSE = RuleImage(roi_front=(1180,227,56,83), roi_back=(1166,215,84,107), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_souls_close.png")
+	# 5星御魂堆叠标识_1个 
+	I_ST_SOUL_STACK_1 = RuleImage(roi_front=(89,239,105,19), roi_back=(89,239,105,19), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_soul_stack_1.png")
+	# 吉运 
+	I_ST_LUCK = RuleImage(roi_front=(596,236,110,56), roi_back=(596,236,110,56), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_luck.png")
+	# 小吉运 
+	I_ST_SMALL_LUCK = RuleImage(roi_front=(549,236,201,35), roi_back=(549,236,201,35), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_small_luck.png")
 
 
 	# Long Click Rule Assets

+ 12 - 1
tasks/SoulsTidy/script_task.py

@@ -126,7 +126,8 @@ class ScriptTask(GameUi, SoulsTidyAssets):
             logger.info('Sort by level')
             # 开始奉纳
             while 1:
-                if self.wait_until_appear(self.I_ST_SOUL_STACK, wait_time=2):
+                if (self.wait_until_appear(self.I_ST_SOUL_STACK, wait_time=2) or
+                        self.wait_until_appear(self.I_ST_SOUL_STACK_1, wait_time=2)):
                     # 方式1. 御魂堆叠奉纳
                     logger.info('Soul stack')
                 else:
@@ -174,6 +175,16 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                         logger.info('God present appear')
                         self.click(self.C_ST_GOD_PRSENT, interval=2)
                         continue
+                    elif self.appear(self.I_ST_LUCK):
+                        # 出现吉运
+                        logger.info('luck appear')
+                        self.click(self.C_ST_SOUL_OFFERING_REWARD, interval=2)
+                        continue
+                    elif self.appear(self.I_ST_SMALL_LUCK):
+                        # 出现小吉运
+                        logger.info('small luck appear')
+                        self.click(self.C_ST_SOUL_OFFERING_REWARD, interval=2)
+                        continue
                     if self.appear_then_click(self.I_ST_DONATE, interval=5.5):
                         self.wait_until_appear(self.I_ST_GOLD, True, wait_time=5)
                         continue

+ 6 - 0
tasks/SoulsTidy/simple/click.json

@@ -10,5 +10,11 @@
     "roiFront": "717,165,100,48",
     "roiBack": "926,165,100,54",
     "description": "出现神赐"
+  },
+  {
+    "itemName": "st_soul_offering_reward",
+    "roiFront": "717,165,100,48",
+    "roiBack": "926,165,100,54",
+    "description": "御魂奉纳奖励"
   }
 ]

+ 28 - 1
tasks/SoulsTidy/simple/image.json

@@ -150,7 +150,7 @@
     "roiBack": "142,234,20,16",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "狗粮御魂的堆叠标识"
+    "description": "5星御魂的堆叠标识_大于1个"
   },
   {
     "itemName": "st_souls_close",
@@ -160,5 +160,32 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "御魂关闭状态"
+  },
+  {
+    "itemName": "st_soul_stack_1",
+    "imageName": "simple_st_soul_stack_1.png",
+    "roiFront": "89,239,105,19",
+    "roiBack": "89,239,105,19",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "5星御魂堆叠标识_1个"
+  },
+  {
+    "itemName": "st_luck",
+    "imageName": "simple_st_luck.png",
+    "roiFront": "596,236,110,56",
+    "roiBack": "596,236,110,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "吉运"
+  },
+  {
+    "itemName": "st_small_luck",
+    "imageName": "simple_st_small_luck.png",
+    "roiFront": "549,236,201,35",
+    "roiBack": "549,236,201,35",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "小吉运"
   }
 ]

BIN
tasks/SoulsTidy/simple/simple_st_luck.png


BIN
tasks/SoulsTidy/simple/simple_st_small_luck.png


BIN
tasks/SoulsTidy/simple/simple_st_soul_stack_1.png


+ 8 - 1
tasks/WantedQuests/explore.py

@@ -27,6 +27,13 @@ class WQExplore(BaseExploration, HighLight):
         _cnt_exploration = 0
         search_fail_cnt = 0
         search_fail_timer = Timer(3.2)  # 这里设置的时间一定要大于S_SWIPE_BACKGROUND_RIGHT滑动的时间
+        # https://github.com/runhey/OnmyojiAutoScript/pull/1697 云景阆苑 皮肤
+        from tasks.Component.Costume.config import MainType
+        if self.config.model.global_game.costume_config.costume_main_type == MainType.COSTUME_MAIN_13:
+            self.TEMPLATE_GIF.match = self.TEMPLATE_GIF.match_with_multi_scale
+            logger.info("Costume '云景阆苑' detected, enable multi-scale matching for highlight")
+        else:
+            self.TEMPLATE_GIF.match = self.TEMPLATE_GIF.match_origin
         while 1:
             self.screenshot()
             if self.appear(self.I_UI_BACK_YELLOW) and self.appear(self.I_E_EXPLORATION_CLICK):
@@ -112,4 +119,4 @@ if __name__ == '__main__':
     config = Config('oas1')
     device = Device(config)
     t = WQExplore(config, device)
-    t.explore(goto=WantedQuestsAssets.I_GOTO_1, num=2)
+    t.explore(goto=WantedQuestsAssets.I_GOTO_1, num=2)