fix select ghost by region got stuck
This commit is contained in:
parent
914163569c
commit
71c7be42a9
@ -149,9 +149,9 @@ export default class GhostModule extends Module {
|
||||
let lists_ghostcar = getGhostCar.lists_ghostcar;
|
||||
|
||||
// Check again if car list for that selected region is available of not
|
||||
if(body.regionId !== null && body.regionId !== undefined && body.regionId !== 0)
|
||||
if(body.regionId !== null && body.regionId !== undefined && body.regionId !== 0 && car.length < 1)
|
||||
{
|
||||
let checkGhostSearchByRegion = await ghostFunctions.checkGhostSearchByRegion(car, body.ghostLevel, body.regionId);
|
||||
let checkGhostSearchByRegion = await ghostFunctions.checkGhostSearchByRegion(body.ghostLevel, body.regionId);
|
||||
lists_ghostcar = checkGhostSearchByRegion.lists_ghostcar;
|
||||
}
|
||||
|
||||
|
@ -274,122 +274,118 @@ export async function getGhostCar(car: any, area: number, ramp: number, path: nu
|
||||
|
||||
|
||||
// Check Ghost Car when using Search by Region
|
||||
export async function checkGhostSearchByRegion(car: any, ghostLevel: number, regionId: number)
|
||||
export async function checkGhostSearchByRegion(ghostLevel: number, regionId: number)
|
||||
{
|
||||
let lists_ghostcar: any;
|
||||
// Get current date
|
||||
let date = Math.floor(new Date().getTime() / 1000);
|
||||
|
||||
let playedPlace = wmproto.wm.protobuf.Place.create({
|
||||
placeId: Config.getConfig().placeId,
|
||||
regionId: Config.getConfig().regionId,
|
||||
shopName: Config.getConfig().shopName,
|
||||
country: Config.getConfig().country
|
||||
});
|
||||
|
||||
if(car.length < 1)
|
||||
let tunePowerDefault = 0
|
||||
let tuneHandlingDefault = 0;
|
||||
if(ghostLevel === 1)
|
||||
{
|
||||
// Get current date
|
||||
let date = Math.floor(new Date().getTime() / 1000);
|
||||
|
||||
let playedPlace = wmproto.wm.protobuf.Place.create({
|
||||
placeId: Config.getConfig().placeId,
|
||||
regionId: Config.getConfig().regionId,
|
||||
shopName: Config.getConfig().shopName,
|
||||
country: Config.getConfig().country
|
||||
});
|
||||
|
||||
let tunePowerDefault = 0
|
||||
let tuneHandlingDefault = 0;
|
||||
if(ghostLevel === 1)
|
||||
{
|
||||
tunePowerDefault = 1;
|
||||
tuneHandlingDefault = 4;
|
||||
}
|
||||
else if(ghostLevel === 2)
|
||||
{
|
||||
tunePowerDefault = 5;
|
||||
tuneHandlingDefault = 5;
|
||||
}
|
||||
else if(ghostLevel === 3)
|
||||
{
|
||||
tunePowerDefault = 8;
|
||||
tuneHandlingDefault = 7;
|
||||
}
|
||||
else if(ghostLevel === 4)
|
||||
{
|
||||
tunePowerDefault = 10;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 5)
|
||||
{
|
||||
tunePowerDefault = 15;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 6)
|
||||
{
|
||||
tunePowerDefault = 18;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 7)
|
||||
{
|
||||
tunePowerDefault = 20;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 8)
|
||||
{
|
||||
tunePowerDefault = 21;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 9)
|
||||
{
|
||||
tunePowerDefault = 22;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 10)
|
||||
{
|
||||
tunePowerDefault = 24;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 11)
|
||||
{
|
||||
tunePowerDefault = 24;
|
||||
tuneHandlingDefault = 24;
|
||||
}
|
||||
|
||||
// Generate default S660 car data
|
||||
car = wmproto.wm.protobuf.Car.create({
|
||||
carId: 999999999, // Don't change this
|
||||
name: 'S660',
|
||||
regionId: regionId, // IDN (福井)
|
||||
manufacturer: 12, // HONDA
|
||||
model: 105, // S660 [JW5]
|
||||
visualModel: 130, // S660 [JW5]
|
||||
defaultColor: 0,
|
||||
customColor: 0,
|
||||
wheel: 20,
|
||||
wheelColor: 0,
|
||||
aero: 0,
|
||||
bonnet: 0,
|
||||
wing: 0,
|
||||
mirror: 0,
|
||||
neon: 0,
|
||||
trunk: 0,
|
||||
plate: 0,
|
||||
plateColor: 0,
|
||||
plateNumber: 0,
|
||||
tunePower: tunePowerDefault,
|
||||
tuneHandling: tuneHandlingDefault,
|
||||
rivalMarker: 32,
|
||||
aura: 551,
|
||||
windowSticker: true,
|
||||
windowStickerString: 'BAYSHORE',
|
||||
windowStickerFont: 0,
|
||||
title: 'No Ghost for this Region',
|
||||
level: 65, // SSSSS
|
||||
lastPlayedAt: date,
|
||||
country: 'JPN',
|
||||
lastPlayedPlace: playedPlace
|
||||
});
|
||||
|
||||
// Push data to Ghost car proto
|
||||
lists_ghostcar.push(wmproto.wm.protobuf.GhostCar.create({
|
||||
car: car,
|
||||
nonhuman: true,
|
||||
type: wmproto.wm.protobuf.GhostType.GHOST_DEFAULT,
|
||||
}));
|
||||
tunePowerDefault = 1;
|
||||
tuneHandlingDefault = 4;
|
||||
}
|
||||
else if(ghostLevel === 2)
|
||||
{
|
||||
tunePowerDefault = 5;
|
||||
tuneHandlingDefault = 5;
|
||||
}
|
||||
else if(ghostLevel === 3)
|
||||
{
|
||||
tunePowerDefault = 8;
|
||||
tuneHandlingDefault = 7;
|
||||
}
|
||||
else if(ghostLevel === 4)
|
||||
{
|
||||
tunePowerDefault = 10;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 5)
|
||||
{
|
||||
tunePowerDefault = 15;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 6)
|
||||
{
|
||||
tunePowerDefault = 18;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 7)
|
||||
{
|
||||
tunePowerDefault = 20;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 8)
|
||||
{
|
||||
tunePowerDefault = 21;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 9)
|
||||
{
|
||||
tunePowerDefault = 22;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 10)
|
||||
{
|
||||
tunePowerDefault = 24;
|
||||
tuneHandlingDefault = 10;
|
||||
}
|
||||
else if(ghostLevel === 11)
|
||||
{
|
||||
tunePowerDefault = 24;
|
||||
tuneHandlingDefault = 24;
|
||||
}
|
||||
|
||||
// Generate default S660 car data
|
||||
let car = wmproto.wm.protobuf.Car.create({
|
||||
carId: 999999999, // Don't change this
|
||||
name: 'S660',
|
||||
regionId: regionId, // IDN (福井)
|
||||
manufacturer: 12, // HONDA
|
||||
model: 105, // S660 [JW5]
|
||||
visualModel: 130, // S660 [JW5]
|
||||
defaultColor: 0,
|
||||
customColor: 0,
|
||||
wheel: 20,
|
||||
wheelColor: 0,
|
||||
aero: 0,
|
||||
bonnet: 0,
|
||||
wing: 0,
|
||||
mirror: 0,
|
||||
neon: 0,
|
||||
trunk: 0,
|
||||
plate: 0,
|
||||
plateColor: 0,
|
||||
plateNumber: 0,
|
||||
tunePower: tunePowerDefault,
|
||||
tuneHandling: tuneHandlingDefault,
|
||||
rivalMarker: 32,
|
||||
aura: 551,
|
||||
windowSticker: true,
|
||||
windowStickerString: 'BAYSHORE',
|
||||
windowStickerFont: 0,
|
||||
title: 'No Ghost for this Region',
|
||||
level: 65, // SSSSS
|
||||
lastPlayedAt: date,
|
||||
country: 'JPN',
|
||||
lastPlayedPlace: playedPlace
|
||||
});
|
||||
|
||||
// Push data to Ghost car proto
|
||||
let lists_ghostcar: wmproto.wm.protobuf.GhostCar[] = [];
|
||||
lists_ghostcar.push(wmproto.wm.protobuf.GhostCar.create({
|
||||
car: car,
|
||||
nonhuman: true,
|
||||
type: wmproto.wm.protobuf.GhostType.GHOST_DEFAULT,
|
||||
}));
|
||||
|
||||
return { lists_ghostcar }
|
||||
}
|
Loading…
Reference in New Issue
Block a user