1
0
forked from Hay1tsme/artemis

let black do it's magic

This commit is contained in:
2023-03-09 11:38:58 -05:00
parent fa7206848c
commit a76bb94eb1
150 changed files with 8474 additions and 4843 deletions

View File

@ -3,6 +3,7 @@ from typing import List, Dict, Optional
from titles.wacca.handlers.base import BaseRequest, BaseResponse
from titles.wacca.handlers.helpers import *
# ---user/status/get----
class UserStatusGetRequest(BaseRequest):
aimeId: int = 0
@ -11,6 +12,7 @@ class UserStatusGetRequest(BaseRequest):
super().__init__(data)
self.aimeId = int(data["params"][0])
class UserStatusGetV1Response(BaseResponse):
def __init__(self) -> None:
super().__init__()
@ -27,14 +29,12 @@ class UserStatusGetV1Response(BaseResponse):
self.setTitleId,
self.setIconId,
self.profileStatus.value,
[
self.versionStatus.value,
str(self.lastGameVersion)
]
[self.versionStatus.value, str(self.lastGameVersion)],
]
return super().make()
class UserStatusGetV2Response(UserStatusGetV1Response):
def __init__(self) -> None:
super().__init__()
@ -48,6 +48,7 @@ class UserStatusGetV2Response(UserStatusGetV1Response):
return super(UserStatusGetV1Response, self).make()
# ---user/status/getDetail----
class UserStatusGetDetailRequest(BaseRequest):
userId: int = 0
@ -56,6 +57,7 @@ class UserStatusGetDetailRequest(BaseRequest):
super().__init__(data)
self.userId = data["params"][0]
class UserStatusGetDetailResponseV1(BaseResponse):
def __init__(self) -> None:
super().__init__()
@ -64,22 +66,32 @@ class UserStatusGetDetailResponseV1(BaseResponse):
self.seasonalPlayModeCounts: List[PlayModeCounts] = []
self.userItems: UserItemInfoV1 = UserItemInfoV1()
self.scores: List[BestScoreDetailV1] = []
self.songPlayStatus: List[int] = [0,0]
self.songPlayStatus: List[int] = [0, 0]
self.seasonInfo: SeasonalInfoV1 = SeasonalInfoV1()
self.playAreaList: List = [ [0],[0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0],[0,0,0,0,0],[0,0,0,0],[0,0,0,0,0,0,0],[0] ]
self.playAreaList: List = [
[0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0],
]
self.songUpdateTime: int = 0
def make(self)-> Dict:
def make(self) -> Dict:
opts = []
play_modes = []
scores = []
for x in self.seasonalPlayModeCounts:
play_modes.append(x.make())
for x in self.scores:
scores.append(x.make())
for x in self.options:
opts.append(x.make())
@ -92,21 +104,31 @@ class UserStatusGetDetailResponseV1(BaseResponse):
self.songPlayStatus,
self.seasonInfo.make(),
self.playAreaList,
self.songUpdateTime
self.songUpdateTime,
]
return super().make()
def find_score_idx(self, song_id: int, difficulty: int = 1, start_idx: int = 0, stop_idx: Optional[int] = None) -> Optional[int]:
def find_score_idx(
self,
song_id: int,
difficulty: int = 1,
start_idx: int = 0,
stop_idx: Optional[int] = None,
) -> Optional[int]:
if stop_idx is None or stop_idx > len(self.scores):
stop_idx = len(self.scores)
for x in range(start_idx, stop_idx):
if self.scores[x].songId == song_id and self.scores[x].difficulty == difficulty:
if (
self.scores[x].songId == song_id
and self.scores[x].difficulty == difficulty
):
return x
return None
class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
def __init__(self) -> None:
super().__init__()
@ -122,7 +144,7 @@ class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
self.gatchaInfo: List[GachaInfo] = []
self.friendList: List[FriendDetail] = []
def make(self)-> Dict:
def make(self) -> Dict:
super().make()
gates = []
friends = []
@ -130,13 +152,13 @@ class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
for x in self.gateInfo:
gates.append(x.make())
for x in self.friendList:
friends.append(x.make())
for x in self.gateTutorialFlags:
tut_flg.append(x.make())
while len(tut_flg) < 5:
flag_id = len(tut_flg) + 1
tut_flg.append([flag_id, 0])
@ -152,11 +174,13 @@ class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
return super(UserStatusGetDetailResponseV1, self).make()
class UserStatusGetDetailResponseV3(UserStatusGetDetailResponseV2):
def __init__(self) -> None:
super().__init__()
self.gateInfo: List[GateDetailV2] = []
class UserStatusGetDetailResponseV4(UserStatusGetDetailResponseV3):
def __init__(self) -> None:
super().__init__()
@ -164,12 +188,13 @@ class UserStatusGetDetailResponseV4(UserStatusGetDetailResponseV3):
self.bingoStatus: BingoDetail = BingoDetail(0)
self.scores: List[BestScoreDetailV2] = []
def make(self)-> Dict:
def make(self) -> Dict:
super().make()
self.params.append(self.bingoStatus.make())
return super(UserStatusGetDetailResponseV1, self).make()
# ---user/status/login----
class UserStatusLoginRequest(BaseRequest):
userId: int = 0
@ -178,16 +203,19 @@ class UserStatusLoginRequest(BaseRequest):
super().__init__(data)
self.userId = data["params"][0]
class UserStatusLoginResponseV1(BaseResponse):
def __init__(self, is_first_login_daily: bool = False, last_login_date: int = 0) -> None:
def __init__(
self, is_first_login_daily: bool = False, last_login_date: int = 0
) -> None:
super().__init__()
self.dailyBonus: List[LoginBonusInfo] = []
self.consecBonus: List[LoginBonusInfo] = []
self.otherBonus: List[LoginBonusInfo] = []
self.otherBonus: List[LoginBonusInfo] = []
self.firstLoginDaily = is_first_login_daily
self.lastLoginDate = last_login_date
def make(self)-> Dict:
def make(self) -> Dict:
super().make()
daily = []
consec = []
@ -202,32 +230,39 @@ class UserStatusLoginResponseV1(BaseResponse):
for bonus in self.otherBonus:
other.append(bonus.make())
self.params = [ daily, consec, other, int(self.firstLoginDaily)]
self.params = [daily, consec, other, int(self.firstLoginDaily)]
return super().make()
class UserStatusLoginResponseV2(UserStatusLoginResponseV1):
def __init__(self, is_first_login_daily: bool = False, last_login_date: int = 0) -> None:
def __init__(
self, is_first_login_daily: bool = False, last_login_date: int = 0
) -> None:
super().__init__(is_first_login_daily)
self.lastLoginDate = last_login_date
self.vipInfo = VipInfo()
def make(self)-> Dict:
def make(self) -> Dict:
super().make()
self.params.append(self.vipInfo.make())
self.params.append(self.lastLoginDate)
return super(UserStatusLoginResponseV1, self).make()
class UserStatusLoginResponseV3(UserStatusLoginResponseV2):
def __init__(self, is_first_login_daily: bool = False, last_login_date: int = 0) -> None:
def __init__(
self, is_first_login_daily: bool = False, last_login_date: int = 0
) -> None:
super().__init__(is_first_login_daily, last_login_date)
self.unk: List = []
def make(self)-> Dict:
def make(self) -> Dict:
super().make()
self.params.append(self.unk)
return super(UserStatusLoginResponseV1, self).make()
# ---user/status/create---
class UserStatusCreateRequest(BaseRequest):
def __init__(self, data: Dict) -> None:
@ -235,26 +270,27 @@ class UserStatusCreateRequest(BaseRequest):
self.aimeId = data["params"][0]
self.username = data["params"][1]
class UserStatusCreateResponseV1(BaseResponse):
def __init__(self, userId: int, username: str) -> None:
super().__init__()
self.userStatus = UserStatusV1()
self.userStatus.userId = userId
self.userStatus.username = username
def make(self)-> Dict:
self.params = [
self.userStatus.make()
]
def make(self) -> Dict:
self.params = [self.userStatus.make()]
return super().make()
class UserStatusCreateResponseV2(UserStatusCreateResponseV1):
def __init__(self, userId: int, username: str) -> None:
super().__init__(userId, username)
self.userStatus: UserStatusV2 = UserStatusV2()
self.userStatus: UserStatusV2 = UserStatusV2()
self.userStatus.userId = userId
self.userStatus.username = username
# ---user/status/logout---
class UserStatusLogoutRequest(BaseRequest):
userId: int
@ -263,6 +299,7 @@ class UserStatusLogoutRequest(BaseRequest):
super().__init__(data)
self.userId = data["params"][0]
# ---user/status/update---
class UserStatusUpdateRequestV1(BaseRequest):
def __init__(self, data: Dict) -> None:
@ -274,11 +311,17 @@ class UserStatusUpdateRequestV1(BaseRequest):
for itm in data["params"][2]:
self.itemsRecieved.append(GenericItemRecv(itm[0], itm[1], itm[2]))
class UserStatusUpdateRequestV2(UserStatusUpdateRequestV1):
def __init__(self, data: Dict) -> None:
super().__init__(data)
self.isContinue = bool(data["params"][3])
self.isFirstPlayFree = bool(data["params"][4])
self.itemsUsed = data["params"][5]
self.lastSongInfo = LastSongDetail(data["params"][6][0], data["params"][6][1],
data["params"][6][2], data["params"][6][3], data["params"][6][4])
self.lastSongInfo = LastSongDetail(
data["params"][6][0],
data["params"][6][1],
data["params"][6][2],
data["params"][6][3],
data["params"][6][4],
)