mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2024-12-01 10:37:28 +01:00
fix story nuke
This commit is contained in:
parent
e58215d782
commit
5c32b127d5
@ -16,71 +16,77 @@ export default class GameModule extends Module {
|
||||
carId: body.carId
|
||||
}
|
||||
});
|
||||
let storyLose: boolean = false;
|
||||
switch (body.gameMode) {
|
||||
case wm.wm.protobuf.GameMode.MODE_STORY:
|
||||
{
|
||||
let maxConsecutiveWins = car!.stConsecutiveWinsMax;
|
||||
if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) {
|
||||
maxConsecutiveWins = body.stResult!.stConsecutiveWins!;
|
||||
}
|
||||
let divcount = body.stResult?.stClearDivCount;
|
||||
let saveEx: any = {};
|
||||
if (divcount !== null && divcount !== undefined && divcount !== 0) {
|
||||
console.log(body.stResult?.stClearDivCount);
|
||||
saveEx.stClearDivCount = divcount;
|
||||
} else {
|
||||
saveEx.stClearDivCount = car?.stClearDivCount;
|
||||
}
|
||||
if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined) {
|
||||
saveEx.stClearBits = body.stResult?.stClearBits;
|
||||
} else {
|
||||
saveEx.stClearBits = car?.stClearBits;
|
||||
}
|
||||
if (body.stResult?.stPlayCount !== null && body.stResult?.stPlayCount !== undefined) {
|
||||
saveEx.stPlayCount = body.stResult?.stPlayCount!;
|
||||
} else {
|
||||
saveEx.stPlayCount = car?.stPlayCount;
|
||||
}
|
||||
if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined) {
|
||||
saveEx.stClearCount = body.stResult?.stClearCount!;
|
||||
} else {
|
||||
saveEx.stClearCount = car?.stClearCount;
|
||||
}
|
||||
if (body.stResult?.stLoseBits !== null && body.stResult?.stLoseBits !== undefined) {
|
||||
let actualLoseBits = BigInt(0);
|
||||
if (body.stResult?.stLoseBits! instanceof Long) {
|
||||
actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.high);
|
||||
actualLoseBits = actualLoseBits << BigInt(32);
|
||||
actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.low);
|
||||
saveEx.stLoseBits = actualLoseBits;
|
||||
}
|
||||
} else {
|
||||
saveEx.stLoseBits = car?.stLoseBits;
|
||||
}
|
||||
if (body.stResult?.stConsecutiveWins !== null && body.stResult?.stConsecutiveWins !== undefined) {
|
||||
saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!;
|
||||
} else {
|
||||
saveEx.stConsecutiveWins = car?.stConsecutiveWins;
|
||||
}
|
||||
if (body.stResult?.tuningPoint !== null && body.stResult?.tuningPoint !== undefined) {
|
||||
saveEx.tuningPoints = body.stResult?.tuningPoint!;
|
||||
} else {
|
||||
saveEx.tuningPoints = car?.tuningPoints;
|
||||
}
|
||||
if (body.stResult?.stCompleted_100Episodes !== null && body.stResult?.stCompleted_100Episodes !== undefined) {
|
||||
saveEx.stCompleted100Episodes = body.stResult?.stCompleted_100Episodes!;
|
||||
} else {
|
||||
saveEx.stCompleted100Episodes = car?.stCompleted100Episodes;
|
||||
}
|
||||
console.log(body);
|
||||
console.log(saveEx);
|
||||
let c = await prisma.car.update({
|
||||
where: {
|
||||
carId: body.carId
|
||||
},
|
||||
data: saveEx
|
||||
});
|
||||
console.log(c);
|
||||
if (!(body.retired)) {
|
||||
let maxConsecutiveWins = car!.stConsecutiveWinsMax;
|
||||
if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) {
|
||||
maxConsecutiveWins = body.stResult!.stConsecutiveWins!;
|
||||
}
|
||||
let divcount = body.stResult?.stClearDivCount;
|
||||
let saveEx: any = {};
|
||||
if (body.stResult?.stLoseBits !== null && body.stResult?.stLoseBits !== undefined) {
|
||||
let actualLoseBits = BigInt(0);
|
||||
if (body.stResult?.stLoseBits! instanceof Long) {
|
||||
actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.high);
|
||||
actualLoseBits = actualLoseBits << BigInt(32);
|
||||
actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.low);
|
||||
saveEx.stLoseBits = Number(actualLoseBits);
|
||||
if(saveEx.stLoseBits > 0){
|
||||
storyLose = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
saveEx.stLoseBits = car?.stLoseBits;
|
||||
}
|
||||
if (divcount !== null && divcount !== undefined && divcount !== 0) {
|
||||
console.log(body.stResult?.stClearDivCount);
|
||||
saveEx.stClearDivCount = divcount;
|
||||
} else {
|
||||
saveEx.stClearDivCount = car?.stClearDivCount;
|
||||
}
|
||||
if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined && storyLose !== true) {
|
||||
saveEx.stClearBits = body.stResult?.stClearBits;
|
||||
} else {
|
||||
saveEx.stClearBits = car?.stClearBits;
|
||||
}
|
||||
if (body.stResult?.stPlayCount !== null && body.stResult?.stPlayCount !== undefined) {
|
||||
saveEx.stPlayCount = body.stResult?.stPlayCount!;
|
||||
} else {
|
||||
saveEx.stPlayCount = car?.stPlayCount;
|
||||
}
|
||||
if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined && body.stResult?.stClearCount !== 0) {
|
||||
saveEx.stClearCount = body.stResult?.stClearCount!;
|
||||
} else {
|
||||
saveEx.stClearCount = car?.stClearCount;
|
||||
}
|
||||
if (body.stResult?.stConsecutiveWins !== null && body.stResult?.stConsecutiveWins !== undefined) {
|
||||
saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!;
|
||||
} else {
|
||||
saveEx.stConsecutiveWins = car?.stConsecutiveWins;
|
||||
}
|
||||
if (body.stResult?.tuningPoint !== null && body.stResult?.tuningPoint !== undefined) {
|
||||
saveEx.tuningPoints = body.stResult?.tuningPoint!;
|
||||
} else {
|
||||
saveEx.tuningPoints = car?.tuningPoints;
|
||||
}
|
||||
if (body.stResult?.stCompleted_100Episodes !== null && body.stResult?.stCompleted_100Episodes !== undefined) {
|
||||
saveEx.stCompleted100Episodes = body.stResult?.stCompleted_100Episodes!;
|
||||
} else {
|
||||
saveEx.stCompleted100Episodes = car?.stCompleted100Episodes;
|
||||
}
|
||||
console.log(saveEx);
|
||||
let c = await prisma.car.update({
|
||||
where: {
|
||||
carId: body.carId
|
||||
},
|
||||
data: saveEx
|
||||
});
|
||||
console.log(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK:
|
||||
|
Loading…
Reference in New Issue
Block a user