mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 09:48:20 +08:00
Refactor: Opsi task managing
This commit is contained in:
56
module/os/tasks/abyssal.py
Normal file
56
module/os/tasks/abyssal.py
Normal file
@@ -0,0 +1,56 @@
|
||||
from module.config.utils import get_os_reset_remain
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from module.os.map import OSMap
|
||||
|
||||
|
||||
class OpsiAbyssal(OSMap):
|
||||
def delay_abyssal(self, result=True):
|
||||
"""
|
||||
Args:
|
||||
result(bool): If still have obscure coordinates.
|
||||
"""
|
||||
if get_os_reset_remain() == 0:
|
||||
logger.info('Just less than 1 day to OpSi reset, delay 2.5 hours')
|
||||
self.config.task_delay(minute=150, server_update=True)
|
||||
self.config.task_stop()
|
||||
elif not result:
|
||||
self.config.task_delay(server_update=True)
|
||||
self.config.task_stop()
|
||||
|
||||
def clear_abyssal(self):
|
||||
"""
|
||||
Get one abyssal logger in storage,
|
||||
attack abyssal boss,
|
||||
repair fleets in port.
|
||||
|
||||
Raises:
|
||||
ActionPointLimit:
|
||||
TaskEnd: If no more abyssal loggers.
|
||||
RequestHumanTakeover: If unable to clear boss, fleets exhausted.
|
||||
"""
|
||||
logger.hr('OS clear abyssal', level=1)
|
||||
self.cl1_ap_preserve()
|
||||
|
||||
with self.config.temporary(STORY_ALLOW_SKIP=False):
|
||||
result = self.storage_get_next_item('ABYSSAL', use_logger=self.config.OpsiGeneral_UseLogger)
|
||||
if not result:
|
||||
self.delay_abyssal(result=False)
|
||||
|
||||
self.config.override(
|
||||
OpsiGeneral_DoRandomMapEvent=False,
|
||||
HOMO_EDGE_DETECT=False,
|
||||
STORY_OPTION=0
|
||||
)
|
||||
self.zone_init()
|
||||
result = self.run_abyssal()
|
||||
if not result:
|
||||
raise RequestHumanTakeover
|
||||
|
||||
self.fleet_repair(revert=False)
|
||||
self.delay_abyssal()
|
||||
|
||||
def os_abyssal(self):
|
||||
while True:
|
||||
self.clear_abyssal()
|
||||
self.config.check_task_switch()
|
||||
Reference in New Issue
Block a user