1
0
forked from Hay1tsme/artemis

wacca: fix favorites, purchasing and unlocking songs, incorrectly displayed grades

This commit is contained in:
Hay1tsme 2023-03-18 12:26:57 -04:00
parent 188be2dfc1
commit 62b62db5b5
4 changed files with 27 additions and 20 deletions

View File

@ -635,14 +635,14 @@ class WaccaBase:
new_tickets.append([ticket["id"], ticket["ticket_id"], 9999999999])
for item in req.itemsUsed:
if item.itemType == WaccaConstants.ITEM_TYPES["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"]:
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.data.item.spend_ticket(new_tickets[x][0])
@ -880,7 +880,7 @@ class WaccaBase:
user_id = profile["user"]
resp.currentWp = profile["wp"]
if req.purchaseType == PurchaseType.PurchaseTypeWP:
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)
@ -1070,19 +1070,12 @@ 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
)
if not old_score:
self.data.score.put_best_score(
user_id,
item.itemId,
item.quantity,
0,
[0] * 5,
[0] * 13,
0,
0,
)
if item.quantity == 0:
item.quantity = WaccaConstants.Difficulty.HARD.value

View File

@ -577,7 +577,21 @@ class SongDetailGradeCountsV2(SongDetailGradeCountsV1):
self.ssspCt = counts[12]
def make(self) -> List:
return super().make() + [self.spCt, self.sspCt, self.ssspCt]
return [
self.dCt,
self.cCt,
self.bCt,
self.aCt,
self.aaCt,
self.aaaCt,
self.sCt,
self.spCt,
self.ssCt,
self.sspCt,
self.sssCt,
self.ssspCt,
self.masterCt,
]
class BestScoreDetailV1:

View File

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

View File

@ -102,7 +102,7 @@ class WaccaServlet:
resp.message = "不正なリクエスト エラーです"
return end(resp.make())
if "/api/" in url_path:
if "api/" in url_path:
func_to_find = (
"handle_" + url_path.partition("api/")[2].replace("/", "_") + "_request"
)