forked from Dniel97/artemis
wacca: allow setting prefecture in config by name
This commit is contained in:
parent
078059f54e
commit
379388c749
@ -1,6 +1,7 @@
|
||||
server:
|
||||
enable: True
|
||||
loglevel: "info"
|
||||
prefecture_name: "Hokkaido"
|
||||
|
||||
mods:
|
||||
always_vip: True
|
||||
|
@ -1,9 +1,8 @@
|
||||
from typing import Any, List, Dict
|
||||
import logging
|
||||
import inflection
|
||||
from math import floor
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.wacca.config import WaccaConfig
|
||||
from titles.wacca.const import WaccaConstants
|
||||
@ -71,6 +70,13 @@ class WaccaBase():
|
||||
}
|
||||
self.allowed_stages = []
|
||||
|
||||
prefecture_name = inflection.underscore(game_cfg.server.prefecture_name).replace(' ', '_').upper()
|
||||
if prefecture_name not in [region.name for region in WaccaConstants.Region]:
|
||||
self.logger.warning(f"Invalid prefecture name {game_cfg.server.prefecture_name} in config file")
|
||||
self.region_id = 1
|
||||
else:
|
||||
self.region_id = int(WaccaConstants.Region[prefecture_name].value)
|
||||
|
||||
def handle_housing_get_request(self, data: Dict) -> Dict:
|
||||
req = BaseRequest(data)
|
||||
housing_id = 1337
|
||||
@ -86,7 +92,7 @@ class WaccaBase():
|
||||
req = HousingStartRequestV1(data)
|
||||
|
||||
resp = HousingStartResponseV1(
|
||||
1,
|
||||
self.region_id,
|
||||
[ # Recomended songs
|
||||
1269,1007,1270,1002,1020,1003,1008,1211,1018,1092,1056,32,
|
||||
1260,1230,1258,1251,2212,1264,1125,1037,2001,1272,1126,1119,
|
||||
|
@ -13,6 +13,10 @@ class WaccaServerConfig():
|
||||
def loglevel(self) -> int:
|
||||
return CoreConfig.str_to_loglevel(CoreConfig.get_config_field(self.__config, 'wacca', 'server', 'loglevel', default="info"))
|
||||
|
||||
@property
|
||||
def prefecture_name(self) -> str:
|
||||
return CoreConfig.get_config_field(self.__config, 'wacca', 'server', 'prefecture_name', default="Hokkaido")
|
||||
|
||||
class WaccaModsConfig():
|
||||
def __init__(self, parent_config: "WaccaConfig") -> None:
|
||||
self.__config = parent_config
|
||||
|
@ -151,6 +151,7 @@ class WaccaConstants():
|
||||
KAGOSHIMA = 46
|
||||
OKINAWA = 47
|
||||
UNITED_STATES = 48
|
||||
USA = 48
|
||||
TAIWAN = 49
|
||||
HONG_KONG = 50
|
||||
SINGAPORE = 51
|
||||
|
@ -44,7 +44,7 @@ class WaccaLily(WaccaS):
|
||||
req = HousingStartRequestV2(data)
|
||||
|
||||
resp = HousingStartResponseV1(
|
||||
1,
|
||||
self.region_id,
|
||||
[ # Recomended songs
|
||||
1269,1007,1270,1002,1020,1003,1008,1211,1018,1092,1056,32,
|
||||
1260,1230,1258,1251,2212,1264,1125,1037,2001,1272,1126,1119,
|
||||
|
Loading…
Reference in New Issue
Block a user