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!.ghostLevel > 12)
|
||||||
{
|
{
|
||||||
if(car!.rgWinCount > 1000)
|
if(car!.rgWinCount > 1000)
|
||||||
{
|
{
|
||||||
car!.ghostLevel = 11;
|
car!.ghostLevel = 11;
|
||||||
|
|
||||||
await prisma.car.update({
|
await prisma.car.update({
|
||||||
@ -76,7 +76,7 @@ export async function getCar(carId: number)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
car!.ghostLevel = 10;
|
car!.ghostLevel = 10;
|
||||||
|
|
||||||
await prisma.car.update({
|
await prisma.car.update({
|
||||||
|
@ -239,7 +239,8 @@ 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,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import wmproto from "../../wmmt/wm.proto";
|
|||||||
import * as common from "../util/common";
|
import * as common from "../util/common";
|
||||||
import * as ghost_history from "../ghost/ghost_history";
|
import * as ghost_history from "../ghost/ghost_history";
|
||||||
import * as ghost_stamp from "../ghost/ghost_stamp";
|
import * as ghost_stamp from "../ghost/ghost_stamp";
|
||||||
import * as carFunctions from "../cars/functions";
|
|
||||||
|
|
||||||
// Save ghost battle result
|
// Save ghost battle result
|
||||||
export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequest, car: any)
|
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
|
// Crown holder data available
|
||||||
if(carCrowns)
|
if(carCrowns)
|
||||||
{
|
{
|
||||||
// Crown Finish Status
|
// Look For Existing Car Record Based On Area
|
||||||
await prisma.carCrownDetect.create({
|
let areaRecord = await prisma.carCrownDetect.findFirst({
|
||||||
data:{
|
where: {
|
||||||
carId: body.carId,
|
carId: body.carId,
|
||||||
status: 'finish',
|
area: area
|
||||||
area: carCrowns.area,
|
|
||||||
ramp: carCrowns.ramp,
|
|
||||||
path: carCrowns.path,
|
|
||||||
playedAt: carCrowns.playedAt,
|
|
||||||
tunePower: carCrowns.tunePower,
|
|
||||||
tuneHandling: carCrowns.tuneHandling
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update it to the new one
|
// Record exist, update it
|
||||||
await prisma.carCrown.update({
|
if(areaRecord)
|
||||||
where: {
|
{
|
||||||
dbId: carCrowns.dbId
|
// Update the record to Crown Finish Status
|
||||||
},
|
await prisma.carCrownDetect.update({
|
||||||
data: {
|
where: {
|
||||||
...dataCrown,
|
id: areaRecord.id
|
||||||
area: area,
|
},
|
||||||
ramp: ramp,
|
data: {
|
||||||
path: path
|
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
|
// Crown holder data not available or still default crown holder data
|
||||||
else
|
else
|
||||||
@ -684,7 +727,8 @@ 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
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import { wm } from "../../wmmt/wm.proto";
|
|||||||
|
|
||||||
// Import Util
|
// Import Util
|
||||||
import * as common from "../util/common";
|
import * as common from "../util/common";
|
||||||
import * as carFunctions from "../cars/functions";
|
|
||||||
|
|
||||||
|
|
||||||
// Save versus battle result
|
// Save versus battle result
|
||||||
@ -15,7 +14,7 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
|
|||||||
{
|
{
|
||||||
// Get the car
|
// Get the car
|
||||||
let cars = body?.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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user