From 8ee6f1a04b2d54c17fec7262f1e74a1a6ea9c647 Mon Sep 17 00:00:00 2001 From: Sainan Date: Thu, 20 Jun 2024 22:27:32 +0200 Subject: [PATCH] feat: implement k-drive crafting (#339) --- src/controllers/api/modularWeaponCraftingController.ts | 9 +++++---- src/models/inventoryModels/inventoryModel.ts | 1 + src/services/inventoryService.ts | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/controllers/api/modularWeaponCraftingController.ts b/src/controllers/api/modularWeaponCraftingController.ts index 092447649..91768e3af 100644 --- a/src/controllers/api/modularWeaponCraftingController.ts +++ b/src/controllers/api/modularWeaponCraftingController.ts @@ -4,13 +4,14 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { WeaponTypeInternal } from "@/src/services/itemDataService"; import { getInventory, updateCurrency, addWeapon, addMiscItems } from "@/src/services/inventoryService"; -const modularWeaponTypes: Record = { +const modularWeaponTypes: Record = { "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryBeam": "LongGuns", "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondary": "Pistols", "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam": "Pistols", "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun": "Pistols", "/Lotus/Weapons/Ostron/Melee/LotusModularWeapon": "Melee", - "/Lotus/Weapons/Sentients/OperatorAmplifiers/OperatorAmpWeapon": "OperatorAmps" + "/Lotus/Weapons/Sentients/OperatorAmplifiers/OperatorAmpWeapon": "OperatorAmps", + "/Lotus/Types/Vehicles/Hoverboard/HoverboardSuit": "Hoverboards" }; interface IModularCraftRequest { @@ -30,8 +31,8 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res) // Give weapon const weapon = await addWeapon(category, data.WeaponType, accountId, data.Parts); - // Remove 4000 credits - const currencyChanges = await updateCurrency(4000, false, accountId); + // Remove credits + const currencyChanges = await updateCurrency(category == "Hoverboards" ? 5000 : 4000, false, accountId); // Remove parts const miscItemChanges = []; diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 4ef0d856f..39a450246 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -975,6 +975,7 @@ type InventoryDocumentProps = { SpaceGuns: Types.DocumentArray; SpaceMelee: Types.DocumentArray; SentinelWeapons: Types.DocumentArray; + Hoverboards: Types.DocumentArray; }; // eslint-disable-next-line @typescript-eslint/ban-types diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index efd291cc7..12e1fbca3 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -425,7 +425,7 @@ export const syndicateSacrifice = async ( }; export const addWeapon = async ( - weaponType: WeaponTypeInternal, + weaponType: WeaponTypeInternal | "Hoverboards", weaponName: string, accountId: string, modularParts: string[] | undefined = undefined