mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Fix: Wait if team not prepared
as game client saves team characters now
This commit is contained in:
parent
cbc5d4d786
commit
4ef3dd26e2
@ -25,6 +25,7 @@ class Route(RouteBase, ForgottenHallUI):
|
||||
logger.hr('Forgotten hall stage 1')
|
||||
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
||||
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
||||
if not self.team_is_prepared():
|
||||
self.team_choose_first_4()
|
||||
self.enter_forgotten_hall_dungeon()
|
||||
|
||||
|
@ -56,7 +56,8 @@ class UseTechniqueUI(MapControlJoystick, ForgottenHallUI):
|
||||
logger.hr('Use techniques', level=2)
|
||||
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
|
||||
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
|
||||
self.team_choose_first()
|
||||
if not self.team_is_prepared():
|
||||
self.team_choose_first_4()
|
||||
self.enter_forgotten_hall_dungeon()
|
||||
self._use_technique(count, skip_first_screenshot=skip_first_screenshot)
|
||||
self.exit_dungeon()
|
||||
|
@ -1,6 +1,7 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import color_similarity_2d, get_color
|
||||
from module.logger import logger
|
||||
from tasks.base.ui import UI
|
||||
@ -72,3 +73,24 @@ class ForgottenHallTeam(UI):
|
||||
self.device.click(character)
|
||||
# Casual sleep, game may not respond that fast
|
||||
self.device.sleep((0.1, 0.2))
|
||||
|
||||
def team_is_prepared(self, skip_first_screenshot=True) -> bool:
|
||||
"""
|
||||
Pages:
|
||||
in: ENTRANCE_CHECKED, ENTER_FORGOTTEN_HALL_DUNGEON
|
||||
"""
|
||||
characters = [CHARACTER_1, CHARACTER_2, CHARACTER_3, CHARACTER_4]
|
||||
timeout = Timer(1, count=5).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
if timeout.reached():
|
||||
logger.info('Team not prepared')
|
||||
return False
|
||||
chosen_list = [self.is_character_chosen(c) for c in characters]
|
||||
if all(chosen_list):
|
||||
logger.info("Team already prepared")
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user