2022-09-13 16:35:13 +08:00
|
|
|
import os
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
2022-09-13 19:35:12 +08:00
|
|
|
from module.config.config import AzurLaneConfig, name_to_function
|
|
|
|
|
from module.config.utils import filepath_config
|
2022-09-13 16:35:13 +08:00
|
|
|
|
|
|
|
|
from submodule.AlasMaaBridge.module.config.config_generated import GeneratedConfig
|
|
|
|
|
from submodule.AlasMaaBridge.module.config.config_updater import ConfigUpdater
|
|
|
|
|
|
|
|
|
|
|
2022-09-13 19:35:12 +08:00
|
|
|
class ArknightsConfig(AzurLaneConfig, ConfigUpdater, GeneratedConfig):
|
|
|
|
|
SCHEDULER_PRIORITY = """
|
|
|
|
|
MaaStartup
|
|
|
|
|
> MaaRecruit > MaaInfrast
|
2022-09-17 16:04:36 +08:00
|
|
|
> MaaVisit > MaaMall
|
2022-09-13 19:35:12 +08:00
|
|
|
> MaaAnnihilation > MaaMaterial
|
2022-09-17 16:04:36 +08:00
|
|
|
> MaaFight > MaaAward
|
2023-02-04 16:47:55 +08:00
|
|
|
> MaaReclamationAlgorithm
|
2022-09-17 16:04:36 +08:00
|
|
|
> MaaRoguelike
|
2022-09-13 19:35:12 +08:00
|
|
|
"""
|
|
|
|
|
|
2022-09-13 16:35:13 +08:00
|
|
|
def __init__(self, config_name, task=None):
|
|
|
|
|
super().__init__(config_name, task)
|
|
|
|
|
if task is None:
|
|
|
|
|
task = name_to_function("Maa")
|
|
|
|
|
self.bind(task)
|
|
|
|
|
self.task = task
|
|
|
|
|
self.save()
|
|
|
|
|
|
2023-12-29 09:50:27 +08:00
|
|
|
def bind(self, func, func_list=None):
|
|
|
|
|
if func_list is None:
|
|
|
|
|
func_list = ['Maa']
|
|
|
|
|
super().bind(func, func_list)
|
2022-09-13 16:35:13 +08:00
|
|
|
|
|
|
|
|
def save(self, mod_name='maa'):
|
|
|
|
|
super().save(mod_name)
|
|
|
|
|
|
2022-11-05 04:17:14 +08:00
|
|
|
def get_mtime(self):
|
2022-09-13 16:35:13 +08:00
|
|
|
timestamp = os.stat(filepath_config(self.config_name, mod_name='maa')).st_mtime
|
|
|
|
|
mtime = datetime.fromtimestamp(timestamp).replace(microsecond=0)
|
|
|
|
|
return mtime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def load_config(config_name, task):
|
|
|
|
|
return ArknightsConfig(config_name, task)
|