1
0
mirror of synced 2024-12-01 00:57:16 +01:00
artemis/titles/wacca/handlers/user_info.py

97 lines
2.7 KiB
Python
Raw Normal View History

from typing import List, Dict
from titles.wacca.handlers.base import BaseRequest, BaseResponse
from titles.wacca.handlers.helpers import UserOption, DateUpdate
2023-03-09 17:38:58 +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] = []
self.unknown2: List = self.params[2]
self.datesUpdated: List[DateUpdate] = []
self.favoritesRemoved: List[int] = self.params[4]
self.favoritesAdded: List[int] = self.params[5]
for x in self.params[1]:
self.optsUpdated.append(UserOption(x[0], x[1]))
2023-03-09 17:38:58 +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-03-09 17:38:58 +01:00
# ---user/info/getMyroom--- TODO: Understand this better
class UserInfogetMyroomRequest(BaseRequest):
game_id = 0
2023-03-09 17:38:58 +01:00
def __init__(self, data: Dict) -> None:
super().__init__(data)
self.game_id = int(self.params[0])
2023-03-09 17:38:58 +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 = []
def make(self) -> Dict:
self.params = [
self.titleViewBadge,
self.iconViewBadge,
self.trophyViewBadge,
self.noteColorViewBadge,
self.noteSoundViewBadge,
self.userViewingInfo,
]
return super().make()
2023-03-09 17:38:58 +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-03-09 17:38:58 +01:00
# ---user/info/getRanking---
class UserInfogetRankingRequest(BaseRequest):
game_id = 0
2023-03-09 17:38:58 +01:00
def __init__(self, data: Dict) -> None:
super().__init__(data)
self.game_id = int(self.params[0])
2023-03-09 17:38:58 +01:00
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,
]
2023-03-09 17:38:58 +01:00
return super().make()