database support for prism

kaleidxScope Key Condition store
This commit is contained in:
SoulGateKey
2025-04-04 09:10:41 +08:00
parent 9a7fc007bc
commit c0df7cd084
4 changed files with 113 additions and 9 deletions

View File

@@ -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: