1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2024-12-03 19:47:17 +01:00

fix crown ghost saving bug

This commit is contained in:
ghkkk090 2022-07-30 21:37:42 +07:00
parent 852b0afb1c
commit fa7cd08351

View File

@ -745,10 +745,29 @@ export default class GameModule extends Module {
saveEx.playedAt = body.ghost?.car.lastPlayedAt!;
}
await prisma.ghostTrail.create({
data: saveEx
let gCount = await prisma.ghostTrail.findFirst({
where:{
carId: saveEx.carId,
area: saveEx.area,
crownBattle: true
}
});
if(gCount){
let gdbId = gCount.dbId;
await prisma.ghostTrail.update({
where: {
dbId: gdbId
},
data: saveEx
});
}
else{
await prisma.ghostTrail.create({
data: saveEx
});
}
await prisma.carCrown.update({
where: {
area: saveEx.area
@ -2490,78 +2509,14 @@ export default class GameModule extends Module {
carId: pCarId,
area: pArea,
crownBattle: true
}
},
orderBy: {
playedAt: 'desc'
},
});
//---------------MAYBE NOT CORRECT---------------
let rampVal = ghost_trails!.ramp;
let pathVal = ghost_trails!.path;
console.log(rampVal +" "+ pathVal);
/*if(pArea === 0){ //GID_RUNAREA_C1
rampVal = Math.floor(Math.random() * 4);
pathVal = Math.floor(Math.random() * 10);
}
else if(pArea === 1){ //GID_RUNAREA_RING
rampVal = Math.floor(Math.random() * 2) + 4;
pathVal = Math.floor(Math.random() * 6) + 10;
}
else if(pArea === 2){ //GID_RUNAREA_SUBTOKYO_3_4
rampVal = Math.floor(Math.random() * 2) + 6;
pathVal = Math.floor(Math.random() * 2) + 16;
}
else if(pArea === 3){ //GID_RUNAREA_SUBTOKYO_5
rampVal = Math.floor(Math.random() * 2) + 8;
pathVal = Math.floor(Math.random() * 2) + 18;
}
else if(pArea === 4){ //GID_RUNAREA_WANGAN
rampVal = Math.floor(Math.random() * 4) + 10;
pathVal = Math.floor(Math.random() * 7) + 20;
}
else if(pArea === 5){ //GID_RUNAREA_K1
rampVal = Math.floor(Math.random() * 4) + 14;
pathVal = Math.floor(Math.random() * 7) + 27;
}
else if(pArea === 6){ //GID_RUNAREA_YAESU
rampVal = Math.floor(Math.random() * 3) + 18;
pathVal = Math.floor(Math.random() * 4) + 34;
}
else if(pArea === 7){ //GID_RUNAREA_YOKOHAMA
rampVal = Math.floor(Math.random() * 4) + 21;
pathVal = Math.floor(Math.random() * 11) + 38;
}
else if(pArea === 8){ //GID_RUNAREA_NAGOYA
rampVal = 25;
pathVal = 49;
}
else if(pArea === 9){ //GID_RUNAREA_OSAKA
rampVal = 26;
pathVal = Math.floor(Math.random() * 4) + 50;
}
else if(pArea === 10){ //GID_RUNAREA_KOBE
rampVal = Math.floor(Math.random() * 2) + 27;
pathVal = Math.floor(Math.random() * 2) + 54;
}
else if(pArea === 11){ //GID_RUNAREA_FUKUOKA
rampVal = Math.floor(Math.random() * 4) + 29;
pathVal = Math.floor(Math.random() * 4) + 58;
}
else if(pArea === 12){ //GID_RUNAREA_HAKONE
rampVal = Math.floor(Math.random() * 2) + 33;
pathVal = Math.floor(Math.random() * 2) + 62;
}
else if(pArea === 13){ //GID_RUNAREA_TURNPIKE
rampVal = Math.floor(Math.random() * 2) + 35;
pathVal = Math.floor(Math.random() * 2) + 64;
}
//14 - 16 are dummy area
else if(pArea === 17){ //GID_RUNAREA_C1_CLOSED
rampVal = Math.floor(Math.random() * 4);
pathVal = Math.floor(Math.random() * 10); //probably not correct
}
else if(pArea === 18){ //GID_RUNAREA_HIROSHIMA
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}*/
//let trails = new Uint8Array([1, 2, 3, 4]); //wtf is this lmao
let msg = {
carId: pCarId,