1
0
mirror of synced 2024-11-12 01:10:47 +01:00

ghost history

This commit is contained in:
ghkkk090 2022-08-25 11:16:44 +07:00
parent 810bcebab2
commit 83424a394f
5 changed files with 65 additions and 23 deletions

View File

@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
-- AlterTable
ALTER TABLE "CarChallenger" ADD COLUMN "lastPlayedAt" INTEGER NOT NULL DEFAULT 0;

View File

@ -415,6 +415,7 @@ model CarChallenger {
stamp Int
result Int
area Int
lastPlayedAt Int @default(0)
}
model CarStampTarget {

View File

@ -33,27 +33,37 @@ export default class GhostModule extends Module {
}
})
// ---For testing only---
let cars = await prisma.car.findMany({
// Car History
let findChallenger = await prisma.carChallenger.findMany({
where: {
OR: [
{
name: { startsWith: '' }
challengerCarId: body.carId
}
})
let carsHistory: wm.wm.protobuf.Car[] = [];
if(findChallenger.length > 0)
{
for(let i=0; i<findChallenger.length; i++)
{
let car = await prisma.car.findFirst({
where: {
carId: findChallenger[i].carId
},
{
name: { startsWith: 'きつ' }
include:{
gtWing: true,
lastPlayedPlace: true
},
],
},
include:{
gtWing: true,
lastPlayedPlace: true
},
orderBy: {
carId: 'asc'
},
take: 10
});
orderBy: {
carId: 'asc'
},
take: 10
});
carsHistory.push(wm.wm.protobuf.Car.create({
...car!
}))
}
}
let carsStamp: wm.wm.protobuf.StampTargetCar[] = [];
let carsChallenger: wm.wm.protobuf.ChallengerCar[] = [];
@ -130,7 +140,7 @@ export default class GhostModule extends Module {
stampSheetCount: car!.stampSheetCount,
stampSheet: car?.stampSheet || null,
stampReturnStats: car?.stampSheet || null,
history: cars || null,
history: carsHistory,
};
// Encode the response

View File

@ -124,6 +124,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
@ -137,6 +140,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
@ -322,6 +328,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
@ -335,6 +344,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
@ -348,6 +360,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
@ -440,6 +455,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
ghost_historys = await ghost_history.saveGhostHistory(body);
// Return Stamp (Shuttle Match)
await ghost_stamp.shuttleReturnStamp(body);
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;

View File

@ -11,7 +11,10 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
{
console.log('Sending Stamp');
let rgResult = body.rgResult
let rgResult = body.rgResult;
// Get current date
let date = Math.floor(new Date().getTime() / 1000);
if(rgResult)
{
@ -54,7 +57,8 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
challengerCarId: body.carId,
stamp: rgResult.rgStamp,
result: rgResult.opponents![i].result,
area: area
area: area,
lastPlayedAt: date
}
// Create Stamp Target data
@ -97,7 +101,10 @@ export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest
{
console.log('Returning Stamp');
let rgResult = body.rgResult
let rgResult = body.rgResult;
// Get current date
let date = Math.floor(new Date().getTime() / 1000);
if(rgResult)
{
@ -179,7 +186,8 @@ export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest
challengerCarId: body.carId,
stamp: rgResult.rgStamp,
result: rgResult.opponents![i].result,
area: area
area: area,
lastPlayedAt: date
}
console.log('Updating challenger entry');