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

fix story nuke

This commit is contained in:
ghkkk090 2022-07-20 00:23:50 +07:00
parent e58215d782
commit 5c32b127d5

View File

@ -16,22 +16,39 @@ export default class GameModule extends Module {
carId: body.carId carId: body.carId
} }
}); });
let storyLose: boolean = false;
switch (body.gameMode) { switch (body.gameMode) {
case wm.wm.protobuf.GameMode.MODE_STORY: case wm.wm.protobuf.GameMode.MODE_STORY:
{ {
console.log(body);
if (!(body.retired)) {
let maxConsecutiveWins = car!.stConsecutiveWinsMax; let maxConsecutiveWins = car!.stConsecutiveWinsMax;
if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) { if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) {
maxConsecutiveWins = body.stResult!.stConsecutiveWins!; maxConsecutiveWins = body.stResult!.stConsecutiveWins!;
} }
let divcount = body.stResult?.stClearDivCount; let divcount = body.stResult?.stClearDivCount;
let saveEx: any = {}; 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) { if (divcount !== null && divcount !== undefined && divcount !== 0) {
console.log(body.stResult?.stClearDivCount); console.log(body.stResult?.stClearDivCount);
saveEx.stClearDivCount = divcount; saveEx.stClearDivCount = divcount;
} else { } else {
saveEx.stClearDivCount = car?.stClearDivCount; saveEx.stClearDivCount = car?.stClearDivCount;
} }
if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined) { if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined && storyLose !== true) {
saveEx.stClearBits = body.stResult?.stClearBits; saveEx.stClearBits = body.stResult?.stClearBits;
} else { } else {
saveEx.stClearBits = car?.stClearBits; saveEx.stClearBits = car?.stClearBits;
@ -41,22 +58,11 @@ export default class GameModule extends Module {
} else { } else {
saveEx.stPlayCount = car?.stPlayCount; saveEx.stPlayCount = car?.stPlayCount;
} }
if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined) { if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined && body.stResult?.stClearCount !== 0) {
saveEx.stClearCount = body.stResult?.stClearCount!; saveEx.stClearCount = body.stResult?.stClearCount!;
} else { } else {
saveEx.stClearCount = car?.stClearCount; 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) { if (body.stResult?.stConsecutiveWins !== null && body.stResult?.stConsecutiveWins !== undefined) {
saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!; saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!;
} else { } else {
@ -72,7 +78,6 @@ export default class GameModule extends Module {
} else { } else {
saveEx.stCompleted100Episodes = car?.stCompleted100Episodes; saveEx.stCompleted100Episodes = car?.stCompleted100Episodes;
} }
console.log(body);
console.log(saveEx); console.log(saveEx);
let c = await prisma.car.update({ let c = await prisma.car.update({
where: { where: {
@ -81,6 +86,7 @@ export default class GameModule extends Module {
data: saveEx data: saveEx
}); });
console.log(c); console.log(c);
}
break; break;
} }
case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK: case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK: