mirror of
https://github.com/shiroikitsu8/Bayshore_6r_legacy.git
synced 2025-02-26 22:49:18 +01:00
fix story clear div count back to 0 agian
This commit is contained in:
parent
068a6a4d1b
commit
fd79079016
@ -45,4 +45,8 @@ export function getBigIntFromLong(n: Long)
|
|||||||
|
|
||||||
export function sanitizeInput(value: any){
|
export function sanitizeInput(value: any){
|
||||||
return (value == null || value == undefined) ? undefined : value;
|
return (value == null || value == undefined) ? undefined : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sanitizeInputNotZero(value: any){
|
||||||
|
return (value !== null && value !== undefined && value !== 0) ? value : undefined;
|
||||||
}
|
}
|
@ -23,19 +23,19 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
|
|||||||
{
|
{
|
||||||
// Story update data
|
// Story update data
|
||||||
let data : any = {
|
let data : any = {
|
||||||
stClearDivCount: common.sanitizeInput(storyResult.stClearDivCount),
|
stClearDivCount: common.sanitizeInputNotZero(storyResult.stClearDivCount),
|
||||||
stPlayCount: common.sanitizeInput(storyResult.stPlayCount),
|
stPlayCount: common.sanitizeInput(storyResult.stPlayCount),
|
||||||
stClearCount: common.sanitizeInput(storyResult.stClearCount),
|
stClearCount: common.sanitizeInputNotZero(storyResult.stClearCount),
|
||||||
stConsecutiveWins: common.sanitizeInput(storyResult.stConsecutiveWins),
|
stConsecutiveWins: common.sanitizeInput(storyResult.stConsecutiveWins),
|
||||||
tuningPoints: common.sanitizeInput(storyResult.tuningPoint),
|
tuningPoints: common.sanitizeInput(storyResult.tuningPoint),
|
||||||
stCompleted100Episodes: common.sanitizeInput(storyResult.stCompleted_100Episodes),
|
stCompleted100Episodes: common.sanitizeInput(storyResult.stCompleted_100Episodes),
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the current consecutive wins is greater than the previous max
|
// If the current consecutive wins is greater than the previous max
|
||||||
if (body.stResult!.stConsecutiveWins! > car!.stConsecutiveWinsMax)
|
if (storyResult.stConsecutiveWins! > car!.stConsecutiveWinsMax)
|
||||||
{
|
{
|
||||||
// Update the maximum consecutive wins;
|
// Update the maximum consecutive wins;
|
||||||
data.stConsecutiveWinsMax = body.stResult!.stConsecutiveWins!;
|
data.stConsecutiveWinsMax = storyResult.stConsecutiveWins;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the lose bits are set, and are long data
|
// If the lose bits are set, and are long data
|
||||||
|
@ -3,53 +3,39 @@ import { prisma } from "../..";
|
|||||||
// Import Proto
|
// Import Proto
|
||||||
import { wm } from "../../wmmt/wm.proto";
|
import { wm } from "../../wmmt/wm.proto";
|
||||||
|
|
||||||
|
// Import Util
|
||||||
|
import * as common from "../common";
|
||||||
|
|
||||||
|
|
||||||
// Save versus battle result
|
// Save versus battle result
|
||||||
export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultRequest)
|
export async function saveVersusBattleResult(body: wm.protobuf.SaveGameResultRequest, car: any)
|
||||||
{
|
{
|
||||||
if (!(body.retired))
|
if (!(body.retired))
|
||||||
{
|
{
|
||||||
// Get the vs result for the car
|
// Get the vs result for the car
|
||||||
let vsResult = body?.vsResult;
|
let vsResult = body?.vsResult;
|
||||||
|
|
||||||
// storyResult is set
|
// vs result is set
|
||||||
if (vsResult)
|
if (vsResult)
|
||||||
{
|
{
|
||||||
// Check if vsTripleStarMedals is not 0
|
|
||||||
let vsTripleStarMedals = undefined;
|
|
||||||
if(vsResult.vsTripleStarMedals && vsResult.vsTripleStarMedals !== 0){
|
|
||||||
vsTripleStarMedals = vsResult.vsTripleStarMedals!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if vsDoubleStarMedals is not 0
|
|
||||||
let vsDoubleStarMedals = undefined;
|
|
||||||
if(vsResult.vsDoubleStarMedals && vsResult.vsDoubleStarMedals !== 0){
|
|
||||||
vsDoubleStarMedals = vsResult.vsDoubleStarMedals!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if vsSingleStarMedals is not 0
|
|
||||||
let vsSingleStarMedals = undefined;
|
|
||||||
if(vsResult.vsSingleStarMedals && vsResult.vsSingleStarMedals !== 0){
|
|
||||||
vsSingleStarMedals = vsResult.vsSingleStarMedals!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if vsPlainMedals is not 0
|
|
||||||
let vsPlainMedals = undefined;
|
|
||||||
if(vsResult.vsPlainMedals && vsResult.vsPlainMedals !== 0){
|
|
||||||
vsPlainMedals = vsResult.vsPlainMedals!;
|
|
||||||
}
|
|
||||||
|
|
||||||
// vs result update data
|
// vs result update data
|
||||||
let data : any = {
|
let data : any = {
|
||||||
vsPlayCount: vsResult.vsPlayCount || undefined,
|
vsPlayCount: common.sanitizeInput(vsResult.vsPlayCount),
|
||||||
vsBurstCount: vsResult.vsBurstCount || undefined,
|
vsBurstCount: common.sanitizeInput(vsResult.vsBurstCount),
|
||||||
vsStarCount: vsResult.vsStarCount || undefined,
|
vsStarCount: common.sanitizeInput(vsResult.vsStarCount),
|
||||||
vsCoolOrWild: vsResult.vsCoolOrWild || undefined,
|
vsCoolOrWild: common.sanitizeInput(vsResult.vsCoolOrWild),
|
||||||
vsSmoothOrRough: vsResult.vsSmoothOrRough || undefined,
|
vsSmoothOrRough: common.sanitizeInput(vsResult.vsSmoothOrRough),
|
||||||
vsTripleStarMedals: vsTripleStarMedals || undefined,
|
vsTripleStarMedals: common.sanitizeInputNotZero(vsResult.vsTripleStarMedals),
|
||||||
vsDoubleStarMedals: vsDoubleStarMedals || undefined,
|
vsDoubleStarMedals: common.sanitizeInputNotZero(vsResult.vsDoubleStarMedals),
|
||||||
vsSingleStarMedals: vsSingleStarMedals || undefined,
|
vsSingleStarMedals: common.sanitizeInputNotZero(vsResult.vsSingleStarMedals),
|
||||||
vsPlainMedals: vsPlainMedals || undefined,
|
vsPlainMedals: common.sanitizeInputNotZero(vsResult.vsPlainMedals),
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the current versus star count is greater than the maximum
|
||||||
|
if (data.vsStarCount && (car.vsStarCountMax < data.vsStarCount))
|
||||||
|
{
|
||||||
|
// Update the maximum versus star count
|
||||||
|
data.vsStarCountMax = data.vsStarCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
await prisma.car.update({
|
await prisma.car.update({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user