From 99ab42c598c61bee1dd26b8dc9fab1c66578af47 Mon Sep 17 00:00:00 2001 From: anthonyng43 Date: Tue, 23 Apr 2024 22:52:37 +0800 Subject: [PATCH] allow player rename --- src/modules/cars/functions.ts | 1 + src/modules/game/ghost.ts | 1 + src/modules/game/versus.ts | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/modules/cars/functions.ts b/src/modules/cars/functions.ts index 5d0afad..09c3a57 100644 --- a/src/modules/cars/functions.ts +++ b/src/modules/cars/functions.ts @@ -502,6 +502,7 @@ export async function updateCar(body: wm.protobuf.UpdateCarRequest) { // Car update data data = { + name: common.sanitizeInput(cars.name), customColor: common.sanitizeInput(cars.customColor), wheel: common.sanitizeInput(cars.wheel), wheelColor: common.sanitizeInput(cars.wheelColor), diff --git a/src/modules/game/ghost.ts b/src/modules/game/ghost.ts index 02f0cc3..42149ff 100644 --- a/src/modules/game/ghost.ts +++ b/src/modules/game/ghost.ts @@ -51,6 +51,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Car update data dataCar = { + name: common.sanitizeInput(cars.name), wheel: common.sanitizeInput(cars.wheel), wheelColor: common.sanitizeInput(cars.wheelColor), aero: common.sanitizeInput(cars.aero), diff --git a/src/modules/game/versus.ts b/src/modules/game/versus.ts index 1746051..6db77a9 100644 --- a/src/modules/game/versus.ts +++ b/src/modules/game/versus.ts @@ -12,14 +12,29 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq { if (!(body.retired)) { + // Get the car + let cars = body?.car; + // Get the vs result for the car let vsResult = body?.vsResult; // vs result is set - if (vsResult) + if (cars && vsResult) { // vs result update data let data : any = { + name: common.sanitizeInput(cars.name), + wheel: common.sanitizeInput(cars.wheel), + wheelColor: common.sanitizeInput(cars.wheelColor), + aero: common.sanitizeInput(cars.aero), + bonnet: common.sanitizeInput(cars.bonnet), + wing: common.sanitizeInput(cars.wing), + mirror: common.sanitizeInput(cars.mirror), + neon: common.sanitizeInput(cars.neon), + trunk: common.sanitizeInput(cars.trunk), + plate: common.sanitizeInput(cars.plate), + plateColor: common.sanitizeInput(cars.plateColor), + plateNumber: common.sanitizeInput(cars.plateNumber), vsPlayCount: common.sanitizeInput(vsResult.vsPlayCount), vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount), vsStarCount: common.sanitizeInputNotZero(vsResult.vsStarCount),