1
0
mirror of synced 2024-11-12 01:10:47 +01:00

Merge pull request #21 from ghkkk090/patch-1

fix crown timestamp again... really sorry
This commit is contained in:
Luna 2022-08-10 07:30:28 +01:00 committed by GitHub
commit c06c741383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 17 deletions

View File

@ -1175,16 +1175,32 @@ export default class GameModule extends Module {
}
})
// Error handling if windowStickerString is undefined if user registering bannapass from terminal first instead of driver unit
let wsString = "";
let wsFont = 0;
if(user.cars[0].windowStickerString !== null && user.cars[0].windowStickerString !== undefined && user.cars[0].windowStickerString !== ''){
wsString = user.cars[0].windowStickerString;
wsFont = user.cars[0].windowStickerFont;
}
else{
// No car data
if(user.cars.length <= 0)
{
wsString = '';
wsFont = 0;
}
// There is car data
else
{
// User atleast have cars
if(user.cars){
if(user.cars[0]?.windowStickerString !== null && user.cars[0]?.windowStickerString !== undefined && user.cars[0]?.windowStickerString !== ''){
wsString = user.cars[0].windowStickerString;
wsFont = user.cars[0].windowStickerFont;
}
}
// User don't have car yet
else{
wsString = '';
wsFont = 0;
}
}
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -1961,15 +1977,19 @@ export default class GameModule extends Module {
}
})
if(userData!.windowStickerString !== saveEx.windowStickerString){
await prisma.car.updateMany({
where: {
userId: userData!.userId
},
data: {
windowStickerString: saveEx.windowStickerString
}
})
if (body.car?.windowStickerString !== null && body.car?.windowStickerString !== undefined)
{
if(userData!.windowStickerString !== saveEx.windowStickerString)
{
await prisma.car.updateMany({
where: {
userId: userData!.userId
},
data: {
windowStickerString: saveEx.windowStickerString
}
})
}
}
// Get car item
@ -2328,6 +2348,13 @@ export default class GameModule extends Module {
}
});
// Error handling if ghostLevel accidentally set to 0 or more than 10
if(car!.ghostLevel < 1){
car!.ghostLevel = 1;
}
else if(car!.ghostLevel > 11){
car!.ghostLevel = 10;
}
// This is fucking terrible
let longLoseBits = Long.fromString(car!.stLoseBits.toString());
@ -2961,7 +2988,15 @@ export default class GameModule extends Module {
playedAt: 'desc'
}
});
playedAt = time!.playedAt - 172800;
if(time!.playedAt !== 0 && time!.playedAt >= 1659805200)
{
playedAt = time!.playedAt - 172800;
}
else if(time!.playedAt === 0 || time!.playedAt < 1659805200)
{
playedAt = 1659805200;
}
ghostTrail = ghost_trails!.trail;
}
else{

View File

@ -302,8 +302,26 @@ export default class StartupModule extends Module {
}
car!.tunePower = car_crown[counter].tunePower;
car!.tuneHandling = car_crown[counter].tuneHandling;
car!.lastPlayedAt = car_crown[counter].playedAt - 172800;
car_crown[counter].playedAt = car_crown[counter].playedAt - 172800;
// Error handling if played At value is current date
if(car_crown[counter].playedAt !== 0 && car_crown[counter].playedAt >= 1659805200)
{
// Acquired crown timestamp - 1 day
car!.lastPlayedAt = car_crown[counter].playedAt - 172800;
// Acquired crown timestamp - 1 day
car_crown[counter].playedAt = car_crown[counter].playedAt - 172800;
}
// Error handling if played At value is 0
else if(car_crown[counter].playedAt === 0 || car_crown[counter].playedAt < 1659805200)
{
// Acquired crown timestamp become 7 August 2022
car!.lastPlayedAt = 1659805200;
// Acquired crown timestamp become 7 August 2022
car_crown[counter].playedAt = 1659805200;
}
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: car_crown[counter].carId,
area: car_crown[counter].area, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA