From f241b4315ce022078a14f1cc45f823eb3c2fc624 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 19 Jun 2024 22:55:09 +0800 Subject: [PATCH 1/3] Fix: wait_selected() has no return --- tasks/item/inventory.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks/item/inventory.py b/tasks/item/inventory.py index 9975952f5..347b893bf 100644 --- a/tasks/item/inventory.py +++ b/tasks/item/inventory.py @@ -319,6 +319,13 @@ class InventoryManager: self.update() def wait_selected(self, skip_first_screenshot=True): + """ + Args: + skip_first_screenshot: + + Returns: + bool: If success + """ timeout = Timer(2, count=6).start() while 1: if skip_first_screenshot: @@ -328,7 +335,7 @@ class InventoryManager: self.update() if self.selected is not None: - break + return True if timeout.reached(): logger.warning('Wait inventory selected timeout') - break + return False From 15d439d4fb4c270147d3121421b95d3ca95236ca Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:04:53 +0800 Subject: [PATCH 2/3] Fix: Redirect Item_Moon_Madness_Fang to Item_Moon_Rage_Fang --- module/config/config_updater.py | 4 ++-- module/config/convert.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/module/config/config_updater.py b/module/config/config_updater.py index 98bcb00bb..6de81c39b 100644 --- a/module/config/config_updater.py +++ b/module/config/config_updater.py @@ -688,8 +688,8 @@ class ConfigUpdater: ('Dungeon.DungeonDaily.CalyxCrimson', 'Dungeon.DungeonDaily.CalyxCrimson', convert_20_dungeon), ('Rogue.RogueWorld.SimulatedUniverseElite', 'Rogue.RogueWorld.SimulatedUniverseFarm', convert_rogue_farm), # 2.3 - ('Dungeon.Planner.Item_Moon_Madness_Fang', 'Dungeon.Planner.Item_Moon_Rage_Fang'), - ('Dungeon.Planner.Item_Moon_Madness_Fang.item', 'Dungeon.Planner.Item_Moon_Rage_Fang.item'), + ('Dungeon.Planner.Item_Moon_Madness_Fang', 'Dungeon.Planner.Item_Moon_Rage_Fang', + convert_Item_Moon_Madness_Fang), ] @cached_property diff --git a/module/config/convert.py b/module/config/convert.py index 799a5ac03..6b8127f85 100644 --- a/module/config/convert.py +++ b/module/config/convert.py @@ -37,3 +37,8 @@ def convert_rogue_farm(value): value['value'] = 100 - value['value'] value['total'] = 100 return value + +def convert_Item_Moon_Madness_Fang(value): + if isinstance(value, dict): + value['item'] = 'Moon_Rage_Fang' + return value From a7c823f1d8e7cec30ee8f99aa5ba5e772c4a0676 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:08:55 +0800 Subject: [PATCH 3/3] Fix: Row data wasn't updated after getting obtained --- tasks/item/synthesize.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tasks/item/synthesize.py b/tasks/item/synthesize.py index 78f9c7822..a5ff46d53 100644 --- a/tasks/item/synthesize.py +++ b/tasks/item/synthesize.py @@ -511,7 +511,8 @@ class Synthesize(CombatObtain, ItemUI): row: Returns: - bool: True if success + StoredPlannerProxy: Same row with updated data + or None if failed """ for _ in range(3): logger.hr('Synthesize planner row', level=1) @@ -523,19 +524,24 @@ class Synthesize(CombatObtain, ItemUI): self.planner.load_obtained_amount(obtained) if not row.need_synthesize(): logger.warning('Planner row do not need to synthesize') - return False + return None # Check current item again current = self.synthesize_get_item() if current.item_group == row.item.item_group: logger.info('Selected at target item') - return True + try: + new = self.planner.rows[row.item.name] + return new + except KeyError: + logger.error(f'synthesize_planner_row_select: row {row} disappeared after updating obtained') + return None else: logger.warning(f'Item changed after getting obtain, expected: {row.item}, current: {current}') continue logger.error('synthesize_planner_row_select failed 3 times') - return False + return None def synthesize_planner(self): """ @@ -548,12 +554,14 @@ class Synthesize(CombatObtain, ItemUI): logger.hr('Synthesize planner', level=1) self.ui_ensure(page_synthesize) - for row in self.planner.rows.values(): + # Cache things to iter + rows = list(self.planner.rows.values()) + for row in rows: if not row.need_synthesize(): continue - success = self.synthesize_planner_row_select(row) - if not success: + row = self.synthesize_planner_row_select(row) + if row is None: continue logger.info(f'Synthesize row: {row}')