mirror of
https://github.com/sui-feng-cb/AzurLaneAutoScript1.git
synced 2026-07-22 14:01:52 +08:00
Refactor: replace independent scheduled DowntimeFetch task with on-demand auto-fetch
This commit is contained in:
@@ -5,7 +5,7 @@ from module.exercise.combat import ExerciseCombat
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Digit, Ocr, OcrYuv
|
||||
from module.ui.page import page_exercise
|
||||
from module.smart_mgmt.utils import parse_downtime
|
||||
from module.smart_mgmt.downtime_fetch import get_downtime_end
|
||||
|
||||
class DatedDuration(Ocr):
|
||||
def __init__(self, buttons, lang='cnocr', letter=(255, 255, 255), threshold=128, alphabet='0123456789:IDS天日d',
|
||||
@@ -77,7 +77,6 @@ class Exercise(ExerciseCombat):
|
||||
opponent_change_count = 0
|
||||
remain = 0
|
||||
preserve = 0
|
||||
DOWNTIME_END_HOUR_THRESHOLD = 15
|
||||
|
||||
def _new_opponent(self):
|
||||
logger.info('New opponent')
|
||||
@@ -212,24 +211,19 @@ class Exercise(ExerciseCombat):
|
||||
Check smart_mgmt downtime window to decide whether to clear attempts.
|
||||
|
||||
Returns:
|
||||
bool:
|
||||
True if today is maintenance day with end time at or after DOWNTIME_END_HOUR_THRESHOLD.
|
||||
bool:
|
||||
True if today is maintenance day with end time at or after ExerciseClearTime.
|
||||
False if available but today is not maintenance day.
|
||||
None if unavailable (disabled, non-CN server, window missing, or parse failed).
|
||||
None if unavailable (disabled, window missing, or parse failed).
|
||||
"""
|
||||
if self.config.SERVER != 'cn':
|
||||
return None
|
||||
if not self.config.cross_get('DowntimeMgmt.DowntimeStrategy.ManageExercise', False):
|
||||
return None
|
||||
window = self.config.cross_get('DowntimeMgmt.Downtime.Window', None)
|
||||
if not window:
|
||||
return None
|
||||
end_dt = parse_downtime(window)
|
||||
end_dt = get_downtime_end(self.config)
|
||||
if end_dt is None:
|
||||
return None
|
||||
if end_dt <= now:
|
||||
return False
|
||||
return end_dt.date() == now.date() and end_dt.hour >= self.DOWNTIME_END_HOUR_THRESHOLD
|
||||
threshold_str = self.config.cross_get('DowntimeMgmt.DowntimeStrategy.ExerciseClearTime', '15:00:00')
|
||||
threshold_time = datetime.datetime.strptime(threshold_str, '%H:%M:%S').time()
|
||||
return end_dt.date() == now.date() and end_dt.time() >= threshold_time
|
||||
|
||||
def _should_force_clear(self, now, remain_time, admiral_interval):
|
||||
"""Decide whether to clear all exercise attempts this run."""
|
||||
|
||||
Reference in New Issue
Block a user