Răsfoiți Sursa

Merge pull request #1653 from runhey/dev

Dev
huangrunheng 4 luni în urmă
părinte
comite
9482d1329d

+ 1 - 2
tasks/AbyssShadows/assets.py

@@ -61,7 +61,7 @@ class AbyssShadowsAssets:
 	# 式神录 
 	I_ABYSS_SHIKI = RuleImage(roi_front=(1199,462,47,53), roi_back=(1199,462,47,53), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_abyss_shiki.png")
 	# 狭间暗域 
-	I_ABYSS_SHADOWS = RuleImage(roi_front=(711,489,107,38), roi_back=(711,479,107,48), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_abyss_shadows.png")
+	I_ABYSS_SHADOWS = RuleImage(roi_front=(711,489,107,38), roi_back=(700,470,140,70), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_abyss_shadows.png")
 	# 开启狭间暗域 
 	I_OPEN_ABYSS_SHADOWS = RuleImage(roi_front=(1133,602,74,58), roi_back=(1133,602,74,58), threshold=0.8, method="Template matching", file="./tasks/AbyssShadows/res/res_open_abyss_shadows.png")
 	# 战报页面 
@@ -102,4 +102,3 @@ class AbyssShadowsAssets:
 	# 滑到狭间 
 	S_TO_ABBSY_SHADOWS = RuleSwipe(roi_front=(752,395,62,66), roi_back=(758,193,62,48), mode="default", name="to_abbsy_shadows")
 
-

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

@@ -75,7 +75,7 @@
     "itemName": "abyss_shadows",
     "imageName": "res_abyss_shadows.png",
     "roiFront": "711,489,107,38",
-    "roiBack": "711,479,107,48",
+    "roiBack": "700,470,140,70",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "狭间暗域"
@@ -206,4 +206,4 @@
     "threshold": 0.8,
     "description": "description"
   }
-]
+]

+ 5 - 1
tasks/AbyssShadows/script_task.py

@@ -317,6 +317,10 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, AbyssShadowsAssets):
         
         while 1:
             self.screenshot()
+            # Entering Shenshe can resume an active Abyss Shadows map directly.
+            if self.appear(self.I_ABYSS_NAVIGATION):
+                logger.info("Already in abyss_shadows")
+                break
             # 进入神社
             if self.appear_then_click(self.I_RYOU_SHENSHE,interval=1):
                 logger.info("Enter Shenshe")
@@ -566,4 +570,4 @@ if __name__ == "__main__":
     config = Config('zhu')
     device = Device(config)
     t = ScriptTask(config, device)
-    t.run()
+    t.run()

BIN
tasks/ActivityShikigami/as/as_climb_mode_pass.png


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

@@ -20,7 +20,7 @@
   {
     "itemName": "climb_mode_pass",
     "imageName": "as_climb_mode_pass.png",
-    "roiFront": "1164,545,21,21",
+    "roiFront": "1142,547,21,21",
     "roiBack": "1129,511,111,68",
     "method": "Template matching",
     "threshold": 0.8,

+ 1 - 1
tasks/ActivityShikigami/assets.py

@@ -29,7 +29,7 @@ class ActivityShikigamiAssets:
 	# 还未上锁图片 
 	I_UNLOCK = RuleImage(roi_front=(884,648,28,25), roi_back=(733,607,266,95), threshold=0.5, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 活动爬塔标志 
-	I_CLIMB_MODE_PASS = RuleImage(roi_front=(1164,545,21,21), roi_back=(1129,511,111,68), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_climb_mode_pass.png")
+	I_CLIMB_MODE_PASS = RuleImage(roi_front=(1142,547,21,21), roi_back=(1129,511,111,68), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_climb_mode_pass.png")
 	# 体力爬塔标志 
 	I_CLIMB_MODE_AP = RuleImage(roi_front=(1093,544,20,20), roi_back=(1055,495,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_climb_mode_ap.png")
 	# 切换按键 

+ 3 - 1
tasks/DemonRetreat/script_task.py

@@ -123,7 +123,9 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DemonRetreatAssets, AbyssSha
             # 确保不离开退治
             if self.appear_then_click(self.I_QUIT_BACK, interval=1):
                 pass
-            if self.appear(self.I_HUNT_CHECK):
+            if (self.appear(self.I_HUNT_CHECK)
+                    or self.appear(self.I_DEMON_GATHER)
+                    or self.is_in_prepare(False)):
                 if self.appear_then_click(self.I_QUIT_BACK, interval=1):
                     pass
                 logger.info("Enter demon_retreat success")

+ 1 - 1
tasks/Exploration/base.py

@@ -198,7 +198,7 @@ class BaseExploration(GameUi, GeneralBattle, GeneralRoom, GeneralInvite, Replace
             logger.warning('Opening settings failed due to now in battle')
             return
         cu, res, total = self.O_E_ALTERNATE_NUMBER.ocr(self.device.image)
-        if cu >= 10:
+        if cu >= 40:
             logger.info("Alternate number is enough")
             self.ui_click_until_disappear(self.I_E_SURE_BUTTON)
             return

+ 11 - 16
tasks/Exploration/solo.py

@@ -15,6 +15,7 @@ from tasks.Exploration.config import ChooseRarity, AutoRotate, UserStatus, Explo
 class SoloExploration(BaseExploration):
     INVITE_FLAG_OFF = (157, 109, 83)
     INVITE_FLAG_ON = (227, 193, 153)
+    explore_init = False
 
     @cached_property
     def _invite_config(self) -> InviteConfig:
@@ -29,7 +30,6 @@ class SoloExploration(BaseExploration):
 
     def run_solo(self):
         logger.hr('solo')
-        explore_init = False
         search_fail_cnt = 0
 
         while 1:
@@ -48,22 +48,20 @@ class SoloExploration(BaseExploration):
                 if self.check_exit():
                     break
                 self.open_expect_level()
-                explore_init = False
                 continue
             #
             elif scene == Scene.ENTRANCE:
                 if self.check_exit():
                     break
                 self.ui_click(self.I_E_EXPLORATION_CLICK, stop=self.I_E_SETTINGS_BUTTON)
-                explore_init = False
                 continue
             #
             elif scene == Scene.MAIN:
-                if not explore_init:
-                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                if not self.explore_init:
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
-                    explore_init = True
+                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                    self.explore_init = True
                     continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
@@ -100,7 +98,6 @@ class SoloExploration(BaseExploration):
 
     def run_leader(self):
         logger.hr('leader')
-        explore_init = False
         search_fail_cnt = 0
         friend_leave_timer = Timer(10)
 
@@ -139,7 +136,7 @@ class SoloExploration(BaseExploration):
                     # 可以加一下,清空第一次 explore_init
                     continue
                 self.open_expect_level()
-                explore_init = False
+                # explore_init = False
                 continue
 
             # 邀请好友, 非常有可能是后面邀请好友,然后直接跳到组队了
@@ -179,12 +176,12 @@ class SoloExploration(BaseExploration):
                     break
             ##
             elif scene == Scene.MAIN:
-                if not explore_init:
-                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                if not self.explore_init:
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
+                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
                     friend_leave_timer = Timer(10)
-                    explore_init = True
+                    self.explore_init = True
                     continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):
@@ -235,7 +232,6 @@ class SoloExploration(BaseExploration):
 
     def run_member(self):
         logger.hr('member')
-        explore_init = False
         wait_timer = Timer(50)
         friend_leave_timer = Timer(10)
 
@@ -260,7 +256,6 @@ class SoloExploration(BaseExploration):
                     logger.warning('Wait timer reached')
                     break
 
-                explore_init = False
                 continue
             #
             elif scene == Scene.ENTRANCE:
@@ -270,11 +265,11 @@ class SoloExploration(BaseExploration):
                 continue
             #
             elif scene == Scene.MAIN:
-                if not explore_init:
-                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                if not self.explore_init:
                     if self._config.exploration_config.auto_rotate == AutoRotate.yes:
                         self.enter_settings_and_do_operations()
-                    explore_init = True
+                    self.ui_click(self.I_E_AUTO_ROTATE_OFF, stop=self.I_E_AUTO_ROTATE_ON)
+                    self.explore_init = True
                     continue
                 # 小纸人
                 if self.appear(self.I_BATTLE_REWARD):

+ 2 - 2
tasks/GameUi/assets.py

@@ -67,7 +67,7 @@ class GameUiAssets:
 	# 探索前往平安奇谭 
 	I_EXPLORATION_GOTO_HEIAN_KITAN = RuleImage(roi_front=(739,643,52,44), roi_back=(35,615,1097,102), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_heian_kitan.png")
 	# 探索前往六道之门 
-	I_EXPLORATION_GOTO_SIX_GATES = RuleImage(roi_front=(928,638,54,46), roi_back=(46,618,1090,100), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_six_gates.png")
+	I_EXPLORATION_GOTO_SIX_GATES = RuleImage(roi_front=(529,679,93,30), roi_back=(46,618,1090,100), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_six_gates.png")
 	# 探索前往契灵之境 
 	I_EXPLORATION_GOTO_BONDLING_FAIRYLAND = RuleImage(roi_front=(1032,634,46,50), roi_back=(41,619,1104,96), threshold=0.65, method="Template matching", file="./tasks/GameUi/page/page_exploration_goto_bondling_fairyland.png")
 	# description 
@@ -89,7 +89,7 @@ class GameUiAssets:
 	# description 
 	I_CHECK_HEIAN_KITAN = RuleImage(roi_front=(27,48,47,39), roi_back=(27,48,47,39), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_heian_kitan.png")
 	# description 
-	I_CHECK_SIX_GATES = RuleImage(roi_front=(1174,621,55,44), roi_back=(1174,621,55,44), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
+	I_CHECK_SIX_GATES = RuleImage(roi_front=(249,33,22,24), roi_back=(227,7,98,85), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_six_gates.png")
 	# description 
 	I_CHECK_BONDLING_FAIRYLAND = RuleImage(roi_front=(614,660,56,49), roi_back=(614,660,56,49), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_bondling_fairyland.png")
 	# description 

BIN
tasks/GameUi/page/page_check_six_gates.png


BIN
tasks/GameUi/page/page_exploration_goto_six_gates.png


+ 3 - 3
tasks/GameUi/page/page_img.json

@@ -110,7 +110,7 @@
   {
     "itemName": "exploration_goto_six_gates",
     "imageName": "page_exploration_goto_six_gates.png",
-    "roiFront": "928,638,54,46",
+    "roiFront": "529,679,93,30",
     "roiBack": "46,618,1090,100",
     "method": "Template matching",
     "threshold": 0.65,
@@ -209,8 +209,8 @@
   {
     "itemName": "check_six_gates",
     "imageName": "page_check_six_gates.png",
-    "roiFront": "1174,621,55,44",
-    "roiBack": "1174,621,55,44",
+    "roiFront": "249,33,22,24",
+    "roiBack": "227,7,98,85",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"

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

@@ -21,7 +21,7 @@
     "itemName": "art_war_card_plus",
     "roiFront": "916,25,90,29",
     "roiBack": "916,25,90,29",
-    "mode": "SINGLE",
+    "mode": "Digit",
     "method": "Default",
     "keyword": "",
     "description": "兵道帖机密"
@@ -35,4 +35,4 @@
     "keyword": "挑战",
     "description": "挑战按钮"
   }
-]
+]

+ 1 - 2
tasks/HeroTest/assets.py

@@ -107,8 +107,7 @@ class HeroTestAssets:
 	# 兵藏秘境兵道帖 
 	O_ART_WAR_CARD = RuleOcr(roi=(712,21,98,36), area=(712,21,98,36), mode="DigitCounter", method="Default", keyword="", name="art_war_card")
 	# 兵道帖机密 
-	O_ART_WAR_CARD_PLUS = RuleOcr(roi=(916,25,90,29), area=(916,25,90,29), mode="SINGLE", method="Default", keyword="", name="art_war_card_plus")
+	O_ART_WAR_CARD_PLUS = RuleOcr(roi=(916,25,90,29), area=(916,25,90,29), mode="Digit", method="Default", keyword="", name="art_war_card_plus")
 	# 挑战按钮 
 	O_FIRE = RuleOcr(roi=(1130,585,92,55), area=(1126,576,100,99), mode="Single", method="Default", keyword="挑战", name="fire")
 
-

+ 0 - 1
tasks/HeroTest/script_task.py

@@ -209,7 +209,6 @@ class ScriptTask(GameUi, GeneralBattle, HeroTestAssets, SwitchSoul):
             logger.info("Art war card is enough")
             return True
         cu = self.O_ART_WAR_CARD_PLUS.ocr(image=self.device.image)
-        cu = 0 if cu == '' else int(cu)
         if cu >= 1:
             logger.info("Art war card is not enough, but plus card is enough")
             return True

+ 7 - 6
tasks/TrueOrochi/script_task.py

@@ -181,26 +181,27 @@ class ScriptTask(OrochiScriptTask, TrueOrochiAssets):
     def check_times(self, battle: bool):
         """
         后续的次数和时间设置
-        :param battle:
+        :param battle: 本次是否挑战了真蛇
         :param current_success: 这周的成功次数
         :return:
         """
         now = datetime.now()
         now_year, now_week_number, now_weekday = now.isocalendar()
         if battle:
+            # 只有真正打过才加一次数
+            logger.info('Add current_success by 1')
+            self.config.true_orochi.true_orochi_config.current_success += 1
+            self.config.true_orochi.true_orochi_config.current_success = min(2, self.config.true_orochi.true_orochi_config.current_success)
             next_run = now + self.config.true_orochi.scheduler.success_interval
         else:
+            logger.info('Battle skipped or not found True Orochi')
             next_run = now + self.config.true_orochi.scheduler.failure_interval
         next_run_year, next_run_week_number, next_run_weekday = next_run.isocalendar()
         # 如果下次运行的时间是下一周,那么就重置成功次数
         if now_week_number != next_run_week_number:
             logger.info('Reset current_success')
             self.config.true_orochi.true_orochi_config.current_success = 0
-        else:
-            # 如果不是下一周,那么就加一
-            logger.info('Add current_success by 1')
-            self.config.true_orochi.true_orochi_config.current_success += 1
-            self.config.true_orochi.true_orochi_config.current_success = min(2, self.config.true_orochi.true_orochi_config.current_success)
+
         self.config.save()
         self.set_next_run(task='TrueOrochi', target=next_run)
         # self.set_next_run('TrueOrochi', finish=True, success=True)