mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-29 15:07:14 +08:00
Add: Add Students with Level >= X Only
This commit is contained in:
@@ -643,27 +643,34 @@ class RewardTacticalClass(Dock):
|
||||
# Wait until they turn into
|
||||
# [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]
|
||||
level_ocr = LevelOcr(CARD_LEVEL_GRIDS.buttons, name='DOCK_LEVEL_OCR', threshold=64)
|
||||
timeout = Timer(1, count=1).start()
|
||||
while 1:
|
||||
list_level = []
|
||||
for _ in self.loop(timeout=1):
|
||||
list_level = level_ocr.ocr(self.device.image)
|
||||
first_ship = next((i for i, x in enumerate(list_level) if x > 0), len(list_level))
|
||||
first_empty = next((i for i, x in enumerate(list_level) if x == 0), len(list_level))
|
||||
if timeout.reached():
|
||||
logger.warning('Wait ship cards timeout')
|
||||
break
|
||||
if first_empty >= first_ship:
|
||||
break
|
||||
self.device.screenshot()
|
||||
else:
|
||||
logger.warning('Wait ship cards timeout')
|
||||
|
||||
try:
|
||||
min_level = int(self.config.AddNewStudent_MinLevel)
|
||||
if min_level < 1:
|
||||
min_level = 1
|
||||
except (ValueError, TypeError) as e:
|
||||
logger.warning(f'Invalid AddNewStudent_MinLevel: {self.config.AddNewStudent_MinLevel}, {e}')
|
||||
min_level = 1
|
||||
logger.attr('AddNewStudent_MinLevel', min_level)
|
||||
|
||||
should_select_button = None
|
||||
for button, level in list(zip(CARD_GRIDS.buttons, list_level))[self.dock_select_index:]:
|
||||
# Select ship LV > 1 only
|
||||
if level > 1:
|
||||
if level >= min_level:
|
||||
should_select_button = button
|
||||
break
|
||||
|
||||
if should_select_button is None:
|
||||
logger.info('No ships with level > 1 in dock')
|
||||
logger.info(f'No ships with level >= {min_level} in dock')
|
||||
return False
|
||||
|
||||
# select a ship
|
||||
|
||||
Reference in New Issue
Block a user