diff --git a/src/modules/ghost_vsorg.ts b/src/modules/ghost_vsorg.ts index 04a7b4b..b3707b8 100644 --- a/src/modules/ghost_vsorg.ts +++ b/src/modules/ghost_vsorg.ts @@ -298,16 +298,26 @@ export default class GhostModule extends Module { let country = 'JPN'; let regionId: number = 20; - if(ghostExpeditionRegion!.opponentCountry === 'IDN') - { - country = 'IDN'; - regionId = 18; - } - else if(ghostExpeditionRegion!.opponentCountry === 'AUS') + if(ghostExpeditionRegion!.opponentCountry === 'AUS') { country = 'AUS'; regionId = 2; } + else if(ghostExpeditionRegion!.opponentCountry === 'BRN') + { + country = 'BRN'; + regionId = 7; + } + else if(ghostExpeditionRegion!.opponentCountry === 'CAN') + { + country = 'CAN'; + regionId = 8; + } + else if(ghostExpeditionRegion!.opponentCountry === 'KHM') + { + country = 'KHM'; + regionId = 9; + } else if(ghostExpeditionRegion!.opponentCountry === 'CHN') { country = 'CHN'; @@ -318,11 +328,71 @@ export default class GhostModule extends Module { country = 'HKG'; regionId = 15; } + else if(ghostExpeditionRegion!.opponentCountry === 'IND') + { + country = 'IND'; + regionId = 17; + } + else if(ghostExpeditionRegion!.opponentCountry === 'IDN') + { + country = 'IDN'; + regionId = 18; + } + else if(ghostExpeditionRegion!.opponentCountry === 'KOR') + { + country = 'KOR'; + regionId = 21; + } + else if(ghostExpeditionRegion!.opponentCountry === 'MAC') + { + country = 'MAC'; + regionId = 22; + } + else if(ghostExpeditionRegion!.opponentCountry === 'MYS') + { + country = 'MYS'; + regionId = 23; + } + else if(ghostExpeditionRegion!.opponentCountry === 'NZL') + { + country = 'NZL'; + regionId = 26; + } else if(ghostExpeditionRegion!.opponentCountry === 'PHL') { country = 'PHL'; regionId = 30; } + else if(ghostExpeditionRegion!.opponentCountry === 'SGP') + { + country = 'SGP'; + regionId = 34; + } + else if(ghostExpeditionRegion!.opponentCountry === 'LKA') + { + country = 'LKA'; + regionId = 37; + } + else if(ghostExpeditionRegion!.opponentCountry === 'TWN') + { + country = 'TWN'; + regionId = 39; + } + else if(ghostExpeditionRegion!.opponentCountry === 'THA') + { + country = 'THA'; + regionId = 40; + } + else if(ghostExpeditionRegion!.opponentCountry === 'USA') + { + country = 'USA'; + regionId = 44; + } + else if(ghostExpeditionRegion!.opponentCountry === 'VNM') + { + country = 'VNM'; + regionId = 46; + } // Get Canditate list let car = await prisma.car.findMany({ diff --git a/src/util/games/ghost.ts b/src/util/games/ghost.ts index fd755dd..b035f58 100644 --- a/src/util/games/ghost.ts +++ b/src/util/games/ghost.ts @@ -129,21 +129,24 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ } let ghostResults = common.sanitizeInput(ghostResult) - let rgRegionsScore = await opponentsRegion(ghostResults); - let rgRegions: number[] = car.rgRegions || []; + let rgRegionsId = await opponentsRegion(ghostResults); - if(rgRegions.length !== (dataGhost.rgWinCount % 100) - rgRegionsScore.length) + let rgRegions: number[] = car.rgRegions || []; + let realLength = (dataGhost.rgWinCount % 100) - rgRegionsId.length; + let missingLength = realLength - rgRegions.length; + + if(missingLength > 0) { - rgRegions = new Array((dataGhost.rgWinCount % 100) - rgRegionsScore.length - rgRegions.length).fill(18) + rgRegions = new Array(missingLength).fill(18); } - let mergedRegion = [...rgRegions, ...rgRegionsScore]; + dataGhost.rgRegions = [...rgRegions, ...rgRegionsId]; // More than 100 - if(mergedRegion.length > 100) + if(dataGhost.rgRegions.length > 100) { - const excess = mergedRegion.length - 100; - mergedRegion = mergedRegion.slice(-excess); + const excess = dataGhost.rgRegions.length - 100; + dataGhost.rgRegions = dataGhost.rgRegions.slice(-excess); } }