From 9bc18f179dbee153116444000a44ffb887128b80 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 12:37:43 +0800 Subject: [PATCH 01/17] add prism+ consts and cm support --- titles/cm/read.py | 3 ++- titles/mai2/const.py | 4 +++- titles/mai2/index.py | 16 +++++++++++----- titles/mai2/prismplus.py | 22 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 titles/mai2/prismplus.py diff --git a/titles/cm/read.py b/titles/cm/read.py index cf697c6..f4617e5 100644 --- a/titles/cm/read.py +++ b/titles/cm/read.py @@ -208,7 +208,8 @@ class CardMakerReader(BaseReader): "1.35": Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS, "1.40": Mai2Constants.VER_MAIMAI_DX_BUDDIES, "1.45": Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - "1.50": Mai2Constants.VER_MAIMAI_DX_PRISM + "1.50": Mai2Constants.VER_MAIMAI_DX_PRISM, + "1.55": Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS } for root, dirs, files in os.walk(base_dir): diff --git a/titles/mai2/const.py b/titles/mai2/const.py index 1d6a4dd..50d7b17 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -57,6 +57,7 @@ class Mai2Constants: VER_MAIMAI_DX_BUDDIES = 21 VER_MAIMAI_DX_BUDDIES_PLUS = 22 VER_MAIMAI_DX_PRISM = 23 + VER_MAIMAI_DX_PRISM_PLUS = 24 VERSION_STRING = ( "maimai", @@ -82,7 +83,8 @@ class Mai2Constants: "maimai DX FESTiVAL PLUS", "maimai DX BUDDiES", "maimai DX BUDDiES PLUS", - "maimai DX PRiSM" + "maimai DX PRiSM", + "maimai DX PRiSM PLUS" ) @classmethod diff --git a/titles/mai2/index.py b/titles/mai2/index.py index 86923e7..1f0a6be 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -32,6 +32,7 @@ from .festivalplus import Mai2FestivalPlus from .buddies import Mai2Buddies from .buddiesplus import Mai2BuddiesPlus from .prism import Mai2Prism +from .prismplus import Mai2PrismPlus class Mai2Servlet(BaseServlet): @@ -68,7 +69,8 @@ class Mai2Servlet(BaseServlet): Mai2FestivalPlus, Mai2Buddies, Mai2BuddiesPlus, - Mai2Prism + Mai2Prism, + Mai2PrismPlus ] self.logger = logging.getLogger("mai2") @@ -308,10 +310,12 @@ class Mai2Servlet(BaseServlet): internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS elif version >= 140 and version < 145: # BUDDiES internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES - elif version >= 145 and version <150: # BUDDiES PLUS + elif version >= 145 and version < 150: # BUDDiES PLUS internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - elif version >=150: + elif version >= 150 and version < 155: internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM + elif version >= 155: + internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS elif game_code == "SDGA": # Int if version < 105: # 1.0 @@ -332,10 +336,12 @@ class Mai2Servlet(BaseServlet): internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS elif version >= 140 and version < 145: # BUDDiES internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES - elif version >= 145 and version <150: # BUDDiES PLUS + elif version >= 145 and version < 150: # BUDDiES PLUS internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - elif version >=150: + elif version >= 150 and version < 155: internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM + elif version >= 155: + internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS if all(c in string.hexdigits for c in endpoint) and len(endpoint) == 32: # If we get a 32 character long hex string, it's a hash and we're diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py new file mode 100644 index 0000000..296207c --- /dev/null +++ b/titles/mai2/prismplus.py @@ -0,0 +1,22 @@ +from typing import Dict + +from core.config import CoreConfig +from titles.mai2.prism import Mai2Prism +from titles.mai2.const import Mai2Constants +from titles.mai2.config import Mai2Config + + + +class Mai2PrismPlus(Mai2Prism): + def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None: + super().__init__(cfg, game_cfg) + self.version = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS + + async def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict: + user_data = await super().handle_cm_get_user_preview_api_request(data) + + # hardcode lastDataVersion for CardMaker + user_data["lastDataVersion"] = "1.55.00" + return user_data + + From f8888c2392acc485c611d835b0e4883377076f92 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 12:42:40 +0800 Subject: [PATCH 02/17] add prism+ playlog support --- ...10616ba4_mai2_add_prism_playlog_support.py | 28 +++++++++++++++++++ titles/mai2/schema/score.py | 1 + 2 files changed, 29 insertions(+) create mode 100644 core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py diff --git a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py new file mode 100644 index 0000000..49eab78 --- /dev/null +++ b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py @@ -0,0 +1,28 @@ +"""Mai2 add PRiSM+ playlog support + +Revision ID: bdf710616ba4 +Revises: 16f34bf7b968 +Create Date: 2025-04-02 12:42:08.981516 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bdf710616ba4' +down_revision = '16f34bf7b968' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('mai2_playlog', sa.Column('extBool3', sa.Boolean(), nullable=True,server_default=sa.text("NULL"))) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('mai2_playlog', 'extBool3') + # ### end Alembic commands ### diff --git a/titles/mai2/schema/score.py b/titles/mai2/schema/score.py index f3e7002..06e686b 100644 --- a/titles/mai2/schema/score.py +++ b/titles/mai2/schema/score.py @@ -149,6 +149,7 @@ playlog = Table( Column("extNum4", Integer), Column("extBool1", Boolean), # new with buddies Column("extBool2", Boolean), # new with prism + Column("extBool3", Boolean), # new with prism+ Column("trialPlayAchievement", Integer), mysql_charset="utf8mb4", ) From 4ceac7db3547f1660e453b737c1037dd559e7396 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 13:49:46 +0800 Subject: [PATCH 03/17] add clientplaytimeapi support --- titles/mai2/prismplus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py index 296207c..ff9c5fc 100644 --- a/titles/mai2/prismplus.py +++ b/titles/mai2/prismplus.py @@ -19,4 +19,8 @@ class Mai2PrismPlus(Mai2Prism): user_data["lastDataVersion"] = "1.55.00" return user_data - + async def handle_upsert_client_play_time_api_request(self, data: Dict) -> Dict: + return{ + "returnCode": 1, + "apiName": "UpsertClientPlayTimeApi" + } From 756c7ce951aa96302ea2b0c077150c39797c1a91 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 13:56:56 +0800 Subject: [PATCH 04/17] update readme.md and game_specific_info.md --- docs/game_specific_info.md | 52 +++++++++++++++++++------------------- readme.md | 1 + 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 6bb3f67..052498d 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -203,32 +203,32 @@ Presents are items given to the user when they login, with a little animation (f ### Versions | Game Code | Version ID | Version Name | -|-----------|------------|-------------------------| -| SBXL | 0 | maimai | -| SBXL | 1 | maimai PLUS | -| SBZF | 2 | maimai GreeN | -| SBZF | 3 | maimai GreeN PLUS | -| SDBM | 4 | maimai ORANGE | -| SDBM | 5 | maimai ORANGE PLUS | -| SDCQ | 6 | maimai PiNK | -| SDCQ | 7 | maimai PiNK PLUS | -| SDDK | 8 | maimai MURASAKi | -| SDDK | 9 | maimai MURASAKi PLUS | -| SDDZ | 10 | maimai MiLK | -| SDDZ | 11 | maimai MiLK PLUS | -| SDEY | 12 | maimai FiNALE | -| SDEZ | 13 | maimai DX | -| SDEZ | 14 | maimai DX PLUS | -| SDEZ | 15 | maimai DX Splash | -| SDEZ | 16 | maimai DX Splash PLUS | -| SDEZ | 17 | maimai DX UNiVERSE | -| SDEZ | 18 | maimai DX UNiVERSE PLUS | -| SDEZ | 19 | maimai DX FESTiVAL | -| SDEZ | 20 | maimai DX FESTiVAL PLUS | -| SDEZ | 21 | maimai DX BUDDiES | -| SDEZ | 22 | maimai DX BUDDiES PLUS | -| SDEZ | 23 | maimai DX PRiSM | - +|----------|------------|-------------------------| +| SBXL | 0 | maimai | +| SBXL | 1 | maimai PLUS | +| SBZF | 2 | maimai GreeN | +| SBZF | 3 | maimai GreeN PLUS | +| SDBM | 4 | maimai ORANGE | +| SDBM | 5 | maimai ORANGE PLUS | +| SDCQ | 6 | maimai PiNK | +| SDCQ | 7 | maimai PiNK PLUS | +| SDDK | 8 | maimai MURASAKi | +| SDDK | 9 | maimai MURASAKi PLUS | +| SDDZ | 10 | maimai MiLK | +| SDDZ | 11 | maimai MiLK PLUS | +| SDEY | 12 | maimai FiNALE | +| SDEZ | 13 | maimai DX | +| SDEZ | 14 | maimai DX PLUS | +| SDEZ | 15 | maimai DX Splash | +| SDEZ | 16 | maimai DX Splash PLUS | +| SDEZ | 17 | maimai DX UNiVERSE | +| SDEZ | 18 | maimai DX UNiVERSE PLUS | +| SDEZ | 19 | maimai DX FESTiVAL | +| SDEZ | 20 | maimai DX FESTiVAL PLUS | +| SDEZ | 21 | maimai DX BUDDiES | +| SDEZ | 22 | maimai DX BUDDiES PLUS | +| SDEZ | 23 | maimai DX PRiSM | +| SDEZ | 24 | maimai DX PRiSM PLUS | ### Importer diff --git a/readme.md b/readme.md index e29784d..663b7cd 100644 --- a/readme.md +++ b/readme.md @@ -53,6 +53,7 @@ Games listed below have been tested and confirmed working. Only game versions ol + BUDDiES + BUDDiES PLUS + PRiSM + + PRiSM PLUS + O.N.G.E.K.I. + SUMMER From c0df7cd084e61b9ecbc86419f58a3365440200a6 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Fri, 4 Apr 2025 09:10:41 +0800 Subject: [PATCH 05/17] database support for prism kaleidxScope Key Condition store --- ....py => 5d7b38996e67_mai2_prism_support.py} | 29 +++++++++---- titles/mai2/prism.py | 16 +++++++ titles/mai2/read.py | 34 ++++++++++++++- titles/mai2/schema/static.py | 43 +++++++++++++++++++ 4 files changed, 113 insertions(+), 9 deletions(-) rename core/data/alembic/versions/{16f34bf7b968_mai2_kaleidx_scope_support.py => 5d7b38996e67_mai2_prism_support.py} (61%) diff --git a/core/data/alembic/versions/16f34bf7b968_mai2_kaleidx_scope_support.py b/core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py similarity index 61% rename from core/data/alembic/versions/16f34bf7b968_mai2_kaleidx_scope_support.py rename to core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py index b8baa1a..64416ae 100644 --- a/core/data/alembic/versions/16f34bf7b968_mai2_kaleidx_scope_support.py +++ b/core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py @@ -1,8 +1,8 @@ -"""Mai2 Kaleidx Scope Support +"""Mai2 PRiSM support -Revision ID: 16f34bf7b968 -Revises: d0f1c7fa9505 -Create Date: 2025-04-02 07:06:15.829591 +Revision ID: 5d7b38996e67 +Revises: 1d0014d35220 +Create Date: 2025-04-04 06:28:24.898912 """ from alembic import op @@ -10,15 +10,25 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -revision = '16f34bf7b968' -down_revision = 'd0f1c7fa9505' +revision = '5d7b38996e67' +down_revision = '1d0014d35220' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.create_table('mai2_score_kaleidx_scope', + op.create_table('mai2_static_kaleidxscope_condition', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('conditionId', sa.Integer(), nullable=True), + sa.Column('conditionName', sa.String(length=255), nullable=True), + sa.Column('songId', sa.Integer(), nullable=True), + sa.Column('songName', sa.String(length=255), nullable=True), + sa.PrimaryKeyConstraint('id'), + sa.UniqueConstraint('conditionId', 'conditionName', 'songId', 'songName', name='mai2_static_kaleidxscope_uk'), + mysql_charset='utf8mb4' + ) + op.create_table('mai2_score_kaleidxscope', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user', sa.Integer(), nullable=False), sa.Column('gateId', sa.Integer(), nullable=True), @@ -41,10 +51,13 @@ def upgrade(): sa.UniqueConstraint('user', 'gateId', name='mai2_score_best_uk'), mysql_charset='utf8mb4' ) + op.add_column('mai2_playlog', sa.Column('extBool2', sa.Boolean(), nullable=True, server_default=sa.text("NULL"))) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('mai2_score_kaleidx_scope') + op.drop_column('mai2_playlog', 'extBool2') + op.drop_table('mai2_score_kaleidxscope') + op.drop_table('mai2_static_kaleidxscope_condition') # ### end Alembic commands ### diff --git a/titles/mai2/prism.py b/titles/mai2/prism.py index 5db7c8a..409132c 100644 --- a/titles/mai2/prism.py +++ b/titles/mai2/prism.py @@ -49,6 +49,22 @@ class Mai2Prism(Mai2BuddiesPlus): } async def handle_get_user_kaleidx_scope_api_request(self, data: Dict) -> Dict: + # kaleidxscope keyget condition judgement + # player may get key before GateFound + for gate in range(1,7): + condition_list = await self.data.static.get_kaleidxscope_condition(gate) + if not condition_list: + continue + condition_satisfy = 0 + for condition in condition_list: + score_list = await self.data.score.get_best_scores(user_id=data["userId"], song_id=condition[3]) + if score_list: + condition_satisfy = condition_satisfy + 1 + if len(condition_list) == condition_satisfy: + new_kaleidxscope = {'gateId': gate, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + kaleidxscope = await self.data.score.get_user_kaleidxscope_list(data["userId"]) if kaleidxscope is None: diff --git a/titles/mai2/read.py b/titles/mai2/read.py index d9450ac..7bbd33f 100644 --- a/titles/mai2/read.py +++ b/titles/mai2/read.py @@ -48,8 +48,12 @@ class Mai2Reader(BaseReader): self.logger.info(f"Read from {dir}") await self.get_events(f"{dir}/event") await self.disable_events(f"{dir}/information", f"{dir}/scoreRanking") - await self.read_music(f"{dir}/music") + #await self.read_music(f"{dir}/music") await self.read_tickets(f"{dir}/ticket") + + if self.version >= Mai2Constants.VER_MAIMAI_DX_PRISM: + for dir in data_dirs: + await self.read_kaleidxscope_condition(f"{dir}/kaleidxScopeKeyCondition") else: if not os.path.exists(f"{self.bin_dir}/tables"): @@ -341,3 +345,31 @@ class Mai2Reader(BaseReader): if scores is None or text is None: return # TODO + + + async def read_kaleidxscope_condition(self, base_dir: str) -> None : + self.logger.info(f"Reading KaleidxScope Key Conditions from {base_dir}...") + + for root, dirs, files in os.walk(base_dir): + for dir in dirs: + if os.path.exists(f"{root}/{dir}/KaleidxScopeKeyCondition.xml"): + with open(f"{root}/{dir}/KaleidxScopeKeyCondition.xml", encoding="utf-8") as f: + troot = ET.fromstring(f.read()) + + condition_id = int(troot.find("name").find("id").text) + condition_name = troot.find("name").find("str").text + + music_list = troot.find("musicIds").find("list") + for music in music_list.findall("StringID"): + music_id = int(music.find("id").text) + music_name = music.find("str").text + + await self.data.static.put_kaleidxscope_condition( + condition_id, + condition_name, + music_id, + music_name + ) + self.logger.info( + f"Add music {music_id} for condition {condition_id}" + ) \ No newline at end of file diff --git a/titles/mai2/schema/static.py b/titles/mai2/schema/static.py index ddba0f8..3fe6391 100644 --- a/titles/mai2/schema/static.py +++ b/titles/mai2/schema/static.py @@ -71,6 +71,17 @@ cards = Table( mysql_charset="utf8mb4", ) +kaleidxscope_condition = Table( + "mai2_static_kaleidxscope_condition", + metadata, + Column("id", Integer, primary_key=True, nullable=False), + Column("conditionId", Integer), + Column("conditionName", String(255)), + Column("songId", Integer), + Column("songName", String(255)), + UniqueConstraint("conditionId", "conditionName", "songId", "songName", name="mai2_static_kaleidxscope_uk"), + mysql_charset="utf8mb4", +) class Mai2StaticData(BaseData): async def put_game_event( @@ -264,3 +275,35 @@ class Mai2StaticData(BaseData): result = await self.execute(event.update(event.c.id == table_id).values(enabled=is_enable, startDate = start_date)) if not result: self.logger.error(f"Failed to update event {table_id} - {is_enable} {start_date}") + + # new in prism + async def put_kaleidxscope_condition( + self, + condition_id: int, + condition_name: str, + music_id: int, + music_name: str + ) -> Optional[int]: + sql = insert(kaleidxscope_condition).values( + conditionId = condition_id, + conditionName = condition_name, + songId = music_id, + songName = music_name, + ) + + + conflict = sql.on_duplicate_key_update(conditionName=condition_name, songName=music_name) + + result = await self.execute(conflict) + if result is None: + self.logger.warning( + f"put_kaleidxscope_condition: Failed to insert kaleidxScope Key Condition! conditionID {condition_id} songId {music_id}" + ) + return result.lastrowid + + async def get_kaleidxscope_condition(self, condition_id: int) -> None: + sql = kaleidxscope_condition.select(kaleidxscope_condition.c.conditionId == condition_id) + result = await self.execute(sql) + if result is None: + return None + return result.fetchall() \ No newline at end of file From dd10508e68ae33ea8c05f647c5af8605f114f13d Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Fri, 4 Apr 2025 09:12:08 +0800 Subject: [PATCH 06/17] unused database deleted --- .../d0f1c7fa9505_mai2_add_prism_support.py | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 core/data/alembic/versions/d0f1c7fa9505_mai2_add_prism_support.py diff --git a/core/data/alembic/versions/d0f1c7fa9505_mai2_add_prism_support.py b/core/data/alembic/versions/d0f1c7fa9505_mai2_add_prism_support.py deleted file mode 100644 index c879706..0000000 --- a/core/data/alembic/versions/d0f1c7fa9505_mai2_add_prism_support.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Mai2 add PRiSM support - -Revision ID: d0f1c7fa9505 -Revises: 1d0014d35220 -Create Date: 2025-04-02 06:37:10.657372 - -""" -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = 'd0f1c7fa9505' -down_revision = '1d0014d35220' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column('mai2_playlog', sa.Column('extBool2', sa.Boolean(), nullable=True,server_default=sa.text("NULL"))) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('mai2_playlog', 'extBool2') - # ### end Alembic commands ### From 3b7a577ea208a0b01532eb457a537615cf4e3839 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 12:37:43 +0800 Subject: [PATCH 07/17] add prism+ consts and cm support --- titles/cm/read.py | 3 ++- titles/mai2/const.py | 4 +++- titles/mai2/index.py | 16 +++++++++++----- titles/mai2/prismplus.py | 22 ++++++++++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 titles/mai2/prismplus.py diff --git a/titles/cm/read.py b/titles/cm/read.py index cf697c6..f4617e5 100644 --- a/titles/cm/read.py +++ b/titles/cm/read.py @@ -208,7 +208,8 @@ class CardMakerReader(BaseReader): "1.35": Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS, "1.40": Mai2Constants.VER_MAIMAI_DX_BUDDIES, "1.45": Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - "1.50": Mai2Constants.VER_MAIMAI_DX_PRISM + "1.50": Mai2Constants.VER_MAIMAI_DX_PRISM, + "1.55": Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS } for root, dirs, files in os.walk(base_dir): diff --git a/titles/mai2/const.py b/titles/mai2/const.py index 1d6a4dd..50d7b17 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -57,6 +57,7 @@ class Mai2Constants: VER_MAIMAI_DX_BUDDIES = 21 VER_MAIMAI_DX_BUDDIES_PLUS = 22 VER_MAIMAI_DX_PRISM = 23 + VER_MAIMAI_DX_PRISM_PLUS = 24 VERSION_STRING = ( "maimai", @@ -82,7 +83,8 @@ class Mai2Constants: "maimai DX FESTiVAL PLUS", "maimai DX BUDDiES", "maimai DX BUDDiES PLUS", - "maimai DX PRiSM" + "maimai DX PRiSM", + "maimai DX PRiSM PLUS" ) @classmethod diff --git a/titles/mai2/index.py b/titles/mai2/index.py index 86923e7..1f0a6be 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -32,6 +32,7 @@ from .festivalplus import Mai2FestivalPlus from .buddies import Mai2Buddies from .buddiesplus import Mai2BuddiesPlus from .prism import Mai2Prism +from .prismplus import Mai2PrismPlus class Mai2Servlet(BaseServlet): @@ -68,7 +69,8 @@ class Mai2Servlet(BaseServlet): Mai2FestivalPlus, Mai2Buddies, Mai2BuddiesPlus, - Mai2Prism + Mai2Prism, + Mai2PrismPlus ] self.logger = logging.getLogger("mai2") @@ -308,10 +310,12 @@ class Mai2Servlet(BaseServlet): internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS elif version >= 140 and version < 145: # BUDDiES internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES - elif version >= 145 and version <150: # BUDDiES PLUS + elif version >= 145 and version < 150: # BUDDiES PLUS internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - elif version >=150: + elif version >= 150 and version < 155: internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM + elif version >= 155: + internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS elif game_code == "SDGA": # Int if version < 105: # 1.0 @@ -332,10 +336,12 @@ class Mai2Servlet(BaseServlet): internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS elif version >= 140 and version < 145: # BUDDiES internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES - elif version >= 145 and version <150: # BUDDiES PLUS + elif version >= 145 and version < 150: # BUDDiES PLUS internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS, - elif version >=150: + elif version >= 150 and version < 155: internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM + elif version >= 155: + internal_ver = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS if all(c in string.hexdigits for c in endpoint) and len(endpoint) == 32: # If we get a 32 character long hex string, it's a hash and we're diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py new file mode 100644 index 0000000..296207c --- /dev/null +++ b/titles/mai2/prismplus.py @@ -0,0 +1,22 @@ +from typing import Dict + +from core.config import CoreConfig +from titles.mai2.prism import Mai2Prism +from titles.mai2.const import Mai2Constants +from titles.mai2.config import Mai2Config + + + +class Mai2PrismPlus(Mai2Prism): + def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None: + super().__init__(cfg, game_cfg) + self.version = Mai2Constants.VER_MAIMAI_DX_PRISM_PLUS + + async def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict: + user_data = await super().handle_cm_get_user_preview_api_request(data) + + # hardcode lastDataVersion for CardMaker + user_data["lastDataVersion"] = "1.55.00" + return user_data + + From d598c8fba0867dedddd2717895c40a5a38a7d0ce Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 12:42:40 +0800 Subject: [PATCH 08/17] add prism+ playlog support --- ...10616ba4_mai2_add_prism_playlog_support.py | 28 +++++++++++++++++++ titles/mai2/schema/score.py | 1 + 2 files changed, 29 insertions(+) create mode 100644 core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py diff --git a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py new file mode 100644 index 0000000..49eab78 --- /dev/null +++ b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py @@ -0,0 +1,28 @@ +"""Mai2 add PRiSM+ playlog support + +Revision ID: bdf710616ba4 +Revises: 16f34bf7b968 +Create Date: 2025-04-02 12:42:08.981516 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bdf710616ba4' +down_revision = '16f34bf7b968' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('mai2_playlog', sa.Column('extBool3', sa.Boolean(), nullable=True,server_default=sa.text("NULL"))) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('mai2_playlog', 'extBool3') + # ### end Alembic commands ### diff --git a/titles/mai2/schema/score.py b/titles/mai2/schema/score.py index d03dba4..54e9287 100644 --- a/titles/mai2/schema/score.py +++ b/titles/mai2/schema/score.py @@ -149,6 +149,7 @@ playlog = Table( Column("extNum4", Integer), Column("extBool1", Boolean), # new with buddies Column("extBool2", Boolean), # new with prism + Column("extBool3", Boolean), # new with prism+ Column("trialPlayAchievement", Integer), mysql_charset="utf8mb4", ) From a4bcca9171135897d4cc2c310db44dfc94bef0da Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 13:49:46 +0800 Subject: [PATCH 09/17] add clientplaytimeapi support --- titles/mai2/prismplus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py index 296207c..ff9c5fc 100644 --- a/titles/mai2/prismplus.py +++ b/titles/mai2/prismplus.py @@ -19,4 +19,8 @@ class Mai2PrismPlus(Mai2Prism): user_data["lastDataVersion"] = "1.55.00" return user_data - + async def handle_upsert_client_play_time_api_request(self, data: Dict) -> Dict: + return{ + "returnCode": 1, + "apiName": "UpsertClientPlayTimeApi" + } From 134af15ed73335b2166b6f4bea6f758506e39dea Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Wed, 2 Apr 2025 13:56:56 +0800 Subject: [PATCH 10/17] update readme.md and game_specific_info.md --- docs/game_specific_info.md | 52 +++++++++++++++++++------------------- readme.md | 1 + 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 6bb3f67..052498d 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -203,32 +203,32 @@ Presents are items given to the user when they login, with a little animation (f ### Versions | Game Code | Version ID | Version Name | -|-----------|------------|-------------------------| -| SBXL | 0 | maimai | -| SBXL | 1 | maimai PLUS | -| SBZF | 2 | maimai GreeN | -| SBZF | 3 | maimai GreeN PLUS | -| SDBM | 4 | maimai ORANGE | -| SDBM | 5 | maimai ORANGE PLUS | -| SDCQ | 6 | maimai PiNK | -| SDCQ | 7 | maimai PiNK PLUS | -| SDDK | 8 | maimai MURASAKi | -| SDDK | 9 | maimai MURASAKi PLUS | -| SDDZ | 10 | maimai MiLK | -| SDDZ | 11 | maimai MiLK PLUS | -| SDEY | 12 | maimai FiNALE | -| SDEZ | 13 | maimai DX | -| SDEZ | 14 | maimai DX PLUS | -| SDEZ | 15 | maimai DX Splash | -| SDEZ | 16 | maimai DX Splash PLUS | -| SDEZ | 17 | maimai DX UNiVERSE | -| SDEZ | 18 | maimai DX UNiVERSE PLUS | -| SDEZ | 19 | maimai DX FESTiVAL | -| SDEZ | 20 | maimai DX FESTiVAL PLUS | -| SDEZ | 21 | maimai DX BUDDiES | -| SDEZ | 22 | maimai DX BUDDiES PLUS | -| SDEZ | 23 | maimai DX PRiSM | - +|----------|------------|-------------------------| +| SBXL | 0 | maimai | +| SBXL | 1 | maimai PLUS | +| SBZF | 2 | maimai GreeN | +| SBZF | 3 | maimai GreeN PLUS | +| SDBM | 4 | maimai ORANGE | +| SDBM | 5 | maimai ORANGE PLUS | +| SDCQ | 6 | maimai PiNK | +| SDCQ | 7 | maimai PiNK PLUS | +| SDDK | 8 | maimai MURASAKi | +| SDDK | 9 | maimai MURASAKi PLUS | +| SDDZ | 10 | maimai MiLK | +| SDDZ | 11 | maimai MiLK PLUS | +| SDEY | 12 | maimai FiNALE | +| SDEZ | 13 | maimai DX | +| SDEZ | 14 | maimai DX PLUS | +| SDEZ | 15 | maimai DX Splash | +| SDEZ | 16 | maimai DX Splash PLUS | +| SDEZ | 17 | maimai DX UNiVERSE | +| SDEZ | 18 | maimai DX UNiVERSE PLUS | +| SDEZ | 19 | maimai DX FESTiVAL | +| SDEZ | 20 | maimai DX FESTiVAL PLUS | +| SDEZ | 21 | maimai DX BUDDiES | +| SDEZ | 22 | maimai DX BUDDiES PLUS | +| SDEZ | 23 | maimai DX PRiSM | +| SDEZ | 24 | maimai DX PRiSM PLUS | ### Importer diff --git a/readme.md b/readme.md index e29784d..663b7cd 100644 --- a/readme.md +++ b/readme.md @@ -53,6 +53,7 @@ Games listed below have been tested and confirmed working. Only game versions ol + BUDDiES + BUDDiES PLUS + PRiSM + + PRiSM PLUS + O.N.G.E.K.I. + SUMMER From 933d8bea2100ed162a13617ffbc1f3f466291576 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Thu, 15 May 2025 02:44:37 +0800 Subject: [PATCH 11/17] add import --- titles/mai2/index.py | 1 + 1 file changed, 1 insertion(+) diff --git a/titles/mai2/index.py b/titles/mai2/index.py index acaa2ca..e5b3c24 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -32,6 +32,7 @@ from .festivalplus import Mai2FestivalPlus from .buddies import Mai2Buddies from .buddiesplus import Mai2BuddiesPlus from .prism import Mai2Prism +from .prismplus import Mai2PrismPlus class Mai2Servlet(BaseServlet): From 394ec74fb7008b9d90124a45b6590c8c175b6867 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Thu, 15 May 2025 03:14:24 +0800 Subject: [PATCH 12/17] add key unlock condition define --- titles/mai2/const.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/titles/mai2/const.py b/titles/mai2/const.py index 85d4845..d8b44dc 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -95,9 +95,13 @@ class Mai2Constants: 2: [11102, 11234, 11300, 11529, 11542, 11612], #白の扉: set Frame as "Latent Kingdom" (459504), play 3 or 4 songs by the composer 大国奏音 in 1 pc 3: [], - #紫の扉: need to enter redeem code 51090942171709440000 + #紫の扉: JP: need to enter redeem code 51090942171709440000 4: [11023, 11106, 11221, 11222, 11300, 11374, 11458, 11523, 11619, 11663, 11746], - #青の扉: Played 11 songs + #黑の扉: Played 11 songs + 5: [11003, 11095, 11152, 11224, 11296, 11375, 11452, 11529, 11608, 11669, 11736, 11806], + #黄の扉: Use random selection to play one of the songs + 6: [212, 213, 337, 270, 271, 11504, 339, 453, 11336, 11852] + #赤の扉: Played 10 songs } MAI_VERSION_LUT = { "100": VER_MAIMAI, From 8b050e89eb256ed5d887f7d994ada7172e32198e Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Thu, 15 May 2025 03:53:42 +0800 Subject: [PATCH 13/17] fix conflict mark --- .../5cf98cfe52ad_mai2_prism_support.py | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py b/core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py index cf4287c..d3296cd 100644 --- a/core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py +++ b/core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py @@ -1,14 +1,8 @@ """Mai2 PRiSM support -<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py -Revision ID: 5d7b38996e67 -Revises: 1d0014d35220 -Create Date: 2025-04-04 06:28:24.898912 -======== Revision ID: 5cf98cfe52ad Revises: 263884e774cc Create Date: 2025-04-08 08:00:51.243089 ->>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py """ from alembic import op @@ -16,32 +10,15 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. -<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py -revision = '5d7b38996e67' -down_revision = '1d0014d35220' -======== + revision = '5cf98cfe52ad' down_revision = '263884e774cc' ->>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### -<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py - op.create_table('mai2_static_kaleidxscope_condition', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('conditionId', sa.Integer(), nullable=True), - sa.Column('conditionName', sa.String(length=255), nullable=True), - sa.Column('songId', sa.Integer(), nullable=True), - sa.Column('songName', sa.String(length=255), nullable=True), - sa.PrimaryKeyConstraint('id'), - sa.UniqueConstraint('conditionId', 'conditionName', 'songId', 'songName', name='mai2_static_kaleidxscope_uk'), - mysql_charset='utf8mb4' - ) -======== ->>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py op.create_table('mai2_score_kaleidxscope', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user', sa.Integer(), nullable=False), @@ -73,8 +50,4 @@ def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('mai2_playlog', 'extBool2') op.drop_table('mai2_score_kaleidxscope') -<<<<<<<< HEAD:core/data/alembic/versions/5d7b38996e67_mai2_prism_support.py - op.drop_table('mai2_static_kaleidxscope_condition') -======== ->>>>>>>> refs/heads/develop:core/data/alembic/versions/5cf98cfe52ad_mai2_prism_support.py # ### end Alembic commands ### From 611806828a42f4a2559170b0d987249e7d312619 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Thu, 15 May 2025 08:19:42 +0800 Subject: [PATCH 14/17] add Gate 5,6 judgement --- ...f710616ba4_mai2_add_prism_plus_support.py} | 3 +- titles/mai2/prismplus.py | 86 +++++++++++++++++++ titles/mai2/schema/score.py | 4 +- 3 files changed, 90 insertions(+), 3 deletions(-) rename core/data/alembic/versions/{bdf710616ba4_mai2_add_prism_playlog_support.py => bdf710616ba4_mai2_add_prism_plus_support.py} (90%) diff --git a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py similarity index 90% rename from core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py rename to core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py index 49eab78..3620b9d 100644 --- a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_playlog_support.py +++ b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py @@ -11,7 +11,8 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'bdf710616ba4' -down_revision = '16f34bf7b968' +#TODO: change down_revision when final merge +down_revision = 'f6007bbf057d' branch_labels = None depends_on = None diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py index ff9c5fc..1719189 100644 --- a/titles/mai2/prismplus.py +++ b/titles/mai2/prismplus.py @@ -24,3 +24,89 @@ class Mai2PrismPlus(Mai2Prism): "returnCode": 1, "apiName": "UpsertClientPlayTimeApi" } + async def handle_get_game_kaleidx_scope_api_request(self, data: Dict) -> Dict: + return { + "gameKaleidxScopeList": [ + {"gateId": 1, "phaseId": 6}, + {"gateId": 2, "phaseId": 6}, + {"gateId": 3, "phaseId": 6}, + {"gateId": 4, "phaseId": 6}, + {"gateId": 5, "phaseId": 6}, + {"gateId": 6, "phaseId": 6}, + {"gateId": 7, "phaseId": 6} + ] + } + + async def handle_get_user_kaleidx_scope_api_request(self, data: Dict) -> Dict: + # kaleidxscope keyget condition judgement + # player may get key before GateFound + for gate in range(1,8): + if gate == 1 or gate == 4 or gate == 6: + condition_satisfy = 0 + for condition in Mai2Constants.KALEIDXSCOPE_KEY_CONDITION[gate]: + score_list = await self.data.score.get_best_scores(user_id=data["userId"], song_id=condition) + if score_list: + condition_satisfy = condition_satisfy + 1 + if len(Mai2Constants.KALEIDXSCOPE_KEY_CONDITION[gate]) == condition_satisfy: + new_kaleidxscope = {'gateId': gate, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + elif gate == 2: + user_profile = await self.data.profile.get_profile_detail(user_id=data["userId"], version=self.version) + user_frame = user_profile["frameId"] + if user_frame == 459504: + playlogs = await self.data.score.get_playlogs(user_id=data["userId"], idx=0, limit=0) + + playlog_dict = {} + for playlog in playlogs: + playlog_id = playlog["playlogId"] + if playlog_id not in playlog_dict: + playlog_dict[playlog_id] = [] + playlog_dict[playlog_id].append(playlog["musicId"]) + valid_playlogs = [] + allowed_music = set(Mai2Constants.KALEIDXSCOPE_KEY_CONDITION[2]) + for playlog_id, music_ids in playlog_dict.items(): + + if len(music_ids) != len(set(music_ids)): + continue + all_valid = True + for mid in music_ids: + if mid not in allowed_music: + all_valid = False + break + if all_valid: + valid_playlogs.append(playlog_id) + + if valid_playlogs: + new_kaleidxscope = {'gateId': 2, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + + elif gate == 5: + + playlogs = await self.data.score.get_playlogs(user_id=data["userId"], idx=0, limit=0) + allowed_music = set(Mai2Constants.KALEIDXSCOPE_KEY_CONDITION[5]) + valid_playlogs = [] + + for playlog in playlogs: + if playlog["extBool2"] == 1 and playlog["musicId"] in allowed_music: + valid_playlogs.append(playlog["playlogId"]) # 直接记录 playlogId + if valid_playlogs: + new_kaleidxscope = {'gateId': 5, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + kaleidxscope = await self.data.score.get_user_kaleidxscope_list(data["userId"]) + + if kaleidxscope is None: + return {"userId": data["userId"], "userKaleidxScopeList":[]} + + kaleidxscope_list = [] + for kaleidxscope_data in kaleidxscope: + tmp = kaleidxscope_data._asdict() + tmp.pop("user") + tmp.pop("id") + kaleidxscope_list.append(tmp) + return { + "userId": data["userId"], + "userKaleidxScopeList": kaleidxscope_list + } \ No newline at end of file diff --git a/titles/mai2/schema/score.py b/titles/mai2/schema/score.py index 54e9287..804cbaa 100644 --- a/titles/mai2/schema/score.py +++ b/titles/mai2/schema/score.py @@ -148,8 +148,8 @@ playlog = Table( Column("extNum2", Integer), Column("extNum4", Integer), Column("extBool1", Boolean), # new with buddies - Column("extBool2", Boolean), # new with prism - Column("extBool3", Boolean), # new with prism+ + Column("extBool2", Boolean), # new with prism IsRandomSelect + Column("extBool3", Boolean), # new with prism+ IsTrackSkip Column("trialPlayAchievement", Integer), mysql_charset="utf8mb4", ) From 0a4dc8dbb0e4530618ea0a89df58a00d35cb0f26 Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Tue, 22 Jul 2025 19:55:33 +0800 Subject: [PATCH 15/17] add Gate 7,8,9,10 support --- titles/mai2/const.py | 10 +++++++++- titles/mai2/prismplus.py | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/titles/mai2/const.py b/titles/mai2/const.py index 1813ca6..e395ba0 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -101,8 +101,16 @@ class Mai2Constants: #黑の扉: Played 11 songs 5: [11003, 11095, 11152, 11224, 11296, 11375, 11452, 11529, 11608, 11669, 11736, 11806], #黄の扉: Use random selection to play one of the songs - 6: [212, 213, 337, 270, 271, 11504, 339, 453, 11336, 11852] + 6: [212, 213, 337, 270, 271, 11504, 339, 453, 11336, 11852], #赤の扉: Played 10 songs + 7: [], + #PRISM TOWER: Get the key after clearing six doors. + 8: [], + #KALEIDXSCOPE_FIRST_STAGE: Clear Prism Tower + 9: [], + #希望の扉: CLEAR KALEIDXSCOPE_FIRST_STAGE + 10: [] + #KALEIDXSCOPE_SECOND_STAGE: JP: scan the DXPASS of 希望の鍵, will automatically unlock after clearing 希望の扉 in artemis } MAI_VERSION_LUT = { "100": VER_MAIMAI, diff --git a/titles/mai2/prismplus.py b/titles/mai2/prismplus.py index 1719189..04b8bc4 100644 --- a/titles/mai2/prismplus.py +++ b/titles/mai2/prismplus.py @@ -33,14 +33,17 @@ class Mai2PrismPlus(Mai2Prism): {"gateId": 4, "phaseId": 6}, {"gateId": 5, "phaseId": 6}, {"gateId": 6, "phaseId": 6}, - {"gateId": 7, "phaseId": 6} + {"gateId": 7, "phaseId": 6}, + {"gateId": 8, "phaseId": 6}, + {"gateId": 9, "phaseId": 6}, + {"gateId": 10, "phaseId": 13} ] } async def handle_get_user_kaleidx_scope_api_request(self, data: Dict) -> Dict: # kaleidxscope keyget condition judgement # player may get key before GateFound - for gate in range(1,8): + for gate in range(1,11): if gate == 1 or gate == 4 or gate == 6: condition_satisfy = 0 for condition in Mai2Constants.KALEIDXSCOPE_KEY_CONDITION[gate]: @@ -95,6 +98,32 @@ class Mai2PrismPlus(Mai2Prism): new_kaleidxscope = {'gateId': 5, "isKeyFound": True} await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + elif gate == 7: + + played_kaleidxscope_list = await self.data.score.get_user_kaleidxscope_list(data["userId"]) + check_results = {} + for i in range(1,7): + check_results[i] = False + for played_kaleidxscope in played_kaleidxscope_list: + if played_kaleidxscope[2] == i and played_kaleidxscope[5] == True: + check_results[i] = True + break + all_true = all(check_results.values()) + + if all_true: + new_kaleidxscope = {'gateId': 7, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + elif gate == 10: + + played_kaleidxscope_list = await self.data.score.get_user_kaleidxscope_list(data["userId"]) + for played_kaleidxscope in played_kaleidxscope_list: + if played_kaleidxscope[2] == 9 and played_kaleidxscope[5] == True: + new_kaleidxscope = {'gateId': 10, "isGateFound": True, "isKeyFound": True} + await self.data.score.put_user_kaleidxscope(data["userId"], new_kaleidxscope) + + + kaleidxscope = await self.data.score.get_user_kaleidxscope_list(data["userId"]) if kaleidxscope is None: From 21415de7754961717163d99571058cf8807ac5ec Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Fri, 19 Sep 2025 23:13:57 +0800 Subject: [PATCH 16/17] add lut --- titles/mai2/const.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/titles/mai2/const.py b/titles/mai2/const.py index e395ba0..117ba6f 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -139,7 +139,8 @@ class Mai2Constants: "135": VER_MAIMAI_DX_FESTIVAL_PLUS, "140": VER_MAIMAI_DX_BUDDIES, "145": VER_MAIMAI_DX_BUDDIES_PLUS, - "150": VER_MAIMAI_DX_PRISM + "150": VER_MAIMAI_DX_PRISM, + "155": VER_MAIMAI_DX_PRISM_PLUS } @classmethod From 77152bf25c0c20852add498373d85c95539e438c Mon Sep 17 00:00:00 2001 From: SoulGateKey Date: Tue, 7 Oct 2025 17:59:02 +0000 Subject: [PATCH 17/17] change down_revision when final merge --- .../versions/bdf710616ba4_mai2_add_prism_plus_support.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py index 3620b9d..30e736a 100644 --- a/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py +++ b/core/data/alembic/versions/bdf710616ba4_mai2_add_prism_plus_support.py @@ -11,8 +11,8 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'bdf710616ba4' -#TODO: change down_revision when final merge -down_revision = 'f6007bbf057d' + +down_revision = '49c295e89cd4' branch_labels = None depends_on = None