2023-02-17 07:02:21 +01:00
|
|
|
from typing import List, Dict
|
|
|
|
|
|
|
|
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
2023-03-03 19:03:48 +01:00
|
|
|
from titles.wacca.handlers.helpers import UserOption, DateUpdate
|
2023-02-17 07:02:21 +01:00
|
|
|
|
|
|
|
# ---user/info/update---
|
|
|
|
class UserInfoUpdateRequest(BaseRequest):
|
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.profileId = int(self.params[0])
|
|
|
|
self.optsUpdated: List[UserOption] = []
|
2023-03-03 19:03:48 +01:00
|
|
|
self.unknown2: List = self.params[2]
|
|
|
|
self.datesUpdated: List[DateUpdate] = []
|
2023-02-17 07:02:21 +01:00
|
|
|
self.favoritesAdded: List[int] = self.params[4]
|
|
|
|
self.favoritesRemoved: List[int] = self.params[5]
|
|
|
|
|
2023-03-03 19:03:48 +01:00
|
|
|
for x in self.params[1]:
|
2023-02-17 07:02:21 +01:00
|
|
|
self.optsUpdated.append(UserOption(x[0], x[1]))
|
2023-03-03 19:03:48 +01:00
|
|
|
|
|
|
|
for x in self.params[3]:
|
2023-03-03 19:07:36 +01:00
|
|
|
self.datesUpdated.append(DateUpdate(x[0], x[1]))
|
2023-02-17 07:02:21 +01:00
|
|
|
|
|
|
|
# ---user/info/getMyroom--- TODO: Understand this better
|
|
|
|
class UserInfogetMyroomRequest(BaseRequest):
|
|
|
|
game_id = 0
|
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.game_id = int(self.params[0])
|
|
|
|
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserInfogetMyroomResponseV1(BaseResponse):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
|
|
|
self.titleViewBadge = 0
|
|
|
|
self.iconViewBadge = 0
|
|
|
|
self.trophyViewBadge = 0
|
|
|
|
self.noteColorViewBadge = 0
|
|
|
|
self.noteSoundViewBadge = 0
|
|
|
|
self.userViewingInfo = []
|
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
def make(self) -> Dict:
|
|
|
|
self.params = [
|
2023-02-23 04:22:03 +01:00
|
|
|
self.titleViewBadge,
|
|
|
|
self.iconViewBadge,
|
|
|
|
self.trophyViewBadge,
|
|
|
|
self.noteColorViewBadge,
|
|
|
|
self.noteSoundViewBadge,
|
|
|
|
self.userViewingInfo,
|
2023-02-17 07:02:21 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
return super().make()
|
|
|
|
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserInfogetMyroomResponseV2(UserInfogetMyroomResponseV1):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
|
|
|
|
|
|
|
def make(self) -> Dict:
|
|
|
|
super().make()
|
|
|
|
self.params += [0, 0, 0]
|
|
|
|
return super(UserInfogetMyroomResponseV1, self).make()
|
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
# ---user/info/getRanking---
|
|
|
|
class UserInfogetRankingRequest(BaseRequest):
|
|
|
|
game_id = 0
|
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.game_id = int(self.params[0])
|
|
|
|
|
|
|
|
class UserInfogetRankingResponse(BaseResponse):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
|
|
|
self.total_score_rank = 0
|
|
|
|
self.high_score_by_song_rank = 0
|
|
|
|
self.cumulative_score_rank = 0
|
|
|
|
self.state_up_score_rank = 0
|
|
|
|
self.other_score_ranking = 0
|
|
|
|
self.wacca_points_ranking = 0
|
|
|
|
|
|
|
|
def make(self) -> Dict:
|
|
|
|
self.params = [
|
|
|
|
self.total_score_rank,
|
|
|
|
self.high_score_by_song_rank,
|
|
|
|
self.cumulative_score_rank,
|
|
|
|
self.state_up_score_rank,
|
|
|
|
self.other_score_ranking,
|
|
|
|
self.wacca_points_ranking,
|
|
|
|
]
|
|
|
|
|
|
|
|
return super().make()
|