1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-11-24 15:50:13 +01:00

Merge pull request #30 from ghkkk090/master

fix ghost stuff again
This commit is contained in:
Luna 2022-08-19 14:14:01 +01:00 committed by GitHub
commit eec96bd011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 705 additions and 594 deletions

View File

@ -422,10 +422,15 @@ export default class GameModule extends Module {
ghostOpponentCar!.manufacturer = 12; ghostOpponentCar!.manufacturer = 12;
ghostOpponentCar!.model = 105; ghostOpponentCar!.model = 105;
ghostOpponentCar!.visualModel = 130; ghostOpponentCar!.visualModel = 130;
ghostOpponentCar!.regionId = 18;
ghostOpponentCar!.country = 'GLB';
} }
let randomRegionId = Math.floor(Math.random() * 47) + 1; if(ghostOpponentCar!.regionId === 0)
ghostOpponentCar!.regionId = randomRegionId; {
let randomRegionId = Math.floor(Math.random() * 47) + 1;
ghostOpponentCar!.regionId = randomRegionId;
}
// Get Opponent 1 tune // Get Opponent 1 tune
ghostOpponentCar!.tunePower = ghostHistoryData![i].opponent1TunePower!; ghostOpponentCar!.tunePower = ghostHistoryData![i].opponent1TunePower!;
@ -460,10 +465,15 @@ export default class GameModule extends Module {
ghostOpponentCar2!.manufacturer = 12; ghostOpponentCar2!.manufacturer = 12;
ghostOpponentCar2!.model = 105; ghostOpponentCar2!.model = 105;
ghostOpponentCar2!.visualModel = 130; ghostOpponentCar2!.visualModel = 130;
ghostOpponentCar2!.regionId = 18;
ghostOpponentCar2!.country = 'GLB';
} }
let randomRegionId = Math.floor(Math.random() * 47) + 1; if(ghostOpponentCar!.regionId === 0)
ghostOpponentCar2!.regionId = randomRegionId; {
let randomRegionId = Math.floor(Math.random() * 47) + 1;
ghostOpponentCar2!.regionId = randomRegionId;
}
// Get Opponent 2 tune // Get Opponent 2 tune
ghostOpponentCar2!.tunePower = ghostHistoryData![i].opponent2TunePower!; ghostOpponentCar2!.tunePower = ghostHistoryData![i].opponent2TunePower!;
@ -495,10 +505,15 @@ export default class GameModule extends Module {
ghostOpponentCar3!.manufacturer = 12; ghostOpponentCar3!.manufacturer = 12;
ghostOpponentCar3!.model = 105; ghostOpponentCar3!.model = 105;
ghostOpponentCar3!.visualModel = 130; ghostOpponentCar3!.visualModel = 130;
ghostOpponentCar3!.regionId = 18;
ghostOpponentCar3!.country = 'GLB';
} }
let randomRegionId = Math.floor(Math.random() * 47) + 1; if(ghostOpponentCar!.regionId === 0)
ghostOpponentCar3!.regionId = randomRegionId; {
let randomRegionId = Math.floor(Math.random() * 47) + 1;
ghostOpponentCar3!.regionId = randomRegionId;
}
// Get Opponent 3 tune // Get Opponent 3 tune
ghostOpponentCar3!.tunePower = ghostHistoryData![i].opponent3TunePower!; ghostOpponentCar3!.tunePower = ghostHistoryData![i].opponent3TunePower!;

View File

@ -241,6 +241,7 @@ export default class GhostModule extends Module {
if(checkOneParticipant) if(checkOneParticipant)
{ {
let itemId = 0; let itemId = 0;
// 16th - C1 // 16th - C1
if(ocmEventDate.competitionId === 1) if(ocmEventDate.competitionId === 1)
{ {
@ -286,6 +287,66 @@ export default class GhostModule extends Module {
{ {
itemId = 47; 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({ let checkNameplate = await prisma.carItem.count({
where:{ where:{

View File

@ -9,7 +9,6 @@ export async function saveGhostHistory(body: wm.protobuf.SaveGameResultRequest)
{ {
console.log('Saving Ghost Battle History'); console.log('Saving Ghost Battle History');
let updateNewTrail: boolean = true;
let saveExGhostHistory: any = {}; let saveExGhostHistory: any = {};
if (body.car?.carId !== null && body.car?.carId !== undefined) { 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({ await prisma.ghostBattleRecord.create({
data: saveExGhostHistory data: saveExGhostHistory
}); });
// Return the value to 'BASE_PATH/src/util/games/ghost.ts'
return { updateNewTrail }
} }

View File

@ -115,7 +115,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Ghost Battle by Level // Ghost Battle by Level
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_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); ghost_historys = await ghost_history.saveGhostHistory(body);
@ -128,7 +128,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Ghost Battle by Name // Ghost Battle by Name
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_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); ghost_historys = await ghost_history.saveGhostHistory(body);
@ -141,7 +141,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Ghost Battle by Region // Ghost Battle by Region
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_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); ghost_historys = await ghost_history.saveGhostHistory(body);
@ -154,7 +154,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Ghost Battle from History // Ghost Battle from History
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_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); ghost_historys = await ghost_history.saveGhostHistory(body);
@ -167,7 +167,7 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Ghost Battle by Shop // Ghost Battle by Shop
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SEARCH_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); ghost_historys = await ghost_history.saveGhostHistory(body);
@ -180,10 +180,12 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
// Crown Ghost Battle Mode // Crown Ghost Battle Mode
case wmproto.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_CROWN_MATCH: 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) 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 // Get the ghost crown result
let ghostResultCrown = body?.rgResult; let ghostResultCrown = body?.rgResult;
@ -316,11 +318,17 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
} }
} }
ghost_historys = await ghost_history.saveGhostHistory(body); updateNewTrail = true;
// Update the updateNewTrail value
updateNewTrail = ghost_historys.updateNewTrail;
} }
// Losing to the crown ghost battle
else
{
console.log('Lose the Crown Ghost Battle');
updateNewTrail = false;
}
await ghost_history.saveGhostHistory(body);
break; break;
} }
@ -333,16 +341,21 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
OCMModePlay = true; OCMModePlay = true;
let saveExOCM: any = {}; let saveExOCM: any = {};
saveExOCM.carId = body.carId; saveExOCM.carId = body.carId;
if(body.rgResult?.competitionId){
if(body.rgResult?.competitionId)
{
saveExOCM.competitionId = body.rgResult?.competitionId!; saveExOCM.competitionId = body.rgResult?.competitionId!;
} }
if(body.rgResult?.periodId){
if(body.rgResult?.periodId)
{
saveExOCM.periodId = body.rgResult?.periodId!; saveExOCM.periodId = body.rgResult?.periodId!;
} }
else else
{ {
saveExOCM.periodId = 0; saveExOCM.periodId = 0;
} }
if(body.rgResult?.brakingPoint) if(body.rgResult?.brakingPoint)
{ {
saveExOCM.brakingPoint = body.rgResult?.brakingPoint!; saveExOCM.brakingPoint = body.rgResult?.brakingPoint!;
@ -351,7 +364,9 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
{ {
saveExOCM.brakingPoint = 0; saveExOCM.brakingPoint = 0;
} }
if(body?.playedAt){
if(body?.playedAt)
{
saveExOCM.playedAt = body?.playedAt!; saveExOCM.playedAt = body?.playedAt!;
} }
@ -364,7 +379,8 @@ export async function saveGhostBattleResult(body: wm.protobuf.SaveGameResultRequ
}); });
// User's OCM Battle data available // User's OCM Battle data available
if(countOCM !== 0){ if(countOCM !== 0)
{
console.log('OCM Play Record found'); console.log('OCM Play Record found');
console.log('Updaing OCM Play Record entry'); 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 // First time User playing OCM Battle
else{ else
{
console.log('OCM Play Record not found'); console.log('OCM Play Record not found');
console.log('Creating new OCM Play Record entry'); console.log('Creating new OCM Play Record entry');

File diff suppressed because it is too large Load Diff

View File

@ -59,7 +59,7 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
data.stClearBits = storyResult.stClearBits; data.stClearBits = storyResult.stClearBits;
} }
// Calling give meter reward function (BASE_PATH/src/util/meter_reward.ts) // Calling check step function (BASE_PATH/src/util/games/games_util/check_step.ts)
let check_steps = await check_step.checkCurrentStep(body); let check_steps = await check_step.checkCurrentStep(body);
// Set the ghost level to the correct level // Set the ghost level to the correct level