From 42bcab790e550be0ccc75c612f61fd1895355d65 Mon Sep 17 00:00:00 2001 From: Sainan Date: Fri, 17 Jan 2025 05:18:27 +0100 Subject: [PATCH] add allDailyAffiliationKeys --- src/controllers/api/inventoryController.ts | 18 ++++-------------- src/services/inventoryService.ts | 4 ++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 631cd45e..d6c1236c 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -15,6 +15,7 @@ import { ExportVirtuals } from "warframe-public-export-plus"; import { handleSubsumeCompletion } from "./infestedFoundryController"; +import { allDailyAffiliationKeys } from "@/src/services/inventoryService"; export const inventoryController: RequestHandler = async (request, response) => { const account = await getAccountForRequest(request); @@ -32,20 +33,9 @@ export const inventoryController: RequestHandler = async (request, response) => account.LastLoginDay = today; await account.save(); - inventory.DailyAffiliation = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationPvp = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationLibrary = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationCetus = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationQuills = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationSolaris = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationVentkids = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationVox = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationEntrati = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationNecraloid = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationZariman = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationKahl = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationCavia = 16000 + inventory.PlayerLevel * 500; - inventory.DailyAffiliationHex = 16000 + inventory.PlayerLevel * 500; + for (const key of allDailyAffiliationKeys) { + inventory[key] = 16000 + inventory.PlayerLevel * 500; + } inventory.DailyFocus = 250000 + inventory.PlayerLevel * 5000; await inventory.save(); } diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 754473c9..c692f3ca 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -514,6 +514,10 @@ const standingLimitBinToInventoryKey: Record< STANDING_LIMIT_BIN_HEX: "DailyAffiliationHex" }; +export const allDailyAffiliationKeys: (keyof IDailyAffiliations)[] = Object.entries(standingLimitBinToInventoryKey).map( + arr => arr[1] +); + export const getStandingLimit = (inventory: IDailyAffiliations, bin: TStandingLimitBin): number => { if (bin == "STANDING_LIMIT_BIN_NONE") { return Number.MAX_SAFE_INTEGER;