1
0
mirror of synced 2025-01-23 23:04:07 +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 { in rec {
packages.bayshore = pkgs.buildNpmPackage { packages.bayshore = pkgs.buildNpmPackage {
pname = "bayshore"; pname = "bayshore";
version = "1.0.10"; version = "1.1.0";
src = ./.; src = ./.;
npmDepsHash = "sha256-VbFdHmPF9we1MS8OibpJY51WKFUK3Iq9xNyb8GiBgL0="; 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)'); console.log('OCM Ghost Mode Found - Appointment (VS HoF Ghost)');
// Defeated HoF Ghost
if(body.rgResult!.opponents![0].result >= 0)
{
// Delete all the records // Delete all the records
await prisma.ghostRegisteredFromTerminal.deleteMany({ await prisma.ghostRegisteredFromTerminal.deleteMany({
where:{ where:{
carId: Number(body.carId) carId: Number(body.carId)
} }
}); });
}
break; break;
} }

View File

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

View File

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

View File

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