From 25463b2dc176467bc01a7c65f869197b92781169 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sat, 18 Apr 2026 02:55:27 +0800 Subject: [PATCH] Opt: Faster receiving if no drop record --- module/commission/commission.py | 9 ++++--- module/research/research.py | 48 ++++++++++++++++++++------------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/module/commission/commission.py b/module/commission/commission.py index 5931f1b00..08a70a4d8 100644 --- a/module/commission/commission.py +++ b/module/commission/commission.py @@ -16,8 +16,8 @@ from module.handler.info_handler import InfoHandler from module.logger import logger from module.map.map_grids import SelectedGrids from module.retire.assets import DOCK_CHECK -from module.ui.assets import BACK_ARROW, COMMISSION_CHECK, REWARD_GOTO_COMMISSION -from module.ui.page import page_reward, page_commission +from module.ui.assets import BACK_ARROW, REWARD_GOTO_COMMISSION +from module.ui.page import page_commission, page_reward from module.ui.scroll import Scroll from module.ui.switch import Switch from module.ui.ui import UI @@ -525,8 +525,9 @@ class RewardCommission(UI, InfoHandler): for button in [EXP_INFO_S_REWARD, GET_ITEMS_1, GET_ITEMS_2, GET_ITEMS_3]: if self.appear(button, interval=1): - self.ensure_no_info_bar(timeout=1) - drop.add(self.device.image) + if drop: + self.ensure_no_info_bar(timeout=1) + drop.add(self.device.image) REWARD_SAVE_CLICK.name = button.name self.device.click(REWARD_SAVE_CLICK) diff --git a/module/research/research.py b/module/research/research.py index 62b35b042..6ffd45eed 100644 --- a/module/research/research.py +++ b/module/research/research.py @@ -358,12 +358,13 @@ class RewardResearch(ResearchSelector, ResearchQueue, StorageHandler): total = 0 with self.stat.new( genre='research', method=self.config.DropRecord_ResearchRecord - ) as record: + ) as drop: # Take screenshots of project list - record.add(self.device.image) + drop.add(self.device.image) end_confirm = Timer(1, count=3) item_confirm = Timer(1.5, count=5) + item_interval = Timer(0.2, count=0) record_button = None while 1: if skip_first_screenshot: @@ -380,31 +381,42 @@ class RewardResearch(ResearchSelector, ResearchQueue, StorageHandler): end_confirm.reset() # Get items - appear_button = self.get_items() - if appear_button is not None: - if appear_button == record_button: - if item_confirm.reached(): - # Record drops and close get items - self.drop_record(drop=record) - self.device.click(GET_ITEMS_RESEARCH_SAVE) + if drop: + # record item drop + appear_button = self.get_items() + if appear_button is not None: + if appear_button == record_button: + if item_confirm.reached(): + # Record drops and close get items + self.drop_record(drop=drop) + self.device.click(GET_ITEMS_RESEARCH_SAVE) + item_confirm.reset() + record_button = None + total += 1 + continue + else: + logger.info(f'{appear_button} appeared') + record_button = appear_button item_confirm.reset() - record_button = None + else: + item_confirm.reset() + record_button = None + else: + # no drop saving, just click it + if item_interval.reached(): + appear_button = self.get_items() + if appear_button is not None: + self.device.click(GET_ITEMS_RESEARCH_SAVE) + item_interval.reset() total += 1 continue - else: - logger.info(f'{appear_button} appeared') - record_button = appear_button - item_confirm.reset() - else: - item_confirm.reset() - record_button = None # Claim rewards if self.appear_then_click(QUEUE_CLAIM_REWARD, offset=None, interval=5): continue if total <= 0: - record.clear() + drop.clear() logger.info(f'Received rewards from {total} projects') return total