From 2f1728b64db5ca6c0d4d2bb9973368e003dd03b4 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Thu, 9 Mar 2023 10:35:58 -0500 Subject: [PATCH] cardmaker: simplify handle_get_game_connect_api_request, add develop mode check --- titles/cm/base.py | 5 ++++- titles/cm/cm136.py | 32 +++++++++----------------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/titles/cm/base.py b/titles/cm/base.py index c22fa41..636e0ee 100644 --- a/titles/cm/base.py +++ b/titles/cm/base.py @@ -22,7 +22,10 @@ class CardMakerBase(): self.version = CardMakerConstants.VER_CARD_MAKER def handle_get_game_connect_api_request(self, data: Dict) -> Dict: - uri = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}" + if self.core_cfg.server.is_develop: + uri = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}" + else: + f"http://{self.core_cfg.title.hostname}" # CHUNITHM = 0, maimai = 1, ONGEKI = 2 return { diff --git a/titles/cm/cm136.py b/titles/cm/cm136.py index 2859c24..2298dc8 100644 --- a/titles/cm/cm136.py +++ b/titles/cm/cm136.py @@ -17,29 +17,15 @@ class CardMaker136(CardMakerBase): self.version = CardMakerConstants.VER_CARD_MAKER_136 def handle_get_game_connect_api_request(self, data: Dict) -> Dict: - uri = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}" - - # CHUNITHM = 0, maimai = 1, ONGEKI = 2 - return { - "length": 3, - "gameConnectList": [ - { - "modelKind": 0, - "type": 1, - "titleUri": f"{uri}/SDHD/205/" - }, - { - "modelKind": 1, - "type": 1, - "titleUri": f"{uri}/SDEZ/125/" - }, - { - "modelKind": 2, - "type": 1, - "titleUri": f"{uri}/SDDT/135/" - } - ] - } + ret = super().handle_get_game_connect_api_request(data) + if self.core_cfg.server.is_develop: + uri = f"http://{self.core_cfg.title.hostname}:{self.core_cfg.title.port}" + else: + uri = f"http://{self.core_cfg.title.hostname}" + + ret["gameConnectList"][0]["titleUri"] = f"{uri}/SDHD/205/" + ret["gameConnectList"][1]["titleUri"] = f"{uri}/SDEZ/125/" + ret["gameConnectList"][2]["titleUri"] = f"{uri}/SDDT/135/" def handle_get_game_setting_api_request(self, data: Dict) -> Dict: ret = super().handle_get_game_setting_api_request(data)