diff --git a/tasks/dungeon/dungeon.py b/tasks/dungeon/dungeon.py index b9614c9c1..cc4ed9959 100644 --- a/tasks/dungeon/dungeon.py +++ b/tasks/dungeon/dungeon.py @@ -6,6 +6,7 @@ from tasks.daily.keywords import KEYWORDS_DAILY_QUEST from tasks.dungeon.event import DungeonEvent from tasks.dungeon.keywords import DungeonList, KEYWORDS_DUNGEON_LIST, KEYWORDS_DUNGEON_NAV, KEYWORDS_DUNGEON_TAB from tasks.dungeon.stamina import DungeonStamina +from tasks.item.synthesize import Synthesize class Dungeon(DungeonStamina, DungeonEvent, Combat): @@ -141,7 +142,10 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat): # Check trailblaze power, this may stop current task if self.is_trailblaze_power_exhausted(): + # Scheduler self.delay_dungeon_task(dungeon) + self.check_synthesize() + self.config.task_stop() return count @@ -290,12 +294,23 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat): # Schedule behind rogue self.config.task_delay(minute=5) self.config.task_call('Rogue') + # Scheduler self.delay_dungeon_task(KEYWORDS_DUNGEON_LIST.Simulated_Universe_World_1) + self.config.task_stop() else: # Combat self.dungeon_run(final) self.is_doing_planner = False + # Scheduler self.delay_dungeon_task(final) + self.check_synthesize() + self.config.task_stop() + + def check_synthesize(self): + logger.info('Check synthesize') + synthesize = Synthesize(config=self.config, device=self.device, task=self.config.task.command) + if synthesize.synthesize_needed(): + synthesize.synthesize_planner() def delay_dungeon_task(self, dungeon: DungeonList): logger.attr('achieved_daily_quest', self.achieved_daily_quest) @@ -316,8 +331,6 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat): # Delay tasks self.dungeon_stamina_delay(dungeon) - self.config.task_stop() - def handle_destructible_around_blaze(self): """ Stagnant_Shadow_Blaze has a destructible object nearby, attacks are aimed at it first diff --git a/tasks/item/synthesize.py b/tasks/item/synthesize.py index 902790a50..60f0ff3c6 100644 --- a/tasks/item/synthesize.py +++ b/tasks/item/synthesize.py @@ -452,6 +452,19 @@ class Synthesize(CombatObtain, ItemUI): if self.handle_popup_confirm(): continue + def synthesize_needed(self): + """ + Returns: + bool: True is any synthesizable items are full + """ + for row in self.planner.rows.values(): + if not row.need_farm() and row.need_synthesize(): + logger.info(f'Going to synthesize {row.item}') + return True + + logger.info('No items need to synthesize') + return False + def synthesize_planner(self): """ Synthesize items in planner