From ff5774b6a23467276a88597f8f13b1a10fc81e4a Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 21 Jul 2022 09:06:18 +0700 Subject: [PATCH 1/5] some ghost battle feature fixed but still bugged -Ghost Battle no longer disconnected but still bugged -Crown Ghost Battle not working (disconnected) -Dress Up Working and saved -Ghost Region Map Score Working and Saved -Search Ghost by Level Working -Search Ghost by Name not Working (disconnected) -Change Full Tune Ticket (now default ghostLevel is 10) -No Ghost Movement Saving -Add rgRegionMapScore to Car table --- .gitignore | 2 +- LICENSE | 2 + README.md | 5 +- .../migration.sql | 3 + prisma/schema.prisma | 1 + src/modules/game.ts | 255 +++++++++++++++++- 6 files changed, 256 insertions(+), 12 deletions(-) create mode 100644 prisma/migrations/20220721011310_rg_region_map_score/migration.sql diff --git a/.gitignore b/.gitignore index fe49650..519848a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,4 @@ key.pem config.json package-lock.json ecosystem.config.js -prisma/public.sql \ No newline at end of file +prisma/*.sql \ No newline at end of file diff --git a/LICENSE b/LICENSE index 32acc6e..f64b446 100644 --- a/LICENSE +++ b/LICENSE @@ -2,6 +2,8 @@ Copyright 2022 Project Asakura Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +TeknoGods, the TeknoParrot team, and anyone affiliated with the TeknoParrot project ("TeknoParrot") is not authorised to use any part of the Software. + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index e69d60c..3c34d78 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,7 @@ Special thanks: ## Donations Donations are not required, however I'm only one person, and I'm still a student, so if you want to thank me for my work, [please buy me a coffee or two](https://ko-fi.com/lostkagamine). -This won't get you anything other than my gratitude, the entire project is and will always remain available to everyone for free. \ No newline at end of file +This won't get you anything other than my gratitude, the entire project is and will always remain available to everyone for free. + +## On TeknoParrot +The TeknoParrot team (TeknoGods) are not authorised to use **any part** of this project. **Do not integrate any portion of Bayshore into TeknoParrot.** \ No newline at end of file diff --git a/prisma/migrations/20220721011310_rg_region_map_score/migration.sql b/prisma/migrations/20220721011310_rg_region_map_score/migration.sql new file mode 100644 index 0000000..48d3cda --- /dev/null +++ b/prisma/migrations/20220721011310_rg_region_map_score/migration.sql @@ -0,0 +1,3 @@ +-- AlterTable +ALTER TABLE "Car" ADD COLUMN "rgRegionMapScore" INTEGER[], +ALTER COLUMN "stLoseBits" SET DEFAULT 0; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0e89ecd..a009659 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -108,6 +108,7 @@ model Car { rgScore Int @default(0) rgStamp Int @default(0) rgAcquireAllCrowns Boolean @default(false) + rgRegionMapScore Int[] dressupLevel Int @default(0) dressupPoint Int @default(0) stPlayCount Int @default(0) diff --git a/src/modules/game.ts b/src/modules/game.ts index 4f65489..e637404 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -89,15 +89,18 @@ export default class GameModule extends Module { console.log('-------'); console.log(c); - for(let i=0; i { + app.post('/method/load_unreceived_user_items', (req, res) => { // In future, might want to check db for player items @@ -1172,6 +1283,7 @@ export default class GameModule extends Module { // Additional full tune values additionalInsert = { + ghostLevel: 10, stClearBits: 0, stLoseBits: 0, stClearCount: 80, @@ -1385,5 +1497,128 @@ export default class GameModule extends Module { .status(200); r.send(Buffer.from(end)); }) + + app.post('/method/load_ghost_battle_info', async (req, res) => { + let body = wm.wm.protobuf.LoadGhostBattleInfoRequest.decode(req.body); + //---------------MAYBE NOT CORRECT--------------- + let msg = { + error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, + stampSheetCount: 100, + }; + //----------------------------------------------- + let resp = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg); + let end = resp.finish(); + let r = res + .header('Server', 'v388 wangan') + .header('Content-Type', 'application/x-protobuf; revision=8053') + .header('Content-Length', end.length.toString()) + .status(200); + r.send(Buffer.from(end)); + }) + app.post('/method/search_cars_by_level', async (req, res) => { + let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body); + console.log(body); + //---------------MAYBE NOT CORRECT--------------- + let rampVal = 0; + let pathVal = 0; + if(body.area === 0){ //GID_RUNAREA_C1 + rampVal = 0; + pathVal = Math.floor(Math.random() * 10); + } + else if(body.area === 1){ //GID_RUNAREA_RING + rampVal = 0; + pathVal = Math.floor(Math.random() * 6) + 10; + } + else if(body.area === 2){ //GID_RUNAREA_SUBTOKYO_3_4 + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 16; + } + else if(body.area === 3){ //GID_RUNAREA_SUBTOKYO_5 + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 18; + } + else if(body.area === 4){ //GID_RUNAREA_WANGAN + rampVal = 0; + pathVal = Math.floor(Math.random() * 7) + 20; + } + else if(body.area === 5){ //GID_RUNAREA_K1 + rampVal = 0; + pathVal = Math.floor(Math.random() * 7) + 27; + } + else if(body.area === 6){ //GID_RUNAREA_YAESU + rampVal = 0; + pathVal = Math.floor(Math.random() * 4) + 34; + } + else if(body.area === 7){ //GID_RUNAREA_YOKOHAMA + rampVal = 0; + pathVal = Math.floor(Math.random() * 11) + 38; + } + else if(body.area === 8){ //GID_RUNAREA_NAGOYA + rampVal = 0; + pathVal = 49; + } + else if(body.area === 9){ //GID_RUNAREA_OSAKA + rampVal = 0; + pathVal = Math.floor(Math.random() * 4) + 50; + } + else if(body.area === 10){ //GID_RUNAREA_KOBE + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 54; + } + else if(body.area === 11){ //GID_RUNAREA_FUKUOKA + rampVal = 0; + pathVal = Math.floor(Math.random() * 4) + 58; + } + else if(body.area === 12){ //GID_RUNAREA_HAKONE + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 62; + } + else if(body.area === 13){ //GID_RUNAREA_TURNPIKE + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 64; + } + //14 - 16 is dummy area + else if(body.area === 17){ //GID_RUNAREA_C1_CLOSED + rampVal = 0; + pathVal = Math.floor(Math.random() * 10); //probably not correct + } + else if(body.area === 18){ //GID_RUNAREA_HIROSHIMA + rampVal = 0; + pathVal = Math.floor(Math.random() * 2) + 56; + } + let msg = { + error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, + ramp: rampVal, + path: pathVal, + selectionMethod: 2, + }; + //----------------------------------------------- + let resp = wm.wm.protobuf.SearchCarsByLevelResponse.encode(msg); + let end = resp.finish(); + let r = res + .header('Server', 'v388 wangan') + .header('Content-Type', 'application/x-protobuf; revision=8053') + .header('Content-Length', end.length.toString()) + .status(200); + r.send(Buffer.from(end)); + }) + app.post('/method/load_ghost_drive_data', async (req, res) => { + let body = wm.wm.protobuf.LoadGhostDriveDataRequest.decode(req.body); + console.log(body); + //---------------MAYBE NOT CORRECT--------------- + let msg = { + error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, + path: body.path + }; + //----------------------------------------------- + let resp = wm.wm.protobuf.LoadGhostDriveDataResponse.encode(msg); + let end = resp.finish(); + let r = res + .header('Server', 'v388 wangan') + .header('Content-Type', 'application/x-protobuf; revision=8053') + .header('Content-Length', end.length.toString()) + .status(200); + r.send(Buffer.from(end)); + }) } } From c585661c022c0cb9e890f6a87fbce4ad43ade8e3 Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 21 Jul 2022 09:08:16 +0700 Subject: [PATCH 2/5] fix branch conflict unrecieved and unreceived bruh --- src/modules/game.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index e637404..40e270d 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -629,7 +629,7 @@ export default class GameModule extends Module { r.send(Buffer.from(end)); }) - // Load unrecieved user items + // Load unreceived user items app.post('/method/load_unreceived_user_items', (req, res) => { // In future, might want to check db for player items From 2bac27996d5b7fa18222bc7b561aee78cd020c64 Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Thu, 21 Jul 2022 12:24:43 +0700 Subject: [PATCH 3/5] fix rgWinCount --- src/modules/game.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/game.ts b/src/modules/game.ts index 40e270d..ad4774e 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -259,6 +259,14 @@ export default class GameModule extends Module { saveEx.ghostLevel = car?.ghostLevel; } + let winCount = 0; + if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){ + for(let i=0; i Date: Thu, 21 Jul 2022 12:47:15 +0700 Subject: [PATCH 4/5] add win count --- src/modules/game.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index ad4774e..18499f5 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -259,13 +259,14 @@ export default class GameModule extends Module { saveEx.ghostLevel = car?.ghostLevel; } - let winCount = 0; + let winCounter = 0; if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){ for(let i=0; i Date: Thu, 21 Jul 2022 14:55:51 +0700 Subject: [PATCH 5/5] edit gitignore --- .gitignore | 3 +-- src/modules/game.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 519848a..ea161cd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,4 @@ cert.pfx key.pem config.json package-lock.json -ecosystem.config.js -prisma/*.sql \ No newline at end of file +ecosystem.config.js \ No newline at end of file diff --git a/src/modules/game.ts b/src/modules/game.ts index 18499f5..ebe3c7f 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -18,6 +18,7 @@ export default class GameModule extends Module { carId: body.carId } }); + console.log(body); let storyLose: boolean = false; switch (body.gameMode) { case wm.wm.protobuf.GameMode.MODE_STORY: