reformat with black in preperation for merge to master

This commit is contained in:
Kevin Trocolli
2023-04-23 21:04:52 -04:00
parent 9d23d59e43
commit 238d437519
70 changed files with 920 additions and 603 deletions

View File

@@ -200,18 +200,24 @@ class WaccaBase:
self.logger.info(f"User {req.userId} login on {req.chipId}")
last_login_time = int(profile["last_login_date"].timestamp())
resp.lastLoginDate = last_login_time
midnight_today_ts = int(datetime.now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp())
midnight_today_ts = int(
datetime.now()
.replace(hour=0, minute=0, second=0, microsecond=0)
.timestamp()
)
# If somebodies login timestamp < midnight of current day, then they are logging in for the first time today
if last_login_time < midnight_today_ts:
resp.firstLoginDaily = True
# If the difference between midnight today and their last login is greater then 1 day (86400 seconds) they've broken their streak
# If the difference between midnight today and their last login is greater then 1 day (86400 seconds) they've broken their streak
if midnight_today_ts - last_login_time > 86400:
is_consec_day = False
self.data.profile.session_login(req.userId, resp.firstLoginDaily, is_consec_day)
self.data.profile.session_login(
req.userId, resp.firstLoginDaily, is_consec_day
)
if resp.firstLoginDaily:
# TODO: Daily bonus
pass
@@ -624,17 +630,25 @@ class WaccaBase:
new_tickets.append([ticket["id"], ticket["ticket_id"], 9999999999])
for item in req.itemsUsed:
if item.itemType == WaccaConstants.ITEM_TYPES["wp"] and not self.game_config.mods.infinite_wp:
if (
item.itemType == WaccaConstants.ITEM_TYPES["wp"]
and not self.game_config.mods.infinite_wp
):
if current_wp >= item.quantity:
current_wp -= item.quantity
self.data.profile.spend_wp(req.profileId, item.quantity)
else:
return BaseResponse().make()
elif item.itemType == WaccaConstants.ITEM_TYPES["ticket"] and not self.game_config.mods.infinite_tickets:
elif (
item.itemType == WaccaConstants.ITEM_TYPES["ticket"]
and not self.game_config.mods.infinite_tickets
):
for x in range(len(new_tickets)):
if new_tickets[x][1] == item.itemId:
self.logger.debug(f"Remove ticket ID {new_tickets[x][0]} type {new_tickets[x][1]} from {user_id}")
self.logger.debug(
f"Remove ticket ID {new_tickets[x][0]} type {new_tickets[x][1]} from {user_id}"
)
self.data.item.spend_ticket(new_tickets[x][0])
new_tickets.pop(x)
break
@@ -865,7 +879,10 @@ class WaccaBase:
user_id = profile["user"]
resp.currentWp = profile["wp"]
if req.purchaseType == PurchaseType.PurchaseTypeWP and not self.game_config.mods.infinite_wp:
if (
req.purchaseType == PurchaseType.PurchaseTypeWP
and not self.game_config.mods.infinite_wp
):
resp.currentWp -= req.cost
self.data.profile.spend_wp(req.profileId, req.cost)
@@ -1055,11 +1072,18 @@ class WaccaBase:
):
if item.quantity > WaccaConstants.Difficulty.HARD.value:
old_score = self.data.score.get_best_score(
user_id, item.itemId, item.quantity
)
user_id, item.itemId, item.quantity
)
if not old_score:
self.data.score.put_best_score(
user_id, item.itemId, item.quantity, 0, [0] * 5, [0] * 13, 0, 0
user_id,
item.itemId,
item.quantity,
0,
[0] * 5,
[0] * 13,
0,
0,
)
if item.quantity == 0:

View File

@@ -366,7 +366,7 @@ class UserEventInfo:
conditions = []
for x in self.conditionInfo:
conditions.append(x.make())
return [self.eventId, conditions]
@@ -374,7 +374,7 @@ class UserEventConditionInfo:
def __init__(self) -> None:
self.achievementCondition = 0
self.progress = 0
def make(self) -> List:
return [self.achievementCondition, self.progress]
@@ -835,11 +835,13 @@ class LastSongDetail:
class FriendScoreDetail:
def __init__(self, song_id: int = 0, difficulty: int = 1, best_score: int = 0) -> None:
def __init__(
self, song_id: int = 0, difficulty: int = 1, best_score: int = 0
) -> None:
self.songId = song_id
self.difficulty = difficulty
self.bestScore = best_score
def make(self) -> List:
return [self.songId, self.difficulty, self.bestScore]

View File

@@ -11,7 +11,7 @@ class UserInfoUpdateRequest(BaseRequest):
self.profileId = int(self.params[0])
self.optsUpdated: List[UserOption] = []
self.unknown2: List = self.params[2]
self.datesUpdated: List[DateUpdate] = []
self.datesUpdated: List[DateUpdate] = []
self.favoritesRemoved: List[int] = self.params[4]
self.favoritesAdded: List[int] = self.params[5]

View File

@@ -168,7 +168,7 @@ class UserStatusGetDetailResponseV2(UserStatusGetDetailResponseV1):
while len(tut_flg) < 5:
flag_id = len(tut_flg) + 1
tut_flg.append([flag_id, 0])
for x in self.eventInfo:
evts.append(x.make())
@@ -267,7 +267,9 @@ class UserStatusLoginResponseV3(UserStatusLoginResponseV2):
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 = [] # Ticket info, item info, message, title, voice name (not sure how they fit...)
self.unk: List = (
[]
) # Ticket info, item info, message, title, voice name (not sure how they fit...)
def make(self) -> Dict:
super().make()

View File

@@ -73,7 +73,7 @@ class WaccaLily(WaccaS):
self.logger.info(f"No user exists for aime id {req.aimeId}")
resp.profileStatus = ProfileStatus.ProfileRegister
return resp.make()
opts = self.data.profile.get_options(req.aimeId)
self.logger.info(f"User preview for {req.aimeId} from {req.chipId}")
@@ -139,7 +139,7 @@ class WaccaLily(WaccaS):
if self.game_config.mods.infinite_wp:
resp.userStatus.wp = 999999
for opt in opts:
resp.options.append(UserOption(opt["opt_id"], opt["value"]))
@@ -165,17 +165,23 @@ class WaccaLily(WaccaS):
self.logger.info(f"User {req.userId} login on {req.chipId}")
last_login_time = int(profile["last_login_date"].timestamp())
resp.lastLoginDate = last_login_time
midnight_today_ts = int(datetime.now().replace(hour=0, minute=0, second=0, microsecond=0).timestamp())
midnight_today_ts = int(
datetime.now()
.replace(hour=0, minute=0, second=0, microsecond=0)
.timestamp()
)
# If somebodies login timestamp < midnight of current day, then they are logging in for the first time today
if last_login_time < midnight_today_ts:
resp.firstLoginDaily = True
# If the difference between midnight today and their last login is greater then 1 day (86400 seconds) they've broken their streak
# If the difference between midnight today and their last login is greater then 1 day (86400 seconds) they've broken their streak
if midnight_today_ts - last_login_time > 86400:
is_consec_day = False
self.data.profile.session_login(req.userId, resp.firstLoginDaily, is_consec_day)
self.data.profile.session_login(
req.userId, resp.firstLoginDaily, is_consec_day
)
resp.vipInfo.pageYear = datetime.now().year
resp.vipInfo.pageMonth = datetime.now().month
resp.vipInfo.pageDay = datetime.now().day

View File

@@ -141,7 +141,7 @@ class WaccaReverse(WaccaLilyR):
)
# For some fucking reason if this isn't here time play is disabled
resp.seasonalPlayModeCounts.append(PlayModeCounts(0, 1, 1))
resp.seasonalPlayModeCounts.append(PlayModeCounts(0, 1, 1))
for opt in profile_options:
resp.options.append(UserOption(opt["opt_id"], opt["value"]))