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

Merge pull request #231 from runhey/dev

Dev
huangrunheng 2 лет назад
Родитель
Сommit
4b7d218dca
39 измененных файлов с 371 добавлено и 34 удалено
  1. 2 2
      dev_tools/assets_test.py
  2. 1 1
      tasks/AreaBoss/assets.py
  3. 2 2
      tasks/AreaBoss/res/image.json
  4. BIN
      tasks/AreaBoss/res/res_filter.png
  5. 1 1
      tasks/CollectiveMissions/assets.py
  6. 2 2
      tasks/CollectiveMissions/cm/ocr.json
  7. 2 2
      tasks/Component/GeneralBattle/general_battle.py
  8. 2 2
      tasks/Component/GeneralInvite/assets.py
  9. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_emoji_1.png
  10. BIN
      tasks/Component/GeneralInvite/gi/gi_gi_emoji_2.png
  11. 5 5
      tasks/Component/GeneralInvite/gi/member.json
  12. 1 1
      tasks/DemonEncounter/script_task.py
  13. 8 2
      tasks/GameUi/assets.py
  14. 4 0
      tasks/GameUi/page.py
  15. BIN
      tasks/GameUi/page/page_check_kyakkiyakou.png
  16. BIN
      tasks/GameUi/page/page_hyakkiyakou_close.png
  17. 27 0
      tasks/GameUi/page/page_img_2.json
  18. 4 4
      tasks/GameUi/page/page_img_3.json
  19. BIN
      tasks/GameUi/page/page_main_goto_collection.png
  20. BIN
      tasks/GameUi/page/page_main_goto_team.png
  21. BIN
      tasks/GameUi/page/page_town_goto_hyakkiyakou.png
  22. 4 2
      tasks/GlobalGame/assets.py
  23. 1 0
      tasks/GlobalGame/config_emergency.py
  24. BIN
      tasks/GlobalGame/gg/gg_g_ignore.png
  25. 11 2
      tasks/GlobalGame/gg/image.json
  26. 24 0
      tasks/Hyakkiyakou/assets.py
  27. 20 0
      tasks/Hyakkiyakou/hya/click.json
  28. BIN
      tasks/Hyakkiyakou/hya/hya_haccess.png
  29. BIN
      tasks/Hyakkiyakou/hya/hya_hend.png
  30. BIN
      tasks/Hyakkiyakou/hya/hya_hfreeze.png
  31. BIN
      tasks/Hyakkiyakou/hya/hya_hinvite.png
  32. BIN
      tasks/Hyakkiyakou/hya/hya_hselected.png
  33. BIN
      tasks/Hyakkiyakou/hya/hya_hstart.png
  34. 56 0
      tasks/Hyakkiyakou/hya/image1.json
  35. 90 0
      tasks/Hyakkiyakou/prepare/get_images.py
  36. 1 1
      tasks/Hyakkiyakou/utils/exp_test.py
  37. 56 0
      tasks/Hyakkiyakou/utils/realm_raid_test.py
  38. 38 5
      tasks/RichMan/thousand_things.py
  39. 9 0
      tasks/base_task.py

+ 2 - 2
dev_tools/assets_test.py

@@ -34,12 +34,12 @@ def detect_ocr(file: str, target: RuleOcr):
 
 
 # 图片文件路径 可以是相对路径
-IMAGE_FILE = r'C:\Users\Ryland\Downloads\QQ截图20240402214513.png'
+IMAGE_FILE = r"C:\Users\Ryland\Desktop\QQ截图20240407130042.png"
 if __name__ == '__main__':
     from tasks.KekkaiActivation.assets import KekkaiActivationAssets
     from tasks.GameUi.assets import GameUiAssets
 
-    targe = GameUiAssets.I_MAIN_GOTO_DAILY
+    targe = GameUiAssets.I_MAIN_GOTO_TEAM
     print(detect_image(IMAGE_FILE, targe))
     # from tasks.KekkaiActivation.assets import KekkaiActivationAssets
     # target = KekkaiActivationAssets.O_CARD_ALL_TIME

+ 1 - 1
tasks/AreaBoss/assets.py

@@ -18,7 +18,7 @@ class AreaBossAssets:
 	# 蓝色的返回 
 	I_BACK_BLUE = RuleImage(roi_front=(51,30,51,52), roi_back=(4,1,128,110), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_back_blue.png")
 	# 右上边选中鬼王的 
-	I_FILTER = RuleImage(roi_front=(1108,31,48,49), roi_back=(1096,19,78,67), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
+	I_FILTER = RuleImage(roi_front=(1116,33,35,31), roi_back=(1076,19,98,78), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
 	# 选中第一个鬼王的 
 	I_BATTLE_1 = RuleImage(roi_front=(1066,210,100,100), roi_back=(1066,210,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_1.png")
 	# 选中第二个鬼王的 

+ 2 - 2
tasks/AreaBoss/res/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "filter",
     "imageName": "res_filter.png",
-    "roiFront": "1108,31,48,49",
-    "roiBack": "1096,19,78,67",
+    "roiFront": "1116,33,35,31",
+    "roiBack": "1076,19,98,78",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "右上边选中鬼王的"

BIN
tasks/AreaBoss/res/res_filter.png


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

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

@@ -89,9 +89,9 @@ 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")
 	# 判断是不是在探索界面 

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


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


+ 5 - 5
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"

+ 1 - 1
tasks/DemonEncounter/script_task.py

@@ -96,7 +96,7 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets):
                 logger.warning('Boss battle already done')
                 self.ui_click_until_disappear(self.I_UI_BACK_RED)
                 return
-            if self.appear_then_click(self.I_BOSS_FIRE, interval=1):
+            if self.appear_then_click(self.I_BOSS_FIRE, interval=3):
                 boss_fire_count += 1
                 continue
         logger.info('Boss battle confirm and enter')

+ 8 - 2
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
@@ -133,9 +139,9 @@ class GameUiAssets:
 	# description 
 	I_MAIN_GOTO_GUILD = RuleImage(roi_front=(540,611,50,54), roi_back=(540,611,50,54), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_guild.png")
 	# description 
-	I_MAIN_GOTO_TEAM = RuleImage(roi_front=(429,622,53,51), roi_back=(429,622,53,51), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_team.png")
+	I_MAIN_GOTO_TEAM = RuleImage(roi_front=(437,625,38,48), roi_back=(366,606,192,83), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_team.png")
 	# description 
-	I_MAIN_GOTO_COLLECTION = RuleImage(roi_front=(92,611,51,64), roi_back=(92,611,51,64), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_collection.png")
+	I_MAIN_GOTO_COLLECTION = RuleImage(roi_front=(92,621,36,41), roi_back=(51,596,159,85), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_collection.png")
 	# description 
 	I_CHECK_RECORDS = RuleImage(roi_front=(269,71,55,50), roi_back=(269,71,55,50), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_records.png")
 	# description 

+ 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"
   }
 ]

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

@@ -56,8 +56,8 @@
   {
     "itemName": "main_goto_team",
     "imageName": "page_main_goto_team.png",
-    "roiFront": "429,622,53,51",
-    "roiBack": "429,622,53,51",
+    "roiFront": "437,625,38,48",
+    "roiBack": "366,606,192,83",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
@@ -65,8 +65,8 @@
   {
     "itemName": "main_goto_collection",
     "imageName": "page_main_goto_collection.png",
-    "roiFront": "92,611,51,64",
-    "roiBack": "92,611,51,64",
+    "roiFront": "92,621,36,41",
+    "roiBack": "51,596,159,85",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

BIN
tasks/GameUi/page/page_main_goto_collection.png


BIN
tasks/GameUi/page/page_main_goto_team.png


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

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

@@ -271,7 +271,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)

+ 56 - 0
tasks/Hyakkiyakou/utils/realm_raid_test.py

@@ -0,0 +1,56 @@
+import time
+from datetime import datetime, timedelta
+import random
+
+from module.logger import logger
+
+from tasks.RyouToppa.script_task import ScriptTask, area_map
+from tasks.RealmRaid.assets import RealmRaidAssets
+
+
+class RealmRaidTest(ScriptTask):
+
+    def attack_area(self, index: int):
+        """
+        :return: 战斗成功(True) or 战斗失败(False) or 区域不可用(False) or 没有进攻机会(设定下次运行并退出)
+        """
+
+        rcl = area_map[index].get("rule_click")
+        # # 点击攻击区域,等待攻击按钮出现。
+        # self.ui_click(rcl, stop=RealmRaidAssets.I_FIRE, interval=2)
+        # 塔塔开!
+        click_failure_count = 0
+        while True:
+            self.screenshot()
+            if click_failure_count >= 3:
+                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)
+                self.screenshot()
+                if self.appear(self.I_TOPPA_RECORD, threshold=0.85):
+                    continue
+                logger.info("Start attach area [%s]" % str(index + 1))
+                return self.run_general_battle_back(config=self.config.ryou_toppa.general_battle_config)
+
+            if self.appear_then_click(RealmRaidAssets.I_FIRE, interval=2, threshold=0.8):
+                click_failure_count += 1
+                continue
+            if self.click(rcl, interval=5):
+                continue
+        self.wait_until_appear(self.I_TOPPA_RECORD)
+
+    def run30(self):
+        for i in range(29):
+            index = i % 7
+            self.attack_area(index)
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+
+    c = Config('oas1')
+    d = Device(c)
+    t = RealmRaidTest(c, d)
+    t.run30()

+ 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
             # 判断网络异常