Add: Do quest Complete_Forgotten_Hall_1_time

This commit is contained in:
LmeSzinc 2023-09-23 19:20:53 +08:00
parent e26be58a05
commit e6c19268d6
6 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,35 @@
from module.logger import logger
from tasks.base.assets.assets_base_popup import POPUP_SINGLE
from tasks.dungeon.keywords import KEYWORDS_DUNGEON_LIST
from tasks.forgotten_hall.keywords import KEYWORDS_FORGOTTEN_HALL_STAGE
from tasks.forgotten_hall.ui import ForgottenHallUI
from tasks.map.control.waypoint import Waypoint
from tasks.map.keywords.plane import Jarilo_BackwaterPass
from tasks.map.route.base import RouteBase
class Route(RouteBase, ForgottenHallUI):
def combat_execute(self, expected_end=None):
# Challenge completed, return button appears
def combat_ended():
return self.appear(POPUP_SINGLE)
return super().combat_execute(expected_end=combat_ended)
def route(self):
"""
Pages:
in: Any
out: page_forgotten_hall
"""
logger.hr('Forgotten hall stage 1')
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
self.team_choose_first_4()
self.enter_forgotten_hall_dungeon()
self.map_init(plane=Jarilo_BackwaterPass, position=(369.4, 643.4))
self.clear_enemy(
Waypoint((313.4, 643.4)).run_2x()
)
self.exit_dungeon()

View File

@ -118,8 +118,11 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
if self.handle_ascension_dungeon_prepare(): if self.handle_ascension_dungeon_prepare():
continue continue
def combat_execute(self): def combat_execute(self, expected_end=None):
""" """
Args:
expected_end: A function returns bool, True represents end.
Pages: Pages:
in: is_combat_executing in: is_combat_executing
out: COMBAT_AGAIN out: COMBAT_AGAIN
@ -135,6 +138,9 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
self.device.screenshot() self.device.screenshot()
# End # End
if callable(expected_end) and expected_end():
logger.info(f'Combat execute ended at {expected_end.__name__}')
break
if self.appear(COMBAT_AGAIN): if self.appear(COMBAT_AGAIN):
logger.info(f'Combat execute ended at {COMBAT_AGAIN}') logger.info(f'Combat execute ended at {COMBAT_AGAIN}')
break break

View File

@ -22,6 +22,7 @@ from tasks.dungeon.keywords import KEYWORDS_DUNGEON_TAB
from tasks.dungeon.ui import DungeonUI from tasks.dungeon.ui import DungeonUI
from tasks.item.consumable_usage import ConsumableUsageUI from tasks.item.consumable_usage import ConsumableUsageUI
from tasks.item.relics import RelicsUI from tasks.item.relics import RelicsUI
from tasks.map.route.loader import RouteLoader
class DailyQuestOcr(Ocr): class DailyQuestOcr(Ocr):
@ -61,7 +62,7 @@ class DailyQuestOcr(Ocr):
return result return result
class DailyQuestUI(DungeonUI): class DailyQuestUI(DungeonUI, RouteLoader):
def _ensure_position(self, direction: str, skip_first_screenshot=True): def _ensure_position(self, direction: str, skip_first_screenshot=True):
interval = Timer(5) interval = Timer(5)
if direction == 'left': if direction == 'left':
@ -258,6 +259,9 @@ class DailyQuestUI(DungeonUI):
if KEYWORDS_DAILY_QUEST.Salvage_any_Relic in quests: if KEYWORDS_DAILY_QUEST.Salvage_any_Relic in quests:
if RelicsUI(self.config, self.device).salvage_relic(): if RelicsUI(self.config, self.device).salvage_relic():
done += 1 done += 1
if KEYWORDS_DAILY_QUEST.Complete_Forgotten_Hall_1_time in quests:
self.route_run('daily.forgotten_hall.stage_1')
done += 1
return done return done

View File

@ -57,7 +57,7 @@ class UseTechniqueUI(MapControlJoystick, ForgottenHallUI):
self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel, self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel,
KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1) KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1)
self.team_choose_first() self.team_choose_first()
self._enter_forgotten_hall_dungeon() self.enter_forgotten_hall_dungeon()
self._use_technique(count, skip_first_screenshot=skip_first_screenshot) self._use_technique(count, skip_first_screenshot=skip_first_screenshot)
self.exit_dungeon() self.exit_dungeon()
self.ui_goto_main() self.ui_goto_main()

View File

@ -207,8 +207,10 @@ class ForgottenHallUI(DungeonUI, ForgottenHallTeam):
continue continue
if self.handle_popup_confirm(): if self.handle_popup_confirm():
continue continue
if self.handle_popup_single():
continue
def _enter_forgotten_hall_dungeon(self, skip_first_screenshot=True): def enter_forgotten_hall_dungeon(self, skip_first_screenshot=True):
""" """
called after team is set called after team is set

View File

@ -135,6 +135,7 @@ class MapControl(Combat, AimDetectorMixin):
logger.info('Walk result add: enemy') logger.info('Walk result add: enemy')
result.append('enemy') result.append('enemy')
contact.up() contact.up()
logger.hr('Combat', level=2)
self.combat_execute() self.combat_execute()
if waypoint.early_stop: if waypoint.early_stop:
return result return result