From 078e8df619c49553439a6bc7a9a0a538eef745c4 Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 20 Jul 2022 16:50:46 +0100 Subject: [PATCH 01/13] Fix spacing in prisma schema --- prisma/schema.prisma | 256 +++++++++++++++++++++---------------------- 1 file changed, 128 insertions(+), 128 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 522091c..68f345d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -2,27 +2,27 @@ // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" } datasource db { - provider = "postgresql" - url = env("POSTGRES_URL") + provider = "postgresql" + url = env("POSTGRES_URL") } model User { - id Int @id @default(autoincrement()) - chipId String @unique - accessCode String - cars Car[] - carOrder Int[] // Order of cars - unusedTickets UserItem[] - tutorials Boolean[] - userBanned Boolean @default(false) - bookmarks Int[] - // ScratchSheet ScratchSheet[] - currentSheet Int @default(0) - lastSheet Int @default(0) + id Int @id @default(autoincrement()) + chipId String @unique + accessCode String + cars Car[] + carOrder Int[] // Order of cars + unusedTickets UserItem[] + tutorials Boolean[] + userBanned Boolean @default(false) + bookmarks Int[] + // ScratchSheet ScratchSheet[] + currentSheet Int @default(0) + lastSheet Int @default(0) } // Not working yet, removing from schema @@ -43,141 +43,141 @@ model User { // } model UserItem { - dbId Int @id @default(autoincrement()) - category Int - itemId Int - User User @relation(fields: [userId], references: [id]) - userId Int + dbId Int @id @default(autoincrement()) + category Int + itemId Int + User User @relation(fields: [userId], references: [id]) + userId Int } model Car { - user User @relation(fields: [userId], references: [id]) - userId Int + user User @relation(fields: [userId], references: [id]) + userId Int - // This is the Car object itself - carId Int @id @default(autoincrement()) - name String - manufacturer Int - regionId Int @default(0) - model Int - visualModel Int - customColor Int @default(0) - defaultColor Int - wheel Int @default(0) - wheelColor Int @default(0) - aero Int @default(0) - bonnet Int @default(0) - wing Int @default(0) - mirror Int @default(0) - neon Int @default(0) - trunk Int @default(0) - plate Int @default(0) - plateColor Int @default(0) - plateNumber Int @default(0) - tunePower Int @default(0) - tuneHandling Int @default(0) - title String @default("New Car") - level Int @default(0) - windowSticker Boolean @default(false) - windowStickerString String @default("WANGAN") - windowStickerFont Int @default(0) - rivalMarker Int @default(0) - aura Int @default(0) - auraMotif Int @default(0) - ghostLevel Int @default(1) + // This is the Car object itself + carId Int @id @default(autoincrement()) + name String + manufacturer Int + regionId Int @default(0) + model Int + visualModel Int + customColor Int @default(0) + defaultColor Int + wheel Int @default(0) + wheelColor Int @default(0) + aero Int @default(0) + bonnet Int @default(0) + wing Int @default(0) + mirror Int @default(0) + neon Int @default(0) + trunk Int @default(0) + plate Int @default(0) + plateColor Int @default(0) + plateNumber Int @default(0) + tunePower Int @default(0) + tuneHandling Int @default(0) + title String @default("New Car") + level Int @default(0) + windowSticker Boolean @default(false) + windowStickerString String @default("WANGAN") + windowStickerFont Int @default(0) + rivalMarker Int @default(0) + aura Int @default(0) + auraMotif Int @default(0) + ghostLevel Int @default(1) - // This is more data about the car - tuningPoints Int @default(0) - odometer Int @default(0) - playCount Int @default(0) - earnedCustomColor Boolean @default(false) - carSettingsDbId Int @unique - settings CarSettings @relation(fields: [carSettingsDbId], references: [dbId]) - vsPlayCount Int @default(0) - vsBurstCount Int @default(0) - vsStarCount Int @default(0) - vsCoolOrWild Int @default(0) - vsSmoothOrRough Int @default(0) - vsTripleStarMedals Int @default(0) - vsDoubleStarMedals Int @default(0) - vsSingleStarMedals Int @default(0) - vsPlainMedals Int @default(0) - rgPlayCount Int @default(0) - rgWinCount Int @default(0) - rgTrophy Int @default(0) - rgScore Int @default(0) - rgStamp Int @default(0) - rgAcquireAllCrowns Boolean @default(false) - dressupLevel Int @default(0) - dressupPoint Int @default(0) - stPlayCount Int @default(0) - stClearBits Int @default(0) - stClearDivCount Int @default(0) - stClearCount Int @default(0) - stLoseBits BigInt @default(0) - stConsecutiveWins Int @default(0) - stConsecutiveWinsMax Int @default(0) - stCompleted100Episodes Boolean @default(false) + // This is more data about the car + tuningPoints Int @default(0) + odometer Int @default(0) + playCount Int @default(0) + earnedCustomColor Boolean @default(false) + carSettingsDbId Int @unique + settings CarSettings @relation(fields: [carSettingsDbId], references: [dbId]) + vsPlayCount Int @default(0) + vsBurstCount Int @default(0) + vsStarCount Int @default(0) + vsCoolOrWild Int @default(0) + vsSmoothOrRough Int @default(0) + vsTripleStarMedals Int @default(0) + vsDoubleStarMedals Int @default(0) + vsSingleStarMedals Int @default(0) + vsPlainMedals Int @default(0) + rgPlayCount Int @default(0) + rgWinCount Int @default(0) + rgTrophy Int @default(0) + rgScore Int @default(0) + rgStamp Int @default(0) + rgAcquireAllCrowns Boolean @default(false) + dressupLevel Int @default(0) + dressupPoint Int @default(0) + stPlayCount Int @default(0) + stClearBits Int @default(0) + stClearDivCount Int @default(0) + stClearCount Int @default(0) + stLoseBits BigInt @default(0) + stConsecutiveWins Int @default(0) + stConsecutiveWinsMax Int @default(0) + stCompleted100Episodes Boolean @default(false) - items CarItem[] + items CarItem[] - carStateDbId Int @unique - state CarState @relation(fields: [carStateDbId], references: [dbId]) - TimeAttackRecord TimeAttackRecord[] + carStateDbId Int @unique + state CarState @relation(fields: [carStateDbId], references: [dbId]) + TimeAttackRecord TimeAttackRecord[] } model CarItem { - Car Car? @relation(fields: [carId], references: [carId]) - carId Int @unique + Car Car? @relation(fields: [carId], references: [carId]) + carId Int @unique - category Int - itemId Int - amount Int + category Int + itemId Int + amount Int } model CarSettings { - dbId Int @id @default(autoincrement()) - car Car? + dbId Int @id @default(autoincrement()) + car Car? - view Boolean @default(true) - transmission Boolean @default(false) - retire Boolean @default(false) - meter Int @default(0) - navigationMap Boolean @default(true) - volume Int @default(1) - bgm Int @default(0) - nameplate Int @default(0) - nameplateColor Int @default(0) - terminalBackground Int @default(0) + view Boolean @default(true) + transmission Boolean @default(false) + retire Boolean @default(false) + meter Int @default(0) + navigationMap Boolean @default(true) + volume Int @default(1) + bgm Int @default(0) + nameplate Int @default(0) + nameplateColor Int @default(0) + terminalBackground Int @default(0) } model CarState { - dbId Int @id @default(autoincrement()) - car Car? + dbId Int @id @default(autoincrement()) + car Car? - hasOpponentGhost Boolean @default(false) - eventJoined Boolean @default(false) - transferred Boolean @default(false) - toBeDeleted Boolean @default(false) + hasOpponentGhost Boolean @default(false) + eventJoined Boolean @default(false) + transferred Boolean @default(false) + toBeDeleted Boolean @default(false) } model TimeAttackRecord { - dbId Int @id @default(autoincrement()) + dbId Int @id @default(autoincrement()) - car Car @relation(fields: [carId], references: [carId]) - carId Int + car Car @relation(fields: [carId], references: [carId]) + carId Int - model Int // Car model, literally just the `model` field from Car - time Int - course Int - isMorning Boolean - section1Time Int @map("section1Time") - section2Time Int @map("section2Time") - section3Time Int @map("section3Time") - section4Time Int @map("section4Time") - section5Time Int? @map("section5Time") - section6Time Int? @map("section6Time") - section7Time Int? @map("section7Time") - tunePower Int @default(0) // Car Power - tuneHandling Int @default(0) // Car Handling + model Int // Car model, literally just the `model` field from Car + time Int + course Int + isMorning Boolean + section1Time Int @map("section1Time") + section2Time Int @map("section2Time") + section3Time Int @map("section3Time") + section4Time Int @map("section4Time") + section5Time Int? @map("section5Time") + section6Time Int? @map("section6Time") + section7Time Int? @map("section7Time") + tunePower Int @default(0) // Car Power + tuneHandling Int @default(0) // Car Handling } From abce28d50e51efb80bf8a8e8665aeb4c61e998b3 Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 20 Jul 2022 16:52:11 +0100 Subject: [PATCH 02/13] Fix prisma schema --- .../20220720155206_terminalmode/migration.sql | 12 ++++++++++++ prisma/schema.prisma | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 prisma/migrations/20220720155206_terminalmode/migration.sql diff --git a/prisma/migrations/20220720155206_terminalmode/migration.sql b/prisma/migrations/20220720155206_terminalmode/migration.sql new file mode 100644 index 0000000..89fe842 --- /dev/null +++ b/prisma/migrations/20220720155206_terminalmode/migration.sql @@ -0,0 +1,12 @@ +-- AlterTable +ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0; + +-- AlterTable +ALTER TABLE "TimeAttackRecord" ADD COLUMN "tuneHandling" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN "tunePower" INTEGER NOT NULL DEFAULT 0; + +-- AlterTable +ALTER TABLE "User" ADD COLUMN "bookmarks" INTEGER[], +ADD COLUMN "carOrder" INTEGER[], +ADD COLUMN "currentSheet" INTEGER NOT NULL DEFAULT 0, +ADD COLUMN "lastSheet" INTEGER NOT NULL DEFAULT 0; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 68f345d..0e89ecd 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -127,8 +127,9 @@ model Car { } model CarItem { - Car Car? @relation(fields: [carId], references: [carId]) - carId Int @unique + dbId Int @id @default(autoincrement()) + Car Car @relation(fields: [carId], references: [carId]) + carId Int category Int itemId Int From 29429d3837ba93f80b6a2aef443565e8f1b2596f Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 20 Jul 2022 20:00:58 +0100 Subject: [PATCH 03/13] Add a license change. --- LICENSE | 2 ++ 1 file changed, 2 insertions(+) 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 From 3f52b31936a7f215d35fb16439b0f03f8d35c71c Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 20 Jul 2022 20:09:36 +0100 Subject: [PATCH 04/13] Add a note to README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 From 2f48bdb7f9131e5c214fe98048897486e8620be4 Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 20 Jul 2022 20:24:27 +0100 Subject: [PATCH 05/13] Fix a typo in unreceived user items --- src/modules/game.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index 4f65489..67767d9 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -518,8 +518,8 @@ export default class GameModule extends Module { r.send(Buffer.from(end)); }) - // Load unrecieved user items - app.post('/method/load_unrecieved_user_items', (req, res) => { + // Load unreceived user items + app.post('/method/load_unreceived_user_items', (req, res) => { // In future, might want to check db for player items 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 06/13] 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 07/13] 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 08/13] 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 09/13] 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 10/13] 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: From e323f64deeeb9aec85dfb8ba75fb285f44968b49 Mon Sep 17 00:00:00 2001 From: Rin Date: Thu, 21 Jul 2022 09:48:09 +0100 Subject: [PATCH 11/13] Add a migration --- prisma/migrations/20220721084743_ghostbattle/migration.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 prisma/migrations/20220721084743_ghostbattle/migration.sql diff --git a/prisma/migrations/20220721084743_ghostbattle/migration.sql b/prisma/migrations/20220721084743_ghostbattle/migration.sql new file mode 100644 index 0000000..811ffe0 --- /dev/null +++ b/prisma/migrations/20220721084743_ghostbattle/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0; From d7e90576591b89b98e2a4b6dff3f4b45b393dcf4 Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Fri, 22 Jul 2022 10:08:20 +0700 Subject: [PATCH 12/13] Update changing dress up and window sticker from terminal --- src/modules/game.ts | 302 ++++++++++++++++++++++++++++---------------- 1 file changed, 194 insertions(+), 108 deletions(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index ebe3c7f..0ab0d4c 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -177,116 +177,117 @@ export default class GameModule extends Module { } case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE: { - console.log(body); - let saveEx: any = {}; - if (body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined) { - saveEx.rgRegionMapScore = body.rgResult?.rgRegionMapScore!; - } else { - saveEx.rgRegionMapScore = car?.rgRegionMapScore; - } - if (body.rgResult?.rgPlayCount !== null && body.rgResult?.rgPlayCount !== undefined) { - saveEx.rgPlayCount = body.rgResult?.rgPlayCount!; - } else { - saveEx.rgPlayCount = car?.rgPlayCount; - } - if (body.rgResult?.dressupLevel !== null && body.rgResult?.dressupLevel !== undefined) { - saveEx.dressupLevel = body.rgResult?.dressupLevel!; - } else { - saveEx.dressupLevel = car?.dressupLevel; - } - if (body.rgResult?.dressupPoint !== null && body.rgResult?.dressupPoint !== undefined) { - saveEx.dressupPoint = body.rgResult?.dressupPoint!; - } else { - saveEx.dressupPoint = car?.dressupPoint; - } - if (body.car?.wheel !== null && body.car?.wheel !== undefined) { - saveEx.wheel = body.car?.wheel!; - } else { - saveEx.wheel = car?.wheel; - } - if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) { - saveEx.wheelColor = body.car?.wheelColor!; - } else { - saveEx.wheelColor = car?.wheelColor; - } - if (body.car?.aero !== null && body.car?.aero !== undefined) { - saveEx.aero = body.car?.aero!; - } else { - saveEx.aero = car?.aero; - } - if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) { - saveEx.bonnet = body.car?.bonnet!; - } else { - saveEx.bonnet = car?.bonnet; - } - if (body.car?.wing !== null && body.car?.wing !== undefined) { - saveEx.wing = body.car?.wing!; - } else { - saveEx.wing = car?.wing; - } - if (body.car?.mirror !== null && body.car?.mirror !== undefined) { - saveEx.mirror = body.car?.mirror!; - } else { - saveEx.mirror = car?.mirror; - } - if (body.car?.neon !== null && body.car?.neon !== undefined) { - saveEx.neon = body.car?.neon!; - } else { - saveEx.neon = car?.neon; - } - if (body.car?.trunk !== null && body.car?.trunk !== undefined) { - saveEx.trunk = body.car?.trunk!; - } else { - saveEx.trunk = car?.trunk; - } - if (body.car?.plate !== null && body.car?.plate !== undefined) { - saveEx.plate = body.car?.plate!; - } else { - saveEx.plate = car?.plate; - } - if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) { - saveEx.plateColor = body.car?.plateColor!; - } else { - saveEx.plateColor = car?.plateColor; - } - if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) { - saveEx.plateNumber = body.car?.plateNumber!; - } else { - saveEx.plateNumber = car?.plateNumber; - } - if (body.car?.ghostLevel !== null && body.car?.ghostLevel !== undefined) { - saveEx.ghostLevel = body.car?.ghostLevel!; - } else { - saveEx.ghostLevel = car?.ghostLevel; - } - - let winCounter = 0; - if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){ - for(let i=0; i { - let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body); + let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body); let car = await prisma.car.findFirst({ where: { carId: body.carId @@ -1132,6 +1133,84 @@ export default class GameModule extends Module { settings: true } }); + + let saveEx: any = {}; + if (body.car?.wheel !== null && body.car?.wheel !== undefined) { + saveEx.wheel = body.car?.wheel!; + } else { + saveEx.wheel = car?.wheel; + } + if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) { + saveEx.wheelColor = body.car?.wheelColor!; + } else { + saveEx.wheelColor = car?.wheelColor; + } + if (body.car?.aero !== null && body.car?.aero !== undefined) { + saveEx.aero = body.car?.aero!; + } else { + saveEx.aero = car?.aero; + } + if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) { + saveEx.bonnet = body.car?.bonnet!; + } else { + saveEx.bonnet = car?.bonnet; + } + if (body.car?.wing !== null && body.car?.wing !== undefined) { + saveEx.wing = body.car?.wing!; + } else { + saveEx.wing = car?.wing; + } + if (body.car?.mirror !== null && body.car?.mirror !== undefined) { + saveEx.mirror = body.car?.mirror!; + } else { + saveEx.mirror = car?.mirror; + } + if (body.car?.neon !== null && body.car?.neon !== undefined) { + saveEx.neon = body.car?.neon!; + } else { + saveEx.neon = car?.neon; + } + if (body.car?.trunk !== null && body.car?.trunk !== undefined) { + saveEx.trunk = body.car?.trunk!; + } else { + saveEx.trunk = car?.trunk; + } + if (body.car?.plate !== null && body.car?.plate !== undefined) { + saveEx.plate = body.car?.plate!; + } else { + saveEx.plate = car?.plate; + } + if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) { + saveEx.plateColor = body.car?.plateColor!; + } else { + saveEx.plateColor = car?.plateColor; + } + if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) { + saveEx.plateNumber = body.car?.plateNumber!; + } else { + saveEx.plateNumber = car?.plateNumber; + } + if (body.car?.customColor !== null && body.car?.customColor !== undefined) { + saveEx.customColor = body.car?.customColor!; + } else { + saveEx.customColor = car?.customColor; + } + if (body.car?.windowStickerString !== null && body.car?.windowStickerString !== undefined) { + saveEx.windowStickerString = body.car?.windowStickerString!; + } else { + saveEx.windowStickerString = car?.windowStickerString; + } + if (body.car?.windowStickerFont !== null && body.car?.windowStickerFont !== undefined) { + saveEx.windowStickerFont = body.car?.windowStickerFont!; + } else { + saveEx.windowStickerFont = car?.windowStickerFont; + } + if (body.car?.rivalMarker !== null && body.car?.rivalMarker !== undefined) { + saveEx.rivalMarker = body.car?.rivalMarker!; + } else { + saveEx.rivalMarker = car?.rivalMarker; + } + await prisma.carSettings.update({ where: { dbId: car?.carSettingsDbId, @@ -1141,6 +1220,13 @@ export default class GameModule extends Module { } }); + let c = await prisma.car.update({ + where: { + carId: body.carId + }, + data: saveEx + }); + let msg = { error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS, } From 0d0b0f0edc2125fae49c3b6fd3c768b50114a55d Mon Sep 17 00:00:00 2001 From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com> Date: Fri, 22 Jul 2022 15:36:21 +0700 Subject: [PATCH 13/13] Update window sticker toggle save --- src/modules/game.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/game.ts b/src/modules/game.ts index 0ab0d4c..2a8249c 100644 --- a/src/modules/game.ts +++ b/src/modules/game.ts @@ -305,6 +305,7 @@ export default class GameModule extends Module { title: body.car!.title!, tunePower: body.car!.tunePower!, tuneHandling: body.car!.tuneHandling!, + windowSticker: body.car!.windowSticker!, } }) await prisma.carSettings.update({ @@ -1133,7 +1134,6 @@ export default class GameModule extends Module { settings: true } }); - let saveEx: any = {}; if (body.car?.wheel !== null && body.car?.wheel !== undefined) { saveEx.wheel = body.car?.wheel!; @@ -1210,6 +1210,11 @@ export default class GameModule extends Module { } else { saveEx.rivalMarker = car?.rivalMarker; } + if (body.car?.windowSticker !== null && body.car?.windowSticker !== undefined) { + saveEx.windowSticker = body.car?.windowSticker!; + } else { + saveEx.windowSticker = car?.windowSticker; + } await prisma.carSettings.update({ where: {