1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-07-13 02:54:25 +08:00

Feat: delay Daily to end of downtime

This commit is contained in:
positnuec
2026-07-10 07:59:47 +08:00
parent 22ca2d0542
commit 1c3d83e92d
9 changed files with 60 additions and 3 deletions

View File

@@ -730,6 +730,10 @@
"ManageExercise": {
"type": "checkbox",
"value": false
},
"ManageDaily": {
"type": "checkbox",
"value": false
}
},
"Storage": {

View File

@@ -162,6 +162,7 @@ Downtime:
display: disabled
DowntimeStrategy:
ManageExercise: false
ManageDaily: false
# ==================== Farm ====================

View File

@@ -82,6 +82,7 @@ class GeneratedConfig:
# Group `DowntimeStrategy`
DowntimeStrategy_ManageExercise = False
DowntimeStrategy_ManageDaily = False
# Group `Campaign`
Campaign_Name = '12-4'

View File

@@ -740,6 +740,10 @@
"ManageExercise": {
"name": "Exercise",
"help": "When the downtime end time is 15:00 or later, exercise strategy before downtime maintenance on that day will be replaced with 'clear exercise attempts'"
},
"ManageDaily": {
"name": "Daily",
"help": "On downtime maintenance day, next run will be delayed to downtime end time to handle possible Emergency Module Development"
}
},
"Campaign": {

View File

@@ -740,6 +740,10 @@
"ManageExercise": {
"name": "演習",
"help": "メンテナンス終了時刻が15:00以降の場合、当日のメンテナンス開始前の演習戦略が'演習回数をクリア'に置き換えられます"
},
"ManageDaily": {
"name": "デイリー",
"help": "メンテナンス当日の次回実行時間をメンテナンス終了時刻に設定し、限時兵装訓練に対応します"
}
},
"Campaign": {

View File

@@ -740,6 +740,10 @@
"ManageExercise": {
"name": "演习",
"help": "当停服结束时间为15:00及之后时当天停服维护前演习策略将替换为'清空演习次数'"
},
"ManageDaily": {
"name": "每日任务",
"help": "停服维护当天的下次运行时间将设为维护结束时,以处理可能的限时兵装训练"
}
},
"Campaign": {

View File

@@ -740,6 +740,10 @@
"ManageExercise": {
"name": "演習",
"help": "當停服結束時間為15:00及之後時當天停服維護前演習策略將替換為'清空演習次數'"
},
"ManageDaily": {
"name": "每日任務",
"help": "停服維護當天的下次運行時間將設為維護結束時間,以處理可能的限時兵裝訓練"
}
},
"Campaign": {

View File

@@ -1,3 +1,5 @@
from datetime import datetime
import numpy as np
import module.config.server as server
@@ -7,6 +9,7 @@ from module.combat.combat import Combat
from module.daily.assets import *
from module.logger import logger
from module.ocr.ocr import Digit
from module.smart_mgmt.utils import parse_downtime
from module.ui.assets import BACK_ARROW, DAILY_CHECK
from module.ui.page import page_campaign_menu, page_daily
@@ -335,13 +338,44 @@ class Daily(Combat):
logger.info('Daily clear complete.')
break
def _get_downtime_end(self):
"""
Get downtime end datetime on maintenance day.
Returns:
datetime.datetime: End datetime if today is maintenance day and
maintenance has not ended yet, or None if smart_mgmt unavailable,
today is not maintenance day, or maintenance already ended.
"""
if self.config.SERVER != 'cn':
return None
if not self.config.cross_get('DowntimeMgmt.DowntimeStrategy.ManageDaily', False):
return None
window = self.config.cross_get('DowntimeMgmt.Downtime.Window', None)
if not window:
return None
end_dt = parse_downtime(window)
if end_dt is None:
return None
now = datetime.now()
if end_dt.date() != now.date():
return None
if end_dt <= now:
return None
return end_dt
def run(self):
"""
Pages:
in: Any page
out: page_daily
"""
# Cannot stay in page_daily, because order is disordered.
self.daily_run()
# Cannot stay in page_daily, because order is disordered.
self.config.task_delay(server_update=True)
end_dt = self._get_downtime_end()
if end_dt is not None:
logger.info('Downtime today, delay to end of downtime')
self.config.task_delay(target=end_dt)
else:
self.config.task_delay(server_update=True)