1
0
mirror of synced 2024-12-18 16:25:53 +01:00
artemis/titles/ongeki/config.py

40 lines
1.0 KiB
Python
Raw Normal View History

2023-03-03 23:46:29 +01:00
from typing import List
from core.config import CoreConfig
2023-03-03 23:46:29 +01:00
2023-03-09 17:38:58 +01:00
class OngekiServerConfig:
def __init__(self, parent_config: "OngekiConfig") -> None:
self.__config = parent_config
2023-03-03 23:46:29 +01:00
@property
def enable(self) -> bool:
2023-03-09 17:38:58 +01:00
return CoreConfig.get_config_field(
self.__config, "ongeki", "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, "ongeki", "server", "loglevel", default="info"
)
)
2023-03-03 23:46:29 +01:00
2023-03-09 17:38:58 +01:00
class OngekiGachaConfig:
2023-03-03 23:46:29 +01:00
def __init__(self, parent_config: "OngekiConfig") -> None:
self.__config = parent_config
@property
def enabled_gachas(self) -> List[int]:
2023-03-09 17:38:58 +01:00
return CoreConfig.get_config_field(
self.__config, "ongeki", "gachas", "enabled_gachas", default=[]
)
2023-03-03 23:46:29 +01:00
class OngekiConfig(dict):
def __init__(self) -> None:
self.server = OngekiServerConfig(self)
2023-03-03 23:46:29 +01:00
self.gachas = OngekiGachaConfig(self)