1
0
mirror of synced 2025-02-22 21:19:55 +01:00

more old ocm data

This commit is contained in:
ghkkk090 2022-09-17 20:07:26 +07:00
parent 8b55fe93bc
commit 938ac7ceb3
7 changed files with 265 additions and 36 deletions

File diff suppressed because one or more lines are too long

View File

@ -36,6 +36,7 @@ export default class ApiModule extends Module {
'"• Hopefully fix ocm HoF bug"'+
'"• Fix duplicate id in carOrder"'+
'"• Fix OCM HoF wrong shopName"'+
'"• More OCM Data (old event before mt6 and dev ghost)"'+
']'+
'}';
message.version = JSON.parse(myJSON);
@ -86,7 +87,7 @@ export default class ApiModule extends Module {
else{
ocmEventDate = await prisma.oCMEvent.findFirst({
orderBy: {
dbId: 'desc'
competitionId: 'desc'
},
select:{
competitionId: true
@ -111,40 +112,93 @@ export default class ApiModule extends Module {
let message: any = {
error: null,
cars: [],
lastPlayedPlace: 'Bayshore'
lastPlayedPlace: 'Bayshore',
rankType: null
};
// Get all of the cars matching the query
message.cars = await prisma.oCMTally.findMany({
// Get current date
let date = Math.floor(new Date().getTime() / 1000);
// Get current / previous active OCM Event
let ocmEventDate = await prisma.oCMEvent.findFirst({
where:{
competitionId: competitionId
},
orderBy: {
result: 'desc'
},
include:{
car: {
select:{
carId: true,
name: true,
defaultColor: true,
visualModel: true,
level: true,
title: true,
regionId: true,
}
},
}
});
// Current date is OCM main draw and so on
if(ocmEventDate!.competitionStartAt < date)
{
// Get all of the cars matching the query
message.cars = await prisma.oCMTally.findMany({
where:{
competitionId: competitionId
},
orderBy: {
result: 'desc'
},
include:{
car: {
select:{
carId: true,
name: true,
defaultColor: true,
visualModel: true,
level: true,
title: true,
regionId: true,
}
},
}
});
let getLastPlayedPlace = await prisma.oCMGhostBattleRecord.findFirst({
where:{
carId: message.cars[0].carId,
competitionId: competitionId
}
})
let getLastPlayedPlace = await prisma.oCMGhostBattleRecord.findFirst({
where:{
carId: message.cars[0].carId,
competitionId: competitionId
}
})
message.lastPlayedPlace = getLastPlayedPlace?.playedShopName;
message.lastPlayedPlace = getLastPlayedPlace?.playedShopName;
message.rankType = 'MainDraw';
}
// Current date is OCM qualifying day
else if(ocmEventDate!.qualifyingPeriodStartAt < date && ocmEventDate!.qualifyingPeriodCloseAt > date)
{
// Get all of the cars matching the query
message.cars = await prisma.oCMGhostBattleRecord.findMany({
where:{
competitionId: competitionId,
ocmMainDraw: false
},
orderBy: {
result: 'desc'
},
include:{
car: {
select:{
carId: true,
name: true,
defaultColor: true,
visualModel: true,
level: true,
title: true,
regionId: true,
}
},
}
});
let getLastPlayedPlace = await prisma.oCMGhostBattleRecord.findFirst({
where:{
carId: message.cars[0].carId,
competitionId: competitionId
}
})
message.lastPlayedPlace = getLastPlayedPlace?.playedShopName;
message.rankType = 'Qualifying';
}
// Send the response to the client
res.send(message);

View File

@ -711,6 +711,8 @@ export default class GhostModule extends Module {
// Query parameter from OCM Battle available
if(pTrailId)
{
console.log('Requesting OCM Ghost Trail');
// Get the trail data
let ghost_trails = await ghost_trail.getOCMGhostTrail(pCarId, pTrailId);
@ -723,6 +725,8 @@ export default class GhostModule extends Module {
// Query parameter from Crown Ghost Battle available
else
{
console.log('Requesting Crown Ghost Trail');
// Get the crown trail data
let ghost_trails = await ghost_trail.getCrownGhostTrail(pCarId, pArea);

View File

@ -226,7 +226,7 @@ export default class GhostModule extends Module {
{
let itemId = 0;
// 16th - C1
// 16th - C1 Outbound
if(ocmEventDate.competitionId === 1)
{
itemId = 204;
@ -246,7 +246,7 @@ export default class GhostModule extends Module {
{
itemId = 222;
}
// 6th - C1
// 6th - C1 Inbound
else if(ocmEventDate.competitionId === 5)
{
itemId = 35;
@ -271,7 +271,7 @@ export default class GhostModule extends Module {
{
itemId = 47;
}
// 1st - C1
// 1st - C1 Outbound
else if(ocmEventDate.competitionId === 10)
{
itemId = 5;

View File

@ -582,7 +582,8 @@ export default class TerminalModule extends Module {
let compeSch;
let msg: any;
if(ocmEventDate){
if(ocmEventDate)
{
// Creating GhostCompetitionSchedule
compeSch = wm.wm.protobuf.GhostCompetitionSchedule.create({

View File

@ -1,5 +1,3 @@
import { wm } from "../../wmmt/wm.proto";
// OCM Area
export async function GhostArea(area: number)
{

View File

@ -5,7 +5,7 @@ export async function OCMArea(competition_id: number)
let rampVal = 0;
let pathVal = 0;
// 16th - C1
// 16th - C1 Outbound
if(competition_id === 1)
{
// GID_RUNAREA_C1
@ -53,7 +53,7 @@ export async function OCMArea(competition_id: number)
// GID_PATH_NGR_MARUNOUCHI
pathVal = 49;
}
// 6th - C1
// 6th - C1 Inbound
else if(competition_id === 5)
{
// GID_RUNAREA_C1
@ -113,6 +113,150 @@ export async function OCMArea(competition_id: number)
// GID_PATH_HKFOR
pathVal = 62;
}
// 1st - C1 Outbound
else if(competition_id === 10)
{
// GID_RUNAREA_C1
areaVal = 0;
// GID_RAMP_C1_OUT_SHIBA
rampVal = 3;
// GID_PATH_C1OUT_KANDABASHI03
pathVal = 9;
}
// 2nd - Osaka
else if(competition_id === 11)
{
// GID_RUNAREA_OSAKA
areaVal = 9;
// GID_RAMP_OOSAKA_DOUTONBORI
rampVal = 26;
// GID_PATH_OS_TONBORI03
pathVal = 52;
}
// 3rd - Fukuoka
else if(competition_id === 12)
{
// GID_RUNAREA_FUKUOKA
areaVal = 11;
// GID_RAMP_FUKUOKA_EAST_NISHI
rampVal = 31
// GID_PATH_FK_NISHIKOUEN;
pathVal = 60;
}
// 4th - Nagoya
else if(competition_id === 13)
{
// GID_RUNAREA_NAGOYA
areaVal = 8;
// GID_RAMP_NAGOYA_MARUNOUCHI
rampVal = 25;
// GID_PATH_NGR_MARUNOUCHI
pathVal = 49;
}
// 5th - Yaesu
else if(competition_id === 14)
{
// GID_RUNAREA_YAESU
areaVal = 6;
// GID_RAMP_YAESU_SHIODOME
rampVal = 18;
// GID_PATH_YSIN_SHIODOME01
pathVal = 34;
}
// 9th - Hakone (Mt. Taikan)
else if(competition_id === 15)
{
// GID_RUNAREA_TURNPIKE
areaVal = 13;
// GID_RAMP_TURNPIKE_UP
rampVal = 35;
// GID_PATH_TP_BOTTOM
pathVal = 64;
}
//10th - Sub-center(Shibuya/Shinjuku)
else if(competition_id === 16)
{
// GID_RUNAREA_SUBTOKYO_3_4
areaVal = 2;
// GID_RAMP_SUBTOKYO_GAIEN
rampVal = 7;
// GID_PATH_WTWEST_GAIEN
pathVal = 17;
}
// 11th - Sub-center(Ikebukuro)
else if(competition_id === 17)
{
// GID_RUNAREA_SUBTOKYO_5
areaVal = 3;
// GID_RAMP_SUBTOKYO_DAIKANCHOU
rampVal = 8;
// GID_PATH_WTUP_DAIKANCHOU
pathVal = 18;
}
// 12th - Kobe
else if(competition_id === 18)
{
// GID_RUNAREA_KOBE
areaVal = 10;
// GID_RAMP_KOBE_NADAOOHASHI
rampVal = 28;
// GID_PATH_KB_NADA
pathVal = 55;
}
// 13th - New Belt Line
else if(competition_id === 19)
{
// GID_RUNAREA_RING
areaVal = 1;
// GID_RAMP_RING_LEFT_ARIAKE
rampVal = 4;
// GID_PATH_N9IN_ARIAKE02
pathVal = 11;
}
// 14th - Yokohama
else if(competition_id === 20)
{
// GID_RUNAREA_YOKOHAMA
areaVal = 7;
// GID_RAMP_MINATOMIRAI_OUT_SHINYAMASHITA
rampVal = 23;
// GID_PATH_KGUP_SHINYAMASHITA03
pathVal = 45;
}
// 15th - Hiroshima
else if(competition_id === 21)
{
// GID_RUNAREA_HIROSHIMA
areaVal = 18;
// GID_RAMP_HIROSHIMA_UJINA
rampVal = 38;
// GID_PATH_HS_UJINA
pathVal = 57;
}
// Return the value to 'BASE_PATH/src/modules/ghost_ocm.ts'
return {areaVal, rampVal, pathVal};