1
0
mirror of synced 2024-12-04 19:17:58 +01:00

Merge pull request #16 from ghkkk090/master

fix crown ghost saving bug
This commit is contained in:
Luna 2022-07-31 10:13:14 +03:00 committed by GitHub
commit cff083083c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 110 additions and 18 deletions

View File

@ -758,18 +758,16 @@ export default class GameModule extends Module {
if(gCount){
let gdbId = gCount.dbId;
await prisma.ghostTrail.update({
await prisma.ghostTrail.delete({
where: {
dbId: gdbId
},
data: saveEx
});
}
else{
await prisma.ghostTrail.create({
data: saveEx
}
});
}
await prisma.ghostTrail.create({
data: saveEx
});
await prisma.carCrown.update({
where: {
@ -2521,14 +2519,94 @@ export default class GameModule extends Module {
let rampVal = ghost_trails!.ramp;
let pathVal = ghost_trails!.path;
let msg = {
carId: pCarId,
area: pArea,
ramp: rampVal,
path: pathVal,
playedAt: ghost_trails!.playedAt,
trail: new Uint8Array(ghost_trails!.trail)
};
let msg;
if(ghost_trails){
msg = {
carId: pCarId,
area: pArea,
ramp: rampVal,
path: pathVal,
playedAt: ghost_trails!.playedAt,
trail: new Uint8Array(ghost_trails!.trail)
};
}
else{
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]);
msg = {
carId: pCarId,
area: pArea,
ramp: rampVal,
path: pathVal,
playedAt: 0,
trail: trails
};
}
//-----------------------------------------------
let resp = wm.wm.protobuf.GhostTrail.encode(msg);
let end = resp.finish();
@ -2541,7 +2619,21 @@ export default class GameModule extends Module {
})
app.get('/method/load_paths_and_tunings', async (req, res) => {
let body = wm.wm.protobuf.LoadPathsAndTuningsRequest.decode(req.body);
console.log(body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
//-----------------------------------------------
let resp = wm.wm.protobuf.LoadPathsAndTuningsResponse.encode(msg);
let end = resp.finish();
let r = res
.header('Server', 'v388 wangan')
.header('Content-Type', 'application/x-protobuf; revision=8053')
.header('Content-Length', end.length.toString())
.status(200);
r.send(Buffer.from(end));
})
}
}

View File

@ -290,7 +290,7 @@ export default class StartupModule extends Module {
//car!.aura = 0;
car!.tunePower = car_crown[counter].tunePower;
car!.tuneHandling = car_crown[counter].tuneHandling;
car!.lastPlayedAt = car_crown[counter].playedAt;
car!.lastPlayedAt = car_crown[counter].playedAt - 100000;
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