Added support for maimai and Chunithm in Card Maker 1.34/1.35 (#14)

Co-authored-by: Dniel97 <Dniel97@noreply.gitea.tendokyu.moe>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/14
Co-authored-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
Co-committed-by: Dniel97 <dniel97@noreply.gitea.tendokyu.moe>
This commit is contained in:
Dniel97
2023-03-15 20:03:22 +00:00
committed by Hay1tsme
parent a791142f95
commit 2af7751504
32 changed files with 1763 additions and 202 deletions

View File

@@ -452,7 +452,8 @@ class OngekiBase:
tmp.pop("id")
items.append(tmp)
xout = kind * 10000000000 + (data["nextIndex"] % 10000000000) + len(items)
xout = kind * 10000000000 + \
(data["nextIndex"] % 10000000000) + len(items)
if len(items) < data["maxCount"] or data["maxCount"] == 0:
nextIndex = 0
@@ -851,7 +852,8 @@ class OngekiBase:
)
if "userOption" in upsert and len(upsert["userOption"]) > 0:
self.data.profile.put_profile_options(user_id, upsert["userOption"][0])
self.data.profile.put_profile_options(
user_id, upsert["userOption"][0])
if "userPlaylogList" in upsert:
for playlog in upsert["userPlaylogList"]:

View File

@@ -93,7 +93,12 @@ class OngekiBright(OngekiBase):
def handle_cm_get_user_character_api_request(self, data: Dict) -> Dict:
user_characters = self.data.item.get_characters(data["userId"])
if user_characters is None:
return {}
return {
"userId": data["userId"],
"length": 0,
"nextIndex": 0,
"userCharacterList": []
}
max_ct = data["maxCount"]
next_idx = data["nextIndex"]
@@ -543,7 +548,7 @@ class OngekiBright(OngekiBase):
"returnCode": 1,
"orderId": 0,
"serialId": "11111111111111111111",
"apiName": "CMUpsertUserPrintPlaylogApi",
"apiName": "CMUpsertUserPrintPlaylogApi"
}
def handle_cm_upsert_user_printlog_api_request(self, data: Dict) -> Dict:
@@ -551,7 +556,7 @@ class OngekiBright(OngekiBase):
"returnCode": 1,
"orderId": 0,
"serialId": "11111111111111111111",
"apiName": "CMUpsertUserPrintlogApi",
"apiName": "CMUpsertUserPrintlogApi"
}
def handle_cm_upsert_user_print_api_request(self, data: Dict) -> Dict:

View File

@@ -142,8 +142,8 @@ class OngekiBrightMemory(OngekiBright):
user_data = super().handle_cm_get_user_data_api_request(data)
# hardcode Card Maker version for now
# Card Maker 1.34.00 = 1.30.01
# Card Maker 1.36.00 = 1.35.04
user_data["userData"]["compatibleCmVersion"] = "1.35.04"
# Card Maker 1.34 = 1.30.01
# Card Maker 1.35 = 1.35.03
user_data["userData"]["compatibleCmVersion"] = "1.35.03"
return user_data

View File

@@ -3,7 +3,8 @@ import json
import inflection
import yaml
import string
import logging, coloredlogs
import logging
import coloredlogs
import zlib
from logging.handlers import TimedRotatingFileHandler
from os import path
@@ -93,7 +94,7 @@ class OngekiServlet:
)
def render_POST(self, request: Request, version: int, url_path: str) -> bytes:
if url_path.lower() == "/ping":
if url_path.lower() == "ping":
return zlib.compress(b'{"returnCode": 1}')
req_raw = request.content.getvalue()

View File

@@ -706,7 +706,7 @@ class OngekiItemData(BaseData):
)
conflict = sql.on_duplicate_key_update(
user=aime_id, serialId=serial_id, **user_print_data
user=aime_id, **user_print_data
)
result = self.execute(conflict)