1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-07-14 11:16:19 +08:00

Feat: notify on empty tactical class slot

This commit is contained in:
positnuec
2026-07-10 03:18:06 +08:00
parent 9920c89fea
commit 47a433d2fc
9 changed files with 51 additions and 1 deletions

View File

@@ -7554,6 +7554,10 @@
"MinLevel": {
"type": "input",
"value": 50
},
"EnableNotify": {
"type": "checkbox",
"value": false
}
},
"Storage": {

View File

@@ -412,6 +412,7 @@ AddNewStudent:
Enable: false
Favorite: false
MinLevel: 50
EnableNotify: false
Research:
UseCube:
value: only_05_hour

View File

@@ -227,6 +227,7 @@ class GeneratedConfig:
AddNewStudent_Enable = False
AddNewStudent_Favorite = False
AddNewStudent_MinLevel = 50
AddNewStudent_EnableNotify = False
# Group `Research`
Research_UseCube = 'only_05_hour' # always_use, only_05_hour, only_no_project, do_not_use

View File

@@ -1561,6 +1561,10 @@
"MinLevel": {
"name": "Add Students with Level >= X Only",
"help": ""
},
"EnableNotify": {
"name": "Notify on Empty Slot",
"help": "Send a notification when there is an empty slot in the Tactical Academy: a ship girl has finished studying and 'Level Skills' is disabled, or enabled but failed to assign a new student"
}
},
"Research": {

View File

@@ -1561,6 +1561,10 @@
"MinLevel": {
"name": "レベルがX以上のキャラクターのみを追加してください。",
"help": ""
},
"EnableNotify": {
"name": "空席通知を送信",
"help": "戦術学院に空席がある時に通知を送信:艦娘が学習を完了し、かつ'新しいスキルを学ぶ'が無効、または有効だが新規生徒の割り当てに失敗した時"
}
},
"Research": {

View File

@@ -1561,6 +1561,10 @@
"MinLevel": {
"name": "仅添加等级 >= X 的角色",
"help": ""
},
"EnableNotify": {
"name": "推送空位提醒",
"help": "在战术学院有空位时推送通知:舰娘完成学习且未启用'学习新技能',或启用了但指派失败时"
}
},
"Research": {

View File

@@ -1561,6 +1561,10 @@
"MinLevel": {
"name": "僅新增等級 >= X 的角色",
"help": ""
},
"EnableNotify": {
"name": "推送空位提醒",
"help": "在戰術學院有空位時推送通知:艦娘完成學習且未啟用'學習新技能',或啟用了但指派失敗時"
}
},
"Research": {

View File

@@ -11,6 +11,7 @@ from module.exception import ScriptError
from module.handler.assets import GET_MISSION, MISSION_POPUP_ACK, MISSION_POPUP_GO, POPUP_CANCEL, POPUP_CONFIRM
from module.logger import logger
from module.map.map_grids import SelectedGrids
from module.notify import handle_notify
from module.ocr.ocr import DigitCounter, Duration, Ocr
from module.retire.assets import DOCK_CHECK, DOCK_EMPTY, SHIP_CONFIRM
from module.retire.dock import CARD_GRIDS, CARD_LEVEL_GRIDS, Dock
@@ -378,6 +379,23 @@ class RewardTacticalClass(Dock):
return False
def _notify_tactical_empty_slot(self, reason: str):
"""
Push notification when tactical class has empty slots.
Only the first call in a single run will actually send, later calls are skipped.
Args:
reason (str):
"""
if getattr(self, '_tactical_notified', False):
return
handle_notify(
self.config.Error_OnePushConfig,
title=f"Alas <{self.config.config_name}> tactical slot empty",
content=f"{reason}",
)
self._tactical_notified = True
def _tactical_get_finish(self):
"""
Get the future finish time.
@@ -389,6 +407,10 @@ class RewardTacticalClass(Dock):
is_running = [self.image_color_count(button, color=(148, 255, 99), count=50) for button in grids.buttons]
logger.info(f'Tactical status: {["running" if s else "empty" for s in is_running]}')
if (self.config.AddNewStudent_EnableNotify
and not self.config.AddNewStudent_Enable and self.appear(ADD_NEW_STUDENT, offset=(800, 20))):
self._notify_tactical_empty_slot("Slot unfilled or lesson just completed, with 'Add New Student' disabled")
buttons = [b for b, s in zip(grids.buttons, is_running) if s]
ocr = Duration(buttons, letter=(148, 255, 99), name='TACTICAL_REMAIN')
remains = ocr.ocr(self.device.image)
@@ -415,6 +437,7 @@ class RewardTacticalClass(Dock):
"""
logger.hr('Tactical class receive', level=1)
received = False
self._tactical_notified = False
study_finished = not self.config.AddNewStudent_Enable
book_empty = False
# tactical cards can't be loaded that fast, confirm if it's empty.
@@ -520,6 +543,8 @@ class RewardTacticalClass(Dock):
if self.select_suitable_ship():
pass
else:
if self.config.AddNewStudent_EnableNotify:
self._notify_tactical_empty_slot('No available student to add')
study_finished = True
self.device.click(BACK_ARROW)
else:
@@ -536,6 +561,8 @@ class RewardTacticalClass(Dock):
if self._tactical_skill_choose():
pass
else:
if self.config.AddNewStudent_EnableNotify:
self._notify_tactical_empty_slot('No available skill to learn')
study_finished = True
self.device.click(BACK_ARROW)
else: