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

Merge pull request #249 from runhey/dev

Dev
huangrunheng 2 лет назад
Родитель
Сommit
1f7ee33f39
32 измененных файлов с 336 добавлено и 87 удалено
  1. 5 5
      script.py
  2. 4 0
      tasks/BondlingFairyland/script_task.py
  3. 1 1
      tasks/Component/Costume/assets.py
  4. 2 2
      tasks/Component/Costume/main4/image.json
  5. BIN
      tasks/Component/Costume/main4/main4_main_goto_exploration_4.png
  6. 1 1
      tasks/Component/GeneralInvite/assets.py
  7. 5 3
      tasks/Component/GeneralInvite/general_invite.py
  8. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_home.png
  9. 2 2
      tasks/Component/GeneralInvite/gi/member.json
  10. 12 8
      tasks/Component/ReplaceShikigami/replace_shikigami.py
  11. 2 1
      tasks/Duel/script_task.py
  12. 3 0
      tasks/EternitySea/config.py
  13. 14 1
      tasks/EternitySea/script_task.py
  14. 4 1
      tasks/EvoZone/config.py
  15. 26 40
      tasks/EvoZone/script_task.py
  16. 10 0
      tasks/GameUi/game_ui.py
  17. 1 1
      tasks/Hyakkiyakou/prepare/get_images.py
  18. 160 1
      tasks/Hyakkiyakou/utils/exp_test.py
  19. 1 1
      tasks/Hyakkiyakou/utils/realm_raid_test.py
  20. BIN
      tasks/KekkaiActivation/a/a_a_harvest_fish_3.png
  21. 9 0
      tasks/KekkaiActivation/a/image.json
  22. 2 0
      tasks/KekkaiActivation/assets.py
  23. 3 0
      tasks/KekkaiActivation/script_task.py
  24. 1 1
      tasks/KekkaiUtilize/assets.py
  25. 2 2
      tasks/KekkaiUtilize/realm/image.json
  26. BIN
      tasks/KekkaiUtilize/realm/realm_shi_card.png
  27. 5 1
      tasks/Nian/script_task.py
  28. 49 3
      tasks/RealmRaid/script_task.py
  29. 4 4
      tasks/RichMan/assets.py
  30. BIN
      tasks/RichMan/guild/guild_guild_check_scrap.png
  31. 5 5
      tasks/RichMan/guild/image.json
  32. 3 3
      tasks/RichMan/mall/bondlings.py

+ 5 - 5
script.py

@@ -361,7 +361,7 @@ class Script:
             self.save_error_log()
             self.save_error_log()
             logger.warning(f'Game stuck, {self.device.package} will be restarted in 10 seconds')
             logger.warning(f'Game stuck, {self.device.package} will be restarted in 10 seconds')
             logger.warning('If you are playing by hand, please stop Alas')
             logger.warning('If you are playing by hand, please stop Alas')
-            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> GameStuckError or GameTooManyClickError")
+            self.config.notifier.push(title=command, content=f"<{self.config_name}> GameStuckError or GameTooManyClickError")
             self.config.task_call('Restart')
             self.config.task_call('Restart')
             self.device.sleep(10)
             self.device.sleep(10)
             return False
             return False
@@ -378,22 +378,22 @@ class Script:
             # 这个还不重要 留着坑填
             # 这个还不重要 留着坑填
             logger.critical('Game page unknown')
             logger.critical('Game page unknown')
             self.save_error_log()
             self.save_error_log()
-            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> GamePageUnknownError")
+            self.config.notifier.push(title=command, content=f"<{self.config_name}> GamePageUnknownError")
             exit(1)
             exit(1)
             return False
             return False
         except ScriptError as e:
         except ScriptError as e:
             logger.critical(e)
             logger.critical(e)
             logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
             logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
-            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> ScriptError")
+            self.config.notifier.push(title=command, content=f"<{self.config_name}> ScriptError")
             exit(1)
             exit(1)
         except RequestHumanTakeover:
         except RequestHumanTakeover:
             logger.critical('Request human takeover')
             logger.critical('Request human takeover')
-            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> RequestHumanTakeover")
+            self.config.notifier.push(title=command, content=f"<{self.config_name}> RequestHumanTakeover")
             exit(1)
             exit(1)
         except Exception as e:
         except Exception as e:
             logger.exception(e)
             logger.exception(e)
             self.save_error_log()
             self.save_error_log()
-            self.config.notifier.push(title='crashed', content=f"<{self.config_name}> Exception occured")
+            self.config.notifier.push(title=command, content=f"<{self.config_name}> Exception occured")
             exit(1)
             exit(1)
 
 
     def loop(self):
     def loop(self):

+ 4 - 0
tasks/BondlingFairyland/script_task.py

@@ -543,6 +543,10 @@ class ScriptTask(GameUi, BondlingBattle, SwitchSoul, BondlingFairylandAssets):
                 return False
                 return False
             if not self.appear(self.I_BF_SEARSH):
             if not self.appear(self.I_BF_SEARSH):
                 return True
                 return True
+            if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+                continue
+            if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
+                continue
             if self.appear_then_click(self.I_BF_SEARSH, interval=2):
             if self.appear_then_click(self.I_BF_SEARSH, interval=2):
                 count += 1
                 count += 1
                 continue
                 continue

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

@@ -53,7 +53,7 @@ class CostumeAssets:
 	# description 
 	# description 
 	I_CHECK_MAIN_4 = RuleImage(roi_front=(513,139,48,55), roi_back=(149,108,1068,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_check_main_4.png")
 	I_CHECK_MAIN_4 = RuleImage(roi_front=(513,139,48,55), roi_back=(149,108,1068,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_check_main_4.png")
 	# description 
 	# description 
-	I_MAIN_GOTO_EXPLORATION_4 = RuleImage(roi_front=(434,233,43,56), roi_back=(148,201,847,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_main_goto_exploration_4.png")
+	I_MAIN_GOTO_EXPLORATION_4 = RuleImage(roi_front=(439,234,32,48), roi_back=(150,201,847,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_main_goto_exploration_4.png")
 	#  
 	#  
 	I_MAIN_GOTO_SUMMON_4 = RuleImage(roi_front=(959,215,41,62), roi_back=(556,187,659,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_main_goto_summon_4.png")
 	I_MAIN_GOTO_SUMMON_4 = RuleImage(roi_front=(959,215,41,62), roi_back=(556,187,659,100), threshold=0.8, method="Template matching", file="./tasks/Component/Costume/main4/main4_main_goto_summon_4.png")
 	# description 
 	# description 

+ 2 - 2
tasks/Component/Costume/main4/image.json

@@ -11,8 +11,8 @@
   {
   {
     "itemName": "main_goto_exploration_4",
     "itemName": "main_goto_exploration_4",
     "imageName": "main4_main_goto_exploration_4.png",
     "imageName": "main4_main_goto_exploration_4.png",
-    "roiFront": "434,233,43,56",
-    "roiBack": "148,201,847,100",
+    "roiFront": "439,234,32,48",
+    "roiBack": "150,201,847,100",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

BIN
tasks/Component/Costume/main4/main4_main_goto_exploration_4.png


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

@@ -93,7 +93,7 @@ class GeneralInviteAssets:
 	# description 
 	# description 
 	I_GI_EMOJI_2 = RuleImage(roi_front=(27,622,55,51), roi_back=(27,622,55,51), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png")
 	I_GI_EMOJI_2 = RuleImage(roi_front=(27,622,55,51), roi_back=(27,622,55,51), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png")
 	# 判断是不是在庭院界面 
 	# 判断是不是在庭院界面 
-	I_GI_HOME = RuleImage(roi_front=(359,44,34,46), roi_back=(359,44,34,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_home.png")
+	I_GI_HOME = RuleImage(roi_front=(361,34,34,46), roi_back=(361,34,34,46), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_home.png")
 	# 判断是不是在探索界面 
 	# 判断是不是在探索界面 
 	I_GI_EXPLORE = RuleImage(roi_front=(1138,119,41,48), roi_back=(1138,119,41,48), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_explore.png")
 	I_GI_EXPLORE = RuleImage(roi_front=(1138,119,41,48), roi_back=(1138,119,41,48), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_explore.png")
 
 

+ 5 - 3
tasks/Component/GeneralInvite/general_invite.py

@@ -12,6 +12,7 @@ from module.base.timer import Timer
 from tasks.base_task import BaseTask
 from tasks.base_task import BaseTask
 from tasks.Component.GeneralInvite.assets import GeneralInviteAssets
 from tasks.Component.GeneralInvite.assets import GeneralInviteAssets
 from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode
 from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode
+from tasks.Component.GeneralBattle.assets import GeneralBattleAssets
 from module.logger import logger
 from module.logger import logger
 
 
 
 
@@ -540,9 +541,6 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
 
 
         return True
         return True
 
 
-
-
-
     def check_then_accept(self) -> bool:
     def check_then_accept(self) -> bool:
         """
         """
         队员接受邀请
         队员接受邀请
@@ -555,6 +553,10 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             self.screenshot()
             self.screenshot()
             if self.is_in_room():
             if self.is_in_room():
                 return True
                 return True
+            # 被秒开
+            # https://github.com/runhey/OnmyojiAutoScript/issues/230
+            if self.appear(GeneralBattleAssets.I_EXIT):
+                return False
             if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
             if self.appear_then_click(self.I_I_NO_DEFAULT, interval=1):
                 continue
                 continue
             if self.appear_then_click(self.I_GI_SURE, interval=1):
             if self.appear_then_click(self.I_GI_SURE, interval=1):

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


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

@@ -20,8 +20,8 @@
   {
   {
     "itemName": "gi_home",
     "itemName": "gi_home",
     "imageName": "gi_gi_home.png",
     "imageName": "gi_gi_home.png",
-    "roiFront": "359,44,34,46",
-    "roiBack": "359,44,34,46",
+    "roiFront": "361,34,34,46",
+    "roiBack": "361,34,34,46",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "判断是不是在庭院界面"
     "description": "判断是不是在庭院界面"

+ 12 - 8
tasks/Component/ReplaceShikigami/replace_shikigami.py

@@ -77,14 +77,14 @@ class ReplaceShikigami(BaseTask, ReplaceShikigamiAssets):
         :return:
         :return:
         """
         """
         # 选择式神
         # 选择式神
-        click_match = {1: self.C_SHIKIGAMI_LEFT_1,
-                       2: self.C_SHIKIGAMI_LEFT_2,
-                       3: self.C_SHIKIGAMI_LEFT_3,
-                       4: self.C_SHIKIGAMI_LEFT_4,
-                       5: self.C_SHIKIGAMI_LEFT_5,
-                       6: self.C_SHIKIGAMI_LEFT_6,
-                       7: self.C_SHIKIGAMI_LEFT_7}
-        click_match = click_match[shikigami_order]
+        _click_match = {1: self.C_SHIKIGAMI_LEFT_1,
+                        2: self.C_SHIKIGAMI_LEFT_2,
+                        3: self.C_SHIKIGAMI_LEFT_3,
+                        4: self.C_SHIKIGAMI_LEFT_4,
+                        5: self.C_SHIKIGAMI_LEFT_5,
+                        6: self.C_SHIKIGAMI_LEFT_6,
+                        7: self.C_SHIKIGAMI_LEFT_7}
+        click_match = _click_match[shikigami_order]
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
 
 
@@ -96,6 +96,10 @@ class ReplaceShikigami(BaseTask, ReplaceShikigamiAssets):
 
 
             if self.click(click_match, interval=1.5):
             if self.click(click_match, interval=1.5):
                 continue
                 continue
+            if self.click(_click_match[6], interval=4.5):
+                # 有的时候第七个格子被占用到寄养上去了
+                # 导致一直无法选上
+                continue
         logger.info('Set shikigami: %d' % shikigami_order)
         logger.info('Set shikigami: %d' % shikigami_order)
 
 
     def detect_no_shikigami(self) -> bool:
     def detect_no_shikigami(self) -> bool:

+ 2 - 1
tasks/Duel/script_task.py

@@ -71,7 +71,7 @@ class ScriptTask(GameUi, GeneralBattle, DuelAssets):
         click_count = 0  # 计数
         click_count = 0  # 计数
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if click_count >= 2:
+            if click_count >= 4:
                 break
                 break
 
 
             if self.appear_then_click(self.I_D_TEAM, interval=1):
             if self.appear_then_click(self.I_D_TEAM, interval=1):
@@ -79,6 +79,7 @@ class ScriptTask(GameUi, GeneralBattle, DuelAssets):
             if self.appear_then_click(self.I_UI_CONFIRM, interval=0.6):
             if self.appear_then_click(self.I_UI_CONFIRM, interval=0.6):
                 continue
                 continue
             if self.appear_then_click(self.I_D_TEAM_SWTICH, interval=1):
             if self.appear_then_click(self.I_D_TEAM_SWTICH, interval=1):
+                click_count += 1
                 continue
                 continue
         logger.info('Souls Switch is complete')
         logger.info('Souls Switch is complete')
         self.ui_click(self.I_UI_BACK_YELLOW, self.I_D_TEAM)
         self.ui_click(self.I_UI_BACK_YELLOW, self.I_D_TEAM)

+ 3 - 0
tasks/EternitySea/config.py

@@ -4,6 +4,7 @@
 from pydantic import BaseModel, Field
 from pydantic import BaseModel, Field
 from enum import Enum
 from enum import Enum
 from datetime import datetime, time
 from datetime import datetime, time
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, Time
 from tasks.Component.config_base import ConfigBase, Time
@@ -31,4 +32,6 @@ class EternitySea(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     eternity_sea_config: EternitySeaConfig = Field(default_factory=EternitySeaConfig)
     eternity_sea_config: EternitySeaConfig = Field(default_factory=EternitySeaConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config_1: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+    switch_soul_config_2: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
 
 

+ 14 - 1
tasks/EternitySea/script_task.py

@@ -7,7 +7,7 @@ from module.exception import TaskEnd
 from module.logger import logger
 from module.logger import logger
 
 
 from tasks.GameUi.game_ui import GameUi, Page
 from tasks.GameUi.game_ui import GameUi, Page
-from tasks.GameUi.page import page_soul_zones
+from tasks.GameUi.page import page_soul_zones, page_shikigami_records
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
@@ -25,7 +25,20 @@ class ScriptTask(
     def task_name(self):
     def task_name(self):
         return "EternitySea"
         return "EternitySea"
 
 
+    def _two_teams_switch_sous(self, config):
+        if config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(config.switch_group_team)
+
+        if config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(config.group_name, config.team_name)
+
     def run(self) -> None:
     def run(self) -> None:
+        self._two_teams_switch_sous(self._task_config.switch_soul_config_1)
+        self._two_teams_switch_sous(self._task_config.switch_soul_config_2)
         match self._task_config.eternity_sea_config.user_status:
         match self._task_config.eternity_sea_config.user_status:
             case UserStatus.ALONE:
             case UserStatus.ALONE:
                 success = self.run_alone()
                 success = self.run_alone()

+ 4 - 1
tasks/EvoZone/config.py

@@ -4,6 +4,7 @@
 from pydantic import BaseModel, Field
 from pydantic import BaseModel, Field
 from enum import Enum
 from enum import Enum
 from datetime import datetime, time
 from datetime import datetime, time
+from tasks.Component.SwitchSoul.switch_soul_config import SwitchSoulConfig
 
 
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_scheduler import Scheduler
 from tasks.Component.config_base import ConfigBase, Time
 from tasks.Component.config_base import ConfigBase, Time
@@ -48,11 +49,13 @@ class EvoZoneConfig(ConfigBase):
     # 限制次数
     # 限制次数
     limit_count: int = Field(default=30, description='limit_count_help')
     limit_count: int = Field(default=30, description='limit_count_help')
     # 是否开启觉醒加成
     # 是否开启觉醒加成
-    soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
+    soul_buff_enable: bool = Field(default=False, description='是否开启觉醒加成')
 
 
 class EvoZone(ConfigBase):
 class EvoZone(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     evo_zone_config: EvoZoneConfig = Field(default_factory=EvoZoneConfig)
     evo_zone_config: EvoZoneConfig = Field(default_factory=EvoZoneConfig)
     invite_config: InviteConfig = Field(default_factory=InviteConfig)
     invite_config: InviteConfig = Field(default_factory=InviteConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
     general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)
+    switch_soul_config: SwitchSoulConfig = Field(default_factory=SwitchSoulConfig)
+
 
 

+ 26 - 40
tasks/EvoZone/script_task.py

@@ -8,14 +8,16 @@ from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralInvite.general_invite import GeneralInvite
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
 from tasks.Component.GeneralRoom.general_room import GeneralRoom
+from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_main, page_awake_zones
+from tasks.GameUi.page import page_main, page_awake_zones, page_shikigami_records
 from tasks.EvoZone.assets import EvoZoneAssets
 from tasks.EvoZone.assets import EvoZoneAssets
 from tasks.EvoZone.config import EvoZone, UserStatus, KirinType
 from tasks.EvoZone.config import EvoZone, UserStatus, KirinType
 from module.logger import logger
 from module.logger import logger
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 
 
-class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, EvoZoneAssets):
+
+class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, EvoZoneAssets, SwitchSoul):
 
 
     def run(self) -> bool:
     def run(self) -> bool:
 
 
@@ -23,7 +25,17 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         limit_time = self.config.evo_zone.evo_zone_config.limit_time
         limit_time = self.config.evo_zone.evo_zone_config.limit_time
         self.current_count = 0
         self.current_count = 0
         self.limit_count: int = limit_count
         self.limit_count: int = limit_count
-        self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute, seconds=limit_time.second)
+        self.limit_time: timedelta = timedelta(hours=limit_time.hour, minutes=limit_time.minute,
+                                               seconds=limit_time.second)
+        con = self.config.evo_zone
+        if con.switch_soul_config.enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul(con.switch_soul_config.switch_group_team)
+        if con.switch_soul_config.enable_switch_by_name:
+            self.ui_get_current_page()
+            self.ui_goto(page_shikigami_records)
+            self.run_switch_soul_by_name(con.switch_soul_config.group_name, con.switch_soul_config.team_name)
 
 
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_main)
         self.ui_goto(page_main)
@@ -35,11 +47,16 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
 
 
         success = True
         success = True
         match config.evo_zone_config.user_status:
         match config.evo_zone_config.user_status:
-            case UserStatus.LEADER: success = self.run_leader()
-            case UserStatus.MEMBER: success = self.run_member()
-            case UserStatus.ALONE: self.run_alone()
-            case UserStatus.WILD: self.run_wild()
-            case _: logger.error('Unknown user status')
+            case UserStatus.LEADER:
+                success = self.run_leader()
+            case UserStatus.MEMBER:
+                success = self.run_member()
+            case UserStatus.ALONE:
+                self.run_alone()
+            case UserStatus.WILD:
+                self.run_wild()
+            case _:
+                logger.error('Unknown user status')
 
 
         # 记得关掉
         # 记得关掉
         if config.evo_zone_config.soul_buff_enable:
         if config.evo_zone_config.soul_buff_enable:
@@ -105,21 +122,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                 if self.appear_then_click(self.I_EVOZONE_LOCK, interval=1):
                 if self.appear_then_click(self.I_EVOZONE_LOCK, interval=1):
                     continue
                     continue
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
     def run_leader(self):
     def run_leader(self):
         logger.info('Start run leader')
         logger.info('Start run leader')
         self.ui_get_current_page()
         self.ui_get_current_page()
@@ -170,8 +172,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                     logger.info('EvoZone time limit out')
                     logger.info('EvoZone time limit out')
                     break
                     break
 
 
-
-
             # 如果没有进入房间那就不需要后面的邀请
             # 如果没有进入房间那就不需要后面的邀请
             if not self.is_in_room():
             if not self.is_in_room():
                 # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
                 # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
@@ -267,7 +267,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             if self.exit_battle():
             if self.exit_battle():
                 pass
                 pass
 
 
-
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_main)
         self.ui_goto(page_main)
         return True
         return True
@@ -324,20 +323,15 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         self.ui_current = page_awake_zones
         self.ui_current = page_awake_zones
         self.ui_goto(page_main)
         self.ui_goto(page_main)
 
 
-
-
     def run_wild(self):
     def run_wild(self):
         logger.error('Wild mode is not implemented')
         logger.error('Wild mode is not implemented')
         pass
         pass
 
 
 
 
-
-
-
-
 if __name__ == '__main__':
 if __name__ == '__main__':
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
+
     c = Config('oas1')
     c = Config('oas1')
     d = Device(c)
     d = Device(c)
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)
@@ -347,11 +341,3 @@ if __name__ == '__main__':
     # t.check_layer('悲')
     # t.check_layer('悲')
 
 
     from module.base.timer import timer
     from module.base.timer import timer
-
-
-
-
-
-
-
-

+ 10 - 0
tasks/GameUi/game_ui.py

@@ -11,6 +11,7 @@ from module.atom.ocr import RuleOcr
 
 
 from tasks.GameUi.assets import GameUiAssets
 from tasks.GameUi.assets import GameUiAssets
 from tasks.GameUi.page import *
 from tasks.GameUi.page import *
+from tasks.Restart.assets import RestartAssets
 from tasks.base_task import BaseTask
 from tasks.base_task import BaseTask
 from module.logger import logger
 from module.logger import logger
 from module.exception import (GameNotRunningError, GamePageUnknownError, RequestHumanTakeover)
 from module.exception import (GameNotRunningError, GamePageUnknownError, RequestHumanTakeover)
@@ -69,6 +70,12 @@ class GameUi(BaseTask, GameUiAssets):
         """
         """
         return self.appear(page.check_button)
         return self.appear(page.check_button)
 
 
+    def ensure_scroll_open(self):
+        """
+        判断庭院界面卷轴是否打开
+        """
+        return self.appear(RestartAssets.I_LOGIN_SCROOLL_CLOSE)
+
     def ensure_button_execute(self, button):
     def ensure_button_execute(self, button):
         """
         """
         确保button执行
         确保button执行
@@ -139,6 +146,9 @@ class GameUi(BaseTask, GameUiAssets):
             minicap_check()
             minicap_check()
             rotation_check()
             rotation_check()
 
 
+        if self.ensure_scroll_open():
+            self.ui_click_until_disappear(RestartAssets.I_LOGIN_SCROOLL_CLOSE)
+
         # Unknown page, need manual switching
         # Unknown page, need manual switching
         logger.warning("Unknown ui page")
         logger.warning("Unknown ui page")
         logger.attr("EMULATOR__SCREENSHOT_METHOD", self.config.script.device.screenshot_method)
         logger.attr("EMULATOR__SCREENSHOT_METHOD", self.config.script.device.screenshot_method)

+ 1 - 1
tasks/Hyakkiyakou/prepare/get_images.py

@@ -25,7 +25,7 @@ class GenerateImages(GameUi, HyakkiyakouAssets):
     def run(self):
     def run(self):
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_hyakkiyakou)
         self.ui_goto(page_hyakkiyakou)
-        for i in range(1):
+        for i in range(20):
             self.save_one()
             self.save_one()
 
 
     def save_one(self):
     def save_one(self):

+ 160 - 1
tasks/Hyakkiyakou/utils/exp_test.py

@@ -19,6 +19,7 @@ from tasks.base_task import BaseTask
 from tasks.Script.config_device import ScreenshotMethod, ControlMethod
 from tasks.Script.config_device import ScreenshotMethod, ControlMethod
 from tasks.Component.RightActivity.right_activity import RightActivity
 from tasks.Component.RightActivity.right_activity import RightActivity
 from tasks.Restart.assets import RestartAssets
 from tasks.Restart.assets import RestartAssets
+from tasks.Exploration.config import ExplorationLevel
 
 
 from utils import usage_time
 from utils import usage_time
 from fast_device import FastDevice
 from fast_device import FastDevice
@@ -100,7 +101,7 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
 
 
             if not start_flag:
             if not start_flag:
                 with usage_time('click'):
                 with usage_time('click'):
-                    self.device.click(x=step.pos[0], y=step.pos[1])
+                    self.device.click(x=step.pos[0], y=step.pos[1], control_name=step.step_name)
                 timer_step.start()
                 timer_step.start()
                 timer_save_img.start()
                 timer_save_img.start()
                 timer_save_interval.start()
                 timer_save_interval.start()
@@ -324,3 +325,161 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
     def back_main(self):
     def back_main(self):
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_main)
         self.ui_goto(page_main)
+
+    def open_expect_level(self, level: int):
+        self.config.model.script.device.control_method = ControlMethod.UIAUTOMATOR2
+        exploration_level = self.exp_level_map.get(level, None)
+        swipeCount = 0
+        while 1:
+            self.screenshot()
+
+            results = self.O_E_EXPLORATION_LEVEL_NUMBER.detect_and_ocr(self.device.image)
+            text1 = [result.ocr_text for result in results]
+            result = set(text1).intersection({exploration_level})
+            if self.appear(self.I_E_EXPLORATION_CLICK) or result and len(result) > 0:
+                break
+            self.device.click_record_clear()
+            self.swipe(self.S_SWIPE_LEVEL_UP)
+            swipeCount += 1
+            if swipeCount >= 25:
+                return False
+        self.config.model.script.device.control_method = ControlMethod.WINDOW_MESSAGE
+
+        self.O_E_EXPLORATION_LEVEL_NUMBER.keyword = exploration_level
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_E_EXPLORATION_CLICK):
+                break
+            if self.ocr_appear_click(self.O_E_EXPLORATION_LEVEL_NUMBER):
+                self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=3)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_E_AUTO_ROTATE_ON) or self.appear(self.I_E_AUTO_ROTATE_OFF):
+                break
+            if self.appear_then_click(self.I_E_EXPLORATION_CLICK, interval=1):
+                continue
+        from time import sleep
+        sleep(1)
+        logger.info(f'Enter exploration {level}')
+
+    @cached_property
+    def exp_level_map(self):
+        return {
+            1: ExplorationLevel.EXPLORATION_1,
+            2: ExplorationLevel.EXPLORATION_2,
+            3: ExplorationLevel.EXPLORATION_3,
+            4: ExplorationLevel.EXPLORATION_4,
+            5: ExplorationLevel.EXPLORATION_5,
+            6: ExplorationLevel.EXPLORATION_6,
+            7: ExplorationLevel.EXPLORATION_7,
+            8: ExplorationLevel.EXPLORATION_8,
+            9: ExplorationLevel.EXPLORATION_9,
+            10: ExplorationLevel.EXPLORATION_10,
+            11: ExplorationLevel.EXPLORATION_11,
+            12: ExplorationLevel.EXPLORATION_12,
+            13: ExplorationLevel.EXPLORATION_13,
+            14: ExplorationLevel.EXPLORATION_14,
+            15: ExplorationLevel.EXPLORATION_15,
+            16: ExplorationLevel.EXPLORATION_16,
+            17: ExplorationLevel.EXPLORATION_17,
+            18: ExplorationLevel.EXPLORATION_18,
+            19: ExplorationLevel.EXPLORATION_19,
+            20: ExplorationLevel.EXPLORATION_20,
+            21: ExplorationLevel.EXPLORATION_21,
+            22: ExplorationLevel.EXPLORATION_22,
+            23: ExplorationLevel.EXPLORATION_23,
+            24: ExplorationLevel.EXPLORATION_24,
+            25: ExplorationLevel.EXPLORATION_25,
+            26: ExplorationLevel.EXPLORATION_26,
+            27: ExplorationLevel.EXPLORATION_27,
+            28: ExplorationLevel.EXPLORATION_28,
+        }
+
+    def run_exp_base(self, pos_top: int = 550, go_times: int = 7, back_times: int = 7):
+        pos_right = 1270
+        pos_left = 260
+        pos_top = pos_top
+        pos_bottom = 620
+        pos_level = (pos_top + pos_bottom) / 2
+        save_roi_start = 200
+        save_roi_end = 640 - save_roi_start
+        step_1 = Step('step_1', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_2 = Step('step_2', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_3 = Step('step_3', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_4 = Step('step_4', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_5 = Step('step_5', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_6 = Step('step_6', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_7 = Step('step_7', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        step_8 = Step('step_7', pos=(pos_right, random.randint(pos_bottom - 10, pos_bottom)), time=2.3)
+        back_1 = Step('back_1', pos=(pos_left, pos_level), time=1.7, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_2 = Step('back_2', pos=(pos_left, pos_top), time=1.7, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_3 = Step('back_3', pos=(pos_left, pos_level), time=1.7, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_4 = Step('back_4', pos=(pos_left, pos_bottom), time=1.7, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_5 = Step('back_5', pos=(pos_left, pos_bottom), time=1.4, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_6 = Step('back_6', pos=(pos_left, pos_top), time=2.1, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_7 = Step('back_7', pos=(pos_left, pos_bottom), time=2.1, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_8 = Step('back_8', pos=(pos_left, pos_level), time=1.8, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_9 = Step('back_9', pos=(pos_left, pos_top), time=1.8, save_img=True,
+                      save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        back_10 = Step('back_10', pos=(pos_left, pos_bottom), time=2.1, save_img=True,
+                       save_roi=(random.randint(save_roi_start, save_roi_end), 80))
+        if go_times >= 3:
+            self.run_step(step_1)
+            self.run_step(step_2)
+            self.run_step(step_3)
+        if go_times >= 4:
+            self.run_step(step_4)
+        if go_times >= 5:
+            self.run_step(step_5)
+        if go_times >= 6:
+            self.run_step(step_6)
+        if go_times >= 7:
+            self.run_step(step_7)
+        if go_times >= 8:
+            self.run_step(step_8)
+
+        if back_times >= 4:
+            self.run_step(back_1)
+            self.run_step(back_2)
+            self.run_step(back_3)
+            self.run_step(back_4)
+        if back_times >= 5:
+            self.run_step(back_5)
+        if back_times >= 6:
+            self.run_step(back_6)
+        if back_times >= 7:
+            self.run_step(back_7)
+        if back_times >= 8:
+            self.run_step(back_8)
+        if back_times >= 9:
+            self.run_step(back_9)
+        if back_times >= 10:
+            self.run_step(back_10)
+        logger.info('exp done')
+        logger.info('-----------------------------------------------------------------------------')
+
+    def run_exp_24(self):
+        self.run_exp_base(pos_top=470, go_times=8, back_times=10)
+
+    def run_exp_20(self):
+        self.run_exp_base(pos_top=470, go_times=7, back_times=8)
+
+    def run_exp_18(self):
+        self.run_exp_base(pos_top=470, go_times=4, back_times=5)
+
+    def run_exp_15(self):
+        self.run_exp_base(pos_top=470, go_times=7, back_times=8)
+
+    def run_exp_12(self):
+        self.run_exp_base(pos_top=470, go_times=3, back_times=5)
+
+

+ 1 - 1
tasks/Hyakkiyakou/utils/realm_raid_test.py

@@ -26,7 +26,7 @@ class RealmRaidTest(ScriptTask):
                 logger.warning("Click failure, check your click position")
                 logger.warning("Click failure, check your click position")
                 return False
                 return False
             if not self.appear(self.I_TOPPA_RECORD, threshold=0.85):
             if not self.appear(self.I_TOPPA_RECORD, threshold=0.85):
-                time.sleep(0.5)
+                time.sleep(1.5)
                 self.screenshot()
                 self.screenshot()
                 if self.appear(self.I_TOPPA_RECORD, threshold=0.85):
                 if self.appear(self.I_TOPPA_RECORD, threshold=0.85):
                     continue
                     continue

BIN
tasks/KekkaiActivation/a/a_a_harvest_fish_3.png


+ 9 - 0
tasks/KekkaiActivation/a/image.json

@@ -205,5 +205,14 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "卸下"
     "description": "卸下"
+  },
+  {
+    "itemName": "a_harvest_fish_3",
+    "imageName": "a_a_harvest_fish_3.png",
+    "roiFront": "891,165,57,39",
+    "roiBack": "854,128,132,124",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "斗鱼3"
   }
   }
 ]
 ]

+ 2 - 0
tasks/KekkaiActivation/assets.py

@@ -74,6 +74,8 @@ class KekkaiActivationAssets:
 	I_A_HARVEST_MOON_3 = RuleImage(roi_front=(897,159,46,40), roi_back=(869,127,100,100), threshold=0.7, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_harvest_moon_3.png")
 	I_A_HARVEST_MOON_3 = RuleImage(roi_front=(897,159,46,40), roi_back=(869,127,100,100), threshold=0.7, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_harvest_moon_3.png")
 	# 卸下 
 	# 卸下 
 	I_A_DEMOUNT = RuleImage(roi_front=(939,575,55,47), roi_back=(903,551,107,91), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_demount.png")
 	I_A_DEMOUNT = RuleImage(roi_front=(939,575,55,47), roi_back=(903,551,107,91), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_demount.png")
+	# 斗鱼3 
+	I_A_HARVEST_FISH_3 = RuleImage(roi_front=(891,165,57,39), roi_back=(854,128,132,124), threshold=0.8, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_harvest_fish_3.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 3 - 0
tasks/KekkaiActivation/script_task.py

@@ -349,6 +349,7 @@ class ScriptTask(KU, KekkaiActivationAssets):
             logger.info('No max level shikigami')
             logger.info('No max level shikigami')
         if self.detect_no_shikigami():
         if self.detect_no_shikigami():
             logger.warning('There are no any shikigami grow room')
             logger.warning('There are no any shikigami grow room')
+            self.switch_shikigami_class(shikigami_class)
             self.set_shikigami(shikigami_order=7, stop_image=self.I_RS_NO_ADD)
             self.set_shikigami(shikigami_order=7, stop_image=self.I_RS_NO_ADD)
 
 
         # 回到结界界面
         # 回到结界界面
@@ -375,6 +376,8 @@ class ScriptTask(KU, KekkaiActivationAssets):
         self.appear_then_click(self.I_A_HARVEST_KAIKO_6)  # 太鼓6
         self.appear_then_click(self.I_A_HARVEST_KAIKO_6)  # 太鼓6
         self.appear_then_click(self.I_A_HARVEST_FISH_6)  # 斗鱼6
         self.appear_then_click(self.I_A_HARVEST_FISH_6)  # 斗鱼6
         self.appear_then_click(self.I_A_HARVEST_MOON_3)  # 太阴3
         self.appear_then_click(self.I_A_HARVEST_MOON_3)  # 太阴3
+        self.appear_then_click(self.I_A_HARVEST_FISH_3)  # 斗鱼三
+
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     from module.config.config import Config
     from module.config.config import Config

+ 1 - 1
tasks/KekkaiUtilize/assets.py

@@ -31,7 +31,7 @@ class KekkaiUtilizeAssets:
 	# 育成 
 	# 育成 
 	I_SHI_GROWN = RuleImage(roi_front=(595,291,35,38), roi_back=(530,254,181,198), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_grown.png")
 	I_SHI_GROWN = RuleImage(roi_front=(595,291,35,38), roi_back=(530,254,181,198), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_grown.png")
 	# 结界卡 
 	# 结界卡 
-	I_SHI_CARD = RuleImage(roi_front=(886,290,44,56), roi_back=(801,259,215,175), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_card.png")
+	I_SHI_CARD = RuleImage(roi_front=(886,290,38,56), roi_back=(870,276,75,86), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_card.png")
 	# description 
 	# description 
 	I_SHI_DEFENSE = RuleImage(roi_front=(294,298,49,56), roi_back=(215,207,208,221), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_defense.png")
 	I_SHI_DEFENSE = RuleImage(roi_front=(294,298,49,56), roi_back=(215,207,208,221), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_defense.png")
 	# 收取经验(没有满的图) 
 	# 收取经验(没有满的图) 

+ 2 - 2
tasks/KekkaiUtilize/realm/image.json

@@ -11,8 +11,8 @@
   {
   {
     "itemName": "shi_card",
     "itemName": "shi_card",
     "imageName": "realm_shi_card.png",
     "imageName": "realm_shi_card.png",
-    "roiFront": "886,290,44,56",
-    "roiBack": "801,259,215,175",
+    "roiFront": "886,290,38,56",
+    "roiBack": "870,276,75,86",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "结界卡"
     "description": "结界卡"

BIN
tasks/KekkaiUtilize/realm/realm_shi_card.png


+ 5 - 1
tasks/Nian/script_task.py

@@ -106,7 +106,11 @@ class ScriptTask(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, NianAssets):
                     self.screenshot()
                     self.screenshot()
                     if not self.appear(self.I_N_WAITING):
                     if not self.appear(self.I_N_WAITING):
                         break
                         break
-                    if self.appear_then_click(self.I_N_WAITING, interval=0.7):
+                    if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+                        continue
+                    if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
+                        continue
+                    if self.appear_then_click(self.I_N_WAITING, interval=1):
                         continue
                         continue
                 logger.info('Nian match timeout, exit')
                 logger.info('Nian match timeout, exit')
                 break
                 break

+ 49 - 3
tasks/RealmRaid/script_task.py

@@ -218,6 +218,10 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
                 else:
                 else:
                     success = False
                     success = False
                     break
                     break
+            # 如果上一轮失败 -> 退出
+            if not last_battle and con.raid_config.when_attack_fail == WhenAttackFail.EXIT:
+                logger.info('Battle lost and exit')
+                break
 
 
 
 
         self.ui_click(self.I_BACK_RED, self.I_CHECK_EXPLORATION)
         self.ui_click(self.I_BACK_RED, self.I_CHECK_EXPLORATION)
@@ -342,7 +346,19 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
         """
         """
         if screenshot:
         if screenshot:
             self.screenshot()
             self.screenshot()
-        target = self.order_medal.find_anyone(self.device.image)
+        image = self.device.image
+        # https://github.com/runhey/OnmyojiAutoScript/issues/71
+        # 如果开始失败后继挑战剩下的
+        if self.config.realm_raid.raid_config.when_attack_fail == WhenAttackFail.CONTINUE:
+            for i, roi in enumerate(self.false_roi):
+                self.false_image.roi_back = roi
+                if not self.appear(self.false_image):
+                    continue
+                logger.info(f'Position {i+1} is a failed')
+                x, y, w, h = self.partition[i].roi_back
+                image[y:y+h, x:x+w, ...] = 0
+        # -----------------------------------------------------
+        target = self.order_medal.find_anyone(image)
         if target:
         if target:
             center = target.front_center()
             center = target.front_center()
             for i, click in enumerate(self.partition):
             for i, click in enumerate(self.partition):
@@ -465,6 +481,36 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RealmRaidAssets):
                 continue
                 continue
         logger.info(f'Click fire {order} success')
         logger.info(f'Click fire {order} success')
 
 
+    @cached_property
+    def false_roi(self) -> list:
+        width = 86
+        height = 64
+        x1 = 386
+        x2 = 714
+        x3 = 1047
+        y1 = 143
+        y2 = 277
+        y3 = 414
+        return [
+            [x1, y1, width, height],  # 左上角
+            [x2, y1, width, height],
+            [x3, y1, width, height],
+            [x1, y2, width, height],  # 左中
+            [x2, y2, width, height],
+            [x3, y2, width, height],
+            [x1, y3, width, height],  # 左下
+            [x2, y3, width, height],
+            [x3, y3, width, height],
+        ]
+
+    @cached_property
+    def false_image(self):
+        return RuleImage(roi_front=(0 ,0, 63, 32),
+                         roi_back=(0, 0, 100, 100),
+                         threshold=0.8,
+                         method="Template matching",
+                         file="./tasks/RyouToppa/dev/loser_sign_1.png")
+
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     from module.config.config import Config
     from module.config.config import Config
@@ -473,8 +519,8 @@ if __name__ == "__main__":
     device = Device(config)
     device = Device(config)
     t = ScriptTask(config, device)
     t = ScriptTask(config, device)
 
 
-    t.run()
+    # t.run()
 
 
-    # print(t.find_one())
+    print(t.find_one())
     # target, order = t.find_one()
     # target, order = t.find_one()
     # print(t.check_medal_is_frog(True, target, order))
     # print(t.check_medal_is_frog(True, target, order))

+ 4 - 4
tasks/RichMan/assets.py

@@ -18,13 +18,13 @@ class RichManAssets:
 	# description 
 	# description 
 	I_GUILD_CLOSE_RED = RuleImage(roi_front=(1029,120,53,57), roi_back=(1029,120,53,57), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_close_red.png")
 	I_GUILD_CLOSE_RED = RuleImage(roi_front=(1029,120,53,57), roi_back=(1029,120,53,57), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_close_red.png")
 	# 蓝票 
 	# 蓝票 
-	I_GUILD_BLUE = RuleImage(roi_front=(344,186,74,73), roi_back=(315,164,584,370), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_blue.png")
+	I_GUILD_BLUE = RuleImage(roi_front=(794,186,74,73), roi_back=(315,164,584,370), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_blue.png")
 	# 黑蛋碎片 
 	# 黑蛋碎片 
-	I_GUILD_SCRAP = RuleImage(roi_front=(795,187,71,68), roi_back=(331,160,559,372), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_scrap.png")
+	I_GUILD_SCRAP = RuleImage(roi_front=(570,439,71,68), roi_back=(331,160,559,372), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_scrap.png")
 	# 皮肤券 
 	# 皮肤券 
-	I_GUILD_SKIN = RuleImage(roi_front=(345,438,71,72), roi_back=(320,162,573,371), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_skin.png")
+	I_GUILD_SKIN = RuleImage(roi_front=(795,438,71,72), roi_back=(320,162,573,371), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_skin.png")
 	# 购买检查 
 	# 购买检查 
-	I_GUILD_CHECK_SCRAP = RuleImage(roi_front=(590,246,90,88), roi_back=(590,246,90,88), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_check_scrap.png")
+	I_GUILD_CHECK_SCRAP = RuleImage(roi_front=(561,429,90,88), roi_back=(561,429,90,88), threshold=0.8, method="Template matching", file="./tasks/RichMan/guild/guild_guild_check_scrap.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

BIN
tasks/RichMan/guild/guild_guild_check_scrap.png


+ 5 - 5
tasks/RichMan/guild/image.json

@@ -29,7 +29,7 @@
   {
   {
     "itemName": "guild_blue",
     "itemName": "guild_blue",
     "imageName": "guild_guild_blue.png",
     "imageName": "guild_guild_blue.png",
-    "roiFront": "344,186,74,73",
+    "roiFront": "794,186,74,73",
     "roiBack": "315,164,584,370",
     "roiBack": "315,164,584,370",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
@@ -38,7 +38,7 @@
   {
   {
     "itemName": "guild_scrap",
     "itemName": "guild_scrap",
     "imageName": "guild_guild_scrap.png",
     "imageName": "guild_guild_scrap.png",
-    "roiFront": "795,187,71,68",
+    "roiFront": "570,439,71,68",
     "roiBack": "331,160,559,372",
     "roiBack": "331,160,559,372",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
@@ -47,7 +47,7 @@
   {
   {
     "itemName": "guild_skin",
     "itemName": "guild_skin",
     "imageName": "guild_guild_skin.png",
     "imageName": "guild_guild_skin.png",
-    "roiFront": "345,438,71,72",
+    "roiFront": "795,438,71,72",
     "roiBack": "320,162,573,371",
     "roiBack": "320,162,573,371",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
@@ -56,8 +56,8 @@
   {
   {
     "itemName": "guild_check_scrap",
     "itemName": "guild_check_scrap",
     "imageName": "guild_guild_check_scrap.png",
     "imageName": "guild_guild_check_scrap.png",
-    "roiFront": "590,246,90,88",
-    "roiBack": "590,246,90,88",
+    "roiFront": "561,429,90,88",
+    "roiBack": "561,429,90,88",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "购买检查"
     "description": "购买检查"

+ 3 - 3
tasks/RichMan/mall/bondlings.py

@@ -24,12 +24,12 @@ class Bondlings(Buy, MallNavbar):
             return
             return
         self._enter_bondlings()
         self._enter_bondlings()
 
 
-        # 购买御魂
-        self._bondlings_base(buy_button=self.I_BL_BUY_SOULS, remain_number=self.O_BL_RES_SOULS, check_class=1,
-                             buy_number=con.random_soul, buy_max=25, buy_money=20)
         # 购买石头
         # 购买石头
         self._bondlings_base(buy_button=self.I_BL_BUY_STONE, remain_number=self.O_BL_RES_STONE, check_class=2,
         self._bondlings_base(buy_button=self.I_BL_BUY_STONE, remain_number=self.O_BL_RES_STONE, check_class=2,
                              buy_number=con.bondling_stone, buy_max=10, buy_money=30)
                              buy_number=con.bondling_stone, buy_max=10, buy_money=30)
+        # 购买御魂
+        self._bondlings_base(buy_button=self.I_BL_BUY_SOULS, remain_number=self.O_BL_RES_SOULS, check_class=1,
+                             buy_number=con.random_soul, buy_max=25, buy_money=20)
         # 购买高级盘
         # 购买高级盘
         self._bondlings_base(buy_button=self.I_BL_BUY_HIGH, remain_number=self.O_BL_RES_HIGH, check_class=3,
         self._bondlings_base(buy_button=self.I_BL_BUY_HIGH, remain_number=self.O_BL_RES_HIGH, check_class=3,
                              buy_number=con.high_bondling_discs, buy_max=10, buy_money=50)
                              buy_number=con.high_bondling_discs, buy_max=10, buy_money=50)