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

Merge branch 'runhey:dev' into dev

SageWizWang 2 лет назад
Родитель
Сommit
887a858b4e

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

+ 2 - 2
tasks/GameUi/assets.py

@@ -133,9 +133,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 - 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


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