proper force finish detection(hopefully)
This commit is contained in:
parent
3f3b330a6a
commit
18530e9d50
@ -63,7 +63,7 @@ export async function getCar(carId: number)
|
||||
if (car!.ghostLevel > 12)
|
||||
{
|
||||
if(car!.rgWinCount > 1000)
|
||||
{
|
||||
{
|
||||
car!.ghostLevel = 11;
|
||||
|
||||
await prisma.car.update({
|
||||
@ -76,7 +76,7 @@ export async function getCar(carId: number)
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
car!.ghostLevel = 10;
|
||||
|
||||
await prisma.car.update({
|
||||
|
@ -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,
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -8,7 +8,6 @@ import wmproto from "../../wmmt/wm.proto";
|
||||
import * as common from "../util/common";
|
||||
import * as ghost_history from "../ghost/ghost_history";
|
||||
import * as ghost_stamp from "../ghost/ghost_stamp";
|
||||
import * as carFunctions from "../cars/functions";
|
||||
|
||||
// Save ghost battle result
|
||||
export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequest, car: any)
|
||||
@ -306,32 +305,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
|
||||
@ -684,7 +727,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
||||
await prisma.carCrownDetect.create({
|
||||
data:{
|
||||
carId: body.carId,
|
||||
status: 'retire'
|
||||
status: 'retire',
|
||||
playedAt: body.playedAt
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import { wm } from "../../wmmt/wm.proto";
|
||||
|
||||
// Import Util
|
||||
import * as common from "../util/common";
|
||||
import * as carFunctions from "../cars/functions";
|
||||
|
||||
|
||||
// Save versus battle result
|
||||
@ -15,7 +14,7 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
|
||||
{
|
||||
// Get the car
|
||||
let cars = body?.car;
|
||||
|
||||
|
||||
// Get the vs result for the car
|
||||
let vsResult = body?.vsResult;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user