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

crown area after kobe is hiroshima first then fukuoka

This commit is contained in:
ghkkk090 2022-10-28 13:53:04 +07:00
parent ae624fd024
commit b977ff21bc
2 changed files with 85 additions and 38 deletions

View File

@ -536,6 +536,8 @@ export default class CarModule extends Module {
// Car update data // Car update data
data = { data = {
name: common.sanitizeInput(cars.name), name: common.sanitizeInput(cars.name),
manufacturer: common.sanitizeInput(cars.manufacturer),
model: common.sanitizeInput(cars.model),
visualModel: common.sanitizeInput(cars.visualModel), visualModel: common.sanitizeInput(cars.visualModel),
customColor: common.sanitizeInput(cars.customColor), customColor: common.sanitizeInput(cars.customColor),
wheel: common.sanitizeInput(cars.wheel), wheel: common.sanitizeInput(cars.wheel),

View File

@ -332,27 +332,28 @@ export default class ResourceModule extends Module {
// Get the crown holder data // Get the crown holder data
let car_crown = await prisma.carCrown.findMany({ let car_crown = await prisma.carCrown.findMany({
orderBy: { orderBy: {
area: 'asc' area: 'asc'
} },
distinct: ['area']
}); });
// Crown holder data available // Crown holder data available
if(car_crown.length !== 0) if(car_crown.length !== 0)
{ {
let counter = 0; let counter = 0;
// Loop GID_RUNAREA // Loop GID_RUNAREA
for(let i=0; i<19; i++) for(let i=0; i<19; i++)
{ {
// 14 - 16 are dummy area, 17 is C1 Closed // After Kobe is Hiroshima then Fukuoka and the rest
if(i >= 14) if(i > 14)
{ {
i = 18; // GID_RUNAREA_HIROSHIMA i = 18; // GID_RUNAREA_HIROSHIMA
} }
// Crown holder for certain area available // Crown holder for certain area available
if(car_crown[counter].area === i){ if(car_crown[counter].area === i)
{
// Get user's data // Get user's data
let car = await prisma.car.findFirst({ let car = await prisma.car.findFirst({
where: { where: {
@ -364,12 +365,6 @@ export default class ResourceModule extends Module {
} }
}); });
// If regionId is 0 or not set, game will crash after defeating the ghost
if(car!.regionId === 0)
{
car!.regionId = i + 1; // Change car region id
}
// Set the tunePower and tuneHandling used when capturing ghost crown // Set the tunePower and tuneHandling used when capturing ghost crown
car!.tunePower = car_crown[counter].tunePower; car!.tunePower = car_crown[counter].tunePower;
car!.tuneHandling = car_crown[counter].tuneHandling; car!.tuneHandling = car_crown[counter].tuneHandling;
@ -394,48 +389,98 @@ export default class ResourceModule extends Module {
} }
// Push the car data to the crown holder data // Push the car data to the crown holder data
list_crown.push(wmsrv.wm.protobuf.Crown.create({ // GID_RUNAREA_HIROSHIMA
carId: car_crown[counter].carId, if(car_crown[counter].area === 18)
area: car_crown[counter].area, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA {
unlockAt: car_crown[counter].playedAt, let listCrown = wmsrv.wm.protobuf.Crown.create({
car: car! carId: car_crown[counter].carId,
area: car_crown[counter].area,
})); unlockAt: car_crown[counter].playedAt,
car: car!
});
if(counter < car_crown.length-1){ // Push it after Kobe
list_crown.splice(11, 0, listCrown);
}
// GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE
else
{
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: car_crown[counter].carId,
area: car_crown[counter].area,
unlockAt: car_crown[counter].playedAt,
car: car!
}));
}
if(counter < car_crown.length-1)
{
counter++; counter++;
} }
} }
// Crown holder for certain area not available // Crown holder for certain area not available
else{ else
{
// Push the default data by the game to the crown holder data // Push the default data by the game to the crown holder data
list_crown.push(wmsrv.wm.protobuf.Crown.create({ // GID_RUNAREA_HIROSHIMA
carId: i, if(i === 18)
area: i, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA {
unlockAt: 0, let listCrown = wmsrv.wm.protobuf.Crown.create({
})); carId: 999999999-i,
area: i,
unlockAt: 0,
});
// Push it after Kobe
list_crown.splice(11, 0, listCrown);
}
// GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE
else
{
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: 999999999-i,
area: i,
unlockAt: 0,
}));
}
} }
} }
} }
// There is no user's crown holder data available // There is no user's crown holder data available
else{ else
{
// Loop GID_RUNAREA // Loop GID_RUNAREA
for(let i=0; i<19; i++) for(let i=0; i<14; i++)
{ {
// 14 - 16 are dummy area, 17 is C1 Closed // After Kobe is Hiroshima then Fukuoka and the rest
if(i >= 14) if(i > 14)
{ {
i = 18; // GID_RUNAREA_HIROSHIMA i = 18; // GID_RUNAREA_HIROSHIMA
} }
// Push the default data by the game to the crown holder data // Push the default data by the game to the crown holder data
list_crown.push(wmsrv.wm.protobuf.Crown.create({ // GID_RUNAREA_HIROSHIMA
carId: i, if(i === 18)
area: i, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA {
unlockAt: 0, let listCrown = wmsrv.wm.protobuf.Crown.create({
})); carId: 999999999-i,
area: i,
unlockAt: 0,
});
// Push it after Kobe
list_crown.splice(11, 0, listCrown);
}
// GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE
else
{
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: 999999999-i,
area: i,
unlockAt: 0,
}));
}
} }
} }