1
0
mirror of synced 2024-12-05 03:27:57 +01:00

fix ghost stuff

This commit is contained in:
ghkkk090 2022-08-18 15:15:26 +07:00
parent bf0cedacec
commit 2542b91dc1
3 changed files with 40 additions and 9 deletions

View File

@ -462,6 +462,39 @@ export default class UserModule extends Module {
}
}
}
if(!ocmEventDate)
{
let ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy: [
{
dbId: 'desc'
},
{
competitionEndAt: 'desc',
},
],
});
if(ocmEventDate)
{
let pastDay = date - ocmEventDate.competitionEndAt;
if(pastDay < 604800)
{
let checkRegisteredGhost = await prisma.ghostRegisteredFromTerminal.findFirst({
where:{
carId: user.cars[i].carId
}
});
if(checkRegisteredGhost)
{
carStates[i].hasOpponentGhost = true;
}
}
}
}
}
// Participated to OCM Event

View File

@ -22,9 +22,6 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Set ghost mode play to true for saving the ghost trail later
ghostModePlay = true;
// Set update new trail to true for updating the user's ghost trail after playing OCM ghost battle mode later
updateNewTrail = true;
// Get the ghost result for the car
let ghostResult = body?.rgResult;
@ -265,13 +262,13 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
});
}
}
ghost_historys = await ghost_history.saveGhostHistory(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
}
ghost_historys = await ghost_history.saveGhostHistory(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
break;
}
@ -279,6 +276,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_COMPETITION:
{
console.log('OCM Ghost Mode Found');
OCMModePlay = true;
let saveExOCM: any = {};
saveExOCM.carId = body.carId;

View File

@ -7,7 +7,7 @@ import { wm } from "../../wmmt/wm.proto";
// Save versus battle result
export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultRequest)
{
if (!(body.retired || body.timeup))
if (!(body.retired))
{
// Get the vs result for the car
let vsResult = body?.vsResult;