1
0
forked from Hay1tsme/artemis
artemis-bugfix/titles/wacca/config.py

69 lines
1.9 KiB
Python
Raw Normal View History

from typing import Dict, List
from core.config import CoreConfig
2023-03-09 16:38:58 +00:00
class WaccaServerConfig:
def __init__(self, parent_config: "WaccaConfig") -> None:
self.__config = parent_config
2023-03-09 16:38:58 +00:00
@property
def enable(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "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, "wacca", "server", "loglevel", default="info"
)
)
@property
def prefecture_name(self) -> str:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "server", "prefecture_name", default="Hokkaido"
)
2023-03-09 16:38:58 +00:00
class WaccaModsConfig:
def __init__(self, parent_config: "WaccaConfig") -> None:
self.__config = parent_config
2023-03-09 16:38:58 +00:00
@property
def always_vip(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "mods", "always_vip", default=True
)
@property
def infinite_tickets(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "mods", "infinite_tickets", default=True
)
@property
def infinite_wp(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "mods", "infinite_wp", default=True
)
2023-03-09 16:38:58 +00:00
class WaccaGateConfig:
def __init__(self, parent_config: "WaccaConfig") -> None:
self.__config = parent_config
@property
def enabled_gates(self) -> List[int]:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "wacca", "gates", "enabled_gates", default=[]
)
class WaccaConfig(dict):
def __init__(self) -> None:
self.server = WaccaServerConfig(self)
self.mods = WaccaModsConfig(self)
self.gates = WaccaGateConfig(self)