Browse Source

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	module/device/method/droidcast.py
Yuulong 2 years ago
parent
commit
9197eeafa9
97 changed files with 845 additions and 261 deletions
  1. 1 1
      .gitignore
  2. 27 0
      module/device/connection.py
  3. 5 4
      module/device/method/uiautomator_2.py
  4. 5 5
      script.py
  5. BIN
      tasks/ActivityShikigami/as/as_battle.png
  6. BIN
      tasks/ActivityShikigami/as/as_drum.png
  7. BIN
      tasks/ActivityShikigami/as/as_fire.png
  8. BIN
      tasks/ActivityShikigami/as/as_lock.png
  9. BIN
      tasks/ActivityShikigami/as/as_shi.png
  10. BIN
      tasks/ActivityShikigami/as/as_unlock.png
  11. 12 12
      tasks/ActivityShikigami/as/image.json
  12. 2 2
      tasks/ActivityShikigami/as/ocr.json
  13. 7 7
      tasks/ActivityShikigami/assets.py
  14. 55 54
      tasks/ActivityShikigami/script_task.py
  15. 4 0
      tasks/BondlingFairyland/script_task.py
  16. 1 1
      tasks/Component/Costume/assets.py
  17. 2 2
      tasks/Component/Costume/main4/image.json
  18. BIN
      tasks/Component/Costume/main4/main4_main_goto_exploration_4.png
  19. 2 2
      tasks/Component/GeneralBattle/general_battle.py
  20. 17 9
      tasks/Component/GeneralBuff/general_buff.py
  21. 2 2
      tasks/Component/GeneralInvite/assets.py
  22. 5 3
      tasks/Component/GeneralInvite/general_invite.py
  23. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png
  24. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_home.png
  25. 5 5
      tasks/Component/GeneralInvite/gi/member.json
  26. 0 2
      tasks/Component/GeneralRoom/assets.py
  27. 2 2
      tasks/Component/GeneralRoom/general_room.py
  28. BIN
      tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png
  29. 0 9
      tasks/Component/GeneralRoom/gr/image.json
  30. 12 8
      tasks/Component/ReplaceShikigami/replace_shikigami.py
  31. 3 3
      tasks/Component/Summon/assets.py
  32. 4 4
      tasks/Component/Summon/sm/image.json
  33. 2 2
      tasks/Component/Summon/sm/ocr.json
  34. 2 1
      tasks/DailyTrifles/script_task.py
  35. 2 1
      tasks/Duel/script_task.py
  36. 3 0
      tasks/EternitySea/config.py
  37. 14 1
      tasks/EternitySea/script_task.py
  38. 0 2
      tasks/EvoZone/assets.py
  39. 4 1
      tasks/EvoZone/config.py
  40. 0 9
      tasks/EvoZone/o/image.json
  41. BIN
      tasks/EvoZone/o/o_evozone_matching.png
  42. 27 41
      tasks/EvoZone/script_task.py
  43. 2 0
      tasks/Exploration/config.py
  44. 14 2
      tasks/Exploration/script_task.py
  45. 0 2
      tasks/FallenSun/assets.py
  46. BIN
      tasks/FallenSun/f/f_fallen_sun_matching.png
  47. 0 9
      tasks/FallenSun/f/image.json
  48. 1 1
      tasks/FallenSun/script_task.py
  49. 7 1
      tasks/GameUi/assets.py
  50. 10 0
      tasks/GameUi/game_ui.py
  51. 5 1
      tasks/GameUi/page.py
  52. BIN
      tasks/GameUi/page/page_check_kyakkiyakou.png
  53. BIN
      tasks/GameUi/page/page_check_team.png
  54. BIN
      tasks/GameUi/page/page_hyakkiyakou_close.png
  55. 27 0
      tasks/GameUi/page/page_img_2.json
  56. 2 2
      tasks/GameUi/page/page_img_3.json
  57. BIN
      tasks/GameUi/page/page_town_goto_hyakkiyakou.png
  58. 0 0
      tasks/GlobalGame/gg/gg_g_jade.png
  59. 24 0
      tasks/Hyakkiyakou/assets.py
  60. 20 0
      tasks/Hyakkiyakou/hya/click.json
  61. BIN
      tasks/Hyakkiyakou/hya/hya_haccess.png
  62. BIN
      tasks/Hyakkiyakou/hya/hya_hend.png
  63. BIN
      tasks/Hyakkiyakou/hya/hya_hfreeze.png
  64. BIN
      tasks/Hyakkiyakou/hya/hya_hinvite.png
  65. BIN
      tasks/Hyakkiyakou/hya/hya_hselected.png
  66. BIN
      tasks/Hyakkiyakou/hya/hya_hstart.png
  67. 56 0
      tasks/Hyakkiyakou/hya/image1.json
  68. 90 0
      tasks/Hyakkiyakou/prepare/get_images.py
  69. 161 2
      tasks/Hyakkiyakou/utils/exp_test.py
  70. 1 1
      tasks/Hyakkiyakou/utils/realm_raid_test.py
  71. BIN
      tasks/KekkaiActivation/a/a_a_harvest_fish_3.png
  72. BIN
      tasks/KekkaiActivation/a/a_aa_swipe_block.png
  73. 9 0
      tasks/KekkaiActivation/a/image.json
  74. 11 0
      tasks/KekkaiActivation/a/image2.json
  75. 7 0
      tasks/KekkaiActivation/assets.py
  76. 8 1
      tasks/KekkaiActivation/script_task.py
  77. 3 1
      tasks/KekkaiUtilize/assets.py
  78. 2 2
      tasks/KekkaiUtilize/realm/image.json
  79. BIN
      tasks/KekkaiUtilize/realm/realm_shi_card.png
  80. 11 2
      tasks/KekkaiUtilize/script_task.py
  81. 8 1
      tasks/KekkaiUtilize/utilize/swipe.json
  82. 5 1
      tasks/Nian/script_task.py
  83. 0 2
      tasks/Orochi/assets.py
  84. 0 9
      tasks/Orochi/o/image.json
  85. BIN
      tasks/Orochi/o/o_orochi_matching.png
  86. 2 2
      tasks/Orochi/script_task.py
  87. 49 3
      tasks/RealmRaid/script_task.py
  88. 8 4
      tasks/RichMan/assets.py
  89. BIN
      tasks/RichMan/guild/guild_guild_check_scrap.png
  90. 5 5
      tasks/RichMan/guild/image.json
  91. 3 3
      tasks/RichMan/mall/bondlings.py
  92. 5 1
      tasks/RichMan/shrine.py
  93. 18 0
      tasks/RichMan/shrine/image.json
  94. BIN
      tasks/RichMan/shrine/shrine_center1.png
  95. BIN
      tasks/RichMan/shrine/shrine_center2.png
  96. 38 5
      tasks/RichMan/thousand_things.py
  97. 6 3
      tasks/base_task.py

+ 1 - 1
.gitignore

@@ -33,7 +33,7 @@ module/config/argument/setting.json
 !dev_tools/Spyxx/spyxx_amd64.exe
 !dev_tools/Spyxx/spyxx_amd64.exe
 !dev_tools/ViewWizard2/ViewWizard2.exe
 !dev_tools/ViewWizard2/ViewWizard2.exe
 !dev_tools/ViewWizard3/ViewWizard.exe
 !dev_tools/ViewWizard3/ViewWizard.exe
-
+hya
 
 
 
 
 
 

+ 27 - 0
module/device/connection.py

@@ -218,6 +218,18 @@ class Connection(ConnectionAttr):
             result = remove_shell_warning(result)
             result = remove_shell_warning(result)
             # str
             # str
             return result
             return result
+    
+    def adb_getprop(self, name):
+        """
+        Get system property in Android, same as `getprop <name>`
+
+        Args:
+            name (str): Property name
+
+        Returns:
+            str:
+        """
+        return self.adb_shell(['getprop', name]).strip()
 
 
     @cached_property
     @cached_property
     def cpu_abi(self) -> str:
     def cpu_abi(self) -> str:
@@ -252,6 +264,21 @@ class Connection(ConnectionAttr):
         if 'goldfish' in self.adb_shell(['getprop', 'ro.hardware.audio.primary']):
         if 'goldfish' in self.adb_shell(['getprop', 'ro.hardware.audio.primary']):
             return True
             return True
         return False
         return False
+    
+    @cached_property
+    def nemud_app_keep_alive(self) -> str:
+        res = self.adb_getprop('nemud.app_keep_alive')
+        logger.attr('nemud.app_keep_alive', res)
+        return res
+    
+    @cached_property
+    def is_mumu_over_version_356(self) -> bool:
+        """
+        Returns:
+            bool: If MuMu12 version >= 3.5.6,
+                which has nemud.app_keep_alive and always be a vertical device
+        """
+        return self.nemud_app_keep_alive != ''
 
 
     @cached_property
     @cached_property
     def _nc_server_host_port(self):
     def _nc_server_host_port(self):

+ 5 - 4
module/device/method/uiautomator_2.py

@@ -245,7 +245,7 @@ class Uiautomator2(Connection):
         return hierarchy
         return hierarchy
 
 
     @retry
     @retry
-    def resolution_uiautomator2(self) -> t.Tuple[int, int]:
+    def resolution_uiautomator2(self, cal_rotation=True) -> t.Tuple[int, int]:
         """
         """
         Faster u2.window_size(), cause that calls `dumpsys display` twice.
         Faster u2.window_size(), cause that calls `dumpsys display` twice.
 
 
@@ -254,9 +254,10 @@ class Uiautomator2(Connection):
         """
         """
         info = self.u2.http.get('/info').json()
         info = self.u2.http.get('/info').json()
         w, h = info['display']['width'], info['display']['height']
         w, h = info['display']['width'], info['display']['height']
-        rotation = self.get_orientation()
-        if (w > h) != (rotation % 2 == 1):
-            w, h = h, w
+        if cal_rotation:
+            rotation = self.get_orientation()
+            if (w > h) != (rotation % 2 == 1):
+                w, h = h, w
         return w, h
         return w, h
 
 
     def resolution_check_uiautomator2(self):
     def resolution_check_uiautomator2(self):

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

BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_drum.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_lock.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_unlock.png


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

@@ -2,8 +2,8 @@
   {
   {
     "itemName": "shi",
     "itemName": "shi",
     "imageName": "as_shi.png",
     "imageName": "as_shi.png",
-    "roiFront": "427,337,82,120",
-    "roiBack": "64,265,1110,277",
+    "roiFront": "421,299,60,120",
+    "roiBack": "64,216,1110,326",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.7,
     "threshold": 0.7,
     "description": "进入活动"
     "description": "进入活动"
@@ -20,8 +20,8 @@
   {
   {
     "itemName": "battle",
     "itemName": "battle",
     "imageName": "as_battle.png",
     "imageName": "as_battle.png",
-    "roiFront": "111,176,35,165",
-    "roiBack": "74,148,105,220",
+    "roiFront": "883,291,35,165",
+    "roiBack": "840,218,138,315",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "进入爬塔"
     "description": "进入爬塔"
@@ -29,8 +29,8 @@
   {
   {
     "itemName": "drum",
     "itemName": "drum",
     "imageName": "as_drum.png",
     "imageName": "as_drum.png",
-    "roiFront": "1011,114,29,31",
-    "roiBack": "1011,114,29,31",
+    "roiFront": "885,310,29,145",
+    "roiBack": "860,244,87,232",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "归鹿之途"
     "description": "归鹿之途"
@@ -38,8 +38,8 @@
   {
   {
     "itemName": "lock",
     "itemName": "lock",
     "imageName": "as_lock.png",
     "imageName": "as_lock.png",
-    "roiFront": "666,597,25,32",
-    "roiBack": "666,597,25,32",
+    "roiFront": "816,655,25,32",
+    "roiBack": "816,655,25,32",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "上锁图标"
     "description": "上锁图标"
@@ -47,8 +47,8 @@
   {
   {
     "itemName": "unlock",
     "itemName": "unlock",
     "imageName": "as_unlock.png",
     "imageName": "as_unlock.png",
-    "roiFront": "665,597,28,28",
-    "roiBack": "665,597,28,28",
+    "roiFront": "813,656,28,28",
+    "roiBack": "813,656,28,28",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "还未上锁图片"
     "description": "还未上锁图片"
@@ -56,8 +56,8 @@
   {
   {
     "itemName": "fire",
     "itemName": "fire",
     "imageName": "as_fire.png",
     "imageName": "as_fire.png",
-    "roiFront": "983,547,107,62",
-    "roiBack": "983,547,107,62",
+    "roiFront": "1117,564,107,108",
+    "roiBack": "1117,564,107,108",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "点击战斗"
     "description": "点击战斗"

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

@@ -1,8 +1,8 @@
 [
 [
   {
   {
     "itemName": "remain_ap",
     "itemName": "remain_ap",
-    "roiFront": "1011,612,77,25",
-    "roiBack": "1011,612,77,25",
+    "roiFront": "1155,672,87,25",
+    "roiBack": "1155,672,87,25",
     "mode": "DigitCounter",
     "mode": "DigitCounter",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",

+ 7 - 7
tasks/ActivityShikigami/assets.py

@@ -34,19 +34,19 @@ class ActivityShikigamiAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 进入活动 
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(427,337,82,120), roi_back=(64,265,1110,277), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(421,299,60,120), roi_back=(64,216,1110,326), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
 	# 左上角返回 
 	I_BACK_GREEN = RuleImage(roi_front=(23,27,44,44), roi_back=(23,27,44,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	I_BACK_GREEN = RuleImage(roi_front=(23,27,44,44), roi_back=(23,27,44,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(111,176,35,165), roi_back=(74,148,105,220), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(883,291,35,165), roi_back=(840,218,138,315), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	# 归鹿之途 
-	I_DRUM = RuleImage(roi_front=(1011,114,29,31), roi_back=(1011,114,29,31), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
+	I_DRUM = RuleImage(roi_front=(885,310,29,145), roi_back=(860,244,87,232), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
 	# 上锁图标 
-	I_LOCK = RuleImage(roi_front=(666,597,25,32), roi_back=(666,597,25,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
+	I_LOCK = RuleImage(roi_front=(816,655,25,32), roi_back=(816,655,25,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
 	# 还未上锁图片 
-	I_UNLOCK = RuleImage(roi_front=(665,597,28,28), roi_back=(665,597,28,28), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
+	I_UNLOCK = RuleImage(roi_front=(813,656,28,28), roi_back=(813,656,28,28), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
 	# 点击战斗 
-	I_FIRE = RuleImage(roi_front=(983,547,107,62), roi_back=(983,547,107,62), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
+	I_FIRE = RuleImage(roi_front=(1117,564,107,108), roi_back=(1117,564,107,108), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
 	# 体力按钮 
 	I_AP = RuleImage(roi_front=(984,474,29,26), roi_back=(984,474,29,26), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	I_AP = RuleImage(roi_front=(984,474,29,26), roi_back=(984,474,29,26), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
 	# 活动体力 
@@ -63,7 +63,7 @@ class ActivityShikigamiAssets:
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets
 	# 体力的数量检测 
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(1011,612,77,25), area=(1011,612,77,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1155,672,87,25), area=(1155,672,87,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	# 活动体力的剩余检测 
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(1062,13,95,30), area=(1062,13,95,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(1062,13,95,30), area=(1062,13,95,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 
 	# 还有多少次购买体力的机会 

+ 55 - 54
tasks/ActivityShikigami/script_task.py

@@ -178,60 +178,61 @@ class ScriptTask(GameUi, BaseActivity, ActivityShikigamiAssets):
         :param current_ap:
         :param current_ap:
         :return:
         :return:
         """
         """
-        if current_ap == ApMode.AP_ACTIVITY:
-            logger.info("Select activity ap")
-            while 1:
-                self.screenshot()
-                if self.appear(self.I_AP_ACTIVITY):
-                    break
-                if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
-                    continue
-                if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
-                    continue
-                if self.appear(self.I_AP, interval=1):
-                    self.appear_then_click(self.I_SWITCH, interval=2)  # 点击切换
-        else:
-            logger.info("Select game ap")
-            while 1:
-                self.screenshot()
-                if self.appear(self.I_AP):
-                    break
-                if self.appear(self.I_AP_ACTIVITY, interval=1):
-                    self.appear_then_click(self.I_SWITCH, interval=2)
-
-    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-        # 重写
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.device.click_record_clear()
-        logger.info("Start battle process")
-        self.C_RANDOM_LEFT.name = "BATTLE_RANDOM"
-        self.C_RANDOM_RIGHT.name = "BATTLE_RANDOM"
-        self.C_RANDOM_TOP.name = "BATTLE_RANDOM"
-        self.C_RANDOM_BOTTOM.name = "BATTLE_RANDOM"
-        while 1:
-            self.screenshot()
-            # 如果出现了 “获得奖励”
-            reward_click = random.choice([self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP, self.C_RANDOM_BOTTOM])
-            if self.appear_then_click(self.I_UI_REWARD, action=reward_click, interval=1.3):
-                continue
-            # 如果出现了 “鼓”
-            if self.appear(self.I_WIN):
-                logger.info("Win")
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_WIN):
-                        break
-                    if self.appear_then_click(self.I_WIN, action=self.C_RANDOM_ALL, interval=1.1):
-                        continue
-                return True
-            # 失败 -> 正常人不会失败
-            if self.appear(self.I_FALSE):
-                logger.warning('False battle')
-                self.ui_click_until_disappear(self.I_FALSE)
-                return False
-            # 如果开启战斗过程随机滑动
-            if random_click_swipt_enable:
-                self.random_click_swipt()
+        pass
+        # if current_ap == ApMode.AP_ACTIVITY:
+        #     logger.info("Select activity ap")
+        #     while 1:
+        #         self.screenshot()
+        #         if self.appear(self.I_AP_ACTIVITY):
+        #             break
+        #         if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
+        #             continue
+        #         if self.appear_then_click(self.I_UI_CONFIRM, interval=1):
+        #             continue
+        #         if self.appear(self.I_AP, interval=1):
+        #             self.appear_then_click(self.I_SWITCH, interval=2)  # 点击切换
+        # else:
+        #     logger.info("Select game ap")
+        #     while 1:
+        #         self.screenshot()
+        #         if self.appear(self.I_AP):
+        #             break
+        #         if self.appear(self.I_AP_ACTIVITY, interval=1):
+        #             self.appear_then_click(self.I_SWITCH, interval=2)
+
+    # def battle_wait(self, random_click_swipt_enable: bool) -> bool:
+    #     # 重写
+    #     self.device.stuck_record_add('BATTLE_STATUS_S')
+    #     self.device.click_record_clear()
+    #     logger.info("Start battle process")
+    #     self.C_RANDOM_LEFT.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_RIGHT.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_TOP.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_BOTTOM.name = "BATTLE_RANDOM"
+    #     while 1:
+    #         self.screenshot()
+    #         # 如果出现了 “获得奖励”
+    #         reward_click = random.choice([self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP, self.C_RANDOM_BOTTOM])
+    #         if self.appear_then_click(self.I_UI_REWARD, action=reward_click, interval=1.3):
+    #             continue
+    #         # 如果出现了 “鼓”
+    #         if self.appear(self.I_WIN):
+    #             logger.info("Win")
+    #             while 1:
+    #                 self.screenshot()
+    #                 if not self.appear(self.I_WIN):
+    #                     break
+    #                 if self.appear_then_click(self.I_WIN, action=self.C_RANDOM_ALL, interval=1.1):
+    #                     continue
+    #             return True
+    #         # 失败 -> 正常人不会失败
+    #         if self.appear(self.I_FALSE):
+    #             logger.warning('False battle')
+    #             self.ui_click_until_disappear(self.I_FALSE)
+    #             return False
+    #         # 如果开启战斗过程随机滑动
+    #         if random_click_swipt_enable:
+    #             self.random_click_swipt()
 
 
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':

+ 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


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

@@ -51,8 +51,8 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
                 if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
                 if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
                     occur_prepare_button = True
                     occur_prepare_button = True
                     continue
                     continue
-                if occur_prepare_button and self.ocr_appear_click(self.O_BATTLE_PREPARE, interval=2):
-                    continue
+                # if occur_prepare_button and self.ocr_appear_click(self.O_BATTLE_PREPARE, interval=2):
+                #     continue
             logger.info("Click prepare ensure button")
             logger.info("Click prepare ensure button")
 
 
             # 照顾一下某些模拟器慢的
             # 照顾一下某些模拟器慢的

+ 17 - 9
tasks/Component/GeneralBuff/general_buff.py

@@ -90,7 +90,7 @@ class GeneralBuff(BaseTask, GeneralBuffAssets):
         self.screenshot()
         self.screenshot()
         area = self.get_area(self.device.image, self.O_GOLD_50)
         area = self.get_area(self.device.image, self.O_GOLD_50)
         if not area:
         if not area:
-            logger.warning('No gold 100 buff')
+            logger.warning('No gold 50 buff')
             return None
             return None
         self.I_OPEN_YELLOW.roi_back = list(area)  # 动态设置roi
         self.I_OPEN_YELLOW.roi_back = list(area)  # 动态设置roi
         self.I_CLOSE_RED.roi_back = list(area)
         self.I_CLOSE_RED.roi_back = list(area)
@@ -145,13 +145,21 @@ class GeneralBuff(BaseTask, GeneralBuffAssets):
         :return:
         :return:
         """
         """
         logger.info('Exp 50 buff')
         logger.info('Exp 50 buff')
-        self.screenshot()
-        area = self.get_area(self.device.image, self.O_EXP_50)
-        if not area:
-            logger.warning('No gold 100 buff')
-            return None
-        self.I_OPEN_YELLOW.roi_back = list(area)
-        self.I_CLOSE_RED.roi_back = list(area)
+        while 1:
+            self.screenshot()
+            area = self.get_area(self.device.image, self.O_EXP_50)
+            if not area:
+                logger.warning('No exp 50 buff')
+                continue
+            self.set_switch_area(area)
+
+            if not self.appear(self.I_OPEN_YELLOW) and not self.appear(self.I_CLOSE_RED):
+                logger.info('No exp 50 buff')
+                self.device.swipe(p2=(530, 240), p1=(580, 320))
+                time.sleep(1)
+            else:
+                break
+
         if is_open:
         if is_open:
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
@@ -178,7 +186,7 @@ class GeneralBuff(BaseTask, GeneralBuffAssets):
             self.screenshot()
             self.screenshot()
             area = self.get_area(self.device.image, self.O_EXP_100)
             area = self.get_area(self.device.image, self.O_EXP_100)
             if not area:
             if not area:
-                logger.warning('No gold 100 buff')
+                logger.warning('No exp 100 buff')
                 continue
                 continue
             self.set_switch_area(area)
             self.set_switch_area(area)
 
 

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

@@ -91,9 +91,9 @@ class GeneralInviteAssets:
 	# description 
 	# description 
 	I_GI_EMOJI_1 = RuleImage(roi_front=(27,526,55,51), roi_back=(27,526,55,51), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png")
 	I_GI_EMOJI_1 = RuleImage(roi_front=(27,526,55,51), roi_back=(27,526,55,51), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png")
 	# description 
 	# description 
-	I_GI_EMOJI_2 = RuleImage(roi_front=(21,632,53,64), roi_back=(21,632,53,64), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.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_emoji_2.png


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


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

@@ -10,9 +10,9 @@
   },
   },
   {
   {
     "itemName": "gi_emoji_2",
     "itemName": "gi_emoji_2",
-    "imageName": "gi_gi_emoji_2.png",
-    "roiFront": "21,632,53,64",
-    "roiBack": "21,632,53,64",
+    "imageName": "gi_gi_emoji_1.png",
+    "roiFront": "27,622,55,51",
+    "roiBack": "27,622,55,51",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
@@ -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": "判断是不是在庭院界面"

+ 0 - 2
tasks/Component/GeneralRoom/assets.py

@@ -37,8 +37,6 @@ class GeneralRoomAssets:
 	# description 
 	# description 
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	I_CREATE_ENSURE_2 = RuleImage(roi_front=(552,489,42,55), roi_back=(552,489,42,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_create_ensure_2.png")
 	# description 
 	# description 
-	I_GR_MATCHING_NEW = RuleImage(roi_front=(62,571,42,121), roi_back=(62,571,42,121), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png")
-	# description 
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 	I_GR_BACK_YELLOW = RuleImage(roi_front=(19,13,53,53), roi_back=(19,13,53,53), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_back_yellow.png")
 	# 自动匹配 
 	# 自动匹配 
 	I_GR_AUTO_MATCH = RuleImage(roi_front=(697,598,181,63), roi_back=(697,598,181,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_auto_match.png")
 	I_GR_AUTO_MATCH = RuleImage(roi_front=(697,598,181,63), roi_back=(697,598,181,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralRoom/gr/gr_gr_auto_match.png")

+ 2 - 2
tasks/Component/GeneralRoom/general_room.py

@@ -105,11 +105,11 @@ class GeneralRoom(BaseTask, GeneralRoomAssets):
         在组队界面 退出组队的界面, 返回到庭院或者是你一开始进入的入口
         在组队界面 退出组队的界面, 返回到庭院或者是你一开始进入的入口
         :return:
         :return:
         """
         """
-        if self.appear(self.I_GR_MATCHING_NEW):
+        if self.appear(self.I_CHECK_TEAM):
             logger.info('Exit team ui')
             logger.info('Exit team ui')
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
-                if not self.appear(self.I_GR_MATCHING_NEW):
+                if not self.appear(self.I_CHECK_TEAM):
                     return True
                     return True
                 if self.appear_then_click(self.I_GR_BACK_YELLOW, interval=0.5):
                 if self.appear_then_click(self.I_GR_BACK_YELLOW, interval=0.5):
                     continue
                     continue

BIN
tasks/Component/GeneralRoom/gr/gr_gr_matching_new.png


+ 0 - 9
tasks/Component/GeneralRoom/gr/image.json

@@ -62,15 +62,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
-  {
-    "itemName": "gr_matching_new",
-    "imageName": "gr_gr_matching_new.png",
-    "roiFront": "62,571,42,121",
-    "roiBack": "62,571,42,121",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "gr_back_yellow",
     "itemName": "gr_back_yellow",
     "imageName": "gr_gr_back_yellow.png",
     "imageName": "gr_gr_back_yellow.png",

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

+ 3 - 3
tasks/Component/Summon/assets.py

@@ -12,9 +12,9 @@ class SummonAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 点击蓝票 
 	# 点击蓝票 
-	I_BLUE_TICKET = RuleImage(roi_front=(533,594,65,76), roi_back=(533,594,65,76), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_blue_ticket.png")
+	I_BLUE_TICKET = RuleImage(roi_front=(595,586,65,76), roi_back=(523,563,211,111), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_blue_ticket.png")
 	# 点击厕所票 
 	# 点击厕所票 
-	I_LOW_TICKET = RuleImage(roi_front=(403,600,63,65), roi_back=(403,600,63,65), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_low_ticket.png")
+	I_LOW_TICKET = RuleImage(roi_front=(436,605,63,65), roi_back=(378,577,157,99), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_low_ticket.png")
 	# 单抽 
 	# 单抽 
 	I_ONE_TICKET = RuleImage(roi_front=(396,599,76,76), roi_back=(396,599,76,76), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_one_ticket.png")
 	I_ONE_TICKET = RuleImage(roi_front=(396,599,76,76), roi_back=(396,599,76,76), threshold=0.8, method="Template matching", file="./tasks/Component/Summon/sm/sm_one_ticket.png")
 	# description 
 	# description 
@@ -25,7 +25,7 @@ class SummonAssets:
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets
 	# Ocr-description 
 	# Ocr-description 
-	O_ONE_TICKET = RuleOcr(roi=(514,682,100,32), area=(514,682,100,32), mode="Single", method="Default", keyword="", name="one_ticket")
+	O_ONE_TICKET = RuleOcr(roi=(574,681,100,32), area=(574,681,100,32), mode="Single", method="Default", keyword="", name="one_ticket")
 
 
 
 
 	# Swipe Rule Assets
 	# Swipe Rule Assets

+ 4 - 4
tasks/Component/Summon/sm/image.json

@@ -2,8 +2,8 @@
   {
   {
     "itemName": "blue_ticket",
     "itemName": "blue_ticket",
     "imageName": "sm_blue_ticket.png",
     "imageName": "sm_blue_ticket.png",
-    "roiFront": "533,594,65,76",
-    "roiBack": "533,594,65,76",
+    "roiFront": "595,586,65,76",
+    "roiBack": "523,563,211,111",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "点击蓝票"
     "description": "点击蓝票"
@@ -11,8 +11,8 @@
   {
   {
     "itemName": "low_ticket",
     "itemName": "low_ticket",
     "imageName": "sm_low_ticket.png",
     "imageName": "sm_low_ticket.png",
-    "roiFront": "403,600,63,65",
-    "roiBack": "403,600,63,65",
+    "roiFront": "436,605,63,65",
+    "roiBack": "378,577,157,99",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "点击厕所票"
     "description": "点击厕所票"

+ 2 - 2
tasks/Component/Summon/sm/ocr.json

@@ -1,8 +1,8 @@
 [
 [
   {
   {
     "itemName": "one_ticket",
     "itemName": "one_ticket",
-    "roiFront": "514,682,100,32",
-    "roiBack": "514,682,100,32",
+    "roiFront": "574,681,100,32",
+    "roiBack": "574,681,100,32",
     "mode": "Single",
     "mode": "Single",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",

+ 2 - 1
tasks/DailyTrifles/script_task.py

@@ -108,5 +108,6 @@ if __name__ == '__main__':
     d = Device(c)
     d = Device(c)
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)
 
 
-    t.run()
+    # t.run_one_summon()
+    t.run_store_sign()
 
 

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

+ 0 - 2
tasks/EvoZone/assets.py

@@ -23,8 +23,6 @@ class EvoZoneAssets:
 	I_EVOZONE_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/EvoZone/o/o_evozone_fire.png")
 	I_EVOZONE_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/EvoZone/o/o_evozone_fire.png")
 	# 式神录 
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_shi_records.png")
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_shi_records.png")
-	# description 
-	I_EVOZONE_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_evozone_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/EvoZone/o/o_pet_present.png")
 	# 风麒麟进入 
 	# 风麒麟进入 

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

+ 0 - 9
tasks/EvoZone/o/image.json

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "式神录"
     "description": "式神录"
   },
   },
-  {
-    "itemName": "evozone_matching",
-    "imageName": "o_evozone_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "o_pet_present.png",
     "imageName": "o_pet_present.png",

BIN
tasks/EvoZone/o/o_evozone_matching.png


+ 27 - 41
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()
@@ -136,7 +138,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_EVOZONE_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue
@@ -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
-
-
-
-
-
-
-
-

+ 2 - 0
tasks/Exploration/config.py

@@ -63,6 +63,8 @@ class ChooseRarity(str, Enum):
 class ExplorationConfig(BaseModel):
 class ExplorationConfig(BaseModel):
     buff_gold_50_click: bool = Field(default=False)
     buff_gold_50_click: bool = Field(default=False)
     buff_gold_100_click: bool = Field(default=False)
     buff_gold_100_click: bool = Field(default=False)
+    buff_exp_50_click: bool = Field(default=False)
+    buff_exp_100_click: bool = Field(default=False)
 
 
     attack_number: AttackNumber = Field(title='探索次数', default=AttackNumber.SEVEN,
     attack_number: AttackNumber = Field(title='探索次数', default=AttackNumber.SEVEN,
                                         description='默认探索7次')
                                         description='默认探索7次')

+ 14 - 2
tasks/Exploration/script_task.py

@@ -40,7 +40,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
 
 
         # 开启加成
         # 开启加成
         con = self.config.exploration.exploration_config
         con = self.config.exploration.exploration_config
-        if con.buff_gold_50_click or con.buff_gold_100_click:
+        if con.buff_gold_50_click or con.buff_gold_100_click or con.buff_exp_50_click or con.buff_exp_100_click:
             self.ui_get_current_page()
             self.ui_get_current_page()
             self.ui_goto(page_main)
             self.ui_goto(page_main)
             self.open_buff()
             self.open_buff()
@@ -48,6 +48,10 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
                 self.gold_50()
                 self.gold_50()
             if con.buff_gold_100_click:
             if con.buff_gold_100_click:
                 self.gold_100()
                 self.gold_100()
+            if con.buff_exp_50_click:
+                self.exp_50()
+            if con.buff_exp_100_click:
+                self.exp_100()
             self.close_buff()
             self.close_buff()
 
 
         self.ui_get_current_page()
         self.ui_get_current_page()
@@ -77,6 +81,14 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
             if self.wait_until_appear(self.I_RED_CLOSE, wait_time=2):
             if self.wait_until_appear(self.I_RED_CLOSE, wait_time=2):
                 self.appear_then_click(self.I_RED_CLOSE)
                 self.appear_then_click(self.I_RED_CLOSE)
             self.ui_goto(page_main)
             self.ui_goto(page_main)
+            # 关闭 buff
+            if con.buff_gold_50_click or con.buff_gold_100_click or con.buff_exp_50_click or con.buff_exp_100_click:
+                self.open_buff()
+                self.gold_50(is_open=False)
+                self.gold_100(is_open=False)
+                self.exp_50(is_open=False)
+                self.exp_100(is_open=False)
+                self.close_buff()
             self.set_next_run(task='Exploration', success=True, finish=False)
             self.set_next_run(task='Exploration', success=True, finish=False)
         raise TaskEnd
         raise TaskEnd
 
 
@@ -246,7 +258,7 @@ 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
 
 
-    config = Config('oas2')
+    config = Config('oas1')
     device = Device(config)
     device = Device(config)
     t = ScriptTask(config, device)
     t = ScriptTask(config, device)
     t.config.exploration.exploration_config.exploration_level = '第二十八章'
     t.config.exploration.exploration_config.exploration_level = '第二十八章'

+ 0 - 2
tasks/FallenSun/assets.py

@@ -21,8 +21,6 @@ class FallenSunAssets:
 	I_FALLEN_SUN_UNLOCK = RuleImage(roi_front=(557,560,31,38), roi_back=(557,560,31,38), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_unlock.png")
 	I_FALLEN_SUN_UNLOCK = RuleImage(roi_front=(557,560,31,38), roi_back=(557,560,31,38), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_unlock.png")
 	# description 
 	# description 
 	I_FALLEN_SUN_LOCK = RuleImage(roi_front=(557,561,31,37), roi_back=(557,561,31,37), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_lock.png")
 	I_FALLEN_SUN_LOCK = RuleImage(roi_front=(557,561,31,37), roi_back=(557,561,31,37), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_lock.png")
-	# description 
-	I_FALLEN_SUN_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_fallen_sun_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/FallenSun/f/f_pet_present.png")
 
 

BIN
tasks/FallenSun/f/f_fallen_sun_matching.png


+ 0 - 9
tasks/FallenSun/f/image.json

@@ -44,15 +44,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
   },
   },
-  {
-    "itemName": "fallen_sun_matching",
-    "imageName": "f_fallen_sun_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "f_pet_present.png",
     "imageName": "f_pet_present.png",

+ 1 - 1
tasks/FallenSun/script_task.py

@@ -114,7 +114,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_FALLEN_SUN_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue

+ 7 - 1
tasks/GameUi/assets.py

@@ -117,6 +117,12 @@ class GameUiAssets:
 	I_BACK_YOLLOW = RuleImage(roi_front=(24,16,48,55), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_yollow.png")
 	I_BACK_YOLLOW = RuleImage(roi_front=(24,16,48,55), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_back_yollow.png")
 	# description 
 	# description 
 	I_DEMON_ENCOUNTER_GOTO_TOWN = RuleImage(roi_front=(28,20,56,52), roi_back=(3,4,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_demon_encounter_goto_town.png")
 	I_DEMON_ENCOUNTER_GOTO_TOWN = RuleImage(roi_front=(28,20,56,52), roi_back=(3,4,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_demon_encounter_goto_town.png")
+	# description 
+	I_TOWN_GOTO_HYAKKIYAKOU = RuleImage(roi_front=(880,165,53,69), roi_back=(827,149,148,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_hyakkiyakou.png")
+	# description 
+	I_CHECK_KYAKKIYAKOU = RuleImage(roi_front=(305,567,56,64), roi_back=(280,545,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_kyakkiyakou.png")
+	# description 
+	I_HYAKKIYAKOU_CLOSE = RuleImage(roi_front=(1063,181,47,43), roi_back=(1063,181,47,43), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_hyakkiyakou_close.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets
@@ -149,7 +155,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_CHECK_GUILD = RuleImage(roi_front=(1072,630,49,46), roi_back=(1072,630,49,46), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_guild.png")
 	I_CHECK_GUILD = RuleImage(roi_front=(1072,630,49,46), roi_back=(1072,630,49,46), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_guild.png")
 	# description 
 	# description 
-	I_CHECK_TEAM = RuleImage(roi_front=(53,570,41,119), roi_back=(53,570,41,119), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_team.png")
+	I_CHECK_TEAM = RuleImage(roi_front=(32,585,82,90), roi_back=(32,585,82,90), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_team.png")
 	# description 
 	# description 
 	I_CHECK_COLLECTION = RuleImage(roi_front=(471,618,100,100), roi_back=(471,618,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
 	I_CHECK_COLLECTION = RuleImage(roi_front=(471,618,100,100), roi_back=(471,618,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_collection.png")
 	# description 
 	# description 

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

+ 5 - 1
tasks/GameUi/page.py

@@ -116,6 +116,10 @@ page_town.link(button=G.I_TOWN_GOTO_DRAFT_DUEL, destination=page_draft_duel)
 page_hyakkisen = Page(G.I_CHECK_HYAKKISEN)
 page_hyakkisen = Page(G.I_CHECK_HYAKKISEN)
 page_hyakkisen.link(button=G.I_BACK_YOLLOW, destination=page_town)
 page_hyakkisen.link(button=G.I_BACK_YOLLOW, destination=page_town)
 page_town.link(button=G.I_TOWN_GOTO_HYAKKISEN, destination=page_hyakkisen)
 page_town.link(button=G.I_TOWN_GOTO_HYAKKISEN, destination=page_hyakkisen)
+# 百鬼夜行
+page_hyakkiyakou = Page(G.I_CHECK_KYAKKIYAKOU)
+page_hyakkiyakou.link(button=G.I_HYAKKIYAKOU_CLOSE, destination=page_town)
+page_town.link(button=G.I_TOWN_GOTO_HYAKKIYAKOU, destination=page_hyakkiyakou)
 
 
 
 
 # ************************************* 庭院部分 *****************************************#
 # ************************************* 庭院部分 *****************************************#
@@ -139,7 +143,7 @@ page_daily.link(button=G.I_BACK_Y, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
 page_main.link(button=G.I_MAIN_GOTO_DAILY, destination=page_daily)
 # 商店 mall
 # 商店 mall
 page_mall = Page(G.I_CHECK_MALL)
 page_mall = Page(G.I_CHECK_MALL)
-page_mall.additional = [G.I_AD_CLOSE_RED]
+page_mall.additional = [G.I_AD_CLOSE_RED, G.I_BACK_Y]
 page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
 page_mall.link(button=G.I_BACK_BLUE, destination=page_main)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 page_main.link(button=G.I_MAIN_GOTO_MALL, destination=page_mall)
 # 阴阳寮 guild
 # 阴阳寮 guild

BIN
tasks/GameUi/page/page_check_kyakkiyakou.png


BIN
tasks/GameUi/page/page_check_team.png


BIN
tasks/GameUi/page/page_hyakkiyakou_close.png


+ 27 - 0
tasks/GameUi/page/page_img_2.json

@@ -133,5 +133,32 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
+  },
+  {
+    "itemName": "town_goto_hyakkiyakou",
+    "imageName": "page_town_goto_hyakkiyakou.png",
+    "roiFront": "880,165,53,69",
+    "roiBack": "827,149,148,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "check_kyakkiyakou",
+    "imageName": "page_check_kyakkiyakou.png",
+    "roiFront": "305,567,56,64",
+    "roiBack": "280,545,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "hyakkiyakou_close",
+    "imageName": "page_hyakkiyakou_close.png",
+    "roiFront": "1063,181,47,43",
+    "roiBack": "1063,181,47,43",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
   }
 ]
 ]

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

@@ -128,8 +128,8 @@
   {
   {
     "itemName": "check_team",
     "itemName": "check_team",
     "imageName": "page_check_team.png",
     "imageName": "page_check_team.png",
-    "roiFront": "53,570,41,119",
-    "roiBack": "53,570,41,119",
+    "roiFront": "32,585,82,90",
+    "roiBack": "32,585,82,90",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"

BIN
tasks/GameUi/page/page_town_goto_hyakkiyakou.png


+ 0 - 0
tasks/GlobalGame/gg/gg_jade.png → tasks/GlobalGame/gg/gg_g_jade.png


+ 24 - 0
tasks/Hyakkiyakou/assets.py

@@ -10,6 +10,30 @@ from module.atom.list import RuleList
 class HyakkiyakouAssets: 
 class HyakkiyakouAssets: 
 
 
 
 
+	# Click Rule Assets
+	# description 
+	C_HSELECT_1 = RuleClick(roi_front=(158,209,225,405), roi_back=(158,209,225,405), name="hselect_1")
+	# description 
+	C_HSELECT_2 = RuleClick(roi_front=(531,225,202,363), roi_back=(531,225,202,363), name="hselect_2")
+	# description 
+	C_HSELECT_3 = RuleClick(roi_front=(875,210,219,394), roi_back=(875,210,219,394), name="hselect_3")
+
+
+	# Image Rule Assets
+	# 邀请按钮 
+	I_HINVITE = RuleImage(roi_front=(139,569,63,60), roi_back=(139,569,63,60), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hinvite.png")
+	# 进入 
+	I_HACCESS = RuleImage(roi_front=(1059,554,100,100), roi_back=(1059,554,100,100), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_haccess.png")
+	# 开始 
+	I_HSTART = RuleImage(roi_front=(1119,555,100,100), roi_back=(1119,555,100,100), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hstart.png")
+	# 押注 
+	I_HSELECTED = RuleImage(roi_front=(980,265,41,44), roi_back=(226,53,836,348), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hselected.png")
+	# 结束 
+	I_HEND = RuleImage(roi_front=(81,164,86,299), roi_back=(81,164,86,299), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hend.png")
+	# 冰冻 
+	I_HFREEZE = RuleImage(roi_front=(1092,665,187,54), roi_back=(1092,665,187,54), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hfreeze.png")
+
+
 	# Click Rule Assets
 	# Click Rule Assets
 	# description 
 	# description 
 	C_CLICK = RuleClick(roi_front=(26,250,33,100), roi_back=(26,250,33,100), name="click")
 	C_CLICK = RuleClick(roi_front=(26,250,33,100), roi_back=(26,250,33,100), name="click")

+ 20 - 0
tasks/Hyakkiyakou/hya/click.json

@@ -0,0 +1,20 @@
+[
+  {
+    "itemName": "hselect_1",
+    "roiFront": "158,209,225,405",
+    "roiBack": "158,209,225,405",
+    "description": "description"
+  },
+  {
+    "itemName": "hselect_2",
+    "roiFront": "531,225,202,363",
+    "roiBack": "531,225,202,363",
+    "description": "description"
+  },
+  {
+    "itemName": "hselect_3",
+    "roiFront": "875,210,219,394",
+    "roiBack": "875,210,219,394",
+    "description": "description"
+  }
+]

BIN
tasks/Hyakkiyakou/hya/hya_haccess.png


BIN
tasks/Hyakkiyakou/hya/hya_hend.png


BIN
tasks/Hyakkiyakou/hya/hya_hfreeze.png


BIN
tasks/Hyakkiyakou/hya/hya_hinvite.png


BIN
tasks/Hyakkiyakou/hya/hya_hselected.png


BIN
tasks/Hyakkiyakou/hya/hya_hstart.png


+ 56 - 0
tasks/Hyakkiyakou/hya/image1.json

@@ -0,0 +1,56 @@
+[
+  {
+    "itemName": "hinvite",
+    "imageName": "hya_hinvite.png",
+    "roiFront": "139,569,63,60",
+    "roiBack": "139,569,63,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "邀请按钮"
+  },
+  {
+    "itemName": "haccess",
+    "imageName": "hya_haccess.png",
+    "roiFront": "1059,554,100,100",
+    "roiBack": "1059,554,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入"
+  },
+  {
+    "itemName": "hstart",
+    "imageName": "hya_hstart.png",
+    "roiFront": "1119,555,100,100",
+    "roiBack": "1119,555,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "开始"
+  },
+  {
+    "itemName": "hselected",
+    "imageName": "hya_hselected.png",
+    "roiFront": "980,265,41,44",
+    "roiBack": "226,53,836,348",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "押注"
+  },
+  {
+    "itemName": "hend",
+    "imageName": "hya_hend.png",
+    "roiFront": "81,164,86,299",
+    "roiBack": "81,164,86,299",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "结束"
+  },
+  {
+    "itemName": "hfreeze",
+    "imageName": "hya_hfreeze.png",
+    "roiFront": "1092,665,187,54",
+    "roiBack": "1092,665,187,54",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "冰冻"
+  }
+]

+ 90 - 0
tasks/Hyakkiyakou/prepare/get_images.py

@@ -0,0 +1,90 @@
+import cv2
+import time
+from datetime import timedelta, datetime
+from cached_property import cached_property
+from random import choice
+from pathlib import Path
+
+from module.exception import TaskEnd
+from module.logger import logger
+from module.base.timer import Timer
+
+from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_hyakkiyakou
+from tasks.Hyakkiyakou.assets import HyakkiyakouAssets
+
+
+class GenerateImages(GameUi, HyakkiyakouAssets):
+    @cached_property
+    def save_folder(self) -> Path:
+        save_time = datetime.now().strftime('%Y%m%dT%H%M%S')
+        save_folder = Path(f'./tasks/Hyakkiyakou/temp/{save_time}')
+        save_folder.mkdir(parents=True, exist_ok=True)
+        return save_folder
+
+    def run(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_hyakkiyakou)
+        for i in range(40):
+            self.save_one()
+
+    def save_one(self):
+        """
+        生成一次票的截图
+        @return:
+        """
+        if not self.appear(self.I_HACCESS):
+            logger.warning('Page Error')
+        self.ui_click(self.I_HACCESS, self.I_HSTART, interval=2)
+        # 随机选一个
+        click_button = choice([self.C_HSELECT_1, self.C_HSELECT_2, self.C_HSELECT_3])
+        while 1:
+            self.screenshot()
+
+            if self.appear(self.I_CHECK_RUN):
+                break
+            if self.appear_then_click(self.I_HSTART, interval=2):
+                continue
+            if not self.appear(self.I_HSELECTED):
+                self.click(click_button, interval=1)
+        self.device.stuck_record_add('BATTLE_STATUS_S')
+        # 保存图片
+        save_img_timer = Timer(0.2)
+        save_img_timer.start()
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_HEND):
+                logger.info('Generate a time Images Success')
+                break
+            if not self.appear(self.I_CHECK_RUN):
+                continue
+            if self.appear(self.I_HFREEZE):
+                continue
+            if save_img_timer.reached():
+                save_img_timer.reset()
+                self.save_image()
+        self.ui_click(self.I_HEND, self.I_HACCESS)
+
+    def save_image(self, image=None):
+        if image is None:
+            image = self.device.image
+        img1 = image[80:, :640]
+        img2 = image[80:, 640:]
+        # 时间戳毫秒级别
+        time_now1 = int(time.time() * 1000)
+        time_now2 = time_now1 + 1
+        cv2.imwrite(str(self.save_folder / f'{time_now1}.png'), img1)
+        cv2.imwrite(str(self.save_folder / f'{time_now2}.png'), img2)
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    t = GenerateImages(c, d)
+    t.screenshot()
+
+    t.run()
+
+

+ 161 - 2
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()
@@ -271,7 +272,7 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
     def run_exp_27(self):
     def run_exp_27(self):
         pos_right = 1270
         pos_right = 1270
         pos_left = 260
         pos_left = 260
-        pos_top = 510
+        pos_top = 550
         pos_bottom = 620
         pos_bottom = 620
         pos_level = (pos_top + pos_bottom) / 2
         pos_level = (pos_top + pos_bottom) / 2
         step_1 = Step('step_1', pos=(pos_right, random.randint(pos_top, pos_bottom)), time=2.1)
         step_1 = Step('step_1', pos=(pos_right, random.randint(pos_top, pos_bottom)), time=2.1)
@@ -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


BIN
tasks/KekkaiActivation/a/a_aa_swipe_block.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"
   }
   }
 ]
 ]

+ 11 - 0
tasks/KekkaiActivation/a/image2.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "aa_swipe_block",
+    "imageName": "a_aa_swipe_block.png",
+    "roiFront": "124,622,35,32",
+    "roiBack": "117,612,50,51",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "用于判断是否滑到底了"
+  }
+]

+ 7 - 0
tasks/KekkaiActivation/assets.py

@@ -74,6 +74,13 @@ 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
+	# 用于判断是否滑到底了 
+	I_AA_SWIPE_BLOCK = RuleImage(roi_front=(124,622,35,32), roi_back=(117,612,50,51), threshold=0.9, method="Template matching", file="./tasks/KekkaiActivation/a/a_aa_swipe_block.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 8 - 1
tasks/KekkaiActivation/script_task.py

@@ -277,8 +277,12 @@ class ScriptTask(KU, KekkaiActivationAssets):
             elif current_best == self.order_cards[1]:
             elif current_best == self.order_cards[1]:
                 break
                 break
 
 
+            # 滑到底就退出
+            if self.appear(self.I_AA_SWIPE_BLOCK):
+                logger.warning('Swipe to the end but no card is found')
+                break
             # 超过十次就退出
             # 超过十次就退出
-            if swipe_count > 20:
+            if swipe_count > 15:
                 logger.warning('Swipe count is more than 10')
                 logger.warning('Swipe count is more than 10')
                 break
                 break
             # 一直向下滑动
             # 一直向下滑动
@@ -349,6 +353,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 +380,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

+ 3 - 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")
 	# 收取经验(没有满的图) 
 	# 收取经验(没有满的图) 
@@ -122,5 +122,7 @@ class KekkaiUtilizeAssets:
 	# Swipe Rule Assets
 	# Swipe Rule Assets
 	# 向下滑动 
 	# 向下滑动 
 	S_U_UP = RuleSwipe(roi_front=(235,419,50,21), roi_back=(225,177,72,21), mode="default", name="u_up")
 	S_U_UP = RuleSwipe(roi_front=(235,419,50,21), roi_back=(225,177,72,21), mode="default", name="u_up")
+	# 滑动到底部 
+	S_U_END = RuleSwipe(roi_front=(175,179,26,26), roi_back=(164,518,49,102), mode="default", name="u_end")
 
 
 
 

+ 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


+ 11 - 2
tasks/KekkaiUtilize/script_task.py

@@ -26,8 +26,8 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_guild)
         self.ui_goto(page_guild)
         # 收体力或者资金
         # 收体力或者资金
-        # 进入寮主页会有一个动画,等一等
-        time.sleep(1)
+        # 进入寮主页会有一个动画,等一等,让小纸人跑一会儿
+        time.sleep(3)
         self.check_guild_ap_or_assets(ap_enable=con.guild_ap_enable, assets_enable=con.guild_assets_enable)
         self.check_guild_ap_or_assets(ap_enable=con.guild_ap_enable, assets_enable=con.guild_assets_enable)
         # 进入寮结界
         # 进入寮结界
         self.goto_realm()
         self.goto_realm()
@@ -297,6 +297,8 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
                 timer_click.reset()
                 timer_click.reset()
                 x, y = check_image.coord()
                 x, y = check_image.coord()
                 self.device.click(x=x, y=y, control_name=check_image.name)
                 self.device.click(x=x, y=y, control_name=check_image.name)
+        if friend == SelectFriendList.DIFFERENT_SERVER:
+            time.sleep(1)
         time.sleep(0.5)
         time.sleep(0.5)
 
 
     @cached_property
     @cached_property
@@ -374,6 +376,13 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
 
 
         logger.hr('Start utilize')
         logger.hr('Start utilize')
         self.switch_friend_list(friend)
         self.switch_friend_list(friend)
+        self.swipe(self.S_U_END, interval=3)
+        if friend == SelectFriendList.SAME_SERVER:
+            self.switch_friend_list(SelectFriendList.DIFFERENT_SERVER)
+            self.switch_friend_list(SelectFriendList.SAME_SERVER)
+        else:
+            self.switch_friend_list(SelectFriendList.SAME_SERVER)
+            self.switch_friend_list(SelectFriendList.DIFFERENT_SERVER)
         card_best = None
         card_best = None
         swipe_count = 0
         swipe_count = 0
         while 1:
         while 1:

+ 8 - 1
tasks/KekkaiUtilize/utilize/swipe.json

@@ -5,5 +5,12 @@
     "roiBack": "225,177,72,21",
     "roiBack": "225,177,72,21",
     "mode": "default",
     "mode": "default",
     "description": "向下滑动"
     "description": "向下滑动"
+  },
+  {
+    "itemName": "u_end",
+    "roiFront": "175,179,26,26",
+    "roiBack": "164,518,49,102",
+    "mode": "default",
+    "description": "滑动到底部"
   }
   }
-]
+]

+ 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

+ 0 - 2
tasks/Orochi/assets.py

@@ -23,8 +23,6 @@ class OrochiAssets:
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_orochi_fire.png")
 	I_OROCHI_FIRE = RuleImage(roi_front=(1095,577,131,124), roi_back=(1095,577,131,124), threshold=0.6, method="Template matching", file="./tasks/Orochi/o/o_orochi_fire.png")
 	# 式神录 
 	# 式神录 
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
 	I_SHI_RECORDS = RuleImage(roi_front=(821,638,48,45), roi_back=(821,638,48,45), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_shi_records.png")
-	# description 
-	I_OROCHI_MATCHING = RuleImage(roi_front=(62,568,44,114), roi_back=(62,568,44,114), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_orochi_matching.png")
 	# 小小宠物,发现宝藏 
 	# 小小宠物,发现宝藏 
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_pet_present.png")
 	I_PET_PRESENT = RuleImage(roi_front=(873,184,62,147), roi_back=(873,184,62,147), threshold=0.8, method="Template matching", file="./tasks/Orochi/o/o_pet_present.png")
 
 

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

@@ -53,15 +53,6 @@
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "式神录"
     "description": "式神录"
   },
   },
-  {
-    "itemName": "orochi_matching",
-    "imageName": "o_orochi_matching.png",
-    "roiFront": "62,568,44,114",
-    "roiBack": "62,568,44,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  },
   {
   {
     "itemName": "pet_present",
     "itemName": "pet_present",
     "imageName": "o_pet_present.png",
     "imageName": "o_pet_present.png",

BIN
tasks/Orochi/o/o_orochi_matching.png


+ 2 - 2
tasks/Orochi/script_task.py

@@ -134,7 +134,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         logger.info('Create team')
         logger.info('Create team')
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
-            if self.appear(self.I_OROCHI_MATCHING):
+            if self.appear(self.I_CHECK_TEAM):
                 break
                 break
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
             if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 continue
                 continue
@@ -332,7 +332,7 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             logger.info('Create team')
             logger.info('Create team')
             while 1:
             while 1:
                 self.screenshot()
                 self.screenshot()
-                if self.appear(self.I_OROCHI_MATCHING):
+                if self.appear(self.I_CHECK_TEAM):
                     break
                     break
                 if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                 if self.appear_then_click(self.I_FORM_TEAM, interval=1):
                     continue
                     continue

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

+ 8 - 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
@@ -331,6 +331,10 @@ class RichManAssets:
 	I_S_CHECK_WHITE_FIVE = RuleImage(roi_front=(810,222,109,182), roi_back=(810,222,109,182), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_five.png")
 	I_S_CHECK_WHITE_FIVE = RuleImage(roi_front=(810,222,109,182), roi_back=(810,222,109,182), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_five.png")
 	# description 
 	# description 
 	I_S_CHECK_WHITE_FOUR = RuleImage(roi_front=(808,222,113,181), roi_back=(808,222,113,181), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_four.png")
 	I_S_CHECK_WHITE_FOUR = RuleImage(roi_front=(808,222,113,181), roi_back=(808,222,113,181), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_s_check_white_four.png")
+	# description 
+	I_CENTER1 = RuleImage(roi_front=(1101,621,48,51), roi_back=(1072,596,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_center1.png")
+	# description 
+	I_CENTER2 = RuleImage(roi_front=(76,590,79,75), roi_back=(65,575,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/shrine/shrine_center2.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)

+ 5 - 1
tasks/RichMan/shrine.py

@@ -25,7 +25,11 @@ class Shrine(GameUi, RichManAssets):
             self.screenshot()
             self.screenshot()
             if self.appear(self.I_S_NEXT_PERIOD):
             if self.appear(self.I_S_NEXT_PERIOD):
                 break
                 break
-            if self.click(self.C_C_SHRINE, interval=1):
+            # if self.click(self.C_C_SHRINE, interval=1):
+            #     continue
+            if self.appear_then_click(self.I_CENTER1, interval=1):
+                continue
+            if self.appear_then_click(self.I_CENTER2, interval=1):
                 continue
                 continue
         logger.info('Enter Shrine')
         logger.info('Enter Shrine')
         time.sleep(0.5)
         time.sleep(0.5)

+ 18 - 0
tasks/RichMan/shrine/image.json

@@ -124,5 +124,23 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
+  },
+  {
+    "itemName": "center1",
+    "imageName": "shrine_center1.png",
+    "roiFront": "1101,621,48,51",
+    "roiBack": "1072,596,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "center2",
+    "imageName": "shrine_center2.png",
+    "roiFront": "76,590,79,75",
+    "roiBack": "65,575,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
   }
 ]
 ]

BIN
tasks/RichMan/shrine/shrine_center1.png


BIN
tasks/RichMan/shrine/shrine_center2.png


+ 38 - 5
tasks/RichMan/thousand_things.py

@@ -68,12 +68,11 @@ class ThousandThings(GameUi, RichManAssets):
             if self.ocr_appear_click(self.O_TT_BLUE_TICKET, interval=1):
             if self.ocr_appear_click(self.O_TT_BLUE_TICKET, interval=1):
                 continue
                 continue
         logger.info('Buy mystery amulet')
         logger.info('Buy mystery amulet')
-        self.ui_get_reward(self.I_TT_BUY_CONFIRM)
+        self.tt_get_reward(self.I_TT_BUY_CONFIRM)
         logger.info('Buy mystery amulet success')
         logger.info('Buy mystery amulet success')
         time.sleep(0.5)
         time.sleep(0.5)
         return True
         return True
 
 
-
     def tt_buy_black_daruma_scrap(self):
     def tt_buy_black_daruma_scrap(self):
         self.screenshot()
         self.screenshot()
         if not self.appear(self.I_TT_BLACK):
         if not self.appear(self.I_TT_BLACK):
@@ -88,7 +87,7 @@ class ThousandThings(GameUi, RichManAssets):
             if self.ocr_appear_click(self.O_TT_BLACK, interval=1):
             if self.ocr_appear_click(self.O_TT_BLACK, interval=1):
                 continue
                 continue
         logger.info('Buy black daruma scrap')
         logger.info('Buy black daruma scrap')
-        self.ui_get_reward(self.I_TT_BUY_CONFIRM)
+        self.tt_get_reward(self.I_TT_BUY_CONFIRM)
         logger.info('Buy black daruma scrap success')
         logger.info('Buy black daruma scrap success')
         time.sleep(0.5)
         time.sleep(0.5)
         return True
         return True
@@ -116,7 +115,7 @@ class ThousandThings(GameUi, RichManAssets):
             if not appear_max and self.ocr_appear_click(self.O_TT_AP, interval=2.3):
             if not appear_max and self.ocr_appear_click(self.O_TT_AP, interval=2.3):
                 continue
                 continue
         logger.info('Buy ap')
         logger.info('Buy ap')
-        self.ui_get_reward(self.I_TT_BUY_CONFIRM)
+        self.tt_get_reward(self.I_TT_BUY_CONFIRM)
         logger.info('Buy ap success')
         logger.info('Buy ap success')
         time.sleep(0.5)
         time.sleep(0.5)
         return True
         return True
@@ -133,11 +132,45 @@ class ThousandThings(GameUi, RichManAssets):
         logger.info('Money is not enough')
         logger.info('Money is not enough')
         return False
         return False
 
 
+    def tt_get_reward(self, image_button):
+        from time import sleep
+        click_count = 0
+        while 1:
+            self.screenshot()
+
+            if click_count >= 6:
+                logger.warning('Get reward failed')
+                while 1:
+                    self.screenshot()
+                    if not self.appear(self.I_TT_BUY_UP):
+                        break
+                    if self.appear_then_click(self.I_UI_BACK_RED, interval=3):
+                        continue
+                break
+
+            if self.ui_reward_appear_click():
+                sleep(0.5)
+                while 1:
+                    self.screenshot()
+                    # 等待动画结束
+                    if not self.appear(self.I_UI_REWARD, threshold=0.6):
+                        logger.info('Get reward success')
+                        break
+
+                    # 一直点击
+                    if self.ui_reward_appear_click():
+                        continue
+                break
+
+            if self.appear_then_click(image_button, interval=2):
+                click_count += 1
+                continue
+        return True
+
 
 
 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
-    from memory_profiler import profile
     c = Config('oas1')
     c = Config('oas1')
     d = Device(c)
     d = Device(c)
     t = ThousandThings(c, d)
     t = ThousandThings(c, d)

+ 6 - 3
tasks/base_task.py

@@ -89,16 +89,19 @@ class BaseTask(GlobalGameAssets, CostumeBase):
                         continue
                         continue
                     if not self.appear(self.I_G_REJECT):
                     if not self.appear(self.I_G_REJECT):
                         break
                         break
-            # 最后一个是仅仅接受勾协
+            # 如果是仅接受勾协
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ONLY_JADE:
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.ONLY_JADE:
                 logger.info(f"Accept jade invitation")
                 logger.info(f"Accept jade invitation")
                 while 1:
                 while 1:
                     self.device.screenshot()
                     self.device.screenshot()
-                    if self.appear_then_click(self.I_G_ACCEPT, interval=1):
+                    if self.appear(self.I_G_JADE):
+                        if self.appear_then_click(self.I_G_ACCEPT, interval=1):
+                            continue
+                    elif self.appear_then_click(self.I_G_IGNORE, interval=1):
                         continue
                         continue
                     if not self.appear(self.I_G_ACCEPT):
                     if not self.appear(self.I_G_ACCEPT):
                         break
                         break
-            # 全部忽略
+            # 如果是全部忽略
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.IGNORE:
             elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.IGNORE:
                 logger.info(f"Ignore friend invitation")
                 logger.info(f"Ignore friend invitation")
                 while 1:
                 while 1: