From f5e04ec49ac21fc8b62b66fade6765951ffe7fec Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:38:36 +0700 Subject: [PATCH] fix story bug --- src/util/games/story.ts | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/util/games/story.ts b/src/util/games/story.ts index e9e4923..2e7405c 100644 --- a/src/util/games/story.ts +++ b/src/util/games/story.ts @@ -21,26 +21,11 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c // storyResult is set if (storyResult) { - // Check if stClearDivCount is not 0 - let stClearDivCount = undefined; - if(storyResult.stClearDivCount && storyResult.stClearDivCount !== 0) - { - stClearDivCount = storyResult.stClearDivCount - } - - // Check if stClearCount is not 0 - let stClearCount = undefined; - if(storyResult.stClearCount && storyResult.stClearCount !== 0) - { - stClearCount = storyResult.stClearCount - } - // Story update data let data : any = { - stClearDivCount: stClearDivCount || undefined, + stClearDivCount: storyResult.stClearDivCount || undefined, stPlayCount: storyResult.stPlayCount || undefined, - stClearCount: stClearCount || undefined, - stClearBits: storyResult.stClearBits || undefined, + stClearCount: storyResult.stClearCount || undefined, stConsecutiveWins: storyResult.stConsecutiveWins || undefined, tuningPoints: storyResult.tuningPoint || 0, stCompleted100Episodes: storyResult.stCompleted_100Episodes || undefined, @@ -67,6 +52,13 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c } } + // Check if clearBits is not null, and not lose the story + if (storyResult.stClearBits !== null && storyResult.stClearBits !== undefined + && data.stLoseBits === 0) + { + data.stClearBits = storyResult.stClearBits; + } + // Calling give meter reward function (BASE_PATH/src/util/meter_reward.ts) let check_steps = await check_step.checkCurrentStep(body);