Explorar el Código

fix(Exploration): team mode

ryland hace 2 años
padre
commit
ab8f2624ab

+ 9 - 9
tasks/Component/GeneralInvite/general_invite.py

@@ -75,14 +75,6 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             if self.timer_wait.reached():
             if self.timer_wait.reached():
                 logger.warning('Wait timeout')
                 logger.warning('Wait timeout')
                 return False
                 return False
-            if self.timer_invite and self.timer_invite.reached():
-                if is_first:
-                    logger.info('Invitation is triggered every 20s')
-                    self.timer_invite.reset()
-                else:
-                    logger.info('Wait for 30s and invite again')
-                    self.timer_invite = None
-                self.invite_friends(config)
             if self.appear(self.I_MATCHING):
             if self.appear(self.I_MATCHING):
                 logger.warning('Timeout, now is no room')
                 logger.warning('Timeout, now is no room')
                 return False
                 return False
@@ -95,7 +87,6 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
                 self.appear_then_click(self.I_GI_EMOJI_1)
                 self.appear_then_click(self.I_GI_EMOJI_1)
                 self.appear_then_click(self.I_GI_EMOJI_2)
                 self.appear_then_click(self.I_GI_EMOJI_2)
 
 
-
             fire = False  # 是否开启挑战
             fire = False  # 是否开启挑战
             # 如果这个房间最多只容纳两个人(意思是只可以邀请一个人),且已经邀请一个人了,那就开启挑战
             # 如果这个房间最多只容纳两个人(意思是只可以邀请一个人),且已经邀请一个人了,那就开启挑战
             if self.room_type == RoomType.NORMAL_2 and not self.appear(self.I_ADD_2):
             if self.room_type == RoomType.NORMAL_2 and not self.appear(self.I_ADD_2):
@@ -130,6 +121,15 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
                 self.click_fire()
                 self.click_fire()
                 return True
                 return True
 
 
+            if self.timer_invite and self.timer_invite.reached():
+                if is_first:
+                    logger.info('Invitation is triggered every 20s')
+                    self.timer_invite.reset()
+                else:
+                    logger.info('Wait for 30s and invite again')
+                    self.timer_invite = None
+                self.invite_friends(config)
+
     def ensure_enter(self) -> bool:
     def ensure_enter(self) -> bool:
         """
         """
         确认是否进入了组队界面
         确认是否进入了组队界面

+ 22 - 0
tasks/Exploration/base.py

@@ -135,6 +135,10 @@ class BaseExploration(GeneralBattle, GeneralRoom, GeneralInvite, ReplaceShikigam
             # 有则跳出检测
             # 有则跳出检测
             if self.appear(self.I_E_EXPLORATION_CLICK) or result and len(result) > 0:
             if self.appear(self.I_E_EXPLORATION_CLICK) or result and len(result) > 0:
                 break
                 break
+            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
             self.device.click_record_clear()
             self.device.click_record_clear()
             self.swipe(self.S_SWIPE_LEVEL_UP)
             self.swipe(self.S_SWIPE_LEVEL_UP)
             swipeCount += 1
             swipeCount += 1
@@ -144,11 +148,17 @@ class BaseExploration(GeneralBattle, GeneralRoom, GeneralInvite, ReplaceShikigam
         # 选中对应章节
         # 选中对应章节
         while 1:
         while 1:
             self.screenshot()
             self.screenshot()
+            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
             self.O_E_EXPLORATION_LEVEL_NUMBER.keyword = explorationConfig.exploration_config.exploration_level
             self.O_E_EXPLORATION_LEVEL_NUMBER.keyword = explorationConfig.exploration_config.exploration_level
             if self.ocr_appear_click(self.O_E_EXPLORATION_LEVEL_NUMBER):
             if self.ocr_appear_click(self.O_E_EXPLORATION_LEVEL_NUMBER):
                 self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=3)
                 self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=3)
             if self.appear(self.I_E_EXPLORATION_CLICK):
             if self.appear(self.I_E_EXPLORATION_CLICK):
                 break
                 break
+            if self.is_in_room():
+                break
 
 
         return True
         return True
 
 
@@ -330,6 +340,18 @@ class BaseExploration(GeneralBattle, GeneralRoom, GeneralInvite, ReplaceShikigam
             if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1.5):
             if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1.5):
                 continue
                 continue
 
 
+    def fire(self, button) -> bool:
+        self.ui_click_until_disappear(button, interval=3)
+        if (self.appear(self.I_E_SETTINGS_BUTTON) or
+                self.appear(self.I_E_AUTO_ROTATE_ON) or
+                self.appear(self.I_E_AUTO_ROTATE_OFF)):
+            # 如果还在探索说明,这个是显示滑动导致挑战按钮不在范围内
+            logger.warning('Fire button disappear, but still in exploration')
+            return False
+        self.run_general_battle(self._config.general_battle_config)
+        self.minions_cnt += 1
+        return True
+
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     from module.config.config import Config
     from module.config.config import Config

+ 3 - 3
tasks/Exploration/solo.py

@@ -158,8 +158,9 @@ class SoloExploration(BaseExploration):
                 if self.appear(self.I_FIRE, threshold=0.8) and not self.appear(self.I_ADD_2):
                 if self.appear(self.I_FIRE, threshold=0.8) and not self.appear(self.I_ADD_2):
                     self.ui_click_until_disappear(self.I_FIRE, interval=1)
                     self.ui_click_until_disappear(self.I_FIRE, interval=1)
                     continue
                     continue
-                if self.run_invite(config=self._invite_config, is_first=True):
-                    continue
+                if self.appear(self.I_ADD_2):
+                    if self.run_invite(config=self._invite_config, is_first=True):
+                        continue
                 else:
                 else:
                     logger.warning('Invite failed, quit')
                     logger.warning('Invite failed, quit')
                     while 1:
                     while 1:
@@ -451,7 +452,6 @@ class ScriptTask(SoloExploration):
             case UserStatus.MEMBER: self.run_member()
             case UserStatus.MEMBER: self.run_member()
             case _: self.run_solo()
             case _: self.run_solo()
 
 
-
         self.post_process()
         self.post_process()