1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-12-11 23:25:58 +01:00

fix custom color and discarded card item reward every n*100 plays

This commit is contained in:
ghkkk090 2022-07-23 16:40:17 +07:00
parent f471add716
commit b076fff40c

View File

@ -21,7 +21,6 @@ export default class GameModule extends Module {
carId: body.carId carId: body.carId
} }
}); });
console.log(body);
let storyLose: boolean = false; let storyLose: boolean = false;
switch (body.gameMode) { switch (body.gameMode) {
case wm.wm.protobuf.GameMode.MODE_STORY: case wm.wm.protobuf.GameMode.MODE_STORY:
@ -92,20 +91,6 @@ export default class GameModule extends Module {
}); });
console.log('-------'); console.log('-------');
console.log(c); console.log(c);
if(body.earnedItems.length !== 0){
console.log('Game reward available, continuing ...');
for(let i=0; i<body.earnedItems.length; i++){
await prisma.carItem.create({
data: {
carId: body.carId,
category: body.earnedItems[i].category,
itemId: body.earnedItems[i].itemId,
amount: 1
}
});
}
}
} }
break; break;
} }
@ -278,9 +263,13 @@ export default class GameModule extends Module {
}, },
data: saveEx data: saveEx
}); });
}
}
}
// Get car item
if(body.earnedItems.length !== 0){ if(body.earnedItems.length !== 0){
console.log('Game reward available, continuing ...'); console.log('Car Item reward available, continuing ...');
for(let i=0; i<body.earnedItems.length; i++){ for(let i=0; i<body.earnedItems.length; i++){
await prisma.carItem.create({ await prisma.carItem.create({
data: { data: {
@ -292,7 +281,20 @@ export default class GameModule extends Module {
}); });
} }
} }
// Get user item
if(body.earnedUserItems.length !== 0){
console.log('User Item reward available, continuing ...');
for(let i=0; i<body.earnedUserItems.length; i++){
await prisma.userItem.create({
data: {
category: body.earnedUserItems[i].category,
itemId: body.earnedUserItems[i].itemId,
userId: body.car!.userId!,
earnedAt: 0,
type: 0
} }
});
} }
} }
@ -311,6 +313,7 @@ export default class GameModule extends Module {
tunePower: body.car!.tunePower!, tunePower: body.car!.tunePower!,
tuneHandling: body.car!.tuneHandling!, tuneHandling: body.car!.tuneHandling!,
windowSticker: body.car!.windowSticker!, windowSticker: body.car!.windowSticker!,
earnedCustomColor: body.earnedCustomColor!
} }
}) })
@ -386,11 +389,8 @@ export default class GameModule extends Module {
}) })
app.post('/method/load_user', async (req, res) => { app.post('/method/load_user', async (req, res) => {
let body = wm.wm.protobuf.LoadUserRequest.decode(req.body); let body = wm.wm.protobuf.LoadUserRequest.decode(req.body);
let user = await prisma.user.findFirst({ let user = await prisma.user.findFirst({
where: { where: {
chipId: body.cardChipId, chipId: body.cardChipId,
@ -407,7 +407,6 @@ export default class GameModule extends Module {
// No user returned // No user returned
if (!user) { if (!user) {
console.log('no such user'); console.log('no such user');
let msg = { let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -1231,9 +1230,7 @@ export default class GameModule extends Module {
}) })
app.post('/method/update_car', async (req, res) => { app.post('/method/update_car', async (req, res) => {
let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body); let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body);
let car = await prisma.car.findFirst({ let car = await prisma.car.findFirst({
where: { where: {
carId: body.carId carId: body.carId
@ -1280,6 +1277,21 @@ export default class GameModule extends Module {
} }
}); });
// Get car item
if(body.earnedItems.length !== 0){
console.log('Car Item reward available, continuing ...');
for(let i=0; i<body.earnedItems.length; i++){
await prisma.carItem.create({
data: {
carId: body.carId,
category: body.earnedItems[i].category,
itemId: body.earnedItems[i].itemId,
amount: 1
}
});
}
}
let msg = { let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
} }
@ -1739,7 +1751,6 @@ export default class GameModule extends Module {
}) })
app.post('/method/update_user_session', (req, res) => { app.post('/method/update_user_session', (req, res) => {
// Get the request body // Get the request body
// let body = wm.wm.protobuf.UpdateUserSessionRequest.decode(req.body); // let body = wm.wm.protobuf.UpdateUserSessionRequest.decode(req.body);
@ -1776,7 +1787,6 @@ export default class GameModule extends Module {
app.post('/method/search_cars_by_level', async (req, res) => { app.post('/method/search_cars_by_level', async (req, res) => {
let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body); let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body);
console.log(body);
//---------------MAYBE NOT CORRECT--------------- //---------------MAYBE NOT CORRECT---------------
let rampVal = 0; let rampVal = 0;
let pathVal = 0; let pathVal = 0;