1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-11-12 02:01:02 +01:00

add missing vsorg region, fix rg regions

This commit is contained in:
Shiroi Kitsu 2024-08-26 17:21:30 +07:00
parent 2223e88b85
commit 950274b1ef
2 changed files with 87 additions and 14 deletions

View File

@ -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({

View File

@ -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);
}
}