mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2025-01-19 15:08:40 +01:00
hopefully fix ocm HoF
This commit is contained in:
parent
1f209a7cb9
commit
1ea17a1abf
12
src/api.ts
12
src/api.ts
@ -10,10 +10,12 @@ export default class ApiModule extends Module {
|
|||||||
extended: true
|
extended: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
app.use(express.json({
|
app.use(express.json({
|
||||||
type: '*/*'
|
type: '*/*'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
// API Get Requests
|
// API Get Requests
|
||||||
// Get Current Competition Id
|
// Get Current Competition Id
|
||||||
app.get('/api/get_competition_id', async (req, res) => {
|
app.get('/api/get_competition_id', async (req, res) => {
|
||||||
@ -51,9 +53,6 @@ export default class ApiModule extends Module {
|
|||||||
if(ocmEventDate)
|
if(ocmEventDate)
|
||||||
{
|
{
|
||||||
message.competitionId = ocmEventDate.competitionId;
|
message.competitionId = ocmEventDate.competitionId;
|
||||||
|
|
||||||
// Send the response to the client
|
|
||||||
res.send(message);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ocmEventDate = await prisma.oCMEvent.findFirst({
|
ocmEventDate = await prisma.oCMEvent.findFirst({
|
||||||
@ -66,12 +65,13 @@ export default class ApiModule extends Module {
|
|||||||
});
|
});
|
||||||
|
|
||||||
message.competitionId = ocmEventDate!.competitionId;
|
message.competitionId = ocmEventDate!.competitionId;
|
||||||
|
|
||||||
// Send the response to the client
|
|
||||||
res.send(message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the response to the client
|
||||||
|
res.send(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Get Competition Ranking
|
// Get Competition Ranking
|
||||||
app.get('/api/get_competition_ranking', async (req, res) => {
|
app.get('/api/get_competition_ranking', async (req, res) => {
|
||||||
|
|
||||||
|
@ -37,10 +37,12 @@ export default class CarModule extends Module {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Error handling if ghostLevel accidentally set to 0 or more than 10
|
// Error handling if ghostLevel accidentally set to 0 or more than 10
|
||||||
if(car!.ghostLevel < 1){
|
if(car!.ghostLevel < 1)
|
||||||
|
{
|
||||||
car!.ghostLevel = 1;
|
car!.ghostLevel = 1;
|
||||||
}
|
}
|
||||||
if(car!.ghostLevel > 11){
|
if(car!.ghostLevel > 11)
|
||||||
|
{
|
||||||
car!.ghostLevel = 10;
|
car!.ghostLevel = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +162,37 @@ export default class CarModule extends Module {
|
|||||||
trailId: trailIdNo1
|
trailId: trailIdNo1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ghostTrailNo1 = await prisma.oCMGhostTrail.findFirst({
|
||||||
|
where:{
|
||||||
|
carId: getNo1OCM.carId,
|
||||||
|
competitionId: ocmEventDate.competitionId
|
||||||
|
},
|
||||||
|
orderBy:{
|
||||||
|
playedAt: 'desc'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(ghostTrailNo1)
|
||||||
|
{
|
||||||
|
console.log('Getting registered ghost trail from other table');
|
||||||
|
|
||||||
|
trailIdNo1 = ghostTrailNo1.dbId;
|
||||||
|
|
||||||
|
ghostCarsNo1 = wm.wm.protobuf.GhostCar.create({
|
||||||
|
car: {
|
||||||
|
...cars!,
|
||||||
|
},
|
||||||
|
area: ghostTrailNo1.area,
|
||||||
|
ramp: ghostTrailNo1.ramp,
|
||||||
|
path: ghostTrailNo1.path,
|
||||||
|
nonhuman: false,
|
||||||
|
type: wm.wm.protobuf.GhostType.GHOST_NORMAL,
|
||||||
|
trailId: trailIdNo1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,8 @@ export default class UserModule extends Module {
|
|||||||
{
|
{
|
||||||
let checkRegisteredGhost = await prisma.ghostRegisteredFromTerminal.findFirst({
|
let checkRegisteredGhost = await prisma.ghostRegisteredFromTerminal.findFirst({
|
||||||
where:{
|
where:{
|
||||||
carId: user.cars[i].carId
|
carId: user.cars[i].carId,
|
||||||
|
competitionId: ocmEventDate.competitionId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -495,6 +496,10 @@ export default class UserModule extends Module {
|
|||||||
{
|
{
|
||||||
carStates[i].hasOpponentGhost = true;
|
carStates[i].hasOpponentGhost = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
carStates[i].hasOpponentGhost = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user