mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-15 12:17:28 +08:00
add back games, conform them to new title dispatch
This commit is contained in:
9
titles/wacca/handlers/__init__.py
Normal file
9
titles/wacca/handlers/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from titles.wacca.handlers.base import *
|
||||
from titles.wacca.handlers.advertise import *
|
||||
from titles.wacca.handlers.housing import *
|
||||
from titles.wacca.handlers.user_info import *
|
||||
from titles.wacca.handlers.user_misc import *
|
||||
from titles.wacca.handlers.user_music import *
|
||||
from titles.wacca.handlers.user_status import *
|
||||
from titles.wacca.handlers.user_trial import *
|
||||
from titles.wacca.handlers.user_vip import *
|
||||
45
titles/wacca/handlers/advertise.py
Normal file
45
titles/wacca/handlers/advertise.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from typing import List, Dict
|
||||
|
||||
from titles.wacca.handlers.base import BaseResponse
|
||||
from titles.wacca.handlers.helpers import Notice
|
||||
|
||||
# ---advertise/GetNews---
|
||||
class GetNewsResponseV1(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.notices: list[Notice] = []
|
||||
self.copywrightListings: list[str] = []
|
||||
self.stoppedSongs: list[int] = []
|
||||
self.stoppedJackets: list[int] = []
|
||||
self.stoppedMovies: list[int] = []
|
||||
self.stoppedIcons: list[int] = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
note = []
|
||||
|
||||
for notice in self.notices:
|
||||
note.append(notice.make())
|
||||
|
||||
self.params = [
|
||||
note,
|
||||
self.copywrightListings,
|
||||
self.stoppedSongs,
|
||||
self.stoppedJackets,
|
||||
self.stoppedMovies,
|
||||
self.stoppedIcons
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
class GetNewsResponseV2(GetNewsResponseV1):
|
||||
stoppedProducts: list[int] = []
|
||||
stoppedNavs: list[int] = []
|
||||
stoppedNavVoices: list[int] = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
super().make()
|
||||
self.params.append(self.stoppedProducts)
|
||||
self.params.append(self.stoppedNavs)
|
||||
self.params.append(self.stoppedNavVoices)
|
||||
|
||||
return super(GetNewsResponseV1, self).make()
|
||||
31
titles/wacca/handlers/base.py
Normal file
31
titles/wacca/handlers/base.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Dict, List
|
||||
from datetime import datetime
|
||||
|
||||
class BaseRequest():
|
||||
def __init__(self, data: Dict) -> None:
|
||||
self.requestNo: int = data["requestNo"]
|
||||
self.appVersion: str = data["appVersion"]
|
||||
self.boardId: str = data["boardId"]
|
||||
self.chipId: str = data["chipId"]
|
||||
self.params: List = data["params"]
|
||||
|
||||
class BaseResponse():
|
||||
def __init__(self) -> None:
|
||||
self.status: int = 0
|
||||
self.message: str = ""
|
||||
self.serverTime: int = int(datetime.now().timestamp())
|
||||
self.maintNoticeTime: int = 0
|
||||
self.maintNotPlayableTime: int = 0
|
||||
self.maintStartTime: int = 0
|
||||
self.params: List = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
return {
|
||||
"status": self.status,
|
||||
"message": self.message,
|
||||
"serverTime": self.serverTime,
|
||||
"maintNoticeTime": self.maintNoticeTime,
|
||||
"maintNotPlayableTime": self.maintNotPlayableTime,
|
||||
"maintStartTime": self.maintStartTime,
|
||||
"params": self.params
|
||||
}
|
||||
786
titles/wacca/handlers/helpers.py
Normal file
786
titles/wacca/handlers/helpers.py
Normal file
@@ -0,0 +1,786 @@
|
||||
from typing import List, Dict, Any
|
||||
from enum import Enum
|
||||
|
||||
from titles.wacca.const import WaccaConstants
|
||||
|
||||
class HousingInfo():
|
||||
"""
|
||||
1 is lan install role, 2 is country
|
||||
"""
|
||||
id: int = 0
|
||||
val: str = ""
|
||||
|
||||
def __init__(self, id: int = 0, val: str = "") -> None:
|
||||
self.id = id
|
||||
self.val = val
|
||||
|
||||
def make(self) -> List:
|
||||
return [ self.id, self.val ]
|
||||
|
||||
class Notice():
|
||||
name: str = ""
|
||||
title: str = ""
|
||||
message: str = ""
|
||||
unknown3: str = ""
|
||||
unknown4: str = ""
|
||||
showTitleScreen: bool = True
|
||||
showWelcomeScreen: bool = True
|
||||
startTime: int = 0
|
||||
endTime: int = 0
|
||||
voiceline: int = 0
|
||||
|
||||
def __init__(self, name: str = "", title: str = "", message: str = "", start: int = 0, end: int = 0) -> None:
|
||||
self.name = name
|
||||
self.title = title
|
||||
self.message = message
|
||||
self.startTime = start
|
||||
self.endTime = end
|
||||
|
||||
def make(self) -> List:
|
||||
return [ self.name, self.title, self.message, self.unknown3, self.unknown4, int(self.showTitleScreen),
|
||||
int(self.showWelcomeScreen), self.startTime, self.endTime, self.voiceline]
|
||||
|
||||
class UserOption():
|
||||
opt_id: int
|
||||
opt_val: Any
|
||||
|
||||
def __init__(self, opt_id: int = 0, opt_val: Any = 0) -> None:
|
||||
self.opt_id = opt_id
|
||||
self.opt_val = opt_val
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.opt_id, self.opt_val]
|
||||
|
||||
class UserStatusV1():
|
||||
def __init__(self) -> None:
|
||||
self.userId: int = -1
|
||||
self.username: str = ""
|
||||
self.userType: int = 1
|
||||
self.xp: int = 0
|
||||
self.danLevel: int = 0
|
||||
self.danType: int = 0
|
||||
self.wp: int = 0
|
||||
self.titlePartIds: List[int] = [0, 0, 0]
|
||||
self.useCount: int = 0
|
||||
self.loginDays: int = 0
|
||||
self.loginConsecutive: int = 0
|
||||
self.loginConsecutiveDays: int = 0
|
||||
self.vipExpireTime: int = 0
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.userId,
|
||||
self.username,
|
||||
self.userType,
|
||||
self.xp,
|
||||
self.danLevel,
|
||||
self.danType,
|
||||
self.wp,
|
||||
self.titlePartIds,
|
||||
self.useCount,
|
||||
self.loginDays,
|
||||
self.loginConsecutive,
|
||||
self.loginConsecutiveDays,
|
||||
self.vipExpireTime
|
||||
]
|
||||
|
||||
class UserStatusV2(UserStatusV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.loginsToday: int = 0
|
||||
self.rating: int = 0
|
||||
|
||||
def make(self) -> List:
|
||||
ret = super().make()
|
||||
|
||||
ret.append(self.loginsToday)
|
||||
ret.append(self.rating)
|
||||
|
||||
return ret
|
||||
|
||||
class ProfileStatus(Enum):
|
||||
ProfileGood = 0
|
||||
ProfileRegister = 1
|
||||
ProfileInUse = 2
|
||||
ProfileWrongRegion = 3
|
||||
|
||||
class PlayVersionStatus(Enum):
|
||||
VersionGood = 0
|
||||
VersionTooNew = 1
|
||||
VersionUpgrade = 2
|
||||
|
||||
class PlayModeCounts():
|
||||
seasonId: int = 0
|
||||
modeId: int = 0
|
||||
playNum: int = 0
|
||||
|
||||
def __init__(self, seasonId: int, modeId: int, playNum: int) -> None:
|
||||
self.seasonId = seasonId
|
||||
self.modeId = modeId
|
||||
self.playNum = playNum
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.seasonId,
|
||||
self.modeId,
|
||||
self.playNum
|
||||
]
|
||||
|
||||
class SongUnlock():
|
||||
songId: int = 0
|
||||
difficulty: int = 0
|
||||
whenAppeared: int = 0
|
||||
whenUnlocked: int = 0
|
||||
|
||||
def __init__(self, song_id: int = 0, difficulty: int = 1, whenAppered: int = 0, whenUnlocked: int = 0) -> None:
|
||||
self.songId = song_id
|
||||
self.difficulty = difficulty
|
||||
self.whenAppeared = whenAppered
|
||||
self.whenUnlocked = whenUnlocked
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.songId,
|
||||
self.difficulty,
|
||||
self.whenAppeared,
|
||||
self.whenUnlocked
|
||||
]
|
||||
|
||||
class GenericItemRecv():
|
||||
def __init__(self, item_type: int = 1, item_id: int = 1, quantity: int = 1) -> None:
|
||||
self.itemId = item_id
|
||||
self.itemType = item_type
|
||||
self.quantity = quantity
|
||||
|
||||
def make(self) -> List:
|
||||
return [ self.itemType, self.itemId, self.quantity ]
|
||||
|
||||
class GenericItemSend():
|
||||
def __init__(self, itemId: int, itemType: int, whenAcquired: int) -> None:
|
||||
self.itemId = itemId
|
||||
self.itemType = itemType
|
||||
self.whenAcquired = whenAcquired
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.itemId,
|
||||
self.itemType,
|
||||
self.whenAcquired
|
||||
]
|
||||
|
||||
class IconItem(GenericItemSend):
|
||||
uses: int = 0
|
||||
|
||||
def __init__(self, itemId: int, itemType: int, uses: int, whenAcquired: int) -> None:
|
||||
super().__init__(itemId, itemType, whenAcquired)
|
||||
self.uses = uses
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.itemId,
|
||||
self.itemType,
|
||||
self.uses,
|
||||
self.whenAcquired
|
||||
]
|
||||
|
||||
class TrophyItem():
|
||||
trophyId: int = 0
|
||||
season: int = 1
|
||||
progress: int = 0
|
||||
badgeType: int = 0
|
||||
|
||||
def __init__(self, trophyId: int, season: int, progress: int, badgeType: int) -> None:
|
||||
self.trophyId = trophyId
|
||||
self.season = season
|
||||
self.progress = progress
|
||||
self.badgeType = badgeType
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.trophyId,
|
||||
self.season,
|
||||
self.progress,
|
||||
self.badgeType
|
||||
]
|
||||
|
||||
class TicketItem():
|
||||
userTicketId: int = 0
|
||||
ticketId: int = 0
|
||||
whenExpires: int = 0
|
||||
|
||||
def __init__(self, userTicketId: int, ticketId: int, whenExpires: int) -> None:
|
||||
self.userTicketId = userTicketId
|
||||
self.ticketId = ticketId
|
||||
self.whenExpires = whenExpires
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.userTicketId,
|
||||
self.ticketId,
|
||||
self.whenExpires
|
||||
]
|
||||
|
||||
class NavigatorItem(IconItem):
|
||||
usesToday: int = 0
|
||||
|
||||
def __init__(self, itemId: int, itemType: int, whenAcquired: int, uses: int, usesToday: int) -> None:
|
||||
super().__init__(itemId, itemType, uses, whenAcquired)
|
||||
self.usesToday = usesToday
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.itemId,
|
||||
self.itemType,
|
||||
self.whenAcquired,
|
||||
self.uses,
|
||||
self.usesToday
|
||||
]
|
||||
|
||||
class SkillItem():
|
||||
skill_type: int
|
||||
level: int
|
||||
flag: int
|
||||
badge: int
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.skill_type,
|
||||
self.level,
|
||||
self.flag,
|
||||
self.badge
|
||||
]
|
||||
|
||||
class UserItemInfoV1():
|
||||
def __init__(self) -> None:
|
||||
self.songUnlocks: List[SongUnlock] = []
|
||||
self.titles: List[GenericItemSend] = []
|
||||
self.icons: List[IconItem] = []
|
||||
self.trophies: List[TrophyItem] = []
|
||||
self.skills: List[SkillItem] = []
|
||||
self.tickets: List[TicketItem] = []
|
||||
self.noteColors: List[GenericItemSend] = []
|
||||
self.noteSounds: List[GenericItemSend] = []
|
||||
|
||||
def make(self) -> List:
|
||||
unlocks = []
|
||||
titles = []
|
||||
icons = []
|
||||
trophies = []
|
||||
skills = []
|
||||
tickets = []
|
||||
colors = []
|
||||
sounds = []
|
||||
|
||||
for x in self.songUnlocks:
|
||||
unlocks.append(x.make())
|
||||
for x in self.titles:
|
||||
titles.append(x.make())
|
||||
for x in self.icons:
|
||||
icons.append(x.make())
|
||||
for x in self.trophies:
|
||||
trophies.append(x.make())
|
||||
for x in self.skills:
|
||||
skills.append(x.make())
|
||||
for x in self.tickets:
|
||||
tickets.append(x.make())
|
||||
for x in self.noteColors:
|
||||
colors.append(x.make())
|
||||
for x in self.noteSounds:
|
||||
sounds.append(x.make())
|
||||
|
||||
return [
|
||||
unlocks,
|
||||
titles,
|
||||
icons,
|
||||
trophies,
|
||||
skills,
|
||||
tickets,
|
||||
colors,
|
||||
sounds,
|
||||
]
|
||||
|
||||
class UserItemInfoV2(UserItemInfoV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.navigators: List[NavigatorItem] = []
|
||||
self.plates: List[GenericItemSend] = []
|
||||
|
||||
def make(self) -> List:
|
||||
ret = super().make()
|
||||
plates = []
|
||||
navs = []
|
||||
|
||||
for x in self.navigators:
|
||||
navs.append(x.make())
|
||||
for x in self.plates:
|
||||
plates.append(x.make())
|
||||
|
||||
ret.append(navs)
|
||||
ret.append(plates)
|
||||
return ret
|
||||
|
||||
class UserItemInfoV3(UserItemInfoV2):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.touchEffect: List[GenericItemSend] = []
|
||||
|
||||
def make(self) -> List:
|
||||
ret = super().make()
|
||||
effect = []
|
||||
|
||||
for x in self.touchEffect:
|
||||
effect.append(x.make())
|
||||
|
||||
ret.append(effect)
|
||||
return ret
|
||||
|
||||
class SongDetailClearCounts():
|
||||
def __init__(self, play_ct: int = 0, clear_ct: int = 0, ml_ct: int = 0, fc_ct: int = 0,
|
||||
am_ct: int = 0, counts: List[int] = None) -> None:
|
||||
if counts is None:
|
||||
self.playCt = play_ct
|
||||
self.clearCt = clear_ct
|
||||
self.misslessCt = ml_ct
|
||||
self.fullComboCt = fc_ct
|
||||
self.allMarvelousCt = am_ct
|
||||
|
||||
else:
|
||||
self.playCt = counts[0]
|
||||
self.clearCt = counts[1]
|
||||
self.misslessCt = counts[2]
|
||||
self.fullComboCt = counts[3]
|
||||
self.allMarvelousCt = counts[4]
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.playCt, self.clearCt, self.misslessCt, self.fullComboCt, self.allMarvelousCt]
|
||||
|
||||
class SongDetailGradeCountsV1():
|
||||
dCt: int
|
||||
cCt: int
|
||||
bCt: int
|
||||
aCt: int
|
||||
aaCt: int
|
||||
aaaCt: int
|
||||
sCt: int
|
||||
ssCt: int
|
||||
sssCt: int
|
||||
masterCt: int
|
||||
|
||||
def __init__(self, d: int = 0, c: int = 0, b: int = 0, a: int = 0, aa: int = 0, aaa: int = 0, s: int = 0,
|
||||
ss: int = 0, sss: int = 0, master: int = 0, counts: List[int] = None) -> None:
|
||||
if counts is None:
|
||||
self.dCt = d
|
||||
self.cCt = c
|
||||
self.bCt = b
|
||||
self.aCt = a
|
||||
self.aaCt = aa
|
||||
self.aaaCt = aaa
|
||||
self.sCt = s
|
||||
self.ssCt = ss
|
||||
self.sssCt = sss
|
||||
self.masterCt = master
|
||||
|
||||
else:
|
||||
self.dCt = counts[0]
|
||||
self.cCt = counts[1]
|
||||
self.bCt = counts[2]
|
||||
self.aCt = counts[3]
|
||||
self.aaCt = counts[4]
|
||||
self.aaaCt = counts[5]
|
||||
self.sCt = counts[6]
|
||||
self.ssCt = counts[7]
|
||||
self.sssCt = counts[8]
|
||||
self.masterCt =counts[9]
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.dCt, self.cCt, self.bCt, self.aCt, self.aaCt, self.aaaCt, self.sCt, self.ssCt, self.sssCt, self.masterCt]
|
||||
|
||||
class SongDetailGradeCountsV2(SongDetailGradeCountsV1):
|
||||
spCt: int
|
||||
sspCt: int
|
||||
ssspCt: int
|
||||
|
||||
def __init__(self, d: int = 0, c: int = 0, b: int = 0, a: int = 0, aa: int = 0, aaa: int = 0, s: int = 0,
|
||||
ss: int = 0, sss: int = 0, master: int = 0, sp: int = 0, ssp: int = 0, sssp: int = 0, counts: List[int] = None, ) -> None:
|
||||
super().__init__(d, c, b, a, aa, aaa, s, ss, sss, master, counts)
|
||||
if counts is None:
|
||||
self.spCt = sp
|
||||
self.sspCt = ssp
|
||||
self.ssspCt = sssp
|
||||
|
||||
else:
|
||||
self.spCt = counts[10]
|
||||
self.sspCt = counts[11]
|
||||
self.ssspCt = counts[12]
|
||||
|
||||
def make(self) -> List:
|
||||
return super().make() + [self.spCt, self.sspCt, self.ssspCt]
|
||||
|
||||
class BestScoreDetailV1():
|
||||
songId: int = 0
|
||||
difficulty: int = 1
|
||||
clearCounts: SongDetailClearCounts = SongDetailClearCounts()
|
||||
clearCountsSeason: SongDetailClearCounts = SongDetailClearCounts()
|
||||
gradeCounts: SongDetailGradeCountsV1 = SongDetailGradeCountsV1()
|
||||
score: int = 0
|
||||
bestCombo: int = 0
|
||||
lowestMissCtMaybe: int = 0
|
||||
isUnlock: int = 1
|
||||
rating: int = 0
|
||||
|
||||
def __init__(self, song_id: int, difficulty: int = 1) -> None:
|
||||
self.songId = song_id
|
||||
self.difficulty = difficulty
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.songId,
|
||||
self.difficulty,
|
||||
self.clearCounts.make(),
|
||||
self.clearCountsSeason.make(),
|
||||
self.gradeCounts.make(),
|
||||
self.score,
|
||||
self.bestCombo,
|
||||
self.lowestMissCtMaybe,
|
||||
self.isUnlock,
|
||||
self.rating
|
||||
]
|
||||
|
||||
class BestScoreDetailV2(BestScoreDetailV1):
|
||||
gradeCounts: SongDetailGradeCountsV2 = SongDetailGradeCountsV2()
|
||||
|
||||
class SongUpdateJudgementCounts():
|
||||
marvCt: int
|
||||
greatCt: int
|
||||
goodCt: int
|
||||
missCt: int
|
||||
|
||||
def __init__(self, marvs: int = 0, greats: int = 0, goods: int = 0, misses: int = 0) -> None:
|
||||
self.marvCt = marvs
|
||||
self.greatCt = greats
|
||||
self.goodCt = goods
|
||||
self.missCt = misses
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.marvCt, self.greatCt, self.goodCt, self.missCt]
|
||||
|
||||
class SongUpdateDetail():
|
||||
songId: int
|
||||
difficulty: int
|
||||
level: float
|
||||
score: int
|
||||
judgements: SongUpdateJudgementCounts
|
||||
maxCombo: int
|
||||
grade: WaccaConstants.GRADES
|
||||
flagCleared: bool
|
||||
flagMissless: bool
|
||||
flagFullcombo: bool
|
||||
flagAllMarvelous: bool
|
||||
flagGiveUp: bool
|
||||
skillPt: int
|
||||
fastCt: int
|
||||
slowCt: int
|
||||
flagNewRecord: bool
|
||||
|
||||
def __init__(self, data: List = None) -> None:
|
||||
if data is not None:
|
||||
self.songId = data[0]
|
||||
self.difficulty = data[1]
|
||||
self.level = data[2]
|
||||
self.score = data[3]
|
||||
|
||||
self.judgements = SongUpdateJudgementCounts(data[4][0], data[4][1], data[4][2], data[4][3])
|
||||
self.maxCombo = data[5]
|
||||
self.grade = WaccaConstants.GRADES(data[6]) # .value to get number, .name to get letter
|
||||
|
||||
self.flagCleared = False if data[7] == 0 else True
|
||||
self.flagMissless = False if data[8] == 0 else True
|
||||
self.flagFullcombo = False if data[9] == 0 else True
|
||||
self.flagAllMarvelous = False if data[10] == 0 else True
|
||||
self.flagGiveUp = False if data[11] == 0 else True
|
||||
|
||||
self.skillPt = data[12]
|
||||
self.fastCt = data[13]
|
||||
self.slowCt = data[14]
|
||||
self.flagNewRecord = False if data[15] == 0 else True
|
||||
|
||||
class SeasonalInfoV1():
|
||||
def __init__(self) -> None:
|
||||
self.level: int = 0
|
||||
self.wpObtained: int = 0
|
||||
self.wpSpent: int = 0
|
||||
self.cumulativeScore: int = 0
|
||||
self.titlesObtained: int = 0
|
||||
self.iconsObtained: int = 0
|
||||
self.skillPts: int = 0
|
||||
self.noteColorsObtained: int = 0
|
||||
self.noteSoundsObtained: int = 0
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.level,
|
||||
self.wpObtained,
|
||||
self.wpSpent,
|
||||
self.cumulativeScore,
|
||||
self.titlesObtained,
|
||||
self.iconsObtained,
|
||||
self.skillPts,
|
||||
self.noteColorsObtained,
|
||||
self.noteSoundsObtained
|
||||
]
|
||||
|
||||
class SeasonalInfoV2(SeasonalInfoV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.platesObtained: int = 0
|
||||
self.cumulativeGatePts: int = 0
|
||||
|
||||
def make(self) -> List:
|
||||
return super().make() + [self.platesObtained, self.cumulativeGatePts]
|
||||
|
||||
class BingoPageStatus():
|
||||
id = 0
|
||||
location = 1
|
||||
progress = 0
|
||||
|
||||
def __init__(self, id: int = 0, location: int = 1, progress: int = 0) -> None:
|
||||
self.id = id
|
||||
self.location = location
|
||||
self.progress = progress
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.id, self.location, self.progress]
|
||||
|
||||
class BingoDetail():
|
||||
def __init__(self, pageNumber: int) -> None:
|
||||
self.pageNumber = pageNumber
|
||||
self.pageStatus: List[BingoPageStatus] = []
|
||||
|
||||
def make(self) -> List:
|
||||
status = []
|
||||
for x in self.pageStatus:
|
||||
status.append(x.make())
|
||||
|
||||
return [
|
||||
self.pageNumber,
|
||||
status
|
||||
]
|
||||
|
||||
class GateDetailV1():
|
||||
def __init__(self, gate_id: int = 1, page: int = 1, progress: int = 0, loops: int = 0, last_used: int = 0, mission_flg = 0) -> None:
|
||||
self.id = gate_id
|
||||
self.page = page
|
||||
self.progress = progress
|
||||
self.loops = loops
|
||||
self.lastUsed = last_used
|
||||
self.missionFlg = mission_flg
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.id, 1, self.page, self.progress, self.loops, self.lastUsed]
|
||||
|
||||
class GateDetailV2(GateDetailV1):
|
||||
def make(self) -> List:
|
||||
return super().make() + [self.missionFlg]
|
||||
|
||||
class GachaInfo():
|
||||
def make() -> List:
|
||||
return []
|
||||
|
||||
class LastSongDetail():
|
||||
lastSongId = 90
|
||||
lastSongDiff = 1
|
||||
lastFolderOrd = 1
|
||||
lastFolderId = 1
|
||||
lastSongOrd = 1
|
||||
|
||||
def __init__(self, last_song: int = 90, last_diff: int = 1, last_folder_ord: int = 1,
|
||||
last_folder_id: int = 1, last_song_ord: int = 1) -> None:
|
||||
self.lastSongId = last_song
|
||||
self.lastSongDiff = last_diff
|
||||
self.lastFolderOrd = last_folder_ord
|
||||
self.lastFolderId = last_folder_id
|
||||
self.lastSongOrd = last_song_ord
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.lastSongId, self.lastSongDiff, self.lastFolderOrd, self.lastFolderId,
|
||||
self.lastSongOrd]
|
||||
|
||||
class FriendDetail():
|
||||
def make(self) -> List:
|
||||
return []
|
||||
|
||||
class UserOption():
|
||||
id = 1
|
||||
val = 1
|
||||
|
||||
def __init__(self, id: int = 1, val: int = val) -> None:
|
||||
self.id = id
|
||||
self.val = val
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.id, self.val]
|
||||
|
||||
class LoginBonusInfo():
|
||||
def __init__(self) -> None:
|
||||
self.tickets: List[TicketItem] = []
|
||||
self.items: List[GenericItemRecv] = []
|
||||
self.message: str = ""
|
||||
|
||||
def make(self) -> List:
|
||||
tks = []
|
||||
itms = []
|
||||
|
||||
for ticket in self.tickets:
|
||||
tks.append(ticket.make())
|
||||
|
||||
for item in self.items:
|
||||
itms.append(item.make())
|
||||
|
||||
return [ tks, itms, self.message ]
|
||||
|
||||
class VipLoginBonus():
|
||||
id = 1
|
||||
unknown = 0
|
||||
item: GenericItemRecv
|
||||
|
||||
def __init__(self, id: int = 1, unk: int = 0, item_type: int = 1, item_id: int = 1, item_qt: int = 1) -> None:
|
||||
self.id = id
|
||||
self.unknown = unk
|
||||
self.item = GenericItemRecv(item_type, item_id, item_qt)
|
||||
|
||||
def make(self) -> List:
|
||||
return [ self.id, self.unknown, self.item.make() ]
|
||||
|
||||
class VipInfo():
|
||||
def __init__(self, year: int = 2019, month: int = 1, day: int = 1, num_item: int = 1) -> None:
|
||||
self.pageYear = year
|
||||
self.pageMonth = month
|
||||
self.pageDay = day
|
||||
self.numItem = num_item
|
||||
self.presentInfo: List[LoginBonusInfo] = []
|
||||
self.vipLoginBonus: List[VipLoginBonus] = []
|
||||
|
||||
def make(self) -> List:
|
||||
pres = []
|
||||
vipBonus = []
|
||||
|
||||
for present in self.presentInfo:
|
||||
pres.append(present.make())
|
||||
|
||||
for b in self.vipLoginBonus:
|
||||
vipBonus.append(b.make())
|
||||
|
||||
return [ self.pageYear, self.pageMonth, self.pageDay, self.numItem, pres, vipBonus ]
|
||||
|
||||
class PurchaseType(Enum):
|
||||
PurchaseTypeCredit = 1
|
||||
PurchaseTypeWP = 2
|
||||
|
||||
class PlayType(Enum):
|
||||
PlayTypeSingle = 1
|
||||
PlayTypeVs = 2
|
||||
PlayTypeCoop = 3
|
||||
PlayTypeStageup = 4
|
||||
|
||||
class SongRatingUpdate():
|
||||
song_id = 0
|
||||
difficulty = 0
|
||||
rating = 0
|
||||
|
||||
def __init__(self, song: int = 0, difficulty: int = 0, rating: int = 0) -> None:
|
||||
self.song_id = song
|
||||
self.difficulty = difficulty
|
||||
self.rating = rating
|
||||
|
||||
def make(self) -> List:
|
||||
return [self.song_id, self.difficulty, self.rating]
|
||||
|
||||
class StageInfo():
|
||||
danId: int = 0
|
||||
danLevel: int = 0
|
||||
clearStatus: int = 0
|
||||
numSongCleared: int = 0
|
||||
song1BestScore: int = 0
|
||||
song2BestScore: int = 0
|
||||
song3BestScore: int = 0
|
||||
unk5: int = 1
|
||||
|
||||
def __init__(self, dan_id: int = 0, dan_level: int = 0) -> None:
|
||||
self.danId = dan_id
|
||||
self.danLevel = dan_level
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.danId,
|
||||
self.danLevel,
|
||||
self.clearStatus,
|
||||
self.numSongCleared,
|
||||
[
|
||||
self.song1BestScore,
|
||||
self.song2BestScore,
|
||||
self.song3BestScore,
|
||||
],
|
||||
self.unk5
|
||||
]
|
||||
|
||||
class StageupClearType(Enum):
|
||||
FAIL = 0
|
||||
CLEAR_BLUE = 1
|
||||
CLEAR_SILVER = 2
|
||||
CLEAR_GOLD = 3
|
||||
|
||||
class MusicUpdateDetailV1():
|
||||
def __init__(self) -> None:
|
||||
self.songId = 0
|
||||
self.difficulty = 1
|
||||
self.clearCounts: SongDetailClearCounts = SongDetailClearCounts()
|
||||
self.clearCountsSeason: SongDetailClearCounts = SongDetailClearCounts()
|
||||
self.grades: SongDetailGradeCountsV1 = SongDetailGradeCountsV1()
|
||||
self.score = 0
|
||||
self.lowestMissCount = 0
|
||||
self.maxSkillPts = 0
|
||||
self.locked = 0
|
||||
self.rating = 0
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.songId,
|
||||
self.difficulty,
|
||||
self.clearCounts.make(),
|
||||
self.clearCountsSeason.make(),
|
||||
self.grades.make(),
|
||||
self.score,
|
||||
self.lowestMissCount,
|
||||
self.maxSkillPts,
|
||||
self.locked,
|
||||
self.rating
|
||||
]
|
||||
|
||||
class MusicUpdateDetailV2(MusicUpdateDetailV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.grades = SongDetailGradeCountsV2()
|
||||
|
||||
class SongRatingUpdate():
|
||||
def __init__(self, song_id: int = 0, difficulty: int = 1, new_rating: int = 0) -> None:
|
||||
self.songId = song_id
|
||||
self.difficulty = difficulty
|
||||
self.rating = new_rating
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.songId,
|
||||
self.difficulty,
|
||||
self.rating,
|
||||
]
|
||||
|
||||
class GateTutorialFlag():
|
||||
def __init__(self, tutorial_id: int = 1, flg_watched: bool = False) -> None:
|
||||
self.tutorialId = tutorial_id
|
||||
self.flagWatched = flg_watched
|
||||
|
||||
def make(self) -> List:
|
||||
return [
|
||||
self.tutorialId,
|
||||
int(self.flagWatched)
|
||||
]
|
||||
38
titles/wacca/handlers/housing.py
Normal file
38
titles/wacca/handlers/housing.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from typing import List, Dict
|
||||
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import HousingInfo
|
||||
|
||||
# ---housing/get----
|
||||
class HousingGetResponse(BaseResponse):
|
||||
def __init__(self, housingId: int) -> None:
|
||||
super().__init__()
|
||||
self.housingId: int = housingId
|
||||
self.regionId: int = 0
|
||||
|
||||
def make(self) -> Dict:
|
||||
self.params = [self.housingId, self.regionId]
|
||||
return super().make()
|
||||
|
||||
# ---housing/start----
|
||||
class HousingStartRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.unknown0: str = self.params[0]
|
||||
self.errorLog: str = self.params[1]
|
||||
self.unknown2: str = self.params[2]
|
||||
self.info: List[HousingInfo] = []
|
||||
|
||||
for info in self.params[3]:
|
||||
self.info.append(HousingInfo(info[0], info[1]))
|
||||
|
||||
class HousingStartResponseV1(BaseResponse):
|
||||
def __init__(self, regionId: int, songList: List[int]) -> None:
|
||||
super().__init__()
|
||||
self.regionId = regionId
|
||||
self.songList = songList
|
||||
|
||||
def make(self) -> Dict:
|
||||
self.params = [self.regionId, self.songList]
|
||||
|
||||
return super().make()
|
||||
61
titles/wacca/handlers/user_info.py
Normal file
61
titles/wacca/handlers/user_info.py
Normal file
@@ -0,0 +1,61 @@
|
||||
from typing import List, Dict
|
||||
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import UserOption
|
||||
|
||||
# ---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.datesUpdated: List = self.params[3]
|
||||
self.favoritesAdded: List[int] = self.params[4]
|
||||
self.favoritesRemoved: List[int] = self.params[5]
|
||||
|
||||
for x in self.params[2]:
|
||||
self.optsUpdated.append(UserOption(x[0], x[1]))
|
||||
|
||||
# ---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])
|
||||
|
||||
class UserInfogetMyroomResponse(BaseResponse):
|
||||
def make(self) -> Dict:
|
||||
self.params = [
|
||||
0,0,0,0,0,[],0,0,0
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
# ---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()
|
||||
85
titles/wacca/handlers/user_misc.py
Normal file
85
titles/wacca/handlers/user_misc.py
Normal file
@@ -0,0 +1,85 @@
|
||||
from typing import List, Dict
|
||||
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import PurchaseType, GenericItemRecv
|
||||
from titles.wacca.handlers.helpers import TicketItem, SongRatingUpdate, BingoDetail
|
||||
from titles.wacca.handlers.helpers import BingoPageStatus, GateTutorialFlag
|
||||
|
||||
# ---user/goods/purchase---
|
||||
class UserGoodsPurchaseRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = int(self.params[0])
|
||||
self.purchaseId = int(self.params[1])
|
||||
self.purchaseCount = int(self.params[2])
|
||||
self.purchaseType = PurchaseType(self.params[3])
|
||||
self.cost = int(self.params[4])
|
||||
self.itemObtained: GenericItemRecv = GenericItemRecv(self.params[5][0], self.params[5][1], self.params[5][2])
|
||||
|
||||
class UserGoodsPurchaseResponse(BaseResponse):
|
||||
def __init__(self, wp: int = 0, tickets: List = []) -> None:
|
||||
super().__init__()
|
||||
self.currentWp = wp
|
||||
self.tickets: List[TicketItem] = []
|
||||
|
||||
for ticket in tickets:
|
||||
self.tickets.append(TicketItem(ticket[0], ticket[1], ticket[2]))
|
||||
|
||||
def make(self) -> List:
|
||||
tix = []
|
||||
for ticket in self.tickets:
|
||||
tix.append(ticket.make())
|
||||
|
||||
self.params = [self.currentWp, tix]
|
||||
|
||||
return super().make()
|
||||
|
||||
# ---user/sugaroku/update---
|
||||
class UserSugarokuUpdateRequestV1(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = int(self.params[0])
|
||||
self.gateId = int(self.params[1])
|
||||
self.page = int(self.params[2])
|
||||
self.progress = int(self.params[3])
|
||||
self.loops = int(self.params[4])
|
||||
self.boostsUsed = self.params[5]
|
||||
self.totalPts = int(self.params[7])
|
||||
self.itemsObtainted: List[GenericItemRecv] = []
|
||||
|
||||
for item in self.params[6]:
|
||||
self.itemsObtainted.append(GenericItemRecv(item[0], item[1], item[2]))
|
||||
|
||||
class UserSugarokuUpdateRequestV2(UserSugarokuUpdateRequestV1):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.mission_flag = int(self.params[8])
|
||||
|
||||
# ---user/rating/update---
|
||||
class UserRatingUpdateRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
self.totalRating = self.params[1]
|
||||
self.songs: List[SongRatingUpdate] = []
|
||||
|
||||
for x in self.params[2]:
|
||||
self.songs.append(SongRatingUpdate(x[0], x[1], x[2]))
|
||||
|
||||
# ---user/mission/update---
|
||||
class UserMissionUpdateRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
self.bingoDetail = BingoDetail(self.params[1][0])
|
||||
self.itemsObtained: List[GenericItemRecv] = []
|
||||
self.gateTutorialFlags: List[GateTutorialFlag] = []
|
||||
|
||||
for x in self.params[1][1]:
|
||||
self.bingoDetail.pageStatus.append(BingoPageStatus(x[0], x[1], x[2]))
|
||||
|
||||
for x in self.params[2]:
|
||||
self.itemsObtained.append(GenericItemRecv(x[0], x[1], x[2]))
|
||||
|
||||
for x in self.params[3]:
|
||||
self.gateTutorialFlags.append(GateTutorialFlag(x[0], x[1]))
|
||||
92
titles/wacca/handlers/user_music.py
Normal file
92
titles/wacca/handlers/user_music.py
Normal file
@@ -0,0 +1,92 @@
|
||||
from typing import List, Dict
|
||||
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import GenericItemRecv, SongUpdateDetail, TicketItem
|
||||
from titles.wacca.handlers.helpers import MusicUpdateDetailV1, MusicUpdateDetailV2
|
||||
from titles.wacca.handlers.helpers import SeasonalInfoV2, SeasonalInfoV1
|
||||
|
||||
# ---user/music/update---
|
||||
class UserMusicUpdateRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId: int = self.params[0]
|
||||
self.songNumber: int = self.params[1]
|
||||
self.songDetail = SongUpdateDetail(self.params[2])
|
||||
self.itemsObtained: List[GenericItemRecv] = []
|
||||
|
||||
for itm in data["params"][3]:
|
||||
self.itemsObtained.append(GenericItemRecv(itm[0], itm[1], itm[2]))
|
||||
|
||||
class UserMusicUpdateResponseV1(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.songDetail = MusicUpdateDetailV1()
|
||||
self.seasonInfo = SeasonalInfoV1()
|
||||
self.rankingInfo: List[List[int]] = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
self.params = [
|
||||
self.songDetail.make(),
|
||||
[self.songDetail.songId, self.songDetail.clearCounts.playCt],
|
||||
self.seasonInfo.make(),
|
||||
self.rankingInfo
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
class UserMusicUpdateResponseV2(UserMusicUpdateResponseV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.seasonInfo = SeasonalInfoV2()
|
||||
|
||||
class UserMusicUpdateResponseV3(UserMusicUpdateResponseV2):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.songDetail = MusicUpdateDetailV2()
|
||||
|
||||
# ---user/music/updateCoop---
|
||||
class UserMusicUpdateCoopRequest(UserMusicUpdateRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.coopData = self.params[4]
|
||||
|
||||
# ---user/music/updateVs---
|
||||
class UserMusicUpdateVsRequest(UserMusicUpdateRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.vsData = self.params[4]
|
||||
|
||||
# ---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]
|
||||
self.difficulty = self.params[2]
|
||||
self.itemsUsed: List[GenericItemRecv] = []
|
||||
|
||||
for itm in self.params[3]:
|
||||
self.itemsUsed.append(GenericItemRecv(itm[0], itm[1], itm[2]))
|
||||
|
||||
class UserMusicUnlockResponse(BaseResponse):
|
||||
def __init__(self, current_wp: int = 0, tickets_remaining: List = []) -> None:
|
||||
super().__init__()
|
||||
self.wp = current_wp
|
||||
self.tickets: List[TicketItem] = []
|
||||
|
||||
for ticket in tickets_remaining:
|
||||
self.tickets.append(TicketItem(ticket[0], ticket[1], ticket[2]))
|
||||
|
||||
def make(self) -> List:
|
||||
tickets = []
|
||||
|
||||
for ticket in self.tickets:
|
||||
tickets.append(ticket.make())
|
||||
|
||||
self.params = [
|
||||
self.wp,
|
||||
tickets
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
289
titles/wacca/handlers/user_status.py
Normal file
289
titles/wacca/handlers/user_status.py
Normal file
@@ -0,0 +1,289 @@
|
||||
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
|
||||
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.aimeId = int(data["params"][0])
|
||||
|
||||
class UserStatusGetV1Response(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.userStatus: UserStatusV1 = UserStatusV1()
|
||||
self.setTitleId: int = 0
|
||||
self.setIconId: int = 0
|
||||
self.profileStatus: ProfileStatus = ProfileStatus.ProfileGood
|
||||
self.versionStatus: PlayVersionStatus = PlayVersionStatus.VersionGood
|
||||
self.lastGameVersion: str = ""
|
||||
|
||||
def make(self) -> Dict:
|
||||
self.params = [
|
||||
self.userStatus.make(),
|
||||
self.setTitleId,
|
||||
self.setIconId,
|
||||
self.profileStatus.value,
|
||||
[
|
||||
self.versionStatus.value,
|
||||
self.lastGameVersion
|
||||
]
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
class UserStatusGetV2Response(UserStatusGetV1Response):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.userStatus: UserStatusV2 = UserStatusV2()
|
||||
self.unknownArr: List = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
super().make()
|
||||
|
||||
self.params.append(self.unknownArr)
|
||||
|
||||
return super(UserStatusGetV1Response, self).make()
|
||||
|
||||
# ---user/status/getDetail----
|
||||
class UserStatusGetDetailRequest(BaseRequest):
|
||||
userId: int = 0
|
||||
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.userId = data["params"][0]
|
||||
|
||||
class UserStatusGetDetailResponseV1(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.userStatus: UserStatusV1 = UserStatusV1()
|
||||
self.options: List[UserOption] = []
|
||||
self.seasonalPlayModeCounts: List[PlayModeCounts] = []
|
||||
self.userItems: UserItemInfoV1 = UserItemInfoV1()
|
||||
self.scores: List[BestScoreDetailV1] = []
|
||||
self.songPlayStatus: List[int] = [0,0]
|
||||
self.seasonInfo: 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.songUpdateTime: int = 0
|
||||
|
||||
def make(self) -> List:
|
||||
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())
|
||||
|
||||
self.params = [
|
||||
self.userStatus.make(),
|
||||
opts,
|
||||
play_modes,
|
||||
self.userItems.make(),
|
||||
scores,
|
||||
self.songPlayStatus,
|
||||
self.seasonInfo.make(),
|
||||
self.playAreaList,
|
||||
self.songUpdateTime
|
||||
]
|
||||
|
||||
return super().make()
|
||||
|
||||
def find_score_idx(self, song_id: int, difficulty: int = 1, start_idx: int = 0, stop_idx: 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:
|
||||
return x
|
||||
|
||||
return None
|
||||
|
||||
class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.userStatus: UserStatusV2 = UserStatusV2()
|
||||
self.seasonInfo: SeasonalInfoV2 = SeasonalInfoV2()
|
||||
self.userItems: UserItemInfoV2 = UserItemInfoV2()
|
||||
self.favorites: List[int] = []
|
||||
self.stoppedSongIds: List[int] = []
|
||||
self.eventInfo: List[int] = []
|
||||
self.gateInfo: List[GateDetailV1] = []
|
||||
self.lastSongInfo: LastSongDetail = LastSongDetail()
|
||||
self.gateTutorialFlags: List[GateTutorialFlag] = []
|
||||
self.gatchaInfo: List[GachaInfo] = []
|
||||
self.friendList: List[FriendDetail] = []
|
||||
|
||||
def make(self) -> List:
|
||||
super().make()
|
||||
gates = []
|
||||
friends = []
|
||||
tut_flg = []
|
||||
|
||||
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])
|
||||
|
||||
self.params.append(self.favorites)
|
||||
self.params.append(self.stoppedSongIds)
|
||||
self.params.append(self.eventInfo)
|
||||
self.params.append(gates)
|
||||
self.params.append(self.lastSongInfo.make())
|
||||
self.params.append(tut_flg)
|
||||
self.params.append(self.gatchaInfo)
|
||||
self.params.append(friends)
|
||||
|
||||
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__()
|
||||
self.userItems: UserItemInfoV3 = UserItemInfoV3()
|
||||
self.bingoStatus: BingoDetail = BingoDetail(0)
|
||||
self.scores: List[BestScoreDetailV2] = []
|
||||
|
||||
def make(self) -> List:
|
||||
super().make()
|
||||
self.params.append(self.bingoStatus.make())
|
||||
|
||||
return super(UserStatusGetDetailResponseV1, self).make()
|
||||
|
||||
# ---user/status/login----
|
||||
class UserStatusLoginRequest(BaseRequest):
|
||||
userId: int = 0
|
||||
|
||||
def __init__(self, data: Dict) -> None:
|
||||
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:
|
||||
super().__init__()
|
||||
self.dailyBonus: List[LoginBonusInfo] = []
|
||||
self.consecBonus: List[LoginBonusInfo] = []
|
||||
self.otherBonus: List[LoginBonusInfo] = []
|
||||
self.firstLoginDaily = is_first_login_daily
|
||||
self.lastLoginDate = last_login_date
|
||||
|
||||
def make(self) -> List:
|
||||
daily = []
|
||||
consec = []
|
||||
other = []
|
||||
|
||||
for bonus in self.dailyBonus:
|
||||
daily.append(bonus.make())
|
||||
|
||||
for bonus in self.consecBonus:
|
||||
consec.append(bonus.make())
|
||||
|
||||
for bonus in self.otherBonus:
|
||||
other.append(bonus.make())
|
||||
|
||||
self.params = [ daily, consec, other, int(self.firstLoginDaily)]
|
||||
return super().make()
|
||||
|
||||
class UserStatusLoginResponseV2(UserStatusLoginResponseV1):
|
||||
vipInfo: VipInfo
|
||||
lastLoginDate: int = 0
|
||||
|
||||
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) -> List:
|
||||
super().make()
|
||||
self.params.append(self.vipInfo.make())
|
||||
self.params.append(self.lastLoginDate)
|
||||
return super(UserStatusLoginResponseV1, self).make()
|
||||
|
||||
class UserStatusLoginResponseV3(UserStatusLoginResponseV2):
|
||||
unk: List = []
|
||||
|
||||
def make(self) -> List:
|
||||
super().make()
|
||||
self.params.append(self.unk)
|
||||
return super(UserStatusLoginResponseV1, self).make()
|
||||
|
||||
# ---user/status/create---
|
||||
class UserStatusCreateRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
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) -> List:
|
||||
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.userId = userId
|
||||
self.userStatus.username = username
|
||||
|
||||
# ---user/status/logout---
|
||||
class UserStatusLogoutRequest(BaseRequest):
|
||||
userId: int
|
||||
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.userId = data["params"][0]
|
||||
|
||||
# ---user/status/update---
|
||||
class UserStatusUpdateRequestV1(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId: int = data["params"][0]
|
||||
self.playType: PlayType = PlayType(data["params"][1])
|
||||
self.itemsRecieved: List[GenericItemRecv] = []
|
||||
|
||||
for itm in data["params"][2]:
|
||||
self.itemsRecieved.append(GenericItemRecv(itm[0], itm[1], itm[2]))
|
||||
|
||||
class UserStatusUpdateRequestV2(UserStatusUpdateRequestV1):
|
||||
isContinue = False
|
||||
isFirstPlayFree = False
|
||||
itemsUsed = []
|
||||
lastSongInfo: LastSongDetail
|
||||
|
||||
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])
|
||||
48
titles/wacca/handlers/user_trial.py
Normal file
48
titles/wacca/handlers/user_trial.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from typing import Dict, List
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import StageInfo, StageupClearType
|
||||
|
||||
# --user/trial/get--
|
||||
class UserTrialGetRequest(BaseRequest):
|
||||
profileId: int = 0
|
||||
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
|
||||
class UserTrialGetResponse(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
self.stageList: List[StageInfo] = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
dans = []
|
||||
for x in self.stageList:
|
||||
dans.append(x.make())
|
||||
|
||||
self.params = [dans]
|
||||
return super().make()
|
||||
|
||||
# --user/trial/update--
|
||||
class UserTrialUpdateRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
self.stageId = self.params[1]
|
||||
self.stageLevel = self.params[2]
|
||||
self.clearType = StageupClearType(self.params[3])
|
||||
self.songScores = self.params[4]
|
||||
self.numSongsCleared = self.params[5]
|
||||
self.itemsObtained = self.params[6]
|
||||
self.unk7: List = []
|
||||
|
||||
if len(self.params) == 8:
|
||||
self.unk7 = self.params[7]
|
||||
|
||||
class UserTrialUpdateResponse(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def make(self) -> Dict:
|
||||
return super().make()
|
||||
54
titles/wacca/handlers/user_vip.py
Normal file
54
titles/wacca/handlers/user_vip.py
Normal file
@@ -0,0 +1,54 @@
|
||||
from typing import Dict, List
|
||||
from titles.wacca.handlers.base import BaseRequest, BaseResponse
|
||||
from titles.wacca.handlers.helpers import VipLoginBonus
|
||||
|
||||
# --user/vip/get--
|
||||
class UserVipGetRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
|
||||
class UserVipGetResponse(BaseResponse):
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.vipDays: int = 0
|
||||
self.unknown1: int = 1
|
||||
self.unknown2: int = 1
|
||||
self.presents: List[VipLoginBonus] = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
pres = []
|
||||
for x in self.presents:
|
||||
pres.append(x.make())
|
||||
|
||||
self.params = [
|
||||
self.vipDays,
|
||||
[
|
||||
self.unknown1,
|
||||
self.unknown2,
|
||||
pres
|
||||
]
|
||||
]
|
||||
return super().make()
|
||||
|
||||
# --user/vip/start--
|
||||
class UserVipStartRequest(BaseRequest):
|
||||
def __init__(self, data: Dict) -> None:
|
||||
super().__init__(data)
|
||||
self.profileId = self.params[0]
|
||||
self.cost = self.params[1]
|
||||
self.days = self.params[2]
|
||||
|
||||
class UserVipStartResponse(BaseResponse):
|
||||
def __init__(self, expires: int = 0) -> None:
|
||||
super().__init__()
|
||||
self.whenExpires: int = expires
|
||||
self.presents = []
|
||||
|
||||
def make(self) -> Dict:
|
||||
self.params = [
|
||||
self.whenExpires,
|
||||
self.presents
|
||||
]
|
||||
|
||||
return super().make()
|
||||
Reference in New Issue
Block a user