1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-12-03 03:27:21 +01:00

Update changing dress up and window sticker from terminal

This commit is contained in:
ghkkk090 2022-07-22 10:08:20 +07:00
parent e323f64dee
commit d7e9057659

View File

@ -177,116 +177,117 @@ export default class GameModule extends Module {
} }
case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE: case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE:
{ {
console.log(body); if (!(body.retired)) {
let saveEx: any = {}; let saveEx: any = {};
if (body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined) { if (body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined) {
saveEx.rgRegionMapScore = body.rgResult?.rgRegionMapScore!; saveEx.rgRegionMapScore = body.rgResult?.rgRegionMapScore!;
} else { } else {
saveEx.rgRegionMapScore = car?.rgRegionMapScore; saveEx.rgRegionMapScore = car?.rgRegionMapScore;
} }
if (body.rgResult?.rgPlayCount !== null && body.rgResult?.rgPlayCount !== undefined) { if (body.rgResult?.rgPlayCount !== null && body.rgResult?.rgPlayCount !== undefined) {
saveEx.rgPlayCount = body.rgResult?.rgPlayCount!; saveEx.rgPlayCount = body.rgResult?.rgPlayCount!;
} else { } else {
saveEx.rgPlayCount = car?.rgPlayCount; saveEx.rgPlayCount = car?.rgPlayCount;
} }
if (body.rgResult?.dressupLevel !== null && body.rgResult?.dressupLevel !== undefined) { if (body.rgResult?.dressupLevel !== null && body.rgResult?.dressupLevel !== undefined) {
saveEx.dressupLevel = body.rgResult?.dressupLevel!; saveEx.dressupLevel = body.rgResult?.dressupLevel!;
} else { } else {
saveEx.dressupLevel = car?.dressupLevel; saveEx.dressupLevel = car?.dressupLevel;
} }
if (body.rgResult?.dressupPoint !== null && body.rgResult?.dressupPoint !== undefined) { if (body.rgResult?.dressupPoint !== null && body.rgResult?.dressupPoint !== undefined) {
saveEx.dressupPoint = body.rgResult?.dressupPoint!; saveEx.dressupPoint = body.rgResult?.dressupPoint!;
} else { } else {
saveEx.dressupPoint = car?.dressupPoint; saveEx.dressupPoint = car?.dressupPoint;
} }
if (body.car?.wheel !== null && body.car?.wheel !== undefined) { if (body.car?.wheel !== null && body.car?.wheel !== undefined) {
saveEx.wheel = body.car?.wheel!; saveEx.wheel = body.car?.wheel!;
} else { } else {
saveEx.wheel = car?.wheel; saveEx.wheel = car?.wheel;
} }
if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) { if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) {
saveEx.wheelColor = body.car?.wheelColor!; saveEx.wheelColor = body.car?.wheelColor!;
} else { } else {
saveEx.wheelColor = car?.wheelColor; saveEx.wheelColor = car?.wheelColor;
} }
if (body.car?.aero !== null && body.car?.aero !== undefined) { if (body.car?.aero !== null && body.car?.aero !== undefined) {
saveEx.aero = body.car?.aero!; saveEx.aero = body.car?.aero!;
} else { } else {
saveEx.aero = car?.aero; saveEx.aero = car?.aero;
} }
if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) { if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) {
saveEx.bonnet = body.car?.bonnet!; saveEx.bonnet = body.car?.bonnet!;
} else { } else {
saveEx.bonnet = car?.bonnet; saveEx.bonnet = car?.bonnet;
} }
if (body.car?.wing !== null && body.car?.wing !== undefined) { if (body.car?.wing !== null && body.car?.wing !== undefined) {
saveEx.wing = body.car?.wing!; saveEx.wing = body.car?.wing!;
} else { } else {
saveEx.wing = car?.wing; saveEx.wing = car?.wing;
} }
if (body.car?.mirror !== null && body.car?.mirror !== undefined) { if (body.car?.mirror !== null && body.car?.mirror !== undefined) {
saveEx.mirror = body.car?.mirror!; saveEx.mirror = body.car?.mirror!;
} else { } else {
saveEx.mirror = car?.mirror; saveEx.mirror = car?.mirror;
} }
if (body.car?.neon !== null && body.car?.neon !== undefined) { if (body.car?.neon !== null && body.car?.neon !== undefined) {
saveEx.neon = body.car?.neon!; saveEx.neon = body.car?.neon!;
} else { } else {
saveEx.neon = car?.neon; saveEx.neon = car?.neon;
} }
if (body.car?.trunk !== null && body.car?.trunk !== undefined) { if (body.car?.trunk !== null && body.car?.trunk !== undefined) {
saveEx.trunk = body.car?.trunk!; saveEx.trunk = body.car?.trunk!;
} else { } else {
saveEx.trunk = car?.trunk; saveEx.trunk = car?.trunk;
} }
if (body.car?.plate !== null && body.car?.plate !== undefined) { if (body.car?.plate !== null && body.car?.plate !== undefined) {
saveEx.plate = body.car?.plate!; saveEx.plate = body.car?.plate!;
} else { } else {
saveEx.plate = car?.plate; saveEx.plate = car?.plate;
} }
if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) { if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) {
saveEx.plateColor = body.car?.plateColor!; saveEx.plateColor = body.car?.plateColor!;
} else { } else {
saveEx.plateColor = car?.plateColor; saveEx.plateColor = car?.plateColor;
} }
if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) { if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) {
saveEx.plateNumber = body.car?.plateNumber!; saveEx.plateNumber = body.car?.plateNumber!;
} else { } else {
saveEx.plateNumber = car?.plateNumber; saveEx.plateNumber = car?.plateNumber;
} }
if (body.car?.ghostLevel !== null && body.car?.ghostLevel !== undefined) { if (body.car?.ghostLevel !== null && body.car?.ghostLevel !== undefined) {
saveEx.ghostLevel = body.car?.ghostLevel!; saveEx.ghostLevel = body.car?.ghostLevel!;
} else { } else {
saveEx.ghostLevel = car?.ghostLevel; saveEx.ghostLevel = car?.ghostLevel;
}
let winCounter = 0;
if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){
for(let i=0; i<body.rgResult.rgRegionMapScore.length; i++){
winCounter += body.rgResult.rgRegionMapScore[i];
} }
}
saveEx.rgWinCount = winCounter;
saveEx.rgScore = winCounter;
let c = await prisma.car.update({ let winCounter = 0;
where: { if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){
carId: body.carId for(let i=0; i<body.rgResult.rgRegionMapScore.length; i++){
}, winCounter += body.rgResult.rgRegionMapScore[i];
data: saveEx }
}); }
saveEx.rgWinCount = winCounter;
saveEx.rgScore = winCounter;
if(body.earnedItems.length !== 0){ let c = await prisma.car.update({
console.log('Game reward available, continuing ...'); where: {
for(let i=0; i<body.earnedItems.length; i++){ carId: body.carId
await prisma.carItem.create({ },
data: { data: saveEx
carId: body.carId, });
category: body.earnedItems[i].category,
itemId: body.earnedItems[i].itemId, if(body.earnedItems.length !== 0){
amount: 1 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
}
});
}
} }
} }
} }
@ -1132,6 +1133,84 @@ export default class GameModule extends Module {
settings: true settings: true
} }
}); });
let saveEx: any = {};
if (body.car?.wheel !== null && body.car?.wheel !== undefined) {
saveEx.wheel = body.car?.wheel!;
} else {
saveEx.wheel = car?.wheel;
}
if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) {
saveEx.wheelColor = body.car?.wheelColor!;
} else {
saveEx.wheelColor = car?.wheelColor;
}
if (body.car?.aero !== null && body.car?.aero !== undefined) {
saveEx.aero = body.car?.aero!;
} else {
saveEx.aero = car?.aero;
}
if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) {
saveEx.bonnet = body.car?.bonnet!;
} else {
saveEx.bonnet = car?.bonnet;
}
if (body.car?.wing !== null && body.car?.wing !== undefined) {
saveEx.wing = body.car?.wing!;
} else {
saveEx.wing = car?.wing;
}
if (body.car?.mirror !== null && body.car?.mirror !== undefined) {
saveEx.mirror = body.car?.mirror!;
} else {
saveEx.mirror = car?.mirror;
}
if (body.car?.neon !== null && body.car?.neon !== undefined) {
saveEx.neon = body.car?.neon!;
} else {
saveEx.neon = car?.neon;
}
if (body.car?.trunk !== null && body.car?.trunk !== undefined) {
saveEx.trunk = body.car?.trunk!;
} else {
saveEx.trunk = car?.trunk;
}
if (body.car?.plate !== null && body.car?.plate !== undefined) {
saveEx.plate = body.car?.plate!;
} else {
saveEx.plate = car?.plate;
}
if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) {
saveEx.plateColor = body.car?.plateColor!;
} else {
saveEx.plateColor = car?.plateColor;
}
if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) {
saveEx.plateNumber = body.car?.plateNumber!;
} else {
saveEx.plateNumber = car?.plateNumber;
}
if (body.car?.customColor !== null && body.car?.customColor !== undefined) {
saveEx.customColor = body.car?.customColor!;
} else {
saveEx.customColor = car?.customColor;
}
if (body.car?.windowStickerString !== null && body.car?.windowStickerString !== undefined) {
saveEx.windowStickerString = body.car?.windowStickerString!;
} else {
saveEx.windowStickerString = car?.windowStickerString;
}
if (body.car?.windowStickerFont !== null && body.car?.windowStickerFont !== undefined) {
saveEx.windowStickerFont = body.car?.windowStickerFont!;
} else {
saveEx.windowStickerFont = car?.windowStickerFont;
}
if (body.car?.rivalMarker !== null && body.car?.rivalMarker !== undefined) {
saveEx.rivalMarker = body.car?.rivalMarker!;
} else {
saveEx.rivalMarker = car?.rivalMarker;
}
await prisma.carSettings.update({ await prisma.carSettings.update({
where: { where: {
dbId: car?.carSettingsDbId, dbId: car?.carSettingsDbId,
@ -1141,6 +1220,13 @@ export default class GameModule extends Module {
} }
}); });
let c = await prisma.car.update({
where: {
carId: body.carId
},
data: saveEx
});
let msg = { let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
} }