3
2
forked from Dniel97/artemis
artemis/titles/diva/config.py

44 lines
1.2 KiB
Python
Raw Permalink Normal View History

from core.config import CoreConfig
2023-03-09 16:38:58 +00:00
class DivaServerConfig:
def __init__(self, parent_config: "DivaConfig") -> None:
self.__config = parent_config
@property
def enable(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "diva", "server", "enable", default=True
)
@property
def loglevel(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.str_to_loglevel(
CoreConfig.get_config_field(
self.__config, "diva", "server", "loglevel", default="info"
)
)
2023-03-09 16:38:58 +00:00
class DivaModsConfig:
def __init__(self, parent_config: "DivaConfig") -> None:
self.__config = parent_config
@property
def unlock_all_modules(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "diva", "mods", "unlock_all_modules", default=True
)
@property
def unlock_all_items(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "diva", "mods", "unlock_all_items", default=True
)
class DivaConfig(dict):
def __init__(self) -> None:
self.server = DivaServerConfig(self)
self.mods = DivaModsConfig(self)