1
0
mirror of synced 2025-02-15 09:52:35 +01:00
artemis/titles/mai2/buddiesplus.py
ppc f47175a144 [mai2] add buddies plus support (#177)
Adds favorite music support (there's an option in the results screen to star a song), handlers for new methods and fixes upsert failures for `userFavoriteList`.
The `UserIntimateApi` has been added but didn't seem to add any data during testing, and `CreateTokenApi`/`RemoveTokenApi` have also been added but I think they're only used during guest play.

---
Tested on 1.45 with no errors/game crashes (see logs). Card Maker hasn't been tested as I don't have a setup to play with.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/177
Co-authored-by: ppc <albie@ppc.moe>
Co-committed-by: ppc <albie@ppc.moe>
2024-09-23 17:21:29 +00:00

61 lines
2.0 KiB
Python

from typing import Dict
from core.config import CoreConfig
from titles.mai2.buddies import Mai2Buddies
from titles.mai2.const import Mai2Constants
from titles.mai2.config import Mai2Config
class Mai2BuddiesPlus(Mai2Buddies):
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
super().__init__(cfg, game_cfg)
self.version = Mai2Constants.VER_MAIMAI_DX_BUDDIES_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.45.00"
return user_data
async def handle_get_game_weekly_data_api_request(self, data: Dict) -> Dict:
return {
"gameWeeklyData": {
"missionCategory": 0,
"updateDate": "2024-03-21 09:00:00",
"beforeDate": "2099-12-31 00:00:00"
}
}
async def handle_create_token_api_request(self, data: Dict) -> Dict:
return {
"Bearer": "ARTEMiSTOKEN" # duplicate of handle_user_login_api_request from Mai2Festival
}
async def handle_remove_token_api_request(self, data: Dict) -> Dict:
return {}
async def handle_get_user_friend_bonus_api_request(self, data: Dict) -> Dict:
return {
"userId": data["userId"],
"returnCode": 1,
"getMiles": 0
}
async def handle_get_user_shop_stock_api_request(self, data: Dict) -> Dict:
return {
"userId": data["userId"],
"userShopStockList": []
}
async def handle_get_user_mission_data_api_request(self, data: Dict) -> Dict:
return {
"userId": data["userId"],
"userMissionDataList": [],
"userWeeklyData": {
"lastLoginWeek": "2024-03-21 09:00:00",
"beforeLoginWeek": "2099-12-31 00:00:00",
"friendBonusFlag": False
}
}