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

Merge pull request #52 from shiroikitsu8/master-asakura

fix star saving (sometimes become 0), barebone save_screenshot, fix ocm sorting, hopefully fix ocm hof
This commit is contained in:
Luna 2022-12-07 11:17:15 +00:00 committed by GitHub
commit 7e926445fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 56 additions and 68 deletions

View File

@ -64,11 +64,15 @@ export default class CarModule extends Module {
if(getTarget)
{
console.log('Registered Opponents Available');
let getTargetTrail = await prisma.oCMTop1GhostTrail.findFirst({
where:{
carId: getTarget.opponentCarId,
competitionId: Number(getTarget.competitionId)
},
orderBy:{
periodId: 'desc'
}
});
@ -77,6 +81,10 @@ export default class CarModule extends Module {
let getTargetCar = await prisma.car.findFirst({
where:{
carId: getTarget.opponentCarId
},
include:{
gtWing: true,
lastPlayedPlace: true
}
});

View File

@ -35,7 +35,7 @@ export default class GhostModule extends Module {
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});
@ -414,7 +414,7 @@ export default class GhostModule extends Module {
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});
@ -423,7 +423,7 @@ export default class GhostModule extends Module {
ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy: [
{
dbId: 'desc'
competitionId: 'desc'
},
],
});

View File

@ -30,14 +30,10 @@ export default class StartupModule extends Module {
// competitionEndAt is greater than current date
competitionEndAt: { gte: date },
},
orderBy: [
{
dbId: 'desc'
},
{
competitionEndAt: 'desc',
},
],
orderBy:
{
competitionEndAt: 'desc',
},
});
let pastEvent = 0;
@ -45,7 +41,7 @@ export default class StartupModule extends Module {
{
ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});
@ -96,7 +92,7 @@ export default class StartupModule extends Module {
});
}
if(pastEvent === 1 && pastDay < 604800)
if(pastEvent === 1)
{
lastCompetitionId = ocmEventDate.competitionId
}

View File

@ -1006,6 +1006,25 @@ export default class TerminalModule extends Module {
common.sendResponse(message, res);
});
// Save Screenshoot
app.post('/method/save_screenshot', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.SaveScreenshotRequest.decode(req.body);
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wm.wm.protobuf.SaveScreenshotResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
/*
app.post('/method/load_unreceived_user_items', async (req, res) => {
@ -1026,24 +1045,6 @@ export default class TerminalModule extends Module {
})
app.post('/method/save_screenshot', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.SaveScreenshotRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.SaveScreenshotResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.post('/method/check_item_receivable_cars', async (req, res) => {
// Get the information from the request

View File

@ -356,7 +356,7 @@ export default class UserModule extends Module {
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});
@ -484,14 +484,10 @@ export default class UserModule extends Module {
if(!ocmEventDate)
{
let ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy: [
{
dbId: 'desc'
},
{
competitionEndAt: 'desc',
},
],
orderBy:
{
competitionEndAt: 'desc',
}
});
if(ocmEventDate)

View File

@ -175,9 +175,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
if (ghostResultCrown)
{
let carId: number = 0;
if(body.carId)
if(body.car?.carId)
{
carId = Number(body.carId);
carId = Number(body.car.carId);
}
// Ghost Crown update data
@ -525,7 +525,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});

View File

@ -22,7 +22,7 @@ export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultReq
let data : any = {
vsPlayCount: common.sanitizeInput(vsResult.vsPlayCount),
vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount),
vsStarCount: common.sanitizeInput(vsResult.vsStarCount),
vsStarCount: common.sanitizeInputNotZero(vsResult.vsStarCount),
vsCoolOrWild: common.sanitizeInput(vsResult.vsCoolOrWild),
vsSmoothOrRough: common.sanitizeInput(vsResult.vsSmoothOrRough),
vsTripleStarMedals: common.sanitizeInputNotZero(vsResult.vsTripleStarMedals),

View File

@ -164,7 +164,7 @@ export async function saveOCMGhostHistory(body: wm.protobuf.SaveGameResultReques
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});

View File

@ -22,7 +22,7 @@ export async function saveOCMGhostTrail(body: wm.protobuf.RegisterGhostTrailRequ
competitionEndAt: { gte: date },
},
orderBy:{
dbId: 'desc'
competitionId: 'desc'
}
});

View File

@ -21,27 +21,19 @@ export async function getOCMGhostTrail(carId: number, trailId: number)
// competitionEndAt is greater than current date
competitionEndAt: { gte: date },
},
orderBy: [
{
dbId: 'desc'
},
{
competitionEndAt: 'desc',
},
],
orderBy:
{
competitionEndAt: 'desc',
}
});
if(!(ocmEventDate))
{
ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy: [
{
dbId: 'desc'
},
{
competitionEndAt: 'desc',
},
],
orderBy:
{
competitionEndAt: 'desc',
}
});
}
@ -97,11 +89,6 @@ export async function getOCMGhostTrail(carId: number, trailId: number)
where: {
carId: carId,
dbId: trailId,
competitionId: ocmEventDate!.competitionId,
periodId: 999999999
},
orderBy: {
playedAt: 'desc'
}
});
}