mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2024-11-14 11:07:50 +01:00
rg regions
This commit is contained in:
parent
8275339913
commit
2223e88b85
3
prisma/migrations/20240624124049_rgregions/migration.sql
Normal file
3
prisma/migrations/20240624124049_rgregions/migration.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Car" ADD COLUMN "rgRegions" INTEGER[],
|
||||||
|
ALTER COLUMN "stLoseBits" SET DEFAULT 0;
|
@ -119,6 +119,7 @@ model Car {
|
|||||||
rgStamp Int @default(1)
|
rgStamp Int @default(1)
|
||||||
rgAcquireAllCrowns Boolean @default(false)
|
rgAcquireAllCrowns Boolean @default(false)
|
||||||
rgRegionMapScore Int[]
|
rgRegionMapScore Int[]
|
||||||
|
rgRegions Int[]
|
||||||
stampSheetCount Int @default(0)
|
stampSheetCount Int @default(0)
|
||||||
stampSheet Int[]
|
stampSheet Int[]
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
stampSheet: stampSheet,
|
stampSheet: stampSheet,
|
||||||
stampSheetCount: common.sanitizeInputNotZero(ghostResult.stampSheetCount),
|
stampSheetCount: common.sanitizeInputNotZero(ghostResult.stampSheetCount),
|
||||||
rgTrophy: common.sanitizeInputNotZero(ghostResult.rgTrophy),
|
rgTrophy: common.sanitizeInputNotZero(ghostResult.rgTrophy),
|
||||||
|
rgRegions: []
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count total win based on region map score
|
// Count total win based on region map score
|
||||||
@ -126,6 +127,24 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
dataGhost.rgWinCount = winCounter;
|
dataGhost.rgWinCount = winCounter;
|
||||||
dataGhost.rgScore = winCounter;
|
dataGhost.rgScore = winCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let ghostResults = common.sanitizeInput(ghostResult)
|
||||||
|
let rgRegionsScore = await opponentsRegion(ghostResults);
|
||||||
|
let rgRegions: number[] = car.rgRegions || [];
|
||||||
|
|
||||||
|
if(rgRegions.length !== (dataGhost.rgWinCount % 100) - rgRegionsScore.length)
|
||||||
|
{
|
||||||
|
rgRegions = new Array((dataGhost.rgWinCount % 100) - rgRegionsScore.length - rgRegions.length).fill(18)
|
||||||
|
}
|
||||||
|
|
||||||
|
let mergedRegion = [...rgRegions, ...rgRegionsScore];
|
||||||
|
|
||||||
|
// More than 100
|
||||||
|
if(mergedRegion.length > 100)
|
||||||
|
{
|
||||||
|
const excess = mergedRegion.length - 100;
|
||||||
|
mergedRegion = mergedRegion.slice(-excess);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the ghost result for the car
|
// Get the ghost result for the car
|
||||||
@ -745,3 +764,28 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
|
|||||||
// Return the value to 'BASE_PATH/src/modules/game.ts'
|
// Return the value to 'BASE_PATH/src/modules/game.ts'
|
||||||
return { ghostModePlay, updateNewTrail, OCMModePlay }
|
return { ghostModePlay, updateNewTrail, OCMModePlay }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Opponent Region
|
||||||
|
async function opponentsRegion(ghostResults: wm.protobuf.SaveGameResultRequest.GhostBattleResult)
|
||||||
|
{
|
||||||
|
let regionIdArray = [];
|
||||||
|
for(const ghostResult of ghostResults.opponents)
|
||||||
|
{
|
||||||
|
let getRegionId = await prisma.car.findFirst({
|
||||||
|
where:{
|
||||||
|
carId: ghostResult.carId
|
||||||
|
},
|
||||||
|
select:{
|
||||||
|
regionId: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(getRegionId)
|
||||||
|
{
|
||||||
|
regionIdArray.push(getRegionId.regionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return regionIdArray;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user