diff --git a/package-lock.json b/package-lock.json index c48dbc2f..03a98546 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "morgan": "^1.10.0", "ncp": "^2.0.0", "undici": "^7.10.0", - "warframe-public-export-plus": "^0.5.86", + "warframe-public-export-plus": "^0.5.87", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0", @@ -5532,9 +5532,9 @@ } }, "node_modules/warframe-public-export-plus": { - "version": "0.5.86", - "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.86.tgz", - "integrity": "sha512-tWJudKs4WdjFNiF6ipav9md3sboPXJFvSItTfSmT9ko+Xgg1QP75vS/qPsuPw67pqzMaSnAbHpEzNn/rZ4mCug==" + "version": "0.5.87", + "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.87.tgz", + "integrity": "sha512-pWDU3Df3fcEgYn42NNZb2XFOs5AdCIqFF/t9fU7VLpokBWjFzZgLz3O4gILssiUrwB4KCkvnjHi3BivgzJuv6g==" }, "node_modules/warframe-riven-info": { "version": "0.1.2", diff --git a/package.json b/package.json index ed3c5d4a..5b996ba2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "morgan": "^1.10.0", "ncp": "^2.0.0", "undici": "^7.10.0", - "warframe-public-export-plus": "^0.5.86", + "warframe-public-export-plus": "^0.5.87", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0", diff --git a/src/controllers/api/infestedFoundryController.ts b/src/controllers/api/infestedFoundryController.ts index f46abd6c..f4ae1b31 100644 --- a/src/controllers/api/infestedFoundryController.ts +++ b/src/controllers/api/infestedFoundryController.ts @@ -10,7 +10,7 @@ import type { IMiscItem } from "../../types/inventoryTypes/inventoryTypes.ts"; import { InventorySlot } from "../../types/inventoryTypes/inventoryTypes.ts"; -import { ExportMisc } from "warframe-public-export-plus"; +import { ExportResources } from "warframe-public-export-plus"; import { getRecipe } from "../../services/itemDataService.ts"; import { toMongoDate, version_compare } from "../../helpers/inventoryHelpers.ts"; import { logger } from "../../utils/logger.ts"; @@ -146,7 +146,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => { const currentUnixSeconds = Math.trunc(Date.now() / 1000); for (const contribution of request.ResourceContributions) { - const snack = ExportMisc.helminthSnacks[contribution.ItemType]; + const snack = ExportResources[contribution.ItemType].helminthSnack!; // tally items for removal const change = miscItemChanges.find(x => x.ItemType == contribution.ItemType); diff --git a/src/controllers/custom/addXpController.ts b/src/controllers/custom/addXpController.ts index 7ca1d2d9..5ef17a2d 100644 --- a/src/controllers/custom/addXpController.ts +++ b/src/controllers/custom/addXpController.ts @@ -1,11 +1,11 @@ import { applyClientEquipmentUpdates, getInventory } from "../../services/inventoryService.ts"; +import { getMaxLevelCap } from "../../services/itemDataService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { IOid } from "../../types/commonTypes.ts"; import type { IEquipmentClient } from "../../types/equipmentTypes.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { RequestHandler } from "express"; -import { ExportMisc } from "warframe-public-export-plus"; export const addXpController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -15,7 +15,7 @@ export const addXpController: RequestHandler = async (req, res) => { for (const clientItem of gear) { const dbItem = inventory[category as TEquipmentKey].id((clientItem.ItemId as IOid).$oid); if (dbItem) { - if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) { + if (getMaxLevelCap(dbItem.ItemType) > 30) { if ((dbItem.Polarized ?? 0) < 5) { dbItem.Polarized = 5; } diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 70f5f814..063d7cfa 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -12,7 +12,6 @@ import { ExportFactions, ExportGear, ExportKeys, - ExportMisc, ExportRailjackWeapons, ExportRecipes, ExportRelics, @@ -80,7 +79,7 @@ const toTitleCase = (str: string): string => { const getItemListsController: RequestHandler = (req, response) => { const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en"); const res: ItemLists = { - uniqueLevelCaps: ExportMisc.uniqueLevelCaps, + uniqueLevelCaps: {}, Suits: [], LongGuns: [], Melee: [], @@ -147,6 +146,9 @@ const getItemListsController: RequestHandler = (req, response) => { name: getString(ability.name || uniqueName, lang) }); }); + if (item.maxLevelCap) { + res.uniqueLevelCaps[uniqueName] = item.maxLevelCap; + } } for (const [uniqueName, item] of Object.entries(ExportSentinels)) { if (item.productCategory == "Sentinels" || item.productCategory == "KubrowPets") { @@ -196,6 +198,9 @@ const getItemListsController: RequestHandler = (req, response) => { name: getString(item.name, lang) }); } + if (item.maxLevelCap) { + res.uniqueLevelCaps[uniqueName] = item.maxLevelCap; + } } for (const [uniqueName, item] of Object.entries(ExportResources)) { let name = getString(item.name, lang); diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index b0603244..eeb411f7 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -40,6 +40,7 @@ import { ExportBoosters, ExportBundles, ExportChallenges, + ExportCreditBundles, ExportCustoms, ExportDrones, ExportEmailItems, @@ -48,7 +49,6 @@ import { ExportFusionBundles, ExportGear, ExportKeys, - ExportMisc, ExportRailjackWeapons, ExportRecipes, ExportResources, @@ -631,8 +631,8 @@ export const addItem = async ( }; } } - if (typeName in ExportMisc.creditBundles) { - const creditsTotal = ExportMisc.creditBundles[typeName] * quantity; + if (typeName in ExportCreditBundles) { + const creditsTotal = ExportCreditBundles[typeName].credits * quantity; inventory.RegularCredits += creditsTotal; return { RegularCredits: creditsTotal diff --git a/src/services/itemDataService.ts b/src/services/itemDataService.ts index 838d732d..0b33a1a1 100644 --- a/src/services/itemDataService.ts +++ b/src/services/itemDataService.ts @@ -323,3 +323,13 @@ export const getDefaultUpgrades = (parts: string[]): IDefaultUpgrade[] | undefin } return allDefaultUpgrades.length == 0 ? undefined : allDefaultUpgrades; }; + +export const getMaxLevelCap = (type: string): number => { + if (type in ExportWarframes) { + return ExportWarframes[type].maxLevelCap ?? 30; + } + if (type in ExportWeapons) { + return ExportWeapons[type].maxLevelCap ?? 30; + } + return 30; +}; diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index a1aa6ee2..69277c54 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -24,8 +24,8 @@ import { ExportBoosterPacks, ExportBoosters, ExportBundles, + ExportCreditBundles, ExportGear, - ExportMisc, ExportResources, ExportSyndicates, ExportVendors @@ -631,8 +631,8 @@ const handleCreditBundlePurchase = async ( typeName: string, inventory: TInventoryDatabaseDocument ): Promise => { - if (typeName && typeName in ExportMisc.creditBundles) { - const creditsAmount = ExportMisc.creditBundles[typeName]; + if (typeName && typeName in ExportCreditBundles) { + const creditsAmount = ExportCreditBundles[typeName].credits; inventory.RegularCredits += creditsAmount; await inventory.save();