diff --git a/src/modules/game.ts b/src/modules/game.ts index 92a1e3e..8a1c83b 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -422,10 +422,15 @@ export default class GameModule extends Module { ghostOpponentCar!.manufacturer = 12; ghostOpponentCar!.model = 105; ghostOpponentCar!.visualModel = 130; + ghostOpponentCar!.regionId = 18; + ghostOpponentCar!.country = 'GLB'; } - let randomRegionId = Math.floor(Math.random() * 47) + 1; - ghostOpponentCar!.regionId = randomRegionId; + if(ghostOpponentCar!.regionId === 0) + { + let randomRegionId = Math.floor(Math.random() * 47) + 1; + ghostOpponentCar!.regionId = randomRegionId; + } // Get Opponent 1 tune ghostOpponentCar!.tunePower = ghostHistoryData![i].opponent1TunePower!; @@ -460,10 +465,15 @@ export default class GameModule extends Module { ghostOpponentCar2!.manufacturer = 12; ghostOpponentCar2!.model = 105; ghostOpponentCar2!.visualModel = 130; + ghostOpponentCar2!.regionId = 18; + ghostOpponentCar2!.country = 'GLB'; } - let randomRegionId = Math.floor(Math.random() * 47) + 1; - ghostOpponentCar2!.regionId = randomRegionId; + if(ghostOpponentCar!.regionId === 0) + { + let randomRegionId = Math.floor(Math.random() * 47) + 1; + ghostOpponentCar2!.regionId = randomRegionId; + } // Get Opponent 2 tune ghostOpponentCar2!.tunePower = ghostHistoryData![i].opponent2TunePower!; @@ -495,10 +505,15 @@ export default class GameModule extends Module { ghostOpponentCar3!.manufacturer = 12; ghostOpponentCar3!.model = 105; ghostOpponentCar3!.visualModel = 130; + ghostOpponentCar3!.regionId = 18; + ghostOpponentCar3!.country = 'GLB'; } - let randomRegionId = Math.floor(Math.random() * 47) + 1; - ghostOpponentCar3!.regionId = randomRegionId; + if(ghostOpponentCar!.regionId === 0) + { + let randomRegionId = Math.floor(Math.random() * 47) + 1; + ghostOpponentCar3!.regionId = randomRegionId; + } // Get Opponent 3 tune ghostOpponentCar3!.tunePower = ghostHistoryData![i].opponent3TunePower!; diff --git a/src/modules/ghost_ocm.ts b/src/modules/ghost_ocm.ts index 5e54189..2304eae 100644 --- a/src/modules/ghost_ocm.ts +++ b/src/modules/ghost_ocm.ts @@ -241,6 +241,7 @@ export default class GhostModule extends Module { if(checkOneParticipant) { let itemId = 0; + // 16th - C1 if(ocmEventDate.competitionId === 1) { @@ -286,6 +287,66 @@ export default class GhostModule extends Module { { itemId = 47; } + // 1st - C1 + else if(ocmEventDate.competitionId === 10) + { + itemId = 5; + } + // 2nd - Osaka + else if(ocmEventDate.competitionId === 11) + { + itemId = 11; + } + // 3rd - Fukuoka + else if(ocmEventDate.competitionId === 12) + { + itemId = 17; + } + // 4th - Nagoya + else if(ocmEventDate.competitionId === 13) + { + itemId = 23; + } + // 5th - Yaesu + else if(ocmEventDate.competitionId === 14) + { + itemId = 29; + } + // 9th - Hakone (Mt. Taikan) + else if(ocmEventDate.competitionId === 15) + { + itemId = 53; + } + // 10th - Sub-center(Shibuya/Shinjuku) + else if(ocmEventDate.competitionId === 16) + { + itemId = 93; + } + // 11th - Sub-center(Ikebukuro) + else if(ocmEventDate.competitionId === 17) + { + itemId = 99; + } + // 12th - Kobe + else if(ocmEventDate.competitionId === 18) + { + itemId = 105; + } + // 13th - New Belt Line + else if(ocmEventDate.competitionId === 19) + { + itemId = 141; + } + // 14th - Yokohama + else if(ocmEventDate.competitionId === 20) + { + itemId = 147; + } + // 15th - Hiroshima + else if(ocmEventDate.competitionId === 21) + { + itemId = 153; + } let checkNameplate = await prisma.carItem.count({ where:{ diff --git a/src/util/games/games_util/ghost_history.ts b/src/util/games/games_util/ghost_history.ts index d841b72..7853aa4 100644 --- a/src/util/games/games_util/ghost_history.ts +++ b/src/util/games/games_util/ghost_history.ts @@ -9,7 +9,6 @@ export async function saveGhostHistory(body: wm.protobuf.SaveGameResultRequest) { console.log('Saving Ghost Battle History'); - let updateNewTrail: boolean = true; let saveExGhostHistory: any = {}; if (body.car?.carId !== null && body.car?.carId !== undefined) { @@ -133,9 +132,6 @@ export async function saveGhostHistory(body: wm.protobuf.SaveGameResultRequest) await prisma.ghostBattleRecord.create({ data: saveExGhostHistory }); - - // Return the value to 'BASE_PATH/src/util/games/ghost.ts' - return { updateNewTrail } } diff --git a/src/util/games/ghost.ts b/src/util/games/ghost.ts index d6727a6..7752c2c 100644 --- a/src/util/games/ghost.ts +++ b/src/util/games/ghost.ts @@ -115,7 +115,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Ghost Battle by Level case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_BY_LEVEL: { - console.log('Normal Ghost Mode Found'); + console.log('Normal Ghost Mode Found - Select by Level'); ghost_historys = await ghost_history.saveGhostHistory(body); @@ -128,7 +128,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Ghost Battle by Name case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_BY_NAME: { - console.log('Normal Ghost Mode Found'); + console.log('Normal Ghost Mode Found - Search by Name'); ghost_historys = await ghost_history.saveGhostHistory(body); @@ -141,7 +141,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Ghost Battle by Region case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_BY_REGION: { - console.log('Normal Ghost Mode Found'); + console.log('Normal Ghost Mode Found - Search by Region'); ghost_historys = await ghost_history.saveGhostHistory(body); @@ -154,7 +154,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Ghost Battle from History case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_FROM_HISTORY: { - console.log('Normal Ghost Mode Found'); + console.log('Normal Ghost Mode Found - Select from History'); ghost_historys = await ghost_history.saveGhostHistory(body); @@ -167,7 +167,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Ghost Battle by Shop case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_BY_SHOP: { - console.log('Normal Ghost Mode Found'); + console.log('Normal Ghost Mode Found - Search by Shop'); ghost_historys = await ghost_history.saveGhostHistory(body); @@ -180,10 +180,12 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ // Crown Ghost Battle Mode case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_CROWN_MATCH: { - // If not losing to the crown ghost battle + console.log('Crown Ghost Mode Found'); + + // Not losing to the crown ghost battle if (body.rgResult?.acquireCrown !== false && body.rgResult?.acquireCrown) { - console.log('Crown Ghost Mode Found'); + console.log('Win the Crown Ghost Battle'); // Get the ghost crown result let ghostResultCrown = body?.rgResult; @@ -315,12 +317,18 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ }); } } - - ghost_historys = await ghost_history.saveGhostHistory(body); - - // Update the updateNewTrail value - updateNewTrail = ghost_historys.updateNewTrail; + + updateNewTrail = true; } + // Losing to the crown ghost battle + else + { + console.log('Lose the Crown Ghost Battle'); + + updateNewTrail = false; + } + + await ghost_history.saveGhostHistory(body); break; } @@ -333,16 +341,21 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ OCMModePlay = true; let saveExOCM: any = {}; saveExOCM.carId = body.carId; - if(body.rgResult?.competitionId){ + + if(body.rgResult?.competitionId) + { saveExOCM.competitionId = body.rgResult?.competitionId!; } - if(body.rgResult?.periodId){ + + if(body.rgResult?.periodId) + { saveExOCM.periodId = body.rgResult?.periodId!; } else { saveExOCM.periodId = 0; } + if(body.rgResult?.brakingPoint) { saveExOCM.brakingPoint = body.rgResult?.brakingPoint!; @@ -351,7 +364,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ { saveExOCM.brakingPoint = 0; } - if(body?.playedAt){ + + if(body?.playedAt) + { saveExOCM.playedAt = body?.playedAt!; } @@ -364,7 +379,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ }); // User's OCM Battle data available - if(countOCM !== 0){ + if(countOCM !== 0) + { console.log('OCM Play Record found'); console.log('Updaing OCM Play Record entry'); @@ -377,7 +393,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ }); } // First time User playing OCM Battle - else{ + else + { console.log('OCM Play Record not found'); console.log('Creating new OCM Play Record entry'); diff --git a/src/util/games/ghost_ocm.ts b/src/util/games/ghost_ocm.ts index bbc8744..d035a54 100644 --- a/src/util/games/ghost_ocm.ts +++ b/src/util/games/ghost_ocm.ts @@ -536,603 +536,625 @@ export async function ocmGiveNamePlateReward(competitionId: number) } }); - let participantLength = getCarParticipant.length; - if(getCarParticipant) { console.log('Giving OCM Rewards'); + + let participantLength = getCarParticipant.length; - // Participant is less than 100 - if(participantLength < 101) + // Participant is more than 100 + if(participantLength > 100) { - // 16th - C1 - if(competitionId === 1) - { - for(let i=0; i