beta ocm
This commit is contained in:
parent
65dea23ff9
commit
2abd6003ae
@ -199,6 +199,7 @@ export default class GhostModule extends Module {
|
||||
let OCMTallyCount = await prisma.oCMTally.count({
|
||||
where: {
|
||||
competitionId: OCMCurrentPeriod.competitionId,
|
||||
periodId: 999999999
|
||||
},
|
||||
orderBy:{
|
||||
periodId: 'desc'
|
||||
@ -275,6 +276,7 @@ export default class GhostModule extends Module {
|
||||
|
||||
let checkNameplate = await prisma.carItem.count({
|
||||
where:{
|
||||
carId: checkOneParticipant.carId,
|
||||
category: 17,
|
||||
itemId: itemId
|
||||
},
|
||||
@ -286,11 +288,7 @@ export default class GhostModule extends Module {
|
||||
|
||||
if(checkNameplate === 0)
|
||||
{
|
||||
console.log('Giving OCM Rewards');
|
||||
|
||||
await ghost_ocm.ocmGiveNamePlateReward(ocmEventDate.competitionId);
|
||||
|
||||
console.log('OCM Rewards Given');
|
||||
}
|
||||
|
||||
// else{} nameplate reward already given
|
||||
|
@ -25,72 +25,57 @@ export default class StartupModule extends Module {
|
||||
|
||||
// Get current active OCM Event
|
||||
let ocmEventDate = await prisma.oCMEvent.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
{
|
||||
// qualifyingPeriodStartAt is less than current date
|
||||
qualifyingPeriodStartAt: { lte: date },
|
||||
|
||||
// qualifyingPeriodCloseAt is greater than current date
|
||||
qualifyingPeriodCloseAt: { gte: date },
|
||||
},
|
||||
{
|
||||
// competitionStartAt is less than current date
|
||||
competitionStartAt: { lte: date },
|
||||
|
||||
// competitionCloseAt is greater than current date
|
||||
competitionCloseAt: { gte: date },
|
||||
},
|
||||
{
|
||||
// competitionCloseAt is less than current date
|
||||
competitionCloseAt: { lte: date },
|
||||
|
||||
// competitionEndAt is greater than current date
|
||||
competitionEndAt: {gte: date },
|
||||
}
|
||||
],
|
||||
},
|
||||
orderBy:{
|
||||
dbId: 'desc'
|
||||
}
|
||||
orderBy: [
|
||||
{
|
||||
dbId: 'desc'
|
||||
},
|
||||
{
|
||||
competitionEndAt: 'desc',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Declare GhostCompetitionSchedule
|
||||
let compeSch;
|
||||
if(ocmEventDate){
|
||||
// Creating GhostCompetitionSchedule
|
||||
compeSch = wm.wm.protobuf.GhostCompetitionSchedule.create({
|
||||
if(ocmEventDate)
|
||||
{
|
||||
let pastDay = date - ocmEventDate.competitionEndAt
|
||||
|
||||
// OCM Competition ID (1 = C1 (Round 16), 4 = Nagoya (Round 19), 8 = Hiroshima (Round 21))
|
||||
competitionId: ocmEventDate.competitionId,
|
||||
if(pastDay < 604800)
|
||||
{
|
||||
// Creating GhostCompetitionSchedule
|
||||
compeSch = wm.wm.protobuf.GhostCompetitionSchedule.create({
|
||||
|
||||
// OCM Qualifying Start Timestamp
|
||||
qualifyingPeriodStartAt: ocmEventDate.qualifyingPeriodStartAt,
|
||||
// OCM Competition ID (1 = C1 (Round 16), 4 = Nagoya (Round 19), 8 = Hiroshima (Round 21))
|
||||
competitionId: ocmEventDate.competitionId,
|
||||
|
||||
// OCM Qualifying Close Timestamp
|
||||
qualifyingPeriodCloseAt: ocmEventDate.qualifyingPeriodCloseAt,
|
||||
// OCM Qualifying Start Timestamp
|
||||
qualifyingPeriodStartAt: ocmEventDate.qualifyingPeriodStartAt,
|
||||
|
||||
// OCM Competition (Main Draw) Start Timestamp
|
||||
competitionStartAt: ocmEventDate.competitionStartAt,
|
||||
// OCM Qualifying Close Timestamp
|
||||
qualifyingPeriodCloseAt: ocmEventDate.qualifyingPeriodCloseAt,
|
||||
|
||||
// OCM Competition (Main Draw) Close Timestamp
|
||||
competitionCloseAt: ocmEventDate.competitionCloseAt,
|
||||
// OCM Competition (Main Draw) Start Timestamp
|
||||
competitionStartAt: ocmEventDate.competitionStartAt,
|
||||
|
||||
// OCM Competition (Main Draw) End Timestamp
|
||||
competitionEndAt: ocmEventDate.competitionEndAt,
|
||||
// OCM Competition (Main Draw) Close Timestamp
|
||||
competitionCloseAt: ocmEventDate.competitionCloseAt,
|
||||
|
||||
// idk what this is
|
||||
lengthOfPeriod: ocmEventDate.lengthOfPeriod,
|
||||
// OCM Competition (Main Draw) End Timestamp
|
||||
competitionEndAt: ocmEventDate.competitionEndAt,
|
||||
|
||||
// idk what this is
|
||||
lengthOfInterval: ocmEventDate.lengthOfInterval,
|
||||
// idk what this is
|
||||
lengthOfPeriod: ocmEventDate.lengthOfPeriod,
|
||||
|
||||
// Area for the event (GID_RUNAREA_*, 8 is GID_RUNAREA_NAGOYA)
|
||||
area: ocmEventDate.area,
|
||||
// idk what this is
|
||||
lengthOfInterval: ocmEventDate.lengthOfInterval,
|
||||
|
||||
// idk what this is
|
||||
minigamePatternId: ocmEventDate.minigamePatternId
|
||||
});
|
||||
// Area for the event (GID_RUNAREA_*, 8 is GID_RUNAREA_NAGOYA)
|
||||
area: ocmEventDate.area,
|
||||
|
||||
// idk what this is
|
||||
minigamePatternId: ocmEventDate.minigamePatternId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Response data
|
||||
|
@ -564,6 +564,20 @@ export default class TerminalModule extends Module {
|
||||
}
|
||||
});
|
||||
|
||||
if(!(ocmEventDate))
|
||||
{
|
||||
ocmEventDate = await prisma.oCMEvent.findFirst({
|
||||
orderBy:{
|
||||
dbId: 'desc'
|
||||
}
|
||||
});
|
||||
|
||||
if(ocmEventDate)
|
||||
{
|
||||
console.log('Previous OCM found');
|
||||
}
|
||||
}
|
||||
|
||||
// Declare GhostCompetitionSchedule
|
||||
let compeSch;
|
||||
let msg: any;
|
||||
@ -773,9 +787,81 @@ export default class TerminalModule extends Module {
|
||||
}
|
||||
}
|
||||
// OCM has ended
|
||||
else if(ocmEventDate!.competitionCloseAt < date && ocmEventDate!.competitionEndAt > date)
|
||||
else
|
||||
{
|
||||
console.log('Current OCM Day : OCM has Ended');
|
||||
console.log('Current / Previous OCM Day : OCM has Ended');
|
||||
|
||||
let ocmParticipant = await prisma.oCMTally.findMany({
|
||||
where:{
|
||||
competitionId: ocmEventDate!.competitionId,
|
||||
periodId: 999999999
|
||||
},
|
||||
orderBy: {
|
||||
result: 'desc'
|
||||
}
|
||||
})
|
||||
|
||||
numOfParticipants = ocmParticipant.length;
|
||||
periodId = 0;
|
||||
let ranking = 0;
|
||||
|
||||
if(ocmParticipant)
|
||||
{
|
||||
for(let i=0; i<ocmParticipant.length; i++)
|
||||
{
|
||||
let cars = await prisma.car.findFirst({
|
||||
where:{
|
||||
carId: ocmParticipant[i].carId
|
||||
}
|
||||
});
|
||||
|
||||
let ocmGhostrecord = await prisma.oCMGhostBattleRecord.findFirst({
|
||||
where:{
|
||||
carId: ocmParticipant[i].carId,
|
||||
competitionId: ocmEventDate!.competitionId,
|
||||
}
|
||||
});
|
||||
|
||||
if(ocmParticipant[i].carId === body.carId && ranking === 0)
|
||||
{
|
||||
// User car setting
|
||||
ownRecords = wm.wm.protobuf.LoadGhostCompetitionRankingResponse.Entry.create({
|
||||
rank: i + 1,
|
||||
result: ocmParticipant[i].result,
|
||||
carId: ocmParticipant[i].carId,
|
||||
name: cars!.name,
|
||||
regionId: cars!.regionId,
|
||||
model: cars!.model,
|
||||
visualModel: cars!.visualModel,
|
||||
defaultColor: cars!.defaultColor,
|
||||
title: cars!.title,
|
||||
level: cars!.level,
|
||||
windowStickerString: cars!.windowStickerString,
|
||||
playedShopName: ocmGhostrecord!.playedShopName,
|
||||
playedAt: ocmGhostrecord!.playedAt
|
||||
});
|
||||
|
||||
ranking++;
|
||||
}
|
||||
|
||||
// Generate OCM Top Records
|
||||
topRecords.push(wm.wm.protobuf.LoadGhostCompetitionRankingResponse.Entry.create({
|
||||
rank: i + 1,
|
||||
result: ocmParticipant[i].result,
|
||||
carId: ocmParticipant[i].carId,
|
||||
name: cars!.name,
|
||||
regionId: cars!.regionId,
|
||||
model: cars!.model,
|
||||
visualModel: cars!.visualModel,
|
||||
defaultColor: cars!.defaultColor,
|
||||
title: cars!.title,
|
||||
level: cars!.level,
|
||||
windowStickerString: cars!.windowStickerString,
|
||||
playedShopName: ocmGhostrecord!.playedShopName,
|
||||
playedAt: ocmGhostrecord!.playedAt
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Response data
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user