1
0
mirror of synced 2025-01-19 08:37:26 +01:00

Revert "allow player rename"

This commit is contained in:
Sylvie Nightshade 2024-08-22 21:03:25 +01:00 committed by GitHub
parent db68d107b4
commit a4de34b477
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 46 additions and 184 deletions

View File

@ -107,7 +107,7 @@ export default class CarModule extends Module {
let additionalInsert = getCarTune.additionalInsert; let additionalInsert = getCarTune.additionalInsert;
// Check created car and item used // Check created car and item used
let checkCreatedCars = await carFunctions.checkCreatedCar(body, itemId); let checkCreatedCars = await carFunctions.checkCreatedCar(body, carInsert, itemId);
if(checkCreatedCars.cheated === true) if(checkCreatedCars.cheated === true)
{ {
let msg = { let msg = {

View File

@ -28,66 +28,14 @@ export async function getCar(carId: number)
} }
}); });
// Error handling if car tune is more than 34 game default // Error handling if ghostLevel accidentally set to 0 or more than 10
if(car!.tunePower + car!.tuneHandling > 34) if(car!.ghostLevel < 1)
{ {
car!.tunePower = 17;
car!.tuneHandling = 17;
await prisma.car.update({
where: {
carId: car!.carId
},
data: {
tunePower: 17,
tuneHandling: 17
}
});
}
// Error handling if ghostLevel accidentally set to 0 or more than 11
if (car!.ghostLevel < 1)
{
car!.ghostLevel = 1; car!.ghostLevel = 1;
await prisma.car.update({
where: {
carId: car!.carId
},
data: {
ghostLevel: 1
}
});
} }
if(car!.ghostLevel > 11)
if (car!.ghostLevel > 12) {
{ car!.ghostLevel = 10;
if(car!.rgWinCount > 1000)
{
car!.ghostLevel = 11;
await prisma.car.update({
where: {
carId: car!.carId
},
data: {
ghostLevel: 11
}
});
}
else
{
car!.ghostLevel = 10;
await prisma.car.update({
where: {
carId: car!.carId
},
data: {
ghostLevel: 10
}
});
}
} }
// Convert the database lose bits to a Long // Convert the database lose bits to a Long
@ -702,8 +650,8 @@ export async function updateCarCustomWing(body: wm.protobuf.UpdateCarRequest)
} }
// Check Create Car // Remove Used Ticket
export async function checkCreatedCar(body: wm.protobuf.CreateCarRequest, itemId: number) export async function checkCreatedCar(body: wm.protobuf.CreateCarRequest, car: any, itemId: number)
{ {
let cheated: boolean = false; let cheated: boolean = false;
@ -756,7 +704,7 @@ export async function checkCreatedCar(body: wm.protobuf.CreateCarRequest, itemId
// Check if user item id is not set and its a special car // Check if user item id is not set and its a special car
for(let i=0; i<allCarVisualModel.length; i++) for(let i=0; i<allCarVisualModel.length; i++)
{ {
if(!(body.userItemId) && body.car.visualModel === allCarVisualModel[i]) if(!(body.userItemId) && car.visualModel === allCarVisualModel[i])
{ {
cheated = true; cheated = true;
@ -767,7 +715,7 @@ export async function checkCreatedCar(body: wm.protobuf.CreateCarRequest, itemId
// Check if user item id is set and its a special car cannot be created from ticket // Check if user item id is set and its a special car cannot be created from ticket
for(let i=0; i<carVisualModelWithoutItem.length; i++) for(let i=0; i<carVisualModelWithoutItem.length; i++)
{ {
if(body.userItemId && body.car.visualModel! === carVisualModelWithoutItem[i]) if(body.userItemId && car.visualModel === carVisualModelWithoutItem[i])
{ {
cheated = true; cheated = true;
@ -776,49 +724,49 @@ export async function checkCreatedCar(body: wm.protobuf.CreateCarRequest, itemId
} }
// Check if user item id is set and its a special car created from ticket // Check if user item id is set and its a special car created from ticket
if(body.car.visualModel! === 122) if(car.visualModel === 122)
{ {
if(itemId < 7 || itemId > 15) if(itemId < 7 || itemId > 15)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! === 130) else if(car.visualModel === 130)
{ {
if(itemId < 22 || itemId > 27) if(itemId < 22 || itemId > 27)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! === 131) else if(car.visualModel === 131)
{ {
if(itemId < 28 || itemId > 36) if(itemId < 28 || itemId > 36)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! === 137) else if(car.visualModel === 137)
{ {
if(itemId !== 37) if(itemId !== 37)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! === 138) else if(car.visualModel === 138)
{ {
if(itemId !== 39) if(itemId !== 39)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! === 139) else if(car.visualModel === 139)
{ {
if(itemId !== 38) if(itemId !== 38)
{ {
cheated = true; cheated = true;
} }
} }
else if(body.car.visualModel! > 144) else if(car.visualModel > 144)
{ {
cheated = true; cheated = true;
} }

View File

@ -239,8 +239,7 @@ export default class GameModule extends Module {
// Check retire crown // Check retire crown
let getCarCrown = await prisma.carCrownDetect.findFirst({ let getCarCrown = await prisma.carCrownDetect.findFirst({
where:{ where:{
carId: body.carId, carId: body.carId
playedAt: body.playedAt,
} }
}); });

View File

@ -49,15 +49,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
} }
} }
// Error handling for equiping GT Wing in game after race
if(cars.wing > 127)
{
cars.wing = 127
}
// Car update data // Car update data
dataCar = { dataCar = {
name: common.sanitizeInput(cars.name),
wheel: common.sanitizeInput(cars.wheel), wheel: common.sanitizeInput(cars.wheel),
wheelColor: common.sanitizeInput(cars.wheelColor), wheelColor: common.sanitizeInput(cars.wheelColor),
aero: common.sanitizeInput(cars.aero), aero: common.sanitizeInput(cars.aero),
@ -305,76 +298,32 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Crown holder data available // Crown holder data available
if(carCrowns) if(carCrowns)
{ {
// Look For Existing Car Record Based On Area // Crown Finish Status
let areaRecord = await prisma.carCrownDetect.findFirst({ await prisma.carCrownDetect.create({
where: { data:{
carId: body.carId, carId: body.carId,
area: area status: 'finish',
area: carCrowns.area,
ramp: carCrowns.ramp,
path: carCrowns.path,
playedAt: carCrowns.playedAt,
tunePower: carCrowns.tunePower,
tuneHandling: carCrowns.tuneHandling
} }
}); });
// Record exist, update it // Update it to the new one
if(areaRecord) await prisma.carCrown.update({
{ where: {
// Update the record to Crown Finish Status dbId: carCrowns.dbId
await prisma.carCrownDetect.update({ },
where: { data: {
id: areaRecord.id ...dataCrown,
}, area: area,
data: { ramp: ramp,
carId: body.carId, path: path
status: 'finish', }
area: carCrowns.area, });
ramp: carCrowns.ramp,
path: carCrowns.path,
playedAt: carCrowns.playedAt,
tunePower: carCrowns.tunePower,
tuneHandling: carCrowns.tuneHandling
}
});
// Update it to the new one
await prisma.carCrown.update({
where: {
dbId: carCrowns.dbId
},
data: {
...dataCrown,
area: area,
ramp: ramp,
path: path
}
});
}
else
{
// Crown Finish Status
await prisma.carCrownDetect.create({
data:{
carId: body.carId,
status: 'finish',
area: carCrowns.area,
ramp: carCrowns.ramp,
path: carCrowns.path,
playedAt: carCrowns.playedAt,
tunePower: carCrowns.tunePower,
tuneHandling: carCrowns.tuneHandling
}
});
// Update it to the new one
await prisma.carCrown.update({
where: {
dbId: carCrowns.dbId
},
data: {
...dataCrown,
area: area,
ramp: ramp,
path: path
}
});
}
} }
// Crown holder data not available or still default crown holder data // Crown holder data not available or still default crown holder data
else else
@ -727,8 +676,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
await prisma.carCrownDetect.create({ await prisma.carCrownDetect.create({
data:{ data:{
carId: body.carId, carId: body.carId,
status: 'retire', status: 'retire'
playedAt: body.playedAt
} }
}); });
} }

View File

@ -12,31 +12,15 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
{ {
if (!(body.retired)) if (!(body.retired))
{ {
// Get the car
let cars = body?.car;
// Get the vs result for the car // Get the vs result for the car
let vsResult = body?.vsResult; let vsResult = body?.vsResult;
// vs result is set // vs result is set
if (cars && vsResult) if (vsResult)
{ {
// vs result update data // vs result update data
let data : any = { 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), vsPlayCount: common.sanitizeInput(vsResult.vsPlayCount),
aura: common.sanitizeInput(cars.aura),
vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount), vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount),
vsStarCount: common.sanitizeInputNotZero(vsResult.vsStarCount), vsStarCount: common.sanitizeInputNotZero(vsResult.vsStarCount),
vsCoolOrWild: common.sanitizeInput(vsResult.vsCoolOrWild), vsCoolOrWild: common.sanitizeInput(vsResult.vsCoolOrWild),
@ -60,23 +44,6 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
}, },
data: data data: data
}); });
// GT Wing stuff
let dataGTWing: any = {
pillar: common.sanitizeInput(body.car?.gtWing?.pillar),
pillarMaterial: common.sanitizeInput(body.car?.gtWing?.pillarMaterial),
mainWing: common.sanitizeInput(body.car?.gtWing?.mainWing),
mainWingColor: common.sanitizeInput(body.car?.gtWing?.mainWingColor),
wingTip: common.sanitizeInput(body.car?.gtWing?.wingTip),
material: common.sanitizeInput(body.car?.gtWing?.material),
};
await prisma.carGTWing.update({
where: {
dbId: body.carId
},
data: dataGTWing
});
} }
} }
} }

View File

@ -589,9 +589,9 @@ export async function ocmGiveNamePlateReward(competitionId: number)
let participantLength = getCarParticipant.length; let participantLength = getCarParticipant.length;
// Participant is more than certain number (100 is default) // Participant is more than certain number (100 is default)
if(participantLength > 100) if(participantLength > 50)
{ {
participantLength = 100; participantLength = 50;
} }
// 16th - C1 // 16th - C1

View File

@ -518,7 +518,7 @@ export default class GhostModule extends Module {
cars = wm.wm.protobuf.Car.create({ cars = wm.wm.protobuf.Car.create({
carId: 999999999, // Don't change this carId: 999999999, // Don't change this
name: '', name: '',
regionId: Math.floor(Math.random() * 47) + 1, // Random Region, old code -> // 18, // IDN (福井) regionId: 18, // IDN (福井)
manufacturer: 12, // HONDA manufacturer: 12, // HONDA
model: 105, // S660 [JW5] model: 105, // S660 [JW5]
visualModel: 130, // S660 [JW5] visualModel: 130, // S660 [JW5]
@ -545,7 +545,7 @@ export default class GhostModule extends Module {
title: 'Don\'t have S660?', title: 'Don\'t have S660?',
level: 65, // SSSSS level: 65, // SSSSS
lastPlayedAt: checkGhostTrail!.playedAt, lastPlayedAt: checkGhostTrail!.playedAt,
country: 'JPN', // Change to JPN, old code -> 'IDN', country: 'IDN',
lastPlayedPlace: playedPlace lastPlayedPlace: playedPlace
}); });