2023-02-17 06:02:21 +00:00
|
|
|
from typing import Dict, List
|
|
|
|
from core.config import CoreConfig
|
|
|
|
|
2023-03-09 16:38:58 +00:00
|
|
|
|
|
|
|
class WaccaServerConfig:
|
2023-02-17 06:02:21 +00:00
|
|
|
def __init__(self, parent_config: "WaccaConfig") -> None:
|
|
|
|
self.__config = parent_config
|
2023-03-09 16:38:58 +00:00
|
|
|
|
2023-02-17 06:02:21 +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
|
|
|
|
)
|
|
|
|
|
2023-02-17 06:02:21 +00:00
|
|
|
@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"
|
|
|
|
)
|
|
|
|
)
|
2023-02-17 06:02:21 +00:00
|
|
|
|
2023-03-02 03:01:35 +00:00
|
|
|
@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-02 03:01:35 +00:00
|
|
|
|
2023-03-09 16:38:58 +00:00
|
|
|
class WaccaModsConfig:
|
2023-02-17 06:02:21 +00:00
|
|
|
def __init__(self, parent_config: "WaccaConfig") -> None:
|
|
|
|
self.__config = parent_config
|
2023-03-09 16:38:58 +00:00
|
|
|
|
2023-02-17 06:02:21 +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
|
|
|
|
)
|
|
|
|
|
2023-02-17 06:02:21 +00:00
|
|
|
@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
|
|
|
|
)
|
2023-02-17 06:02:21 +00:00
|
|
|
|
|
|
|
@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-02-17 06:02:21 +00:00
|
|
|
|
2023-03-09 16:38:58 +00:00
|
|
|
|
|
|
|
class WaccaGateConfig:
|
2023-02-17 06:02:21 +00:00
|
|
|
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=[]
|
|
|
|
)
|
|
|
|
|
2023-02-17 06:02:21 +00:00
|
|
|
|
|
|
|
class WaccaConfig(dict):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.server = WaccaServerConfig(self)
|
|
|
|
self.mods = WaccaModsConfig(self)
|
|
|
|
self.gates = WaccaGateConfig(self)
|