From d7e90576591b89b98e2a4b6dff3f4b45b393dcf4 Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Fri, 22 Jul 2022 10:08:20 +0700 Subject: [PATCH 1/2] Update changing dress up and window sticker from terminal --- src/modules/game.ts | 302 ++++++++++++++++++++++++++++---------------- 1 file changed, 194 insertions(+), 108 deletions(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index ebe3c7f..0ab0d4c 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -177,116 +177,117 @@ export default class GameModule extends Module { } case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE: { - console.log(body); - let saveEx: any = {}; - if (body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined) { - saveEx.rgRegionMapScore = body.rgResult?.rgRegionMapScore!; - } else { - saveEx.rgRegionMapScore = car?.rgRegionMapScore; - } - if (body.rgResult?.rgPlayCount !== null && body.rgResult?.rgPlayCount !== undefined) { - saveEx.rgPlayCount = body.rgResult?.rgPlayCount!; - } else { - saveEx.rgPlayCount = car?.rgPlayCount; - } - if (body.rgResult?.dressupLevel !== null && body.rgResult?.dressupLevel !== undefined) { - saveEx.dressupLevel = body.rgResult?.dressupLevel!; - } else { - saveEx.dressupLevel = car?.dressupLevel; - } - if (body.rgResult?.dressupPoint !== null && body.rgResult?.dressupPoint !== undefined) { - saveEx.dressupPoint = body.rgResult?.dressupPoint!; - } else { - saveEx.dressupPoint = car?.dressupPoint; - } - 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?.ghostLevel !== null && body.car?.ghostLevel !== undefined) { - saveEx.ghostLevel = body.car?.ghostLevel!; - } else { - 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 { - let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body); + let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body); let car = await prisma.car.findFirst({ where: { carId: body.carId @@ -1132,6 +1133,84 @@ export default class GameModule extends Module { 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({ where: { 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 = { error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, } From 0d0b0f0edc2125fae49c3b6fd3c768b50114a55d Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Fri, 22 Jul 2022 15:36:21 +0700 Subject: [PATCH 2/2] Update window sticker toggle save --- src/modules/game.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index 0ab0d4c..2a8249c 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -305,6 +305,7 @@ export default class GameModule extends Module { title: body.car!.title!, tunePower: body.car!.tunePower!, tuneHandling: body.car!.tuneHandling!, + windowSticker: body.car!.windowSticker!, } }) await prisma.carSettings.update({ @@ -1133,7 +1134,6 @@ export default class GameModule extends Module { settings: true } }); - let saveEx: any = {}; if (body.car?.wheel !== null && body.car?.wheel !== undefined) { saveEx.wheel = body.car?.wheel!; @@ -1210,6 +1210,11 @@ export default class GameModule extends Module { } else { saveEx.rivalMarker = car?.rivalMarker; } + if (body.car?.windowSticker !== null && body.car?.windowSticker !== undefined) { + saveEx.windowSticker = body.car?.windowSticker!; + } else { + saveEx.windowSticker = car?.windowSticker; + } await prisma.carSettings.update({ where: {