fix ghost return stamp no stamp logo
This commit is contained in:
parent
b787aec0da
commit
47744d4647
@ -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,
|
||||
|
@ -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 }
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user