Merge pull request #41 from ghkkk090/master
fix story clear bits not resetting.. haiyaaa
This commit is contained in:
commit
a1af767f06
@ -441,8 +441,14 @@ export default class CarModule extends Module {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Randomize regionId
|
||||||
|
let randomRegionId: number = 18;
|
||||||
|
for(let i=0; i<5; i++)
|
||||||
|
{
|
||||||
|
randomRegionId = Math.floor(Math.random() * 47) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Default car values
|
// Default car values
|
||||||
let randomRegionId = Math.floor(Math.random() * 47) + 1;
|
|
||||||
let carInsert = {
|
let carInsert = {
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
manufacturer: body.car.manufacturer!,
|
manufacturer: body.car.manufacturer!,
|
||||||
|
@ -17,6 +17,7 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
|
|||||||
{
|
{
|
||||||
// Get the story result for the car
|
// Get the story result for the car
|
||||||
let storyResult = body?.stResult;
|
let storyResult = body?.stResult;
|
||||||
|
let stLoseBits = 0;
|
||||||
|
|
||||||
// storyResult is set
|
// storyResult is set
|
||||||
if (storyResult)
|
if (storyResult)
|
||||||
@ -43,9 +44,10 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
|
|||||||
{
|
{
|
||||||
// Convert them to BigInt and add to the data
|
// Convert them to BigInt and add to the data
|
||||||
data.stLoseBits = common.getBigIntFromLong(storyResult.stLoseBits);
|
data.stLoseBits = common.getBigIntFromLong(storyResult.stLoseBits);
|
||||||
|
stLoseBits = data.stLoseBits
|
||||||
|
|
||||||
// If a loss has been recorded
|
// If a loss has been recorded
|
||||||
if (data.stLoseBits > 0)
|
if (stLoseBits > 0)
|
||||||
{
|
{
|
||||||
// End the win streak
|
// End the win streak
|
||||||
data.stConsecutiveWins = 0;
|
data.stConsecutiveWins = 0;
|
||||||
@ -53,10 +55,13 @@ export async function saveStoryResult(body: wm.protobuf.SaveGameResultRequest, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if clearBits is not null, and not lose the story
|
// Check if clearBits is not null, and not lose the story
|
||||||
if (common.sanitizeInput(storyResult.stClearBits) && data.stLoseBits === 0)
|
if(storyResult.stClearBits !== null && storyResult.stClearBits !== undefined)
|
||||||
|
{
|
||||||
|
if(stLoseBits === 0)
|
||||||
{
|
{
|
||||||
data.stClearBits = storyResult.stClearBits;
|
data.stClearBits = storyResult.stClearBits;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Calling check step function (BASE_PATH/src/util/games/games_util/check_step.ts)
|
// Calling check step function (BASE_PATH/src/util/games/games_util/check_step.ts)
|
||||||
let check_steps = await check_step.checkCurrentStep(body);
|
let check_steps = await check_step.checkCurrentStep(body);
|
||||||
|
Loading…
Reference in New Issue
Block a user