From 1e84a50330e663fc6b9fe852a885f1f1c844950d Mon Sep 17 00:00:00 2001 From: Midorica Date: Mon, 6 Nov 2023 21:04:49 -0500 Subject: [PATCH 1/5] fixing again the render_POST for CXB --- titles/cxb/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/titles/cxb/index.py b/titles/cxb/index.py index 0ef8667..0c38d55 100644 --- a/titles/cxb/index.py +++ b/titles/cxb/index.py @@ -103,7 +103,7 @@ class CxbServlet(resource.Resource): else: self.logger.info(f"Ready on port {self.game_cfg.server.port}") - def render_POST(self, request: Request, version: int, endpoint: str): + def render_POST(self, request: Request): version = 0 internal_ver = 0 func_to_find = "" From e88e1f82f88973d100cde4486b93a5013a5f32fb Mon Sep 17 00:00:00 2001 From: Midorica Date: Mon, 6 Nov 2023 21:55:05 -0500 Subject: [PATCH 2/5] fixing get_energy for CXB --- titles/cxb/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/titles/cxb/base.py b/titles/cxb/base.py index 89e9cc3..4a92ca6 100644 --- a/titles/cxb/base.py +++ b/titles/cxb/base.py @@ -530,7 +530,6 @@ class CxbBase: profile = self.data.profile.get_profile_index(0, uid, self.version) data1 = profile["data"] p = self.data.item.get_energy(uid) - energy = p["energy"] if not p: self.data.item.put_energy(uid, 5) @@ -543,6 +542,7 @@ class CxbBase: } array = [] + energy = p["energy"] newenergy = int(energy) + 5 self.data.item.put_energy(uid, newenergy) From a497a9806dda5320949effc418bc5db86941e0d5 Mon Sep 17 00:00:00 2001 From: Midorica Date: Tue, 7 Nov 2023 22:40:15 -0500 Subject: [PATCH 3/5] fixing CXB render_POST --- titles/cxb/index.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/titles/cxb/index.py b/titles/cxb/index.py index 0c38d55..4011537 100644 --- a/titles/cxb/index.py +++ b/titles/cxb/index.py @@ -111,7 +111,10 @@ class CxbServlet(resource.Resource): subcmd = "" req_url = request.uri.decode() url_split = req_url.split("/") - req_bytes = request.content.getvalue() + try: + req_bytes = request.content.getvalue() + except: + req_bytes = request.content.read().decode("utf-8") try: req_json: Dict = json.loads(req_bytes) From d400a0be4b0b0c604b00b6f8929b38f29a6914c7 Mon Sep 17 00:00:00 2001 From: Midorica Date: Fri, 16 Aug 2024 09:25:39 -0400 Subject: [PATCH 4/5] adding luminous to readme --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 505f241..c792928 100644 --- a/readme.md +++ b/readme.md @@ -29,6 +29,7 @@ Games listed below have been tested and confirmed working. Only game versions ol + NEW PLUS + SUN + SUN PLUS + + LUMINOUS + crossbeats REV. + Crossbeats REV. From eacd4a2f4388861bba8226dee113a2054340d8c7 Mon Sep 17 00:00:00 2001 From: daydensteve Date: Mon, 2 Sep 2024 20:00:59 -0400 Subject: [PATCH 5/5] Adding stock_tickets and stock_count chuni mods. Enables specified tickets to be auto-stocked on login --- docs/game_specific_info.md | 14 ++++++++------ example_config/chuni.yaml | 6 +++++- titles/chuni/base.py | 27 +++++++++++++++++++++------ titles/chuni/config.py | 12 ++++++++++++ 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 33d5710..37561fc 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -80,12 +80,14 @@ The importer for Chunithm will import: Events, Music, Charge Items and Avatar Ac 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. | -| `use_login_bonus`| This is used to enable the login bonuses | -| `crypto` | This option is used to enable the TLS Encryption | +| 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. | +| `use_login_bonus`| This is used to enable the login bonuses | +| `stock_tickets` | If this is set, specifies tickets to auto-stock at login. Format is a comma-delimited list of IDs. Defaults to None | +| `stock_count` | Ignored if stock_tickets is not specified. Number to stock of each ticket. Defaults to 99 | +| `crypto` | This option is used to enable the TLS Encryption | If you would like to use network encryption, add the keys to the `keys` section under `crypto`, where the key diff --git a/example_config/chuni.yaml b/example_config/chuni.yaml index 4855fa1..ca27fad 100644 --- a/example_config/chuni.yaml +++ b/example_config/chuni.yaml @@ -8,7 +8,11 @@ team: mods: use_login_bonus: True - + # stock_tickets allows specified ticket IDs to be auto-stocked at login. Format is a comma-delimited string of ticket IDs + # note: quanity is not refreshed on "continue" after set - only on subsequent login + stock_tickets: + stock_count: 99 + version: 11: rom: 2.00.00 diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 9be4bf7..0e0adac 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -24,20 +24,35 @@ class ChuniBase: async def handle_game_login_api_request(self, data: Dict) -> Dict: """ - Handles the login bonus logic, required for the game because - getUserLoginBonus gets called after getUserItem and therefore the + Handles the login bonus and ticket stock logic, required for the game + because getUserLoginBonus gets called after getUserItem; therefore the items needs to be inserted in the database before they get requested. - Adds a bonusCount after a user logged in after 24 hours, makes sure - loginBonus 30 gets looped, only show the login banner every 24 hours, - adds the bonus to items (itemKind 6) + - Adds a stock for each specified ticket (itemKind 5) + - Adds a bonusCount after a user logged in after 24 hours, makes sure + loginBonus 30 gets looped, only show the login banner every 24 hours, + adds the bonus to items (itemKind 6) """ + user_id = data["userId"] + + # If we want to make certain tickets always available, stock them now + if self.game_cfg.mods.stock_tickets: + for ticket in self.game_cfg.mods.stock_tickets.split(","): + await self.data.item.put_item( + user_id, + { + "itemId": ticket.strip(), + "itemKind": 5, + "stock": self.game_cfg.mods.stock_count, + "isValid": True, + }, + ) + # ignore the login bonus if disabled in config if not self.game_cfg.mods.use_login_bonus: return {"returnCode": 1} - user_id = data["userId"] login_bonus_presets = await self.data.static.get_login_bonus_presets(self.version) for preset in login_bonus_presets: diff --git a/titles/chuni/config.py b/titles/chuni/config.py index 72329ec..dcdfce4 100644 --- a/titles/chuni/config.py +++ b/titles/chuni/config.py @@ -53,6 +53,18 @@ class ChuniModsConfig: self.__config, "chuni", "mods", "use_login_bonus", default=True ) + @property + def stock_tickets(self) -> str: + return CoreConfig.get_config_field( + self.__config, "chuni", "mods", "stock_tickets", default=None + ) + + @property + def stock_count(self) -> int: + return CoreConfig.get_config_field( + self.__config, "chuni", "mods", "stock_count", default=99 + ) + class ChuniVersionConfig: def __init__(self, parent_config: "ChuniConfig") -> None: