1
0
mirror of synced 2025-01-19 16:38:41 +01:00

Merge pull request #29 from ghkkk090/master

fix story bug
This commit is contained in:
Luna 2022-08-18 16:59:14 +01:00 committed by GitHub
commit 91706202a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 205 additions and 17 deletions

View File

@ -636,5 +636,37 @@ export default class GhostModule extends Module {
// Send the response to the client
common.sendResponse(message, res);
})
/*
app.post('/method/lock_stamp_target', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.LockStampTargetResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.get('/resource/ghost_list', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.GhostList.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
*/
}
}

View File

@ -610,5 +610,65 @@ export default class StartupModule extends Module {
// Send the response to the client
common.sendResponse(message, res);
})
/*
app.post('/method/register_system_stats', async (req, res) => {
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
// Encode the response
let message = wm.wm.protobuf.RegisterSystemStatsResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.post('/method/update_event_mode_serial', async (req, res) => {
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
// Encode the response
let message = wm.wm.protobuf.UpdateEventModeSerialResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.post('/method/submit_client_log', async (req, res) => {
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
// Encode the response
let message = wm.wm.protobuf.SubmitClientLogResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.get('/resource/file_list', async (req, res) => {
// Response data
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
// Encode the response
let message = wm.wm.protobuf.FileList.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
*/
}
}

View File

@ -178,6 +178,7 @@ export default class TerminalModule extends Module {
r.send(Buffer.from(end));
})
// Car Summary Request (for bookmarks, also for search ghost by name)
app.get('/resource/car_summary', async (req, res) => {
@ -222,6 +223,7 @@ export default class TerminalModule extends Module {
})
// Save upon timeout / exit terminal
app.post('/method/save_terminal_result', async (req, res) => {
@ -968,5 +970,52 @@ export default class TerminalModule extends Module {
// Send the response to the client
common.sendResponse(message, res);
})
/*
app.post('/method/load_unreceived_user_items', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.LockStampTargetResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.post('/method/save_screenshot', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.SaveScreenshotResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
app.post('/method/check_item_receivable_cars', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.CheckItemReceivableCarsResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
*/
}
}

View File

@ -656,25 +656,80 @@ export default class UserModule extends Module {
// Start Transfer
app.post('/method/start_transfer', (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.StartTransferResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
});
// Grant Car Right
app.post('/method/grant_car_right', (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.GrantCarRightResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
});
// Ask Access Code
app.post('/method/ask_access_code', (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.AskAccessCodeResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
});
// Participate In Invite Friend Campaign
app.post('/method/participate_in_invite_friend_campaign', (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.ParticipateInInviteFriendCampaignResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
});
app.post('/method/consume_user_item', async (req, res) => {
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.ConsumeUserItemResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
})
*/
}
}

View File

@ -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);