From bfaadff9f6d73d4ab87c9d87ba55987f76e0e4d4 Mon Sep 17 00:00:00 2001 From: Midorica Date: Sat, 7 Oct 2023 12:31:08 -0400 Subject: [PATCH] pushing news support customization for chunithm --- docs/game_specific_info.md | 1 + example_config/chuni.yaml | 1 + titles/chuni/base.py | 12 +++++++++++- titles/chuni/config.py | 6 ++++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 12a8e86..722fdda 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -65,6 +65,7 @@ Config file is located in `config/chuni.yaml`. | Option | Info | |------------------|----------------------------------------------------------------------------------------------------------------| +| `news_msg` | If this is set, the news at the top of the main screen will be displayed (up to Chunithm Paradise Lost) | | `name` | If this is set, all players that are not on a team will use this one by default. | | `rank_scale` | Scales the in-game ranking based on the number of teams within the database | | `use_login_bonus`| This is used to enable the login bonuses | diff --git a/example_config/chuni.yaml b/example_config/chuni.yaml index 687b195..09e3569 100644 --- a/example_config/chuni.yaml +++ b/example_config/chuni.yaml @@ -1,6 +1,7 @@ server: enable: True loglevel: "info" + news_msg: "" team: name: ARTEMiS # If this is set, all players that are not on a team will use this one by default. diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 1a7f350..0783b55 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -181,7 +181,17 @@ class ChuniBase: return {"type": data["type"], "length": 0, "gameIdlistList": []} def handle_get_game_message_api_request(self, data: Dict) -> Dict: - return {"type": data["type"], "length": "0", "gameMessageList": []} + return { + "type": data["type"], + "length": 1, + "gameMessageList": [{ + "id": 1, + "type": 1, + "message": f"Welcome to {self.core_cfg.server.name} network!" if not self.game_config.server.news_msg else self.game_config.server.news_msg, + "startDate": "2017-12-05 07:00:00.0", + "endDate": "2099-12-31 00:00:00.0" + }] + } def handle_get_game_ranking_api_request(self, data: Dict) -> Dict: return {"type": data["type"], "gameRankingList": []} diff --git a/titles/chuni/config.py b/titles/chuni/config.py index 9b294ad..2ec1368 100644 --- a/titles/chuni/config.py +++ b/titles/chuni/config.py @@ -19,6 +19,12 @@ class ChuniServerConfig: self.__config, "chuni", "server", "loglevel", default="info" ) ) + + @property + def news_msg(self) -> str: + CoreConfig.get_config_field( + self.__config, "chuni", "server", "news_msg", default="" + ) class ChuniTeamConfig: