2023-05-30 12:14:18 +02:00
|
|
|
from typing import Dict
|
2023-03-03 23:46:29 +01:00
|
|
|
from core.config import CoreConfig
|
|
|
|
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
class CardMakerServerConfig:
|
2023-03-03 23:46:29 +01:00
|
|
|
def __init__(self, parent_config: "CardMakerConfig") -> None:
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "cardmaker", "server", "enable", default=True
|
|
|
|
)
|
2023-03-03 23:46:29 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def loglevel(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.str_to_loglevel(
|
|
|
|
CoreConfig.get_config_field(
|
|
|
|
self.__config, "cardmaker", "server", "loglevel", default="info"
|
|
|
|
)
|
|
|
|
)
|
2023-03-03 23:46:29 +01:00
|
|
|
|
|
|
|
|
2023-05-30 12:14:18 +02:00
|
|
|
class CardMakerVersionConfig:
|
|
|
|
def __init__(self, parent_config: "CardMakerConfig") -> None:
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
def version(self, version: int) -> Dict:
|
|
|
|
"""
|
|
|
|
in the form of:
|
|
|
|
1: {"ongeki": 1.30.01, "chuni": 2.00.00, "maimai": 1.20.00}
|
|
|
|
"""
|
|
|
|
return CoreConfig.get_config_field(
|
2023-08-19 07:35:15 +02:00
|
|
|
self.__config, "cardmaker", "version", default={
|
|
|
|
0: {
|
|
|
|
"ongeki": "1.30.01",
|
|
|
|
"chuni": "2.00.00",
|
|
|
|
"maimai": "1.20.00"
|
|
|
|
},
|
|
|
|
1: {
|
|
|
|
"ongeki": "1.35.03",
|
|
|
|
"chuni": "2.10.00",
|
|
|
|
"maimai": "1.30.00"
|
|
|
|
}
|
|
|
|
}
|
2023-05-30 12:14:18 +02:00
|
|
|
)[version]
|
|
|
|
|
|
|
|
|
2023-03-03 23:46:29 +01:00
|
|
|
class CardMakerConfig(dict):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.server = CardMakerServerConfig(self)
|
2023-05-30 12:14:18 +02:00
|
|
|
self.version = CardMakerVersionConfig(self)
|