mai2: Added BUDDiES PLUS Support

This commit is contained in:
zaphkito 2024-08-03 20:57:42 +08:00
parent 68bbde209a
commit 8438647b48
7 changed files with 99 additions and 3 deletions

View File

@ -216,6 +216,7 @@ Presents are items given to the user when they login, with a little animation (f
| SDEZ | 19 | maimai DX FESTiVAL |
| SDEZ | 20 | maimai DX FESTiVAL PLUS |
| SDEZ | 21 | maimai DX BUDDiES |
| SDEZ | 22 | maimai DX BUDDiES PLUS |
### Importer

View File

@ -207,6 +207,7 @@ class CardMakerReader(BaseReader):
"1.30": Mai2Constants.VER_MAIMAI_DX_FESTIVAL,
"1.35": Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS,
"1.40": Mai2Constants.VER_MAIMAI_DX_BUDDIES,
"1.45": Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS,
}
for root, dirs, files in os.walk(base_dir):

View File

@ -0,0 +1,63 @@
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": "2000-01-01 00:00:00",
"beforeDate": "2099-12-31 23:59:59"
}
}
async def handle_get_user_mission_data_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
return {
"userId": user_id,
"userWeeklyData":{
"lastLoginWeek": "1900/01/01",
"beforeLoginWeek": "1900/01/01",
"friendBonusFlag": False
},
"userMissionDataList":[]
}
async def handle_get_user_friend_bonus_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
return {
"userId": user_id,
"returnCode": 0,
"getMiles": 0
}
async def handle_get_user_shop_stock_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
return {
"userId": user_id,
"userShopStockList": []
}
async def handle_get_user_intimate_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
return {
"userId": user_id,
"length": 0,
"userIntimateList": []
}

View File

@ -55,6 +55,7 @@ class Mai2Constants:
VER_MAIMAI_DX_FESTIVAL = 19
VER_MAIMAI_DX_FESTIVAL_PLUS = 20
VER_MAIMAI_DX_BUDDIES = 21
VER_MAIMAI_DX_BUDDIES_PLUS = 22
VERSION_STRING = (
"maimai",
@ -78,7 +79,8 @@ class Mai2Constants:
"maimai DX UNiVERSE PLUS",
"maimai DX FESTiVAL",
"maimai DX FESTiVAL PLUS",
"maimai DX BUDDiES"
"maimai DX BUDDiES",
"maimai DX BUDDiES PLUS",
)
@classmethod

View File

@ -259,6 +259,20 @@ class Mai2DX(Mai2Base):
if "user2pPlaylog" in upsert:
await self.data.score.put_playlog_2p(user_id, upsert["user2pPlaylog"])
# if "userFavouritemusicList" in upsert:
# if "userGetPointList" in upsert:
# if "userIntimateList" in upsert:
# if "userMissionDataList" in upsert:
# if "userShopItemStockList" in upsert:
# if "userTrideItemList" in upsert:
# if "userWeeklyData" in upsert:
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
async def handle_get_user_data_api_request(self, data: Dict) -> Dict:

View File

@ -30,6 +30,7 @@ from .universeplus import Mai2UniversePlus
from .festival import Mai2Festival
from .festivalplus import Mai2FestivalPlus
from .buddies import Mai2Buddies
from .buddiesplus import Mai2BuddiesPlus
class Mai2Servlet(BaseServlet):
@ -64,7 +65,8 @@ class Mai2Servlet(BaseServlet):
Mai2UniversePlus,
Mai2Festival,
Mai2FestivalPlus,
Mai2Buddies
Mai2Buddies,
Mai2BuddiesPlus,
]
self.logger = logging.getLogger("mai2")
@ -302,8 +304,10 @@ class Mai2Servlet(BaseServlet):
internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL
elif version >= 135 and version < 140: # FESTiVAL PLUS
internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL_PLUS
elif version >= 140: # BUDDiES
elif version >= 140 and version < 145: # BUDDiES
internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES
elif version >= 145: # BUDDiES PLUS
internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_PLUS
elif game_code == "SDGA": # Int
if version < 105: # 1.0
internal_ver = Mai2Constants.VER_MAIMAI_DX
@ -321,6 +325,10 @@ class Mai2Servlet(BaseServlet):
internal_ver = Mai2Constants.VER_MAIMAI_DX_FESTIVAL
elif version >= 135 and version < 140: # FESTiVAL PLUS
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: # BUDDiES PLUS
internal_ver = Mai2Constants.VER_MAIMAI_DX_BUDDIES_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

View File

@ -43,6 +43,12 @@ detail = Table(
Column("currentPlayCount", Integer), # new with buddies
Column("renameCredit", Integer), # new with buddies
Column("mapStock", Integer), # new with fes+
Column("point", Integer), # new with bud+
Column("totalPoint", Integer), # new with bud+
Column("viewIconId", Integer), # new with bud+
Column("viewTitleId", Integer), # new with bud+
Column("viewPlateId", Integer), # new with bud+
Column("viewFrameId", Integer), # new with bud+
Column("eventWatchedDate", String(25)),
Column("lastGameId", String(25)),
Column("lastRomVersion", String(25)),
@ -97,6 +103,7 @@ detail = Table(
Column("playerOldRating", BigInteger),
Column("playerNewRating", BigInteger),
Column("dateTime", BigInteger),
Column("friendRegistSkip", Integer), # new with bud+
Column("banState", Integer), # new with uni+
UniqueConstraint("user", "version", name="mai2_profile_detail_uk"),
mysql_charset="utf8mb4",