From 97d27e8110bad883156571a284df3c82f5048b64 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Sat, 12 Apr 2025 06:14:46 -0700 Subject: [PATCH] feat: playedParkourTutorial (#1579) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1579 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- src/controllers/api/playedParkourTutorialController.ts | 9 +++++++++ src/routes/api.ts | 2 ++ src/services/inventoryService.ts | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/controllers/api/playedParkourTutorialController.ts diff --git a/src/controllers/api/playedParkourTutorialController.ts b/src/controllers/api/playedParkourTutorialController.ts new file mode 100644 index 00000000..a37689f2 --- /dev/null +++ b/src/controllers/api/playedParkourTutorialController.ts @@ -0,0 +1,9 @@ +import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; +import { getAccountIdForRequest } from "@/src/services/loginService"; +import { RequestHandler } from "express"; + +export const playedParkourTutorialController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + await Inventory.updateOne({ accountOwnerId: accountId }, { PlayedParkourTutorial: true }); + res.end(); +}; diff --git a/src/routes/api.ts b/src/routes/api.ts index 77b389a3..f5c12376 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -85,6 +85,7 @@ import { modularWeaponSaleController } from "@/src/controllers/api/modularWeapon import { nameWeaponController } from "@/src/controllers/api/nameWeaponController"; import { nemesisController } from "@/src/controllers/api/nemesisController"; import { placeDecoInComponentController } from "@/src/controllers/api/placeDecoInComponentController"; +import { playedParkourTutorialController } from "@/src/controllers/api/playedParkourTutorialController"; import { playerSkillsController } from "@/src/controllers/api/playerSkillsController"; import { postGuildAdvertisementController } from "@/src/controllers/api/postGuildAdvertisementController"; import { projectionManagerController } from "@/src/controllers/api/projectionManagerController"; @@ -177,6 +178,7 @@ apiRouter.get("/logout.php", logoutController); apiRouter.get("/marketRecommendations.php", marketRecommendationsController); apiRouter.get("/marketSearchRecommendations.php", marketRecommendationsController); apiRouter.get("/modularWeaponSale.php", modularWeaponSaleController); +apiRouter.get("/playedParkourTutorial.php", playedParkourTutorialController); apiRouter.get("/queueDojoComponentDestruction.php", queueDojoComponentDestructionController); apiRouter.get("/removeFromAlliance.php", removeFromAllianceController); apiRouter.get("/setActiveQuest.php", setActiveQuestController); diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index e29ea0a5..90b26303 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -178,7 +178,9 @@ export const addStartingGear = async ( combineInventoryChanges(inventoryChanges, inventoryDelta); } - inventory.PlayedParkourTutorial = true; + if (inventory.ReceivedStartingGear) { + logger.warn(`account already had starting gear but asked for it again?!`); + } inventory.ReceivedStartingGear = true; return inventoryChanges;