mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-19 17:42:13 +08:00
Opt: Faster receiving if no drop record
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user