Merge pull request #83 from anthonyng43/master
some fix and proper force finish handling(hopefully)
This commit is contained in:
commit
1ba8f9c7f2
@ -28,14 +28,66 @@ export async function getCar(carId: number)
|
||||
}
|
||||
});
|
||||
|
||||
// Error handling if ghostLevel accidentally set to 0 or more than 10
|
||||
if(car!.ghostLevel < 1)
|
||||
// Error handling if car tune is more than 34 game default
|
||||
if(car!.tunePower + car!.tuneHandling > 34)
|
||||
{
|
||||
car!.ghostLevel = 1;
|
||||
car!.tunePower = 17;
|
||||
car!.tuneHandling = 17;
|
||||
|
||||
await prisma.car.update({
|
||||
where: {
|
||||
carId: car!.carId
|
||||
},
|
||||
data: {
|
||||
tunePower: 17,
|
||||
tuneHandling: 17
|
||||
}
|
||||
});
|
||||
}
|
||||
if(car!.ghostLevel > 11)
|
||||
{
|
||||
car!.ghostLevel = 10;
|
||||
|
||||
// Error handling if ghostLevel accidentally set to 0 or more than 11
|
||||
if (car!.ghostLevel < 1)
|
||||
{
|
||||
car!.ghostLevel = 1;
|
||||
|
||||
await prisma.car.update({
|
||||
where: {
|
||||
carId: car!.carId
|
||||
},
|
||||
data: {
|
||||
ghostLevel: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (car!.ghostLevel > 12)
|
||||
{
|
||||
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
|
||||
|
@ -239,7 +239,8 @@ export default class GameModule extends Module {
|
||||
// Check retire crown
|
||||
let getCarCrown = await prisma.carCrownDetect.findFirst({
|
||||
where:{
|
||||
carId: body.carId
|
||||
carId: body.carId,
|
||||
playedAt: body.playedAt,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -49,6 +49,12 @@ 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
|
||||
dataCar = {
|
||||
wheel: common.sanitizeInput(cars.wheel),
|
||||
@ -298,32 +304,76 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
||||
// Crown holder data available
|
||||
if(carCrowns)
|
||||
{
|
||||
// Crown Finish Status
|
||||
await prisma.carCrownDetect.create({
|
||||
data:{
|
||||
// Look For Existing Car Record Based On Area
|
||||
let areaRecord = await prisma.carCrownDetect.findFirst({
|
||||
where: {
|
||||
carId: body.carId,
|
||||
status: 'finish',
|
||||
area: carCrowns.area,
|
||||
ramp: carCrowns.ramp,
|
||||
path: carCrowns.path,
|
||||
playedAt: carCrowns.playedAt,
|
||||
tunePower: carCrowns.tunePower,
|
||||
tuneHandling: carCrowns.tuneHandling
|
||||
area: area
|
||||
}
|
||||
});
|
||||
|
||||
// Update it to the new one
|
||||
await prisma.carCrown.update({
|
||||
where: {
|
||||
dbId: carCrowns.dbId
|
||||
},
|
||||
data: {
|
||||
...dataCrown,
|
||||
area: area,
|
||||
ramp: ramp,
|
||||
path: path
|
||||
}
|
||||
});
|
||||
// Record exist, update it
|
||||
if(areaRecord)
|
||||
{
|
||||
// Update the record to Crown Finish Status
|
||||
await prisma.carCrownDetect.update({
|
||||
where: {
|
||||
id: areaRecord.id
|
||||
},
|
||||
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
|
||||
}
|
||||
});
|
||||
}
|
||||
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
|
||||
else
|
||||
@ -676,7 +726,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
||||
await prisma.carCrownDetect.create({
|
||||
data:{
|
||||
carId: body.carId,
|
||||
status: 'retire'
|
||||
status: 'retire',
|
||||
playedAt: body.playedAt
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -12,15 +12,30 @@ 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 = {
|
||||
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),
|
||||
aura: common.sanitizeInput(cars.aura),
|
||||
vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount),
|
||||
vsStarCount: common.sanitizeInputNotZero(vsResult.vsStarCount),
|
||||
vsCoolOrWild: common.sanitizeInput(vsResult.vsCoolOrWild),
|
||||
@ -44,6 +59,23 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
|
||||
},
|
||||
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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -589,9 +589,9 @@ export async function ocmGiveNamePlateReward(competitionId: number)
|
||||
let participantLength = getCarParticipant.length;
|
||||
|
||||
// Participant is more than certain number (100 is default)
|
||||
if(participantLength > 50)
|
||||
if(participantLength > 100)
|
||||
{
|
||||
participantLength = 50;
|
||||
participantLength = 100;
|
||||
}
|
||||
|
||||
// 16th - C1
|
||||
|
@ -518,7 +518,7 @@ export default class GhostModule extends Module {
|
||||
cars = wm.wm.protobuf.Car.create({
|
||||
carId: 999999999, // Don't change this
|
||||
name: 'S660',
|
||||
regionId: 18, // IDN (福井)
|
||||
regionId: Math.floor(Math.random() * 47) + 1, // Random Region, old code -> // 18, // IDN (福井)
|
||||
manufacturer: 12, // HONDA
|
||||
model: 105, // S660 [JW5]
|
||||
visualModel: 130, // S660 [JW5]
|
||||
@ -545,7 +545,7 @@ export default class GhostModule extends Module {
|
||||
title: 'Don\'t have S660?',
|
||||
level: 65, // SSSSS
|
||||
lastPlayedAt: checkGhostTrail!.playedAt,
|
||||
country: 'IDN',
|
||||
country: 'JPN', // Change to JPN, old code -> 'IDN',
|
||||
lastPlayedPlace: playedPlace
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user