mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-29 13:57:13 +08:00
Add: Add Students with Level >= X Only
This commit is contained in:
@@ -1253,7 +1253,8 @@
|
|||||||
},
|
},
|
||||||
"AddNewStudent": {
|
"AddNewStudent": {
|
||||||
"Enable": false,
|
"Enable": false,
|
||||||
"Favorite": true
|
"Favorite": true,
|
||||||
|
"MinLevel": 50
|
||||||
},
|
},
|
||||||
"Storage": {
|
"Storage": {
|
||||||
"Storage": {}
|
"Storage": {}
|
||||||
|
|||||||
@@ -6685,6 +6685,10 @@
|
|||||||
"Favorite": {
|
"Favorite": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"value": true
|
"value": true
|
||||||
|
},
|
||||||
|
"MinLevel": {
|
||||||
|
"type": "input",
|
||||||
|
"value": 50
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Storage": {
|
"Storage": {
|
||||||
|
|||||||
@@ -362,6 +362,7 @@ ControlExpOverflow:
|
|||||||
AddNewStudent:
|
AddNewStudent:
|
||||||
Enable: false
|
Enable: false
|
||||||
Favorite: true
|
Favorite: true
|
||||||
|
MinLevel: 50
|
||||||
Research:
|
Research:
|
||||||
UseCube:
|
UseCube:
|
||||||
value: only_05_hour
|
value: only_05_hour
|
||||||
|
|||||||
@@ -1417,6 +1417,10 @@
|
|||||||
"Favorite": {
|
"Favorite": {
|
||||||
"name": "Use Favorite Filter",
|
"name": "Use Favorite Filter",
|
||||||
"help": "During student selection apply the favorite filter\nThereby, giving priority to certain ship girls\nApply the favorite status to a ship girl in-game"
|
"help": "During student selection apply the favorite filter\nThereby, giving priority to certain ship girls\nApply the favorite status to a ship girl in-game"
|
||||||
|
},
|
||||||
|
"MinLevel": {
|
||||||
|
"name": "Add Students with Level >= X Only",
|
||||||
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Research": {
|
"Research": {
|
||||||
|
|||||||
@@ -1417,6 +1417,10 @@
|
|||||||
"Favorite": {
|
"Favorite": {
|
||||||
"name": "好ましい選択",
|
"name": "好ましい選択",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
},
|
||||||
|
"MinLevel": {
|
||||||
|
"name": "レベルがX以上のキャラクターのみを追加してください。",
|
||||||
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Research": {
|
"Research": {
|
||||||
|
|||||||
@@ -1417,6 +1417,10 @@
|
|||||||
"Favorite": {
|
"Favorite": {
|
||||||
"name": "优先选择常用",
|
"name": "优先选择常用",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
},
|
||||||
|
"MinLevel": {
|
||||||
|
"name": "仅添加等级 >= X 的角色",
|
||||||
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Research": {
|
"Research": {
|
||||||
|
|||||||
@@ -1417,6 +1417,10 @@
|
|||||||
"Favorite": {
|
"Favorite": {
|
||||||
"name": "優先選擇常用",
|
"name": "優先選擇常用",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
},
|
||||||
|
"MinLevel": {
|
||||||
|
"name": "僅新增等級 >= X 的角色",
|
||||||
|
"help": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Research": {
|
"Research": {
|
||||||
|
|||||||
@@ -643,27 +643,34 @@ class RewardTacticalClass(Dock):
|
|||||||
# Wait until they turn into
|
# Wait until they turn into
|
||||||
# [120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120]
|
# [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)
|
level_ocr = LevelOcr(CARD_LEVEL_GRIDS.buttons, name='DOCK_LEVEL_OCR', threshold=64)
|
||||||
timeout = Timer(1, count=1).start()
|
list_level = []
|
||||||
while 1:
|
for _ in self.loop(timeout=1):
|
||||||
list_level = level_ocr.ocr(self.device.image)
|
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_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))
|
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:
|
if first_empty >= first_ship:
|
||||||
break
|
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
|
should_select_button = None
|
||||||
for button, level in list(zip(CARD_GRIDS.buttons, list_level))[self.dock_select_index:]:
|
for button, level in list(zip(CARD_GRIDS.buttons, list_level))[self.dock_select_index:]:
|
||||||
# Select ship LV > 1 only
|
# Select ship LV > 1 only
|
||||||
if level > 1:
|
if level >= min_level:
|
||||||
should_select_button = button
|
should_select_button = button
|
||||||
break
|
break
|
||||||
|
|
||||||
if should_select_button is None:
|
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
|
return False
|
||||||
|
|
||||||
# select a ship
|
# select a ship
|
||||||
|
|||||||
Reference in New Issue
Block a user