1
0
mirror of synced 2025-01-23 15:02:06 +01:00

Merge pull request #74 from shiroikitsu8/master

also delete the challenge hof ghost when lost
This commit is contained in:
Sylvie Nightshade 2023-07-03 12:11:49 +01:00 committed by GitHub
commit 9f25055d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 28 deletions

View File

@ -26,7 +26,7 @@
in rec {
packages.bayshore = pkgs.buildNpmPackage {
pname = "bayshore";
version = "1.0.10";
version = "1.1.0";
src = ./.;
npmDepsHash = "sha256-VbFdHmPF9we1MS8OibpJY51WKFUK3Iq9xNyb8GiBgL0=";

View File

@ -442,16 +442,12 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
{
console.log('OCM Ghost Mode Found - Appointment (VS HoF Ghost)');
// Defeated HoF Ghost
if(body.rgResult!.opponents![0].result >= 0)
{
// Delete all the records
await prisma.ghostRegisteredFromTerminal.deleteMany({
where:{
carId: Number(body.carId)
}
});
}
// Delete all the records
await prisma.ghostRegisteredFromTerminal.deleteMany({
where:{
carId: Number(body.carId)
}
});
break;
}

View File

@ -39,13 +39,17 @@ export default class GhostModule extends Module {
let getStampTargets = await ghostFunctions.getOpponentHistory(body.carId);
let opponentHistory = getStampTargets.opponentHistory;
// Get Stamp Target
let getStampTarget = await ghostFunctions.getStampTarget(body.carId);
let stampTarget = getStampTarget.stampTarget;
// ------------- STAMP STUFF -------------
// Must declare both
// Get Challengers
let getChallengers = await ghostFunctions.getChallengers(body.carId);
let challengers = getChallengers.challengers;
let arrayCarId = getChallengers.arrayCarId
// Get Stamp Target
let getStampTarget = await ghostFunctions.getStampTarget(body.carId, arrayCarId);
let stampTarget = getStampTarget.stampTarget;
// ---------------------------------------
// Response data
let msg = {
@ -98,14 +102,17 @@ export default class GhostModule extends Module {
// Get the request body for the load stamp target request
let body = wm.wm.protobuf.LoadStampTargetRequest.decode(req.body);
// Get Stamp Target
let getStampTarget = await ghostFunctions.getStampTarget(body.carId);
let stampTarget = getStampTarget.stampTarget;
// ------------- STAMP STUFF -------------
// Must declare both
// Get Challengers
let getChallengers = await ghostFunctions.getChallengers(body.carId);
let challengers = getChallengers.challengers;
let arrayCarId = getChallengers.arrayCarId
// Get Stamp Target
let getStampTarget = await ghostFunctions.getStampTarget(body.carId, arrayCarId);
let stampTarget = getStampTarget.stampTarget;
// ---------------------------------------
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,

View File

@ -61,22 +61,22 @@ export async function getOpponentHistory(carId: number)
// Get Stamp Target
export async function getStampTarget(carId: number)
export async function getStampTarget(carId: number, arrayCarId: number[])
{
// Get all of the friend cars for the carId provided
let getStampTargets = await prisma.carStampTarget.findMany({
where: {
stampTargetCarId: carId,
recommended: true
recommended: true,
carId: { in: arrayCarId },
},
orderBy:{
locked: 'desc'
},
take: 10
});
let stampTarget: wmproto.wm.protobuf.StampTargetCar[] = [];
if(getStampTargets)
if(getStampTargets.length > 0)
{
for(let i=0; i<getStampTargets.length; i++)
{
@ -104,6 +104,8 @@ export async function getStampTarget(carId: number)
recommended: getStampTargets[i].recommended
})
);
}
}
@ -126,6 +128,7 @@ export async function getChallengers(carId: number)
});
let challengers: wmproto.wm.protobuf.ChallengerCar[] = [];
let arrChallengerCarId = [];
let arrayCarId = [];
// Push beated carId to array
for(let i=0; i<checkBeatedCar.length; i++)
@ -144,7 +147,7 @@ export async function getChallengers(carId: number)
take: 10
});
if(getChallengers)
if(getChallengers.length > 0)
{
for(let i=0; i<getChallengers.length; i++)
{
@ -181,10 +184,12 @@ export async function getChallengers(carId: number)
area: getChallengers[i].area
})
);
arrayCarId.push(getChallengers[i].challengerCarId);
}
}
return { challengers }
return { challengers, arrayCarId }
}

View File

@ -589,9 +589,9 @@ export async function ocmGiveNamePlateReward(competitionId: number)
let participantLength = getCarParticipant.length;
// Participant is more than certain number (100 is default)
if(participantLength > 25)
if(participantLength > 50)
{
participantLength = 25;
participantLength = 50;
}
// 16th - C1

View File

@ -62,6 +62,7 @@ export function sendResponse(message: Writer, res: Response, headers: string[])
// Get config
const config = Config.getConfig();
let revisionCheck = config.gameOptions.revisionCheck || 1;
// Get the end of the message
let end = message.finish();
@ -74,7 +75,7 @@ export function sendResponse(message: Writer, res: Response, headers: string[])
.status(200);
// If revision check is enabled
if (config.gameOptions.revisionCheck) {
if (revisionCheck == 1) {
// Get the protobuf revision from the headers
let revision = getProtobufRevision(headers);