From bc0797884628564b0460ecd9abd752d3663fa42c Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 24 Feb 2025 21:46:20 -0800 Subject: [PATCH] chore: use creditBundles map from PE+ (#1008) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1008 --- package-lock.json | 8 +++---- package.json | 2 +- src/services/inventoryService.ts | 6 +++--- src/services/missionInventoryUpdateService.ts | 21 ------------------- src/services/purchaseService.ts | 6 +++--- 5 files changed, 11 insertions(+), 32 deletions(-) diff --git a/package-lock.json b/package-lock.json index a46ffbde6..478f3d4e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "copyfiles": "^2.4.1", "express": "^5", "mongoose": "^8.9.4", - "warframe-public-export-plus": "^0.5.35", + "warframe-public-export-plus": "^0.5.36", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" @@ -4093,9 +4093,9 @@ } }, "node_modules/warframe-public-export-plus": { - "version": "0.5.35", - "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.35.tgz", - "integrity": "sha512-YLQP1n5sOV+PS5hfC4Kuoapa9gsqOy5Qy/E4EYfRV/xJBruFl3tPhbdbgFn3HhL2OBrgRJ8yzT5bjIvaHKhOCw==" + "version": "0.5.36", + "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.36.tgz", + "integrity": "sha512-FYZECqBSnynl6lQvcQyEqpnGW9l84wzusekhtwKjvg3280CYdn7g5x0Q9tOMhj1jpc/1tuY+akHtHa94sPtqKw==" }, "node_modules/warframe-riven-info": { "version": "0.1.2", diff --git a/package.json b/package.json index 64eb538f6..d3446687f 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "copyfiles": "^2.4.1", "express": "^5", "mongoose": "^8.9.4", - "warframe-public-export-plus": "^0.5.35", + "warframe-public-export-plus": "^0.5.36", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index ca64cbe27..81da3eb15 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -44,6 +44,7 @@ import { ExportFusionBundles, ExportGear, ExportKeys, + ExportMisc, ExportRecipes, ExportResources, ExportSentinels, @@ -53,7 +54,6 @@ import { TStandingLimitBin } from "warframe-public-export-plus"; import { createShip } from "./shipService"; -import { creditBundles } from "@/src/services/missionInventoryUpdateService"; import { IKeyChainRequest } from "@/src/controllers/api/giveKeyChainTriggeredItemsController"; import { toOid } from "../helpers/inventoryHelpers"; import { generateRewardSeed } from "@/src/controllers/api/getNewRewardSeedController"; @@ -308,8 +308,8 @@ export const addItem = async ( }; } } - if (typeName in creditBundles) { - const creditsTotal = creditBundles[typeName] * quantity; + if (typeName in ExportMisc.creditBundles) { + const creditsTotal = ExportMisc.creditBundles[typeName] * quantity; inventory.RegularCredits += creditsTotal; return { InventoryChanges: { diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 0b9a16ba1..ad6948021 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -51,27 +51,6 @@ const getRandomRewardByChance = (pool: IReward[]): IRngResult | undefined => { return getRandomReward(pool as IRngResult[]); }; -export const creditBundles: Record = { - "/Lotus/Types/PickUps/Credits/1500Credits": 1500, - "/Lotus/Types/PickUps/Credits/2000Credits": 2000, - "/Lotus/Types/PickUps/Credits/2500Credits": 2500, - "/Lotus/Types/PickUps/Credits/3000Credits": 3000, - "/Lotus/Types/PickUps/Credits/4000Credits": 4000, - "/Lotus/Types/PickUps/Credits/5000Credits": 5000, - "/Lotus/Types/PickUps/Credits/7500Credits": 7500, - "/Lotus/Types/PickUps/Credits/10000Credits": 10000, - "/Lotus/Types/PickUps/Credits/5000Hollars": 5000, - "/Lotus/Types/PickUps/Credits/7500Hollars": 7500, - "/Lotus/Types/PickUps/Credits/10000Hollars": 10000, - "/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardOneHard": 105000, - "/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardTwoHard": 175000, - "/Lotus/Types/PickUps/Credits/CorpusArenaCreditRewards/CorpusArenaRewardThreeHard": 250000, - "/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsCommon": 15000, - "/Lotus/Types/StoreItems/CreditBundles/Zariman/TableACreditsUncommon": 30000, - "/Lotus/Types/StoreItems/CreditBundles/CreditBundleA": 50000, - "/Lotus/Types/StoreItems/CreditBundles/CreditBundleC": 175000 -}; - //type TMissionInventoryUpdateKeys = keyof IMissionInventoryUpdateRequest; //const ignoredInventoryUpdateKeys = ["FpsAvg", "FpsMax", "FpsMin", "FpsSamples"] satisfies TMissionInventoryUpdateKeys[]; // for keys with no meaning for this server //type TignoredInventoryUpdateKeys = (typeof ignoredInventoryUpdateKeys)[number]; diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index 7b59ab52d..71d31de3f 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -18,6 +18,7 @@ import { ExportBoosterPacks, ExportBundles, ExportGear, + ExportMisc, ExportResources, ExportSyndicates, ExportVendors, @@ -25,7 +26,6 @@ import { } from "warframe-public-export-plus"; import { config } from "./configService"; import { TInventoryDatabaseDocument } from "../models/inventoryModels/inventoryModel"; -import { creditBundles } from "./missionInventoryUpdateService"; export const getStoreItemCategory = (storeItem: string): string => { const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/"); @@ -335,8 +335,8 @@ const handleCreditBundlePurchase = async ( typeName: string, inventory: TInventoryDatabaseDocument ): Promise => { - if (typeName && typeName in creditBundles) { - const creditsAmount = creditBundles[typeName]; + if (typeName && typeName in ExportMisc.creditBundles) { + const creditsAmount = ExportMisc.creditBundles[typeName]; inventory.RegularCredits += creditsAmount; await inventory.save();