diff --git a/route/daily/forgotten_hall/stage_1.py b/route/daily/forgotten_hall/stage_1.py new file mode 100644 index 000000000..05e6cd5bb --- /dev/null +++ b/route/daily/forgotten_hall/stage_1.py @@ -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() diff --git a/tasks/combat/combat.py b/tasks/combat/combat.py index f2550e4f2..e86f69106 100644 --- a/tasks/combat/combat.py +++ b/tasks/combat/combat.py @@ -118,8 +118,11 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo if self.handle_ascension_dungeon_prepare(): continue - def combat_execute(self): + def combat_execute(self, expected_end=None): """ + Args: + expected_end: A function returns bool, True represents end. + Pages: in: is_combat_executing out: COMBAT_AGAIN @@ -135,6 +138,9 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo self.device.screenshot() # End + if callable(expected_end) and expected_end(): + logger.info(f'Combat execute ended at {expected_end.__name__}') + break if self.appear(COMBAT_AGAIN): logger.info(f'Combat execute ended at {COMBAT_AGAIN}') break diff --git a/tasks/daily/daily_quest.py b/tasks/daily/daily_quest.py index 27d469292..dea9e4b89 100644 --- a/tasks/daily/daily_quest.py +++ b/tasks/daily/daily_quest.py @@ -22,6 +22,7 @@ from tasks.dungeon.keywords import KEYWORDS_DUNGEON_TAB from tasks.dungeon.ui import DungeonUI from tasks.item.consumable_usage import ConsumableUsageUI from tasks.item.relics import RelicsUI +from tasks.map.route.loader import RouteLoader class DailyQuestOcr(Ocr): @@ -61,7 +62,7 @@ class DailyQuestOcr(Ocr): return result -class DailyQuestUI(DungeonUI): +class DailyQuestUI(DungeonUI, RouteLoader): def _ensure_position(self, direction: str, skip_first_screenshot=True): interval = Timer(5) if direction == 'left': @@ -258,6 +259,9 @@ class DailyQuestUI(DungeonUI): if KEYWORDS_DAILY_QUEST.Salvage_any_Relic in quests: if RelicsUI(self.config, self.device).salvage_relic(): 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 diff --git a/tasks/daily/use_technique.py b/tasks/daily/use_technique.py index bde1e84f8..eff114cdc 100644 --- a/tasks/daily/use_technique.py +++ b/tasks/daily/use_technique.py @@ -57,7 +57,7 @@ class UseTechniqueUI(MapControlJoystick, ForgottenHallUI): self.stage_goto(KEYWORDS_DUNGEON_LIST.The_Last_Vestiges_of_Towering_Citadel, KEYWORDS_FORGOTTEN_HALL_STAGE.Stage_1) 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.exit_dungeon() self.ui_goto_main() diff --git a/tasks/forgotten_hall/ui.py b/tasks/forgotten_hall/ui.py index e47cec7ec..1e51cb4f9 100644 --- a/tasks/forgotten_hall/ui.py +++ b/tasks/forgotten_hall/ui.py @@ -207,8 +207,10 @@ class ForgottenHallUI(DungeonUI, ForgottenHallTeam): continue if self.handle_popup_confirm(): 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 diff --git a/tasks/map/control/control.py b/tasks/map/control/control.py index 1c2741848..e22d65425 100644 --- a/tasks/map/control/control.py +++ b/tasks/map/control/control.py @@ -135,6 +135,7 @@ class MapControl(Combat, AimDetectorMixin): logger.info('Walk result add: enemy') result.append('enemy') contact.up() + logger.hr('Combat', level=2) self.combat_execute() if waypoint.early_stop: return result