diva: add configurable banner_msg

This commit is contained in:
Hay1tsme 2023-10-05 12:29:02 -04:00
parent 5e03193819
commit b2a01d20d5
3 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
server:
enable: True
loglevel: "info"
banner_msg: ""
mods:
unlock_all_modules: True

View File

@ -57,7 +57,7 @@ class DivaBase:
def handle_ping_request(self, data: bytes) -> str:
encoded = "&"
params = {
"ping_b_msg": f"Welcome to {self.core_cfg.server.name} network!",
"ping_b_msg": f"Welcome to {self.core_cfg.server.name} network!" if not self.game_config.server.banner_msg else self.game_config.server.banner_msg,
"ping_m_msg": "xxx",
"atnd_lut": f"{self.time_lut}",
"fi_lut": f"{self.time_lut}",
@ -93,9 +93,8 @@ class DivaBase:
"nblss_ltt_ed_tm": "2019-09-22 12:00:00.0",
}
encoded += parse.urlencode(params)
encoded += parse.urlencode(params, safe=",")
encoded = encoded.replace("+", "%20")
encoded = encoded.replace("%2C", ",")
return encoded
@ -287,8 +286,8 @@ class DivaBase:
"fi_add_vp": "20,5",
"fi_mul_vp": "1,2",
"fi_st": "2019-01-01 00:00:00.0,2019-01-01 00:00:00.0",
"fi_et": "2029-01-01 00:00:00.0,2029-01-01 00:00:00.0",
"fi_lut": "{self.time_lut}",
"fi_et": "2029-01-01 00:00:00.0,2029-01-01 00:00:00.0", # TODO: make this last longer
"fi_lut": f"{self.time_lut}",
}
encoded += parse.urlencode(params)

View File

@ -18,6 +18,12 @@ class DivaServerConfig:
self.__config, "diva", "server", "loglevel", default="info"
)
)
@property
def banner_msg(self) -> str:
CoreConfig.get_config_field(
self.__config, "diva", "server", "banner_msg", default=""
)
class DivaModsConfig: