mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2025-02-26 17:51:37 +01:00
ghost history
This commit is contained in:
parent
810bcebab2
commit
83424a394f
@ -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;
|
@ -415,6 +415,7 @@ model CarChallenger {
|
|||||||
stamp Int
|
stamp Int
|
||||||
result Int
|
result Int
|
||||||
area Int
|
area Int
|
||||||
|
lastPlayedAt Int @default(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
model CarStampTarget {
|
model CarStampTarget {
|
||||||
|
@ -33,27 +33,37 @@ export default class GhostModule extends Module {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// ---For testing only---
|
// Car History
|
||||||
let cars = await prisma.car.findMany({
|
let findChallenger = await prisma.carChallenger.findMany({
|
||||||
where: {
|
where: {
|
||||||
OR: [
|
challengerCarId: body.carId
|
||||||
{
|
}
|
||||||
name: { startsWith: 'KITSU' }
|
})
|
||||||
|
|
||||||
|
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
|
||||||
},
|
},
|
||||||
{
|
include:{
|
||||||
name: { startsWith: 'きつ' }
|
gtWing: true,
|
||||||
|
lastPlayedPlace: true
|
||||||
},
|
},
|
||||||
],
|
orderBy: {
|
||||||
},
|
carId: 'asc'
|
||||||
include:{
|
},
|
||||||
gtWing: true,
|
take: 10
|
||||||
lastPlayedPlace: true
|
});
|
||||||
},
|
|
||||||
orderBy: {
|
carsHistory.push(wm.wm.protobuf.Car.create({
|
||||||
carId: 'asc'
|
...car!
|
||||||
},
|
}))
|
||||||
take: 10
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
let carsStamp: wm.wm.protobuf.StampTargetCar[] = [];
|
let carsStamp: wm.wm.protobuf.StampTargetCar[] = [];
|
||||||
let carsChallenger: wm.wm.protobuf.ChallengerCar[] = [];
|
let carsChallenger: wm.wm.protobuf.ChallengerCar[] = [];
|
||||||
@ -130,7 +140,7 @@ export default class GhostModule extends Module {
|
|||||||
stampSheetCount: car!.stampSheetCount,
|
stampSheetCount: car!.stampSheetCount,
|
||||||
stampSheet: car?.stampSheet || null,
|
stampSheet: car?.stampSheet || null,
|
||||||
stampReturnStats: car?.stampSheet || null,
|
stampReturnStats: car?.stampSheet || null,
|
||||||
history: cars || null,
|
history: carsHistory,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Encode the response
|
// Encode the response
|
||||||
|
@ -124,6 +124,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
@ -137,6 +140,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
@ -322,6 +328,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
@ -335,6 +344,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
@ -348,6 +360,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
@ -440,6 +455,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
|
|
||||||
ghost_historys = await ghost_history.saveGhostHistory(body);
|
ghost_historys = await ghost_history.saveGhostHistory(body);
|
||||||
|
|
||||||
|
// Return Stamp (Shuttle Match)
|
||||||
|
await ghost_stamp.shuttleReturnStamp(body);
|
||||||
|
|
||||||
// Update the updateNewTrail value
|
// Update the updateNewTrail value
|
||||||
updateNewTrail = ghost_historys.updateNewTrail;
|
updateNewTrail = ghost_historys.updateNewTrail;
|
||||||
|
|
||||||
|
@ -11,7 +11,10 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
|
|||||||
{
|
{
|
||||||
console.log('Sending Stamp');
|
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)
|
if(rgResult)
|
||||||
{
|
{
|
||||||
@ -54,7 +57,8 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
|
|||||||
challengerCarId: body.carId,
|
challengerCarId: body.carId,
|
||||||
stamp: rgResult.rgStamp,
|
stamp: rgResult.rgStamp,
|
||||||
result: rgResult.opponents![i].result,
|
result: rgResult.opponents![i].result,
|
||||||
area: area
|
area: area,
|
||||||
|
lastPlayedAt: date
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Stamp Target data
|
// Create Stamp Target data
|
||||||
@ -97,7 +101,10 @@ export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest
|
|||||||
{
|
{
|
||||||
console.log('Returning Stamp');
|
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)
|
if(rgResult)
|
||||||
{
|
{
|
||||||
@ -179,7 +186,8 @@ export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest
|
|||||||
challengerCarId: body.carId,
|
challengerCarId: body.carId,
|
||||||
stamp: rgResult.rgStamp,
|
stamp: rgResult.rgStamp,
|
||||||
result: rgResult.opponents![i].result,
|
result: rgResult.opponents![i].result,
|
||||||
area: area
|
area: area,
|
||||||
|
lastPlayedAt: date
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Updating challenger entry');
|
console.log('Updating challenger entry');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user