Browse Source

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

Chino dentist Ko 2 years ago
parent
commit
57442bdab1
45 changed files with 504 additions and 47 deletions
  1. 5 5
      script.py
  2. 4 0
      tasks/BondlingFairyland/script_task.py
  3. 1 1
      tasks/CollectiveMissions/assets.py
  4. 2 2
      tasks/CollectiveMissions/cm/ocr.json
  5. 2 2
      tasks/Component/GeneralBattle/general_battle.py
  6. 3 3
      tasks/Component/GeneralInvite/assets.py
  7. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png
  8. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png
  9. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_home.png
  10. 7 7
      tasks/Component/GeneralInvite/gi/member.json
  11. 6 0
      tasks/GameUi/assets.py
  12. 4 0
      tasks/GameUi/page.py
  13. BIN
      tasks/GameUi/page/page_check_kyakkiyakou.png
  14. BIN
      tasks/GameUi/page/page_hyakkiyakou_close.png
  15. 27 0
      tasks/GameUi/page/page_img_2.json
  16. BIN
      tasks/GameUi/page/page_town_goto_hyakkiyakou.png
  17. 4 2
      tasks/GlobalGame/assets.py
  18. 1 0
      tasks/GlobalGame/config_emergency.py
  19. BIN
      tasks/GlobalGame/gg/gg_g_ignore.png
  20. 11 2
      tasks/GlobalGame/gg/image.json
  21. 24 0
      tasks/Hyakkiyakou/assets.py
  22. 20 0
      tasks/Hyakkiyakou/hya/click.json
  23. BIN
      tasks/Hyakkiyakou/hya/hya_haccess.png
  24. BIN
      tasks/Hyakkiyakou/hya/hya_hend.png
  25. BIN
      tasks/Hyakkiyakou/hya/hya_hfreeze.png
  26. BIN
      tasks/Hyakkiyakou/hya/hya_hinvite.png
  27. BIN
      tasks/Hyakkiyakou/hya/hya_hselected.png
  28. BIN
      tasks/Hyakkiyakou/hya/hya_hstart.png
  29. 56 0
      tasks/Hyakkiyakou/hya/image1.json
  30. 90 0
      tasks/Hyakkiyakou/prepare/get_images.py
  31. 161 2
      tasks/Hyakkiyakou/utils/exp_test.py
  32. 1 1
      tasks/Hyakkiyakou/utils/realm_raid_test.py
  33. BIN
      tasks/KekkaiActivation/a/a_a_harvest_fish_3.png
  34. 9 0
      tasks/KekkaiActivation/a/image.json
  35. 2 0
      tasks/KekkaiActivation/assets.py
  36. 2 0
      tasks/KekkaiActivation/script_task.py
  37. 1 1
      tasks/KekkaiUtilize/assets.py
  38. 2 2
      tasks/KekkaiUtilize/realm/image.json
  39. BIN
      tasks/KekkaiUtilize/realm/realm_shi_card.png
  40. 4 4
      tasks/RichMan/assets.py
  41. BIN
      tasks/RichMan/guild/guild_guild_check_scrap.png
  42. 5 5
      tasks/RichMan/guild/image.json
  43. 3 3
      tasks/RichMan/mall/bondlings.py
  44. 38 5
      tasks/RichMan/thousand_things.py
  45. 9 0
      tasks/base_task.py

+ 5 - 5
script.py

@@ -361,7 +361,7 @@ class Script:
             self.save_error_log()
             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')
-            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.device.sleep(10)
             return False
@@ -378,22 +378,22 @@ class Script:
             # 这个还不重要 留着坑填
             logger.critical('Game page unknown')
             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)
             return False
         except ScriptError as e:
             logger.critical(e)
             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)
         except RequestHumanTakeover:
             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)
         except Exception as e:
             logger.exception(e)
             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)
 
     def loop(self):

+ 4 - 0
tasks/BondlingFairyland/script_task.py

@@ -543,6 +543,10 @@ class ScriptTask(GameUi, BondlingBattle, SwitchSoul, BondlingFairylandAssets):
                 return False
             if not self.appear(self.I_BF_SEARSH):
                 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):
                 count += 1
                 continue

+ 1 - 1
tasks/CollectiveMissions/assets.py

@@ -56,7 +56,7 @@ class CollectiveMissionsAssets:
 	# Ocr-description 
 	O_CM_6 = RuleOcr(roi=(1002,133,91,42), area=(1002,133,91,42), mode="Single", method="Default", keyword="", name="cm_6")
 	# 记录已完成的数量 
-	O_CM_NUMBER = RuleOcr(roi=(1097,564,58,28), area=(1097,564,58,28), mode="DigitCounter", method="Default", keyword="", name="cm_number")
+	O_CM_NUMBER = RuleOcr(roi=(1105,564,60,28), area=(1105,564,60,28), mode="DigitCounter", method="Default", keyword="", name="cm_number")
 	# 材料的数量 
 	O_CM_1_MATTER = RuleOcr(roi=(427,172,100,27), area=(427,172,100,27), mode="DigitCounter", method="Default", keyword="", name="cm_1_matter")
 	# Ocr-description 

+ 2 - 2
tasks/CollectiveMissions/cm/ocr.json

@@ -55,8 +55,8 @@
   },
   {
     "itemName": "cm_number",
-    "roiFront": "1097,564,58,28",
-    "roiBack": "1097,564,58,28",
+    "roiFront": "1105,564,60,28",
+    "roiBack": "1105,564,60,28",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",

+ 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):
                     occur_prepare_button = True
                     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")
 
             # 照顾一下某些模拟器慢的

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

@@ -89,11 +89,11 @@ class GeneralInviteAssets:
 
 	# Image Rule Assets
 	# description 
-	I_GI_EMOJI_1 = RuleImage(roi_front=(25,538,50,56), roi_back=(25,538,50,56), 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 
-	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")
 

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


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


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


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

@@ -2,17 +2,17 @@
   {
     "itemName": "gi_emoji_1",
     "imageName": "gi_gi_emoji_1.png",
-    "roiFront": "25,538,50,56",
-    "roiBack": "25,538,50,56",
+    "roiFront": "27,526,55,51",
+    "roiBack": "27,526,55,51",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
   },
   {
     "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",
     "threshold": 0.8,
     "description": "description"
@@ -20,8 +20,8 @@
   {
     "itemName": "gi_home",
     "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",
     "threshold": 0.8,
     "description": "判断是不是在庭院界面"

+ 6 - 0
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")
 	# 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")
+	# 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

+ 4 - 0
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.link(button=G.I_BACK_YOLLOW, destination=page_town)
 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)
 
 
 # ************************************* 庭院部分 *****************************************#

BIN
tasks/GameUi/page/page_check_kyakkiyakou.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",
     "threshold": 0.8,
     "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"
   }
 ]

BIN
tasks/GameUi/page/page_town_goto_hyakkiyakou.png


+ 4 - 2
tasks/GlobalGame/assets.py

@@ -11,12 +11,14 @@ class GlobalGameAssets:
 
 
 	# Image Rule Assets
-	# description 
+	# 接受 
 	I_G_ACCEPT = RuleImage(roi_front=(830,407,56,46), roi_back=(798,369,117,110), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_accept.png")
-	# description 
+	# 拒绝 
 	I_G_REJECT = RuleImage(roi_front=(832,508,53,51), roi_back=(808,480,108,101), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_reject.png")
 	# 勾玉 
 	I_G_JADE = RuleImage(roi_front=(661,466,43,46), roi_back=(661,466,43,46), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_jade.png")
+	# 忽略 
+	I_G_IGNORE = RuleImage(roi_front=(773,116,21,21), roi_back=(759,102,48,48), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_g_ignore.png")
 	# 网络异常 
 	I_NETWORK_ABNORMAL = RuleImage(roi_front=(583,330,221,67), roi_back=(583,330,221,67), threshold=0.8, method="Template matching", file="./tasks/GlobalGame/gg/gg_network_abnormal.png")
 	# 已端口游戏服务器,需要重新连接,这种情况一般是断开很久了 

+ 1 - 0
tasks/GlobalGame/config_emergency.py

@@ -10,6 +10,7 @@ class FriendInvitation(str, Enum):
     ACCEPT = 'accept'
     REJECT = 'reject'
     ONLY_JADE = 'only_jade'  # 仅接受勾玉邀请
+    IGNORE = 'ignore'
 
 class WhenNetworkAbnormal(str, Enum):
     RESTART = 'restart'

BIN
tasks/GlobalGame/gg/gg_g_ignore.png


+ 11 - 2
tasks/GlobalGame/gg/image.json

@@ -6,7 +6,7 @@
     "roiBack": "798,369,117,110",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "description"
+    "description": "接受"
   },
   {
     "itemName": "g_reject",
@@ -15,7 +15,7 @@
     "roiBack": "808,480,108,101",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "description"
+    "description": "拒绝"
   },
   {
     "itemName": "g_jade",
@@ -26,6 +26,15 @@
     "threshold": 0.8,
     "description": "勾玉"
   },
+  {
+    "itemName": "g_ignore",
+    "imageName": "gg_g_ignore.png",
+    "roiFront": "773,116,21,21",
+    "roiBack": "759,102,48,48",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "忽略"
+  },
   {
     "itemName": "network_abnormal",
     "imageName": "gg_network_abnormal.png",

+ 24 - 0
tasks/Hyakkiyakou/assets.py

@@ -10,6 +10,30 @@ from module.atom.list import RuleList
 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
 	# description 
 	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(20):
+            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.4)
+        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.Component.RightActivity.right_activity import RightActivity
 from tasks.Restart.assets import RestartAssets
+from tasks.Exploration.config import ExplorationLevel
 
 from utils import usage_time
 from fast_device import FastDevice
@@ -100,7 +101,7 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
 
             if not start_flag:
                 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_save_img.start()
                 timer_save_interval.start()
@@ -271,7 +272,7 @@ class ExpTest(RightActivity, FastDevice, RestartAssets, ExplorationAssets):
     def run_exp_27(self):
         pos_right = 1270
         pos_left = 260
-        pos_top = 510
+        pos_top = 550
         pos_bottom = 620
         pos_level = (pos_top + pos_bottom) / 2
         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):
         self.ui_get_current_page()
         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")
                 return False
             if not self.appear(self.I_TOPPA_RECORD, threshold=0.85):
-                time.sleep(0.5)
+                time.sleep(1.5)
                 self.screenshot()
                 if self.appear(self.I_TOPPA_RECORD, threshold=0.85):
                     continue

BIN
tasks/KekkaiActivation/a/a_a_harvest_fish_3.png


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

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

+ 2 - 0
tasks/KekkaiActivation/assets.py

@@ -74,6 +74,8 @@ class KekkaiActivationAssets:
 	I_A_HARVEST_MOON_3 = RuleImage(roi_front=(897,159,46,40), roi_back=(869,127,100,100), threshold=0.7, method="Template matching", file="./tasks/KekkaiActivation/a/a_a_harvest_moon_3.png")
 	# 卸下 
 	I_A_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

+ 2 - 0
tasks/KekkaiActivation/script_task.py

@@ -375,6 +375,8 @@ class ScriptTask(KU, KekkaiActivationAssets):
         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_MOON_3)  # 太阴3
+        self.appear_then_click(self.I_A_HARVEST_FISH_3)  # 斗鱼三
+
 
 if __name__ == "__main__":
     from module.config.config import Config

+ 1 - 1
tasks/KekkaiUtilize/assets.py

@@ -31,7 +31,7 @@ class KekkaiUtilizeAssets:
 	# 育成 
 	I_SHI_GROWN = RuleImage(roi_front=(595,291,35,38), roi_back=(530,254,181,198), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_grown.png")
 	# 结界卡 
-	I_SHI_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 
 	I_SHI_DEFENSE = RuleImage(roi_front=(294,298,49,56), roi_back=(215,207,208,221), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_defense.png")
 	# 收取经验(没有满的图) 

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

@@ -11,8 +11,8 @@
   {
     "itemName": "shi_card",
     "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",
     "threshold": 0.8,
     "description": "结界卡"

BIN
tasks/KekkaiUtilize/realm/realm_shi_card.png


+ 4 - 4
tasks/RichMan/assets.py

@@ -18,13 +18,13 @@ class RichManAssets:
 	# 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_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

BIN
tasks/RichMan/guild/guild_guild_check_scrap.png


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

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

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

@@ -24,12 +24,12 @@ class Bondlings(Buy, MallNavbar):
             return
         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,
                              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,
                              buy_number=con.high_bondling_discs, buy_max=10, buy_money=50)

+ 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):
                 continue
         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')
         time.sleep(0.5)
         return True
 
-
     def tt_buy_black_daruma_scrap(self):
         self.screenshot()
         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):
                 continue
         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')
         time.sleep(0.5)
         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):
                 continue
         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')
         time.sleep(0.5)
         return True
@@ -133,11 +132,45 @@ class ThousandThings(GameUi, RichManAssets):
         logger.info('Money is not enough')
         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__':
     from module.config.config import Config
     from module.device.device import Device
-    from memory_profiler import profile
     c = Config('oas1')
     d = Device(c)
     t = ThousandThings(c, d)

+ 9 - 0
tasks/base_task.py

@@ -98,6 +98,15 @@ class BaseTask(GlobalGameAssets, CostumeBase):
                         continue
                     if not self.appear(self.I_G_ACCEPT):
                         break
+            # 全部忽略
+            elif invite and self.config.global_game.emergency.friend_invitation == FriendInvitation.IGNORE:
+                logger.info(f"Ignore friend invitation")
+                while 1:
+                    self.device.screenshot()
+                    if self.appear_then_click(self.I_G_IGNORE, interval=1):
+                        continue
+                    if not self.appear(self.I_G_IGNORE):
+                        break
             # 有的时候长战斗 点击后会取消战斗状态
             self.device.detect_record = detect_record
             # 判断网络异常