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 1/3] 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); From 3ca5fdfbf0c8fb80ba8ad2a6344f07ea57cb42dd Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 18 Aug 2022 21:33:32 +0700 Subject: [PATCH 2/3] add some misc --- src/modules/ghost.ts | 32 ++++++++++++++++++++++ src/modules/startup.ts | 60 +++++++++++++++++++++++++++++++++++++++++ src/modules/terminal.ts | 47 ++++++++++++++++++++++++++++++++ src/modules/users.ts | 55 +++++++++++++++++++++++++++++++++++++ 4 files changed, 194 insertions(+) diff --git a/src/modules/ghost.ts b/src/modules/ghost.ts index 82b9221..a46df45 100644 --- a/src/modules/ghost.ts +++ b/src/modules/ghost.ts @@ -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); + }) + */ } } \ No newline at end of file diff --git a/src/modules/startup.ts b/src/modules/startup.ts index 0842659..b5aea81 100644 --- a/src/modules/startup.ts +++ b/src/modules/startup.ts @@ -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); + }) + */ } } diff --git a/src/modules/terminal.ts b/src/modules/terminal.ts index b5e6bdf..b02c436 100644 --- a/src/modules/terminal.ts +++ b/src/modules/terminal.ts @@ -968,5 +968,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); + }) + */ } } \ No newline at end of file diff --git a/src/modules/users.ts b/src/modules/users.ts index cc1d020..9b5436b 100644 --- a/src/modules/users.ts +++ b/src/modules/users.ts @@ -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); + }) */ } } \ No newline at end of file From e7d498f6ddcd0aadf4a33c185fc8b5c9c05eea71 Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 18 Aug 2022 22:45:35 +0700 Subject: [PATCH 3/3] add some misc --- src/modules/terminal.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/terminal.ts b/src/modules/terminal.ts index b02c436..30c2d84 100644 --- a/src/modules/terminal.ts +++ b/src/modules/terminal.ts @@ -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) => {