2023-02-17 07:02:21 +01:00
|
|
|
from typing import List, Dict
|
|
|
|
|
|
|
|
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
2023-03-09 17:38:58 +01:00
|
|
|
from titles.wacca.handlers.helpers import (
|
|
|
|
GenericItemRecv,
|
|
|
|
SongUpdateDetailV2,
|
|
|
|
TicketItem,
|
|
|
|
)
|
2023-02-23 04:22:03 +01:00
|
|
|
from titles.wacca.handlers.helpers import MusicUpdateDetailV2, MusicUpdateDetailV3
|
2023-03-09 17:38:58 +01:00
|
|
|
from titles.wacca.handlers.helpers import (
|
|
|
|
SeasonalInfoV2,
|
|
|
|
SeasonalInfoV1,
|
|
|
|
SongUpdateDetailV1,
|
|
|
|
)
|
2023-02-23 04:22:03 +01:00
|
|
|
from titles.wacca.handlers.helpers import MusicUpdateDetailV1
|
2023-02-17 07:02:21 +01:00
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
# ---user/music/update---
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserMusicUpdateRequestV1(BaseRequest):
|
2023-02-17 07:02:21 +01:00
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.profileId: int = self.params[0]
|
|
|
|
self.songNumber: int = self.params[1]
|
2023-02-23 04:22:03 +01:00
|
|
|
self.songDetail = SongUpdateDetailV1(self.params[2])
|
2023-02-17 07:02:21 +01:00
|
|
|
self.itemsObtained: List[GenericItemRecv] = []
|
|
|
|
|
|
|
|
for itm in data["params"][3]:
|
|
|
|
self.itemsObtained.append(GenericItemRecv(itm[0], itm[1], itm[2]))
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserMusicUpdateRequestV2(UserMusicUpdateRequestV1):
|
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.songDetail = SongUpdateDetailV2(self.params[2])
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class UserMusicUpdateResponseV1(BaseResponse):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
|
|
|
self.songDetail = MusicUpdateDetailV1()
|
|
|
|
self.seasonInfo = SeasonalInfoV1()
|
|
|
|
self.rankingInfo: List[List[int]] = []
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
def make(self) -> Dict:
|
|
|
|
self.params = [
|
|
|
|
self.songDetail.make(),
|
|
|
|
[self.songDetail.songId, self.songDetail.clearCounts.playCt],
|
|
|
|
self.seasonInfo.make(),
|
2023-03-09 17:38:58 +01:00
|
|
|
self.rankingInfo,
|
2023-02-17 07:02:21 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
return super().make()
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class UserMusicUpdateResponseV2(UserMusicUpdateResponseV1):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
2023-02-23 04:22:03 +01:00
|
|
|
self.songDetail = MusicUpdateDetailV2()
|
2023-02-17 07:02:21 +01:00
|
|
|
self.seasonInfo = SeasonalInfoV2()
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class UserMusicUpdateResponseV3(UserMusicUpdateResponseV2):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
super().__init__()
|
2023-02-23 04:22:03 +01:00
|
|
|
self.songDetail = MusicUpdateDetailV3()
|
2023-02-17 07:02:21 +01:00
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
# ---user/music/updateCoop---
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserMusicUpdateCoopRequest(UserMusicUpdateRequestV2):
|
2023-02-17 07:02:21 +01:00
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.coopData = self.params[4]
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
# ---user/music/updateVs---
|
2023-02-23 04:22:03 +01:00
|
|
|
class UserMusicUpdateVsRequest(UserMusicUpdateRequestV2):
|
2023-02-17 07:02:21 +01:00
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.vsData = self.params[4]
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
# ---user/music/unlock---
|
|
|
|
class UserMusicUnlockRequest(BaseRequest):
|
|
|
|
def __init__(self, data: Dict) -> None:
|
|
|
|
super().__init__(data)
|
|
|
|
self.profileId = self.params[0]
|
|
|
|
self.songId = self.params[1]
|
2023-03-09 17:38:58 +01:00
|
|
|
self.difficulty = self.params[2]
|
2023-02-17 07:02:21 +01:00
|
|
|
self.itemsUsed: List[GenericItemRecv] = []
|
|
|
|
|
|
|
|
for itm in self.params[3]:
|
|
|
|
self.itemsUsed.append(GenericItemRecv(itm[0], itm[1], itm[2]))
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class UserMusicUnlockResponse(BaseResponse):
|
2023-05-22 18:24:16 +02:00
|
|
|
def __init__(self, current_wp: int = 0, tickets_remaining: List[TicketItem] = []) -> None:
|
2023-02-17 07:02:21 +01:00
|
|
|
super().__init__()
|
2023-03-09 17:38:58 +01:00
|
|
|
self.wp = current_wp
|
2023-05-22 18:24:16 +02:00
|
|
|
self.tickets = tickets_remaining
|
2023-03-09 17:38:58 +01:00
|
|
|
|
|
|
|
def make(self) -> Dict:
|
2023-02-17 07:02:21 +01:00
|
|
|
tickets = []
|
|
|
|
|
|
|
|
for ticket in self.tickets:
|
|
|
|
tickets.append(ticket.make())
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
self.params = [self.wp, tickets]
|
2023-02-17 07:02:21 +01:00
|
|
|
|
|
|
|
return super().make()
|