diff --git a/.eslintrc b/.eslintrc index aa166037..d21f4aa7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,6 +13,7 @@ "node": true }, "rules": { + "@typescript-eslint/consistent-type-imports": "error", "@typescript-eslint/explicit-function-return-type": "error", "@typescript-eslint/restrict-template-expressions": "error", "@typescript-eslint/restrict-plus-operands": "error", diff --git a/config-vanilla.json b/config-vanilla.json index c7cf618c..4ecb5aec 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -13,37 +13,15 @@ "skipTutorial": false, "skipAllDialogue": false, "unlockAllScans": false, - "claimingBlueprintRefundsIngredients": false, - "dontSubtractPurchaseCreditCost": false, - "dontSubtractPurchasePlatinumCost": false, - "dontSubtractPurchaseItemCost": false, - "dontSubtractPurchaseStandingCost": false, - "dontSubtractVoidTraces": false, - "dontSubtractConsumables": false, "unlockAllShipFeatures": false, "unlockAllShipDecorations": false, "unlockAllFlavourItems": false, "unlockAllSkins": false, "unlockAllCapturaScenes": false, - "universalPolarityEverywhere": false, - "unlockDoubleCapacityPotatoesEverywhere": false, - "unlockExilusEverywhere": false, - "unlockArcanesEverywhere": false, - "noDailyStandingLimits": false, - "noDailyFocusLimit": false, - "noArgonCrystalDecay": false, - "noMasteryRankUpCooldown": false, - "noVendorPurchaseLimits": false, - "noDeathMarks": false, - "noKimCooldowns": false, "fullyStockedVendors": false, "baroAlwaysAvailable": false, "baroFullyStocked": false, - "syndicateMissionsRepeatable": false, "unlockAllProfitTakerStages": false, - "instantFinishRivenChallenge": false, - "instantResourceExtractorDrones": false, - "noResourceExtractorDronesDamage": false, "skipClanKeyCrafting": false, "noDojoRoomBuildStage": false, "noDecoBuildStage": false, diff --git a/src/controllers/api/abandonLibraryDailyTaskController.ts b/src/controllers/api/abandonLibraryDailyTaskController.ts index ac515609..d7dbdcdd 100644 --- a/src/controllers/api/abandonLibraryDailyTaskController.ts +++ b/src/controllers/api/abandonLibraryDailyTaskController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const abandonLibraryDailyTaskController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/abortDojoComponentController.ts b/src/controllers/api/abortDojoComponentController.ts index 3fcf770c..03fe0459 100644 --- a/src/controllers/api/abortDojoComponentController.ts +++ b/src/controllers/api/abortDojoComponentController.ts @@ -9,7 +9,7 @@ import { import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const abortDojoComponentController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/abortDojoComponentDestructionController.ts b/src/controllers/api/abortDojoComponentDestructionController.ts index 75f08f37..75e2efb4 100644 --- a/src/controllers/api/abortDojoComponentDestructionController.ts +++ b/src/controllers/api/abortDojoComponentDestructionController.ts @@ -2,7 +2,7 @@ import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermissio import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const abortDojoComponentDestructionController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/activateRandomModController.ts b/src/controllers/api/activateRandomModController.ts index b0350434..f4679f5b 100644 --- a/src/controllers/api/activateRandomModController.ts +++ b/src/controllers/api/activateRandomModController.ts @@ -8,13 +8,12 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addMods, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getRandomElement } from "@/src/services/rngService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportUpgrades } from "warframe-public-export-plus"; -import { config } from "@/src/services/configService"; export const activateRandomModController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); - const inventory = await getInventory(accountId); + const inventory = await getInventory(accountId, "RawUpgrades Upgrades instantFinishRivenChallenge"); const request = getJSONfromString(String(req.body)); addMods(inventory, [ { @@ -23,7 +22,7 @@ export const activateRandomModController: RequestHandler = async (req, res) => { } ]); const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!; - const fingerprint = config.instantFinishRivenChallenge + const fingerprint = inventory.instantFinishRivenChallenge ? createUnveiledRivenFingerprint(ExportUpgrades[rivenType]) : createVeiledRivenFingerprint(ExportUpgrades[rivenType]); const upgradeIndex = diff --git a/src/controllers/api/addFriendController.ts b/src/controllers/api/addFriendController.ts index bbb629d9..2637731f 100644 --- a/src/controllers/api/addFriendController.ts +++ b/src/controllers/api/addFriendController.ts @@ -3,8 +3,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Friendship } from "@/src/models/friendModel"; import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IFriendInfo } from "@/src/types/friendTypes"; -import { RequestHandler } from "express"; +import type { IFriendInfo } from "@/src/types/friendTypes"; +import type { RequestHandler } from "express"; export const addFriendController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/addFriendImageController.ts b/src/controllers/api/addFriendImageController.ts index 5f224ad8..f8ba7d61 100644 --- a/src/controllers/api/addFriendImageController.ts +++ b/src/controllers/api/addFriendImageController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; diff --git a/src/controllers/api/addIgnoredUserController.ts b/src/controllers/api/addIgnoredUserController.ts index 8e8d4441..48bacaeb 100644 --- a/src/controllers/api/addIgnoredUserController.ts +++ b/src/controllers/api/addIgnoredUserController.ts @@ -2,8 +2,8 @@ import { toOid } from "@/src/helpers/inventoryHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Account, Ignore } from "@/src/models/loginModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IFriendInfo } from "@/src/types/friendTypes"; -import { RequestHandler } from "express"; +import type { IFriendInfo } from "@/src/types/friendTypes"; +import type { RequestHandler } from "express"; export const addIgnoredUserController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/addPendingFriendController.ts b/src/controllers/api/addPendingFriendController.ts index 0ba548f4..30279c2b 100644 --- a/src/controllers/api/addPendingFriendController.ts +++ b/src/controllers/api/addPendingFriendController.ts @@ -5,8 +5,8 @@ import { Account } from "@/src/models/loginModel"; import { addInventoryDataToFriendInfo, areFriendsOfFriends } from "@/src/services/friendService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IFriendInfo } from "@/src/types/friendTypes"; -import { RequestHandler } from "express"; +import type { IFriendInfo } from "@/src/types/friendTypes"; +import type { RequestHandler } from "express"; export const addPendingFriendController: RequestHandler = async (req, res) => { const payload = getJSONfromString(String(req.body)); diff --git a/src/controllers/api/addToAllianceController.ts b/src/controllers/api/addToAllianceController.ts index 36970a22..abf409ae 100644 --- a/src/controllers/api/addToAllianceController.ts +++ b/src/controllers/api/addToAllianceController.ts @@ -5,7 +5,7 @@ import { getEffectiveAvatarImageType, getInventory } from "@/src/services/invent import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportFlavour } from "warframe-public-export-plus"; export const addToAllianceController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/addToGuildController.ts b/src/controllers/api/addToGuildController.ts index 53f0b445..bb16aa5a 100644 --- a/src/controllers/api/addToGuildController.ts +++ b/src/controllers/api/addToGuildController.ts @@ -6,10 +6,11 @@ import { hasGuildPermission } from "@/src/services/guildService"; import { createMessage } from "@/src/services/inboxService"; import { getEffectiveAvatarImageType, getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; -import { GuildPermission, IGuildMemberClient } from "@/src/types/guildTypes"; +import type { IOid } from "@/src/types/commonTypes"; +import type { IGuildMemberClient } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportFlavour } from "warframe-public-export-plus"; export const addToGuildController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/adoptPetController.ts b/src/controllers/api/adoptPetController.ts index 3cd340da..1c275029 100644 --- a/src/controllers/api/adoptPetController.ts +++ b/src/controllers/api/adoptPetController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const adoptPetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/apartmentController.ts b/src/controllers/api/apartmentController.ts index 638dd6ca..b857180a 100644 --- a/src/controllers/api/apartmentController.ts +++ b/src/controllers/api/apartmentController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const apartmentController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/arcaneCommonController.ts b/src/controllers/api/arcaneCommonController.ts index 2448140b..ea6bb279 100644 --- a/src/controllers/api/arcaneCommonController.ts +++ b/src/controllers/api/arcaneCommonController.ts @@ -1,8 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, addMods } from "@/src/services/inventoryService"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; export const arcaneCommonController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/archonFusionController.ts b/src/controllers/api/archonFusionController.ts index 04c92384..5b84bb6b 100644 --- a/src/controllers/api/archonFusionController.ts +++ b/src/controllers/api/archonFusionController.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { colorToShard, combineColors, shardToColor } from "@/src/helpers/shardHelper"; export const archonFusionController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/artifactTransmutationController.ts b/src/controllers/api/artifactTransmutationController.ts index deb05cde..bcacfb80 100644 --- a/src/controllers/api/artifactTransmutationController.ts +++ b/src/controllers/api/artifactTransmutationController.ts @@ -3,9 +3,10 @@ import { createVeiledRivenFingerprint, rivenRawToRealWeighted } from "@/src/help import { addMiscItems, addMods, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getRandomElement, getRandomWeightedReward, getRandomWeightedRewardUc } from "@/src/services/rngService"; -import { IUpgradeFromClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; -import { ExportBoosterPacks, ExportUpgrades, TRarity } from "warframe-public-export-plus"; +import type { IUpgradeFromClient } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; +import type { TRarity } from "warframe-public-export-plus"; +import { ExportBoosterPacks, ExportUpgrades } from "warframe-public-export-plus"; export const artifactTransmutationController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/artifactsController.ts b/src/controllers/api/artifactsController.ts index 7bbb68a7..c25db5d3 100644 --- a/src/controllers/api/artifactsController.ts +++ b/src/controllers/api/artifactsController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; -import { IInventoryClient, IUpgradeClient } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; +import type { IInventoryClient, IUpgradeClient } from "@/src/types/inventoryTypes/inventoryTypes"; import { addMods, getInventory } from "@/src/services/inventoryService"; export const artifactsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/cancelGuildAdvertisementController.ts b/src/controllers/api/cancelGuildAdvertisementController.ts index aa587201..1a7ccf12 100644 --- a/src/controllers/api/cancelGuildAdvertisementController.ts +++ b/src/controllers/api/cancelGuildAdvertisementController.ts @@ -3,7 +3,7 @@ import { getGuildForRequestEx, hasGuildPermission } from "@/src/services/guildSe import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const cancelGuildAdvertisementController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/changeDojoRootController.ts b/src/controllers/api/changeDojoRootController.ts index 1c7cb792..cd8f050e 100644 --- a/src/controllers/api/changeDojoRootController.ts +++ b/src/controllers/api/changeDojoRootController.ts @@ -1,7 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src/services/guildService"; import { logger } from "@/src/utils/logger"; -import { GuildPermission, IDojoComponentDatabase } from "@/src/types/guildTypes"; +import type { IDojoComponentDatabase } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; import { Types } from "mongoose"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/api/changeGuildRankController.ts b/src/controllers/api/changeGuildRankController.ts index 28a8113e..5a0a6bc0 100644 --- a/src/controllers/api/changeGuildRankController.ts +++ b/src/controllers/api/changeGuildRankController.ts @@ -2,7 +2,7 @@ import { GuildMember } from "@/src/models/guildModel"; import { getGuildForRequest, hasGuildPermissionEx } from "@/src/services/guildService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const changeGuildRankController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/checkDailyMissionBonusController.ts b/src/controllers/api/checkDailyMissionBonusController.ts index 8e457142..5d67d4b5 100644 --- a/src/controllers/api/checkDailyMissionBonusController.ts +++ b/src/controllers/api/checkDailyMissionBonusController.ts @@ -1,5 +1,5 @@ import { getAccountForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const checkDailyMissionBonusController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); diff --git a/src/controllers/api/claimCompletedRecipeController.ts b/src/controllers/api/claimCompletedRecipeController.ts index f07200e5..fa93611e 100644 --- a/src/controllers/api/claimCompletedRecipeController.ts +++ b/src/controllers/api/claimCompletedRecipeController.ts @@ -1,10 +1,10 @@ //this is a controller for the claimCompletedRecipe route //it will claim a recipe for the user -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { logger } from "@/src/utils/logger"; import { getRecipe } from "@/src/services/itemDataService"; -import { IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; +import type { IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountForRequest } from "@/src/services/loginService"; import { @@ -18,13 +18,14 @@ import { addPowerSuit, addEquipment } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { InventorySlot, IPendingRecipeDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IPendingRecipeDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { toOid2 } from "@/src/helpers/inventoryHelpers"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { IRecipe } from "warframe-public-export-plus"; -import { config } from "@/src/services/configService"; -import { EquipmentFeatures, IEquipmentClient, Status } from "@/src/types/equipmentTypes"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IRecipe } from "warframe-public-export-plus"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import { EquipmentFeatures, Status } from "@/src/types/equipmentTypes"; interface IClaimCompletedRecipeRequest { RecipeIds: IOid[]; @@ -247,7 +248,7 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) = } } if ( - config.claimingBlueprintRefundsIngredients && + inventory.claimingBlueprintRefundsIngredients && recipe.secretIngredientAction != "SIA_CREATE_KUBROW" // Can't refund the egg ) { await refundRecipeIngredients(inventory, InventoryChanges, recipe, pendingRecipe); diff --git a/src/controllers/api/claimJunctionChallengeRewardController.ts b/src/controllers/api/claimJunctionChallengeRewardController.ts index 849126cb..b83fbde4 100644 --- a/src/controllers/api/claimJunctionChallengeRewardController.ts +++ b/src/controllers/api/claimJunctionChallengeRewardController.ts @@ -2,7 +2,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { combineInventoryChanges, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportChallenges } from "warframe-public-export-plus"; export const claimJunctionChallengeRewardController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/claimLibraryDailyTaskRewardController.ts b/src/controllers/api/claimLibraryDailyTaskRewardController.ts index 3d582e46..60bd036a 100644 --- a/src/controllers/api/claimLibraryDailyTaskRewardController.ts +++ b/src/controllers/api/claimLibraryDailyTaskRewardController.ts @@ -1,6 +1,6 @@ import { addFusionPoints, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const claimLibraryDailyTaskRewardController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/clearDialogueHistoryController.ts b/src/controllers/api/clearDialogueHistoryController.ts index f24f360a..4dfc9e93 100644 --- a/src/controllers/api/clearDialogueHistoryController.ts +++ b/src/controllers/api/clearDialogueHistoryController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const clearDialogueHistoryController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/clearNewEpisodeRewardController.ts b/src/controllers/api/clearNewEpisodeRewardController.ts index 1dd3010a..dcd8e46c 100644 --- a/src/controllers/api/clearNewEpisodeRewardController.ts +++ b/src/controllers/api/clearNewEpisodeRewardController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; // example req.body: {"NewEpisodeReward":true,"crossPlaySetting":"ENABLED"} export const clearNewEpisodeRewardController: RequestHandler = (_req, res) => { diff --git a/src/controllers/api/completeCalendarEventController.ts b/src/controllers/api/completeCalendarEventController.ts index 11aba85c..e9dbc4e4 100644 --- a/src/controllers/api/completeCalendarEventController.ts +++ b/src/controllers/api/completeCalendarEventController.ts @@ -2,8 +2,8 @@ import { checkCalendarAutoAdvance, getCalendarProgress, getInventory } from "@/s import { getAccountIdForRequest } from "@/src/services/loginService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; import { getWorldState } from "@/src/services/worldStateService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; // GET request; query parameters: CompletedEventIdx=0&Iteration=4&Version=19&Season=CST_SUMMER export const completeCalendarEventController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/completeRandomModChallengeController.ts b/src/controllers/api/completeRandomModChallengeController.ts index 0400c2b0..730c6111 100644 --- a/src/controllers/api/completeRandomModChallengeController.ts +++ b/src/controllers/api/completeRandomModChallengeController.ts @@ -1,10 +1,10 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { IVeiledRivenFingerprint } from "@/src/helpers/rivenHelper"; +import type { IVeiledRivenFingerprint } from "@/src/helpers/rivenHelper"; export const completeRandomModChallengeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/confirmAllianceInvitationController.ts b/src/controllers/api/confirmAllianceInvitationController.ts index 8d998e77..4dd206ec 100644 --- a/src/controllers/api/confirmAllianceInvitationController.ts +++ b/src/controllers/api/confirmAllianceInvitationController.ts @@ -1,7 +1,7 @@ import { Alliance, AllianceMember, Guild, GuildMember } from "@/src/models/guildModel"; import { getAllianceClient } from "@/src/services/guildService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const confirmAllianceInvitationController: RequestHandler = async (req, res) => { // Check requester is a warlord in their guild diff --git a/src/controllers/api/confirmGuildInvitationController.ts b/src/controllers/api/confirmGuildInvitationController.ts index 11deac0c..02fe5140 100644 --- a/src/controllers/api/confirmGuildInvitationController.ts +++ b/src/controllers/api/confirmGuildInvitationController.ts @@ -11,8 +11,8 @@ import { import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getAccountIdForRequest, getSuffixedName } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; // GET request: A player accepting an invite they got in their inbox. @@ -95,7 +95,10 @@ export const confirmGuildInvitationPostController: RequestHandler = async (req, await GuildMember.deleteMany({ accountId: guildMember.accountId, status: 1 }); // Update inventory of new member - const inventory = await getInventory(guildMember.accountId.toString(), "GuildId LevelKeys Recipes"); + const inventory = await getInventory( + guildMember.accountId.toString(), + "GuildId LevelKeys Recipes skipClanKeyCrafting" + ); inventory.GuildId = new Types.ObjectId(req.query.clanId as string); giveClanKey(inventory); await inventory.save(); diff --git a/src/controllers/api/contributeGuildClassController.ts b/src/controllers/api/contributeGuildClassController.ts index 865eb868..6bf4014d 100644 --- a/src/controllers/api/contributeGuildClassController.ts +++ b/src/controllers/api/contributeGuildClassController.ts @@ -4,7 +4,7 @@ import { Guild } from "@/src/models/guildModel"; import { checkClanAscensionHasRequiredContributors } from "@/src/services/guildService"; import { addFusionPoints, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; export const contributeGuildClassController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/contributeToDojoComponentController.ts b/src/controllers/api/contributeToDojoComponentController.ts index 6d0016eb..eaed2d18 100644 --- a/src/controllers/api/contributeToDojoComponentController.ts +++ b/src/controllers/api/contributeToDojoComponentController.ts @@ -1,5 +1,6 @@ -import { GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TGuildDatabaseDocument } from "@/src/models/guildModel"; +import { GuildMember } from "@/src/models/guildModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { addGuildMemberMiscItemContribution, getDojoClient, @@ -11,11 +12,12 @@ import { } from "@/src/services/guildService"; import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IDojoContributable, IGuildMemberDatabase } from "@/src/types/guildTypes"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; -import { ExportDojoRecipes, IDojoBuild } from "warframe-public-export-plus"; +import type { IDojoContributable, IGuildMemberDatabase } from "@/src/types/guildTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; +import type { IDojoBuild } from "warframe-public-export-plus"; +import { ExportDojoRecipes } from "warframe-public-export-plus"; interface IContributeToDojoComponentRequest { ComponentId: string; diff --git a/src/controllers/api/contributeToVaultController.ts b/src/controllers/api/contributeToVaultController.ts index e6a33443..d793549a 100644 --- a/src/controllers/api/contributeToVaultController.ts +++ b/src/controllers/api/contributeToVaultController.ts @@ -1,10 +1,5 @@ -import { - Alliance, - Guild, - GuildMember, - TGuildDatabaseDocument, - TGuildMemberDatabaseDocument -} from "@/src/models/guildModel"; +import type { TGuildDatabaseDocument, TGuildMemberDatabaseDocument } from "@/src/models/guildModel"; +import { Alliance, Guild, GuildMember } from "@/src/models/guildModel"; import { addGuildMemberMiscItemContribution, addGuildMemberShipDecoContribution, @@ -21,9 +16,9 @@ import { updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ITypeCount } from "@/src/types/commonTypes"; -import { IFusionTreasure, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { ITypeCount } from "@/src/types/commonTypes"; +import type { IFusionTreasure, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const contributeToVaultController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/createAllianceController.ts b/src/controllers/api/createAllianceController.ts index e3a81a24..205e67a6 100644 --- a/src/controllers/api/createAllianceController.ts +++ b/src/controllers/api/createAllianceController.ts @@ -4,7 +4,7 @@ import { getAllianceClient } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const createAllianceController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/createGuildController.ts b/src/controllers/api/createGuildController.ts index ea0e48a6..ac5d1f94 100644 --- a/src/controllers/api/createGuildController.ts +++ b/src/controllers/api/createGuildController.ts @@ -1,10 +1,10 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Guild, GuildMember } from "@/src/models/guildModel"; import { createUniqueClanName, getGuildClient, giveClanKey } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; export const createGuildController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); @@ -27,7 +27,7 @@ export const createGuildController: RequestHandler = async (req, res) => { rank: 0 }); - const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes"); + const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes skipClanKeyCrafting"); inventory.GuildId = guild._id; const inventoryChanges: IInventoryChanges = {}; giveClanKey(inventory, inventoryChanges); diff --git a/src/controllers/api/creditsController.ts b/src/controllers/api/creditsController.ts index ecd37fa1..8bbac3a8 100644 --- a/src/controllers/api/creditsController.ts +++ b/src/controllers/api/creditsController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/api/crewMembersController.ts b/src/controllers/api/crewMembersController.ts index a4f2ea2a..fd5d9087 100644 --- a/src/controllers/api/crewMembersController.ts +++ b/src/controllers/api/crewMembersController.ts @@ -1,9 +1,9 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ICrewMemberClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { ICrewMemberClient } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; export const crewMembersController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/crewShipFusionController.ts b/src/controllers/api/crewShipFusionController.ts index 160c19b7..093d975f 100644 --- a/src/controllers/api/crewShipFusionController.ts +++ b/src/controllers/api/crewShipFusionController.ts @@ -1,10 +1,11 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addMiscItems, freeUpSlot, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; -import { ICrewShipComponentFingerprint, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IOid } from "@/src/types/commonTypes"; +import type { ICrewShipComponentFingerprint } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; import { ExportCustoms, ExportDojoRecipes } from "warframe-public-export-plus"; export const crewShipFusionController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/crewShipIdentifySalvageController.ts b/src/controllers/api/crewShipIdentifySalvageController.ts index 83a9d7cb..29ac2609 100644 --- a/src/controllers/api/crewShipIdentifySalvageController.ts +++ b/src/controllers/api/crewShipIdentifySalvageController.ts @@ -5,14 +5,17 @@ import { addEquipment } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; -import { ICrewShipComponentFingerprint, IInnateDamageFingerprint } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; +import type { + ICrewShipComponentFingerprint, + IInnateDamageFingerprint +} from "@/src/types/inventoryTypes/inventoryTypes"; import { ExportCustoms, ExportRailjackWeapons, ExportUpgrades } from "warframe-public-export-plus"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { getRandomInt } from "@/src/services/rngService"; -import { IFingerprintStat } from "@/src/helpers/rivenHelper"; -import { IEquipmentDatabase } from "@/src/types/equipmentTypes"; +import type { IFingerprintStat } from "@/src/helpers/rivenHelper"; +import type { IEquipmentDatabase } from "@/src/types/equipmentTypes"; export const crewShipIdentifySalvageController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/customObstacleCourseLeaderboardController.ts b/src/controllers/api/customObstacleCourseLeaderboardController.ts index de5c4217..731766b0 100644 --- a/src/controllers/api/customObstacleCourseLeaderboardController.ts +++ b/src/controllers/api/customObstacleCourseLeaderboardController.ts @@ -5,7 +5,7 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const customObstacleCourseLeaderboardController: RequestHandler = async (req, res) => { const data = getJSONfromString(String(req.body)); diff --git a/src/controllers/api/customizeGuildRanksController.ts b/src/controllers/api/customizeGuildRanksController.ts index 5ddca7b6..4106ef21 100644 --- a/src/controllers/api/customizeGuildRanksController.ts +++ b/src/controllers/api/customizeGuildRanksController.ts @@ -1,7 +1,8 @@ import { getGuildForRequest, hasGuildPermission } from "@/src/services/guildService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { GuildPermission, IGuildRank } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { IGuildRank } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; export const customizeGuildRanksController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/declineAllianceInviteController.ts b/src/controllers/api/declineAllianceInviteController.ts index 2d9f9dd6..c2e3ae36 100644 --- a/src/controllers/api/declineAllianceInviteController.ts +++ b/src/controllers/api/declineAllianceInviteController.ts @@ -1,6 +1,6 @@ import { AllianceMember, GuildMember } from "@/src/models/guildModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const declineAllianceInviteController: RequestHandler = async (req, res) => { // Check requester is a warlord in their guild diff --git a/src/controllers/api/declineGuildInviteController.ts b/src/controllers/api/declineGuildInviteController.ts index c2bcd073..a6690006 100644 --- a/src/controllers/api/declineGuildInviteController.ts +++ b/src/controllers/api/declineGuildInviteController.ts @@ -1,6 +1,6 @@ import { GuildMember } from "@/src/models/guildModel"; import { getAccountForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const declineGuildInviteController: RequestHandler = async (req, res) => { const accountId = await getAccountForRequest(req); diff --git a/src/controllers/api/deleteSessionController.ts b/src/controllers/api/deleteSessionController.ts index d4053779..1662be48 100644 --- a/src/controllers/api/deleteSessionController.ts +++ b/src/controllers/api/deleteSessionController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { deleteSession } from "@/src/managers/sessionManager"; const deleteSessionController: RequestHandler = (_req, res) => { diff --git a/src/controllers/api/destroyDojoDecoController.ts b/src/controllers/api/destroyDojoDecoController.ts index cb95e930..5e27bd86 100644 --- a/src/controllers/api/destroyDojoDecoController.ts +++ b/src/controllers/api/destroyDojoDecoController.ts @@ -10,7 +10,7 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const destroyDojoDecoController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/divvyAllianceVaultController.ts b/src/controllers/api/divvyAllianceVaultController.ts index 8847a19f..4ecdaa02 100644 --- a/src/controllers/api/divvyAllianceVaultController.ts +++ b/src/controllers/api/divvyAllianceVaultController.ts @@ -3,7 +3,7 @@ import { getAccountForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; import { parallelForeach } from "@/src/utils/async-utils"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const divvyAllianceVaultController: RequestHandler = async (req, res) => { // Afaict, there's no way to put anything other than credits in the alliance vault (anymore?), so just no-op if this is not a request to divvy credits. diff --git a/src/controllers/api/dojoComponentRushController.ts b/src/controllers/api/dojoComponentRushController.ts index 899ed0af..03770928 100644 --- a/src/controllers/api/dojoComponentRushController.ts +++ b/src/controllers/api/dojoComponentRushController.ts @@ -1,10 +1,12 @@ -import { GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel"; +import type { TGuildDatabaseDocument } from "@/src/models/guildModel"; +import { GuildMember } from "@/src/models/guildModel"; import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, scaleRequiredCount } from "@/src/services/guildService"; import { getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IDojoContributable } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; -import { ExportDojoRecipes, IDojoBuild } from "warframe-public-export-plus"; +import type { IDojoContributable } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; +import type { IDojoBuild } from "warframe-public-export-plus"; +import { ExportDojoRecipes } from "warframe-public-export-plus"; interface IDojoComponentRushRequest { DecoType?: string; diff --git a/src/controllers/api/dojoController.ts b/src/controllers/api/dojoController.ts index 9c54b449..913a2176 100644 --- a/src/controllers/api/dojoController.ts +++ b/src/controllers/api/dojoController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; // Arbiter Dojo endpoints, not really used by us as we don't provide a ContentURL. diff --git a/src/controllers/api/dronesController.ts b/src/controllers/api/dronesController.ts index a1f8a505..393178f8 100644 --- a/src/controllers/api/dronesController.ts +++ b/src/controllers/api/dronesController.ts @@ -1,13 +1,12 @@ import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; -import { config } from "@/src/services/configService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; import { fromStoreItem } from "@/src/services/itemDataService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getRandomInt, getRandomWeightedRewardUc } from "@/src/services/rngService"; -import { IMongoDate, IOid } from "@/src/types/commonTypes"; -import { IDroneClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IDroneClient } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; import { ExportDrones, ExportResources, ExportSystems } from "warframe-public-export-plus"; export const dronesController: RequestHandler = async (req, res) => { @@ -39,10 +38,13 @@ export const dronesController: RequestHandler = async (req, res) => { ActiveDrones: activeDrones }); } else if ("droneId" in req.query && "systemIndex" in req.query) { - const inventory = await getInventory(accountId, "Drones"); + const inventory = await getInventory( + accountId, + "Drones instantResourceExtractorDrones noResourceExtractorDronesDamage" + ); const drone = inventory.Drones.id(req.query.droneId as string)!; const droneMeta = ExportDrones[drone.ItemType]; - drone.DeployTime = config.instantResourceExtractorDrones ? new Date(0) : new Date(); + drone.DeployTime = inventory.instantResourceExtractorDrones ? new Date(0) : new Date(); if (drone.RepairStart) { const repairMinutes = (Date.now() - drone.RepairStart.getTime()) / 60_000; const hpPerMinute = droneMeta.repairRate / 60; @@ -51,11 +53,11 @@ export const dronesController: RequestHandler = async (req, res) => { } drone.System = parseInt(req.query.systemIndex as string); const system = ExportSystems[drone.System - 1]; - drone.DamageTime = config.instantResourceExtractorDrones + drone.DamageTime = inventory.instantResourceExtractorDrones ? new Date() : new Date(Date.now() + getRandomInt(3 * 3600 * 1000, 4 * 3600 * 1000)); drone.PendingDamage = - !config.noResourceExtractorDronesDamage && Math.random() < system.damageChance + !inventory.noResourceExtractorDronesDamage && Math.random() < system.damageChance ? getRandomInt(system.droneDamage.minValue, system.droneDamage.maxValue) : 0; const resource = getRandomWeightedRewardUc(system.resources, droneMeta.probabilities)!; diff --git a/src/controllers/api/endlessXpController.ts b/src/controllers/api/endlessXpController.ts index 1be4bd2b..0a98ed9a 100644 --- a/src/controllers/api/endlessXpController.ts +++ b/src/controllers/api/endlessXpController.ts @@ -1,13 +1,14 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { combineInventoryChanges, getInventory } from "@/src/services/inventoryService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { IEndlessXpReward, IInventoryClient, TEndlessXpCategory } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IEndlessXpReward, IInventoryClient, TEndlessXpCategory } from "@/src/types/inventoryTypes/inventoryTypes"; import { logger } from "@/src/utils/logger"; -import { ExportRewards, ICountedStoreItem } from "warframe-public-export-plus"; +import type { ICountedStoreItem } from "warframe-public-export-plus"; +import { ExportRewards } from "warframe-public-export-plus"; import { getRandomElement } from "@/src/services/rngService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; export const endlessXpController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/entratiLabConquestModeController.ts b/src/controllers/api/entratiLabConquestModeController.ts index c16595ee..226cb348 100644 --- a/src/controllers/api/entratiLabConquestModeController.ts +++ b/src/controllers/api/entratiLabConquestModeController.ts @@ -2,7 +2,7 @@ import { toMongoDate } from "@/src/helpers/inventoryHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory, updateEntratiVault } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const entratiLabConquestModeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/evolveWeaponController.ts b/src/controllers/api/evolveWeaponController.ts index 8318f17b..50887844 100644 --- a/src/controllers/api/evolveWeaponController.ts +++ b/src/controllers/api/evolveWeaponController.ts @@ -1,8 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { getRecipe, WeaponTypeInternal } from "@/src/services/itemDataService"; +import type { WeaponTypeInternal } from "@/src/services/itemDataService"; +import { getRecipe } from "@/src/services/itemDataService"; import { EquipmentFeatures } from "@/src/types/equipmentTypes"; export const evolveWeaponController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/findSessionsController.ts b/src/controllers/api/findSessionsController.ts index 70d714bb..152df91d 100644 --- a/src/controllers/api/findSessionsController.ts +++ b/src/controllers/api/findSessionsController.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getSession } from "@/src/managers/sessionManager"; import { logger } from "@/src/utils/logger"; -import { IFindSessionRequest } from "@/src/types/session"; +import type { IFindSessionRequest } from "@/src/types/session"; export const findSessionsController: RequestHandler = (_req, res) => { const req = JSON.parse(String(_req.body)) as IFindSessionRequest; diff --git a/src/controllers/api/fishmongerController.ts b/src/controllers/api/fishmongerController.ts index 16fcc69b..43946fdf 100644 --- a/src/controllers/api/fishmongerController.ts +++ b/src/controllers/api/fishmongerController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addMiscItems, addStanding, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; import { ExportResources } from "warframe-public-export-plus"; export const fishmongerController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/focusController.ts b/src/controllers/api/focusController.ts index b5257201..e5764aed 100644 --- a/src/controllers/api/focusController.ts +++ b/src/controllers/api/focusController.ts @@ -1,7 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, addMiscItems, addEquipment, occupySlot } from "@/src/services/inventoryService"; -import { IMiscItem, TFocusPolarity, TEquipmentKey, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IMiscItem, TFocusPolarity, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { logger } from "@/src/utils/logger"; import { ExportFocusUpgrades } from "warframe-public-export-plus"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; diff --git a/src/controllers/api/fusionTreasuresController.ts b/src/controllers/api/fusionTreasuresController.ts index 27ea7820..0aee216a 100644 --- a/src/controllers/api/fusionTreasuresController.ts +++ b/src/controllers/api/fusionTreasuresController.ts @@ -1,8 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportResources } from "warframe-public-export-plus"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addFusionTreasures, addMiscItems, getInventory } from "@/src/services/inventoryService"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { parseFusionTreasure } from "@/src/helpers/inventoryHelpers"; interface IFusionTreasureRequest { diff --git a/src/controllers/api/gardeningController.ts b/src/controllers/api/gardeningController.ts index 4cdb32fd..b21c8fb2 100644 --- a/src/controllers/api/gardeningController.ts +++ b/src/controllers/api/gardeningController.ts @@ -4,11 +4,11 @@ import { addMiscItem, getInventory } from "@/src/services/inventoryService"; import { toStoreItem } from "@/src/services/itemDataService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IMongoDate } from "@/src/types/commonTypes"; -import { IMissionReward } from "@/src/types/missionTypes"; -import { IGardeningClient, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IMongoDate } from "@/src/types/commonTypes"; +import type { IMissionReward } from "@/src/types/missionTypes"; +import type { IGardeningClient, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; import { dict_en, ExportResources } from "warframe-public-export-plus"; export const gardeningController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/genericUpdateController.ts b/src/controllers/api/genericUpdateController.ts index e5f0b593..2146fb32 100644 --- a/src/controllers/api/genericUpdateController.ts +++ b/src/controllers/api/genericUpdateController.ts @@ -1,8 +1,8 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { updateGeneric } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { IGenericUpdate } from "@/src/types/genericUpdate"; +import type { IGenericUpdate } from "@/src/types/genericUpdate"; // This endpoint used to be /api/genericUpdate.php, but sometime around the Jade Shadows update, it was changed to /api/updateNodeIntros.php. // SpaceNinjaServer supports both endpoints right now. diff --git a/src/controllers/api/getAllianceController.ts b/src/controllers/api/getAllianceController.ts index a4ea7bcd..b6be0648 100644 --- a/src/controllers/api/getAllianceController.ts +++ b/src/controllers/api/getAllianceController.ts @@ -2,7 +2,7 @@ import { Alliance, Guild } from "@/src/models/guildModel"; import { getAllianceClient } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getAllianceController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/getDailyDealStockLevelsController.ts b/src/controllers/api/getDailyDealStockLevelsController.ts index b67522c5..bd8cfeff 100644 --- a/src/controllers/api/getDailyDealStockLevelsController.ts +++ b/src/controllers/api/getDailyDealStockLevelsController.ts @@ -1,5 +1,5 @@ import { DailyDeal } from "@/src/models/worldStateModel"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getDailyDealStockLevelsController: RequestHandler = async (req, res) => { const dailyDeal = (await DailyDeal.findOne({ StoreItem: req.query.productName }, "AmountSold"))!; diff --git a/src/controllers/api/getFriendsController.ts b/src/controllers/api/getFriendsController.ts index 684e9bcc..2135873f 100644 --- a/src/controllers/api/getFriendsController.ts +++ b/src/controllers/api/getFriendsController.ts @@ -2,8 +2,8 @@ import { toOid } from "@/src/helpers/inventoryHelpers"; import { Friendship } from "@/src/models/friendModel"; import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IFriendInfo } from "@/src/types/friendTypes"; -import { Request, RequestHandler, Response } from "express"; +import type { IFriendInfo } from "@/src/types/friendTypes"; +import type { Request, RequestHandler, Response } from "express"; // POST with {} instead of GET as of 38.5.0 export const getFriendsController: RequestHandler = async (req: Request, res: Response) => { diff --git a/src/controllers/api/getGuildContributionsController.ts b/src/controllers/api/getGuildContributionsController.ts index c17729f7..123a39f6 100644 --- a/src/controllers/api/getGuildContributionsController.ts +++ b/src/controllers/api/getGuildContributionsController.ts @@ -1,8 +1,8 @@ import { GuildMember } from "@/src/models/guildModel"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IGuildMemberClient } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { IGuildMemberClient } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; export const getGuildContributionsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/getGuildController.ts b/src/controllers/api/getGuildController.ts index f99b8d1c..cef53aa8 100644 --- a/src/controllers/api/getGuildController.ts +++ b/src/controllers/api/getGuildController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Guild } from "@/src/models/guildModel"; import { getAccountForRequest } from "@/src/services/loginService"; import { logger } from "@/src/utils/logger"; diff --git a/src/controllers/api/getGuildDojoController.ts b/src/controllers/api/getGuildDojoController.ts index 7c5b9412..b5076235 100644 --- a/src/controllers/api/getGuildDojoController.ts +++ b/src/controllers/api/getGuildDojoController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; import { Guild } from "@/src/models/guildModel"; import { getDojoClient } from "@/src/services/guildService"; diff --git a/src/controllers/api/getGuildEventScoreController.ts b/src/controllers/api/getGuildEventScoreController.ts index df995021..a045d2e5 100644 --- a/src/controllers/api/getGuildEventScoreController.ts +++ b/src/controllers/api/getGuildEventScoreController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; import { Guild } from "@/src/models/guildModel"; diff --git a/src/controllers/api/getGuildLogController.ts b/src/controllers/api/getGuildLogController.ts index 037d07be..035a8c28 100644 --- a/src/controllers/api/getGuildLogController.ts +++ b/src/controllers/api/getGuildLogController.ts @@ -2,8 +2,8 @@ import { toMongoDate } from "@/src/helpers/inventoryHelpers"; import { Guild } from "@/src/models/guildModel"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IMongoDate } from "@/src/types/commonTypes"; -import { RequestHandler } from "express"; +import type { IMongoDate } from "@/src/types/commonTypes"; +import type { RequestHandler } from "express"; export const getGuildLogController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/getIgnoredUsersController.ts b/src/controllers/api/getIgnoredUsersController.ts index b3a6cf22..e893b42f 100644 --- a/src/controllers/api/getIgnoredUsersController.ts +++ b/src/controllers/api/getIgnoredUsersController.ts @@ -1,9 +1,9 @@ import { toOid } from "@/src/helpers/inventoryHelpers"; import { Account, Ignore } from "@/src/models/loginModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IFriendInfo } from "@/src/types/friendTypes"; +import type { IFriendInfo } from "@/src/types/friendTypes"; import { parallelForeach } from "@/src/utils/async-utils"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getIgnoredUsersController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/getNewRewardSeedController.ts b/src/controllers/api/getNewRewardSeedController.ts index 9aed91f6..75e4bfec 100644 --- a/src/controllers/api/getNewRewardSeedController.ts +++ b/src/controllers/api/getNewRewardSeedController.ts @@ -1,7 +1,7 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { generateRewardSeed } from "@/src/services/rngService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getNewRewardSeedController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/getPastWeeklyChallengesController.ts b/src/controllers/api/getPastWeeklyChallengesController.ts index cee6fe50..3f4b551a 100644 --- a/src/controllers/api/getPastWeeklyChallengesController.ts +++ b/src/controllers/api/getPastWeeklyChallengesController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; import { EPOCH, getSeasonChallengePools, getWorldState, pushWeeklyActs } from "@/src/services/worldStateService"; import { unixTimesInMs } from "@/src/constants/timeConstants"; -import { ISeasonChallenge } from "@/src/types/worldStateTypes"; +import type { ISeasonChallenge } from "@/src/types/worldStateTypes"; import { ExportChallenges } from "warframe-public-export-plus"; export const getPastWeeklyChallengesController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/getShipController.ts b/src/controllers/api/getShipController.ts index ff04aec2..5f976ef5 100644 --- a/src/controllers/api/getShipController.ts +++ b/src/controllers/api/getShipController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { config } from "@/src/services/configService"; import allShipFeatures from "@/static/fixed_responses/allShipFeatures.json"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { createGarden, getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IGetShipResponse, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; +import type { IGetShipResponse, IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; import { getLoadout } from "@/src/services/loadoutService"; import { toOid } from "@/src/helpers/inventoryHelpers"; diff --git a/src/controllers/api/getVendorInfoController.ts b/src/controllers/api/getVendorInfoController.ts index 15ec9287..a0ffd654 100644 --- a/src/controllers/api/getVendorInfoController.ts +++ b/src/controllers/api/getVendorInfoController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { applyStandingToVendorManifest, getVendorManifestByTypeName } from "@/src/services/serversideVendorsService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; diff --git a/src/controllers/api/getVoidProjectionRewardsController.ts b/src/controllers/api/getVoidProjectionRewardsController.ts index 3a09f4ba..96614431 100644 --- a/src/controllers/api/getVoidProjectionRewardsController.ts +++ b/src/controllers/api/getVoidProjectionRewardsController.ts @@ -2,8 +2,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { crackRelic } from "@/src/helpers/relicHelper"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IVoidTearParticipantInfo } from "@/src/types/requestTypes"; -import { RequestHandler } from "express"; +import type { IVoidTearParticipantInfo } from "@/src/types/requestTypes"; +import type { RequestHandler } from "express"; export const getVoidProjectionRewardsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/giftingController.ts b/src/controllers/api/giftingController.ts index 3e714a8d..a54cdcab 100644 --- a/src/controllers/api/giftingController.ts +++ b/src/controllers/api/giftingController.ts @@ -10,9 +10,10 @@ import { } from "@/src/services/inventoryService"; import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService"; import { handleDailyDealPurchase, handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { IOid } from "@/src/types/commonTypes"; -import { IPurchaseParams, IPurchaseResponse, PurchaseSource } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IOid } from "@/src/types/commonTypes"; +import type { IPurchaseParams, IPurchaseResponse } from "@/src/types/purchaseTypes"; +import { PurchaseSource } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; import { ExportBundles, ExportFlavour } from "warframe-public-export-plus"; const checkPurchaseParams = (params: IPurchaseParams): boolean => { diff --git a/src/controllers/api/gildWeaponController.ts b/src/controllers/api/gildWeaponController.ts index b06c449c..a5b18af4 100644 --- a/src/controllers/api/gildWeaponController.ts +++ b/src/controllers/api/gildWeaponController.ts @@ -1,13 +1,14 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { ExportRecipes } from "warframe-public-export-plus"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { EquipmentFeatures, IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import { EquipmentFeatures } from "@/src/types/equipmentTypes"; interface IGildWeaponRequest { ItemName: string; diff --git a/src/controllers/api/giveKeyChainTriggeredItemsController.ts b/src/controllers/api/giveKeyChainTriggeredItemsController.ts index df8e8a80..4cbd602b 100644 --- a/src/controllers/api/giveKeyChainTriggeredItemsController.ts +++ b/src/controllers/api/giveKeyChainTriggeredItemsController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { parseString } from "@/src/helpers/general"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { giveKeyChainItem } from "@/src/services/questService"; -import { IKeyChainRequest } from "@/src/types/requestTypes"; +import type { IKeyChainRequest } from "@/src/types/requestTypes"; export const giveKeyChainTriggeredItemsController: RequestHandler = async (req, res) => { const accountId = parseString(req.query.accountId); diff --git a/src/controllers/api/giveKeyChainTriggeredMessageController.ts b/src/controllers/api/giveKeyChainTriggeredMessageController.ts index 3bc41c21..2afc5ec6 100644 --- a/src/controllers/api/giveKeyChainTriggeredMessageController.ts +++ b/src/controllers/api/giveKeyChainTriggeredMessageController.ts @@ -1,8 +1,8 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { giveKeyChainMessage } from "@/src/services/questService"; -import { IKeyChainRequest } from "@/src/types/requestTypes"; -import { RequestHandler } from "express"; +import type { IKeyChainRequest } from "@/src/types/requestTypes"; +import type { RequestHandler } from "express"; export const giveKeyChainTriggeredMessageController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/giveQuestKeyRewardController.ts b/src/controllers/api/giveQuestKeyRewardController.ts index d74d56bf..bf64693f 100644 --- a/src/controllers/api/giveQuestKeyRewardController.ts +++ b/src/controllers/api/giveQuestKeyRewardController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addItem, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; -import { RequestHandler } from "express"; +import type { IOid } from "@/src/types/commonTypes"; +import type { RequestHandler } from "express"; export const giveQuestKeyRewardController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/giveShipDecoAndLoreFragmentController.ts b/src/controllers/api/giveShipDecoAndLoreFragmentController.ts index ae998374..0b8b5c30 100644 --- a/src/controllers/api/giveShipDecoAndLoreFragmentController.ts +++ b/src/controllers/api/giveShipDecoAndLoreFragmentController.ts @@ -1,9 +1,9 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addLoreFragmentScans, addShipDecorations, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ITypeCount } from "@/src/types/commonTypes"; -import { ILoreFragmentScan } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { ITypeCount } from "@/src/types/commonTypes"; +import type { ILoreFragmentScan } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const giveShipDecoAndLoreFragmentController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/giveStartingGearController.ts b/src/controllers/api/giveStartingGearController.ts index 6556de93..1ac5afc1 100644 --- a/src/controllers/api/giveStartingGearController.ts +++ b/src/controllers/api/giveStartingGearController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addStartingGear, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { TPartialStartingGear } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { TPartialStartingGear } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const giveStartingGearController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/guildTechController.ts b/src/controllers/api/guildTechController.ts index f3e37217..177a9b4b 100644 --- a/src/controllers/api/guildTechController.ts +++ b/src/controllers/api/guildTechController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { addGuildMemberMiscItemContribution, getGuildForRequestEx, @@ -25,14 +25,16 @@ import { occupySlot, updateCurrency } from "@/src/services/inventoryService"; -import { IMiscItem, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { config } from "@/src/services/configService"; -import { GuildPermission, ITechProjectClient } from "@/src/types/guildTypes"; +import type { ITechProjectClient } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; import { GuildMember } from "@/src/models/guildModel"; import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; import { logger } from "@/src/utils/logger"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; export const guildTechController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/hostSessionController.ts b/src/controllers/api/hostSessionController.ts index 52c7a6a2..3ab49740 100644 --- a/src/controllers/api/hostSessionController.ts +++ b/src/controllers/api/hostSessionController.ts @@ -1,8 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; import { createNewSession } from "@/src/managers/sessionManager"; import { logger } from "@/src/utils/logger"; -import { ISession } from "@/src/types/session"; +import type { ISession } from "@/src/types/session"; import { JSONParse } from "json-with-bigint"; import { toOid2, version_compare } from "@/src/helpers/inventoryHelpers"; diff --git a/src/controllers/api/hubBlessingController.ts b/src/controllers/api/hubBlessingController.ts index 55b59c4f..410d6680 100644 --- a/src/controllers/api/hubBlessingController.ts +++ b/src/controllers/api/hubBlessingController.ts @@ -2,7 +2,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addBooster, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getRandomInt } from "@/src/services/rngService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportBoosters } from "warframe-public-export-plus"; export const hubBlessingController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/hubController.ts b/src/controllers/api/hubController.ts index 8475a88b..41e17a84 100644 --- a/src/controllers/api/hubController.ts +++ b/src/controllers/api/hubController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const hubController: RequestHandler = (_req, res) => { res.json("hub 127.0.0.1:6952"); diff --git a/src/controllers/api/hubInstancesController.ts b/src/controllers/api/hubInstancesController.ts index b7519656..89a5564c 100644 --- a/src/controllers/api/hubInstancesController.ts +++ b/src/controllers/api/hubInstancesController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const hubInstancesController: RequestHandler = (_req, res) => { res.json("list 50 1 0 0 scenarios 0 0 0 0 0 0"); diff --git a/src/controllers/api/inboxController.ts b/src/controllers/api/inboxController.ts index 5f36c998..a62c79ed 100644 --- a/src/controllers/api/inboxController.ts +++ b/src/controllers/api/inboxController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Inbox } from "@/src/models/inboxModel"; import { createMessage, @@ -20,7 +20,7 @@ import { logger } from "@/src/utils/logger"; import { ExportFlavour } from "warframe-public-export-plus"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; import { fromStoreItem, isStoreItem } from "@/src/services/itemDataService"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; export const inboxController: RequestHandler = async (req, res) => { const { deleteId, lastMessage: latestClientMessageId, messageId } = req.query; diff --git a/src/controllers/api/infestedFoundryController.ts b/src/controllers/api/infestedFoundryController.ts index a962d7a8..ddc94b75 100644 --- a/src/controllers/api/infestedFoundryController.ts +++ b/src/controllers/api/infestedFoundryController.ts @@ -1,15 +1,15 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory, addMiscItems, updateCurrency, addRecipes, freeUpSlot } from "@/src/services/inventoryService"; -import { IOid } from "@/src/types/commonTypes"; -import { +import type { IOid } from "@/src/types/commonTypes"; +import type { IConsumedSuit, IHelminthFoodRecord, IInventoryClient, - IMiscItem, - InventorySlot + IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { ExportMisc } from "warframe-public-export-plus"; import { getRecipe } from "@/src/services/itemDataService"; import { toMongoDate, version_compare } from "@/src/helpers/inventoryHelpers"; diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index d5df7619..729df2e7 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -1,19 +1,16 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; -import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { config } from "@/src/services/configService"; import allDialogue from "@/static/fixed_responses/allDialogue.json"; -import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; -import { IInventoryClient, IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { - eFaction, - ExportCustoms, - ExportFlavour, - ExportResources, - ExportVirtuals, - ICountedItem -} from "warframe-public-export-plus"; +import type { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; +import type { IInventoryClient, IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes"; +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import { ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { ICountedItem } from "warframe-public-export-plus"; +import { eFaction, ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus"; import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService"; import { addEmailItem, @@ -30,7 +27,7 @@ import { addString, catBreadHash } from "@/src/helpers/stringHelpers"; import { Types } from "mongoose"; import { getNemesisManifest } from "@/src/helpers/nemesisHelpers"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; +import type { IPersonalRoomsClient } from "@/src/types/personalRoomsTypes"; import { Ship } from "@/src/models/shipModel"; import { toLegacyOid, toOid, version_compare } from "@/src/helpers/inventoryHelpers"; import { Inbox } from "@/src/models/inboxModel"; @@ -68,7 +65,7 @@ export const inventoryController: RequestHandler = async (request, response) => const lastLoginDay = Math.trunc(inventory.NextRefill.getTime() / 86400000) - 1; const daysPassed = today - lastLoginDay; - if (config.noArgonCrystalDecay) { + if (inventory.noArgonCrystalDecay) { inventory.FoundToday = undefined; } else { for (let i = 0; i != daysPassed; ++i) { @@ -387,7 +384,7 @@ export const getInventoryResponse = async ( } } - if (config.universalPolarityEverywhere) { + if (inventory.universalPolarityEverywhere) { const Polarity: IPolarity[] = []; // 12 is needed for necramechs. 15 is needed for plexus/crewshipharness. for (let i = 0; i != 15; ++i) { @@ -405,7 +402,7 @@ export const getInventoryResponse = async ( } } - if (config.unlockDoubleCapacityPotatoesEverywhere) { + if (inventory.unlockDoubleCapacityPotatoesEverywhere) { for (const key of equipmentKeys) { if (key in inventoryResponse) { for (const equipment of inventoryResponse[key]) { @@ -416,7 +413,7 @@ export const getInventoryResponse = async ( } } - if (config.unlockExilusEverywhere) { + if (inventory.unlockExilusEverywhere) { for (const key of equipmentKeys) { if (key in inventoryResponse) { for (const equipment of inventoryResponse[key]) { @@ -427,7 +424,7 @@ export const getInventoryResponse = async ( } } - if (config.unlockArcanesEverywhere) { + if (inventory.unlockArcanesEverywhere) { for (const key of equipmentKeys) { if (key in inventoryResponse) { for (const equipment of inventoryResponse[key]) { @@ -438,14 +435,14 @@ export const getInventoryResponse = async ( } } - if (config.noDailyStandingLimits) { + if (inventory.noDailyStandingLimits) { const spoofedDailyAffiliation = Math.max(999_999, 16000 + inventoryResponse.PlayerLevel * 500); for (const key of allDailyAffiliationKeys) { inventoryResponse[key] = spoofedDailyAffiliation; } } - if (config.noDailyFocusLimit) { + if (inventory.noDailyFocusLimit) { inventoryResponse.DailyFocus = Math.max(999_999, 250000 + inventoryResponse.PlayerLevel * 5000); } diff --git a/src/controllers/api/inventorySlotsController.ts b/src/controllers/api/inventorySlotsController.ts index 8a8fce0a..7b937a2e 100644 --- a/src/controllers/api/inventorySlotsController.ts +++ b/src/controllers/api/inventorySlotsController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, updateCurrency, updateSlots } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { exhaustive } from "@/src/utils/ts-utils"; diff --git a/src/controllers/api/joinSessionController.ts b/src/controllers/api/joinSessionController.ts index 7dff9fc9..8bb516ad 100644 --- a/src/controllers/api/joinSessionController.ts +++ b/src/controllers/api/joinSessionController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getSessionByID } from "@/src/managers/sessionManager"; import { logger } from "@/src/utils/logger"; diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index 05329be4..68fffd93 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -1,11 +1,11 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { config } from "@/src/services/configService"; import { buildConfig } from "@/src/services/buildConfigService"; import { Account } from "@/src/models/loginModel"; import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "@/src/services/loginService"; -import { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "@/src/types/loginTypes"; +import type { IDatabaseAccountJson, ILoginRequest, ILoginResponse } from "@/src/types/loginTypes"; import { logger } from "@/src/utils/logger"; import { version_compare } from "@/src/helpers/inventoryHelpers"; import { sendWsBroadcastTo } from "@/src/services/wsService"; diff --git a/src/controllers/api/loginRewardsController.ts b/src/controllers/api/loginRewardsController.ts index 547724c2..a994b860 100644 --- a/src/controllers/api/loginRewardsController.ts +++ b/src/controllers/api/loginRewardsController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; +import type { ILoginRewardsReponse } from "@/src/services/loginRewardService"; import { claimLoginReward, getRandomLoginRewards, - ILoginRewardsReponse, isLoginRewardAChoice, setAccountGotLoginRewardToday } from "@/src/services/loginRewardService"; diff --git a/src/controllers/api/loginRewardsSelectionController.ts b/src/controllers/api/loginRewardsSelectionController.ts index 174c5659..d0f10f73 100644 --- a/src/controllers/api/loginRewardsSelectionController.ts +++ b/src/controllers/api/loginRewardsSelectionController.ts @@ -7,9 +7,9 @@ import { import { getAccountForRequest } from "@/src/services/loginService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const loginRewardsSelectionController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); diff --git a/src/controllers/api/logoutController.ts b/src/controllers/api/logoutController.ts index bf7328a4..14821921 100644 --- a/src/controllers/api/logoutController.ts +++ b/src/controllers/api/logoutController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Account } from "@/src/models/loginModel"; import { sendWsBroadcastTo } from "@/src/services/wsService"; diff --git a/src/controllers/api/marketRecommendationsController.ts b/src/controllers/api/marketRecommendationsController.ts index 8acfa89e..fd105836 100644 --- a/src/controllers/api/marketRecommendationsController.ts +++ b/src/controllers/api/marketRecommendationsController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const marketRecommendationsController: RequestHandler = (_req, res) => { const data = Buffer.from([ diff --git a/src/controllers/api/marketSearchRecommendationsController.ts b/src/controllers/api/marketSearchRecommendationsController.ts index bc99897b..1360a7ab 100644 --- a/src/controllers/api/marketSearchRecommendationsController.ts +++ b/src/controllers/api/marketSearchRecommendationsController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const marketSearchRecommendationsController: RequestHandler = (_req, res) => { res.sendStatus(200); diff --git a/src/controllers/api/maturePetController.ts b/src/controllers/api/maturePetController.ts index 1bfb83f6..5c769307 100644 --- a/src/controllers/api/maturePetController.ts +++ b/src/controllers/api/maturePetController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const maturePetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/missionInventoryUpdateController.ts b/src/controllers/api/missionInventoryUpdateController.ts index e6a48e70..b2ca85c9 100644 --- a/src/controllers/api/missionInventoryUpdateController.ts +++ b/src/controllers/api/missionInventoryUpdateController.ts @@ -1,12 +1,12 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountForRequest } from "@/src/services/loginService"; -import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes"; +import type { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes"; import { addMissionInventoryUpdates, addMissionRewards } from "@/src/services/missionInventoryUpdateService"; import { getInventory } from "@/src/services/inventoryService"; import { getInventoryResponse } from "@/src/controllers/api/inventoryController"; import { logger } from "@/src/utils/logger"; -import { +import type { IMissionInventoryUpdateResponse, IMissionInventoryUpdateResponseBackToDryDock, IMissionInventoryUpdateResponseRailjackInterstitial diff --git a/src/controllers/api/modularWeaponCraftingController.ts b/src/controllers/api/modularWeaponCraftingController.ts index a3b69f0e..4ba319e5 100644 --- a/src/controllers/api/modularWeaponCraftingController.ts +++ b/src/controllers/api/modularWeaponCraftingController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; @@ -13,12 +13,14 @@ import { combineInventoryChanges, addSpecialItem } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { getDefaultUpgrades } from "@/src/services/itemDataService"; import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper"; import { getRandomInt } from "@/src/services/rngService"; -import { ExportSentinels, ExportWeapons, IDefaultUpgrade } from "warframe-public-export-plus"; -import { IEquipmentDatabase, Status } from "@/src/types/equipmentTypes"; +import type { IDefaultUpgrade } from "warframe-public-export-plus"; +import { ExportSentinels, ExportWeapons } from "warframe-public-export-plus"; +import type { IEquipmentDatabase } from "@/src/types/equipmentTypes"; +import { Status } from "@/src/types/equipmentTypes"; interface IModularCraftRequest { WeaponType: string; diff --git a/src/controllers/api/modularWeaponSaleController.ts b/src/controllers/api/modularWeaponSaleController.ts index 2ce6c11c..4f5a1b2e 100644 --- a/src/controllers/api/modularWeaponSaleController.ts +++ b/src/controllers/api/modularWeaponSaleController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportWeapons } from "warframe-public-export-plus"; -import { IMongoDate } from "@/src/types/commonTypes"; +import type { IMongoDate } from "@/src/types/commonTypes"; import { toMongoDate } from "@/src/helpers/inventoryHelpers"; import { SRng } from "@/src/services/rngService"; -import { ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addEquipment, @@ -17,7 +17,7 @@ import { getDefaultUpgrades } from "@/src/services/itemDataService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; import { modularWeaponTypes } from "@/src/helpers/modularWeaponHelper"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { EquipmentFeatures } from "@/src/types/equipmentTypes"; export const modularWeaponSaleController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/nameWeaponController.ts b/src/controllers/api/nameWeaponController.ts index c3c899ba..e0f45cdc 100644 --- a/src/controllers/api/nameWeaponController.ts +++ b/src/controllers/api/nameWeaponController.ts @@ -1,8 +1,8 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; import { sendWsBroadcastTo } from "@/src/services/wsService"; interface INameWeaponRequest { diff --git a/src/controllers/api/nemesisController.ts b/src/controllers/api/nemesisController.ts index 2d361c80..2352c56c 100644 --- a/src/controllers/api/nemesisController.ts +++ b/src/controllers/api/nemesisController.ts @@ -1,4 +1,5 @@ -import { version_compare } from "@/src/helpers/inventoryHelpers"; +import { fromDbOid, version_compare } from "@/src/helpers/inventoryHelpers"; +import type { IKnifeResponse } from "@/src/helpers/nemesisHelpers"; import { antivirusMods, decodeNemesisGuess, @@ -12,30 +13,28 @@ import { GUESS_NEUTRAL, GUESS_NONE, GUESS_WILDCARD, - IKnifeResponse, parseUpgrade } from "@/src/helpers/nemesisHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; import { addMods, freeUpSlot, getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest } from "@/src/services/loginService"; import { SRng } from "@/src/services/rngService"; -import { IMongoDate, IOid } from "@/src/types/commonTypes"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { IInnateDamageFingerprint, IInventoryClient, INemesisClient, - InventorySlot, IUpgradeClient, IWeaponSkinClient, - LoadoutIndex, TEquipmentKey, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot, LoadoutIndex } from "@/src/types/inventoryTypes/inventoryTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; export const nemesisController: RequestHandler = async (req, res) => { @@ -130,7 +129,9 @@ export const nemesisController: RequestHandler = async (req, res) => { if (result1 == GUESS_CORRECT || result2 == GUESS_CORRECT || result3 == GUESS_CORRECT) { let antivirusGain = 5; const loadout = (await Loadout.findById(inventory.LoadOutPresets, "DATAKNIFE"))!; - const dataknifeLoadout = loadout.DATAKNIFE.id(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE].$oid); + const dataknifeLoadout = loadout.DATAKNIFE.id( + fromDbOid(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE]) + ); const dataknifeConfigIndex = dataknifeLoadout?.s?.mod ?? 0; const dataknifeUpgrades = inventory.DataKnives[0].Configs[dataknifeConfigIndex].Upgrades!; for (const upgrade of body.knife!.AttachedUpgrades) { @@ -219,7 +220,7 @@ export const nemesisController: RequestHandler = async (req, res) => { // Subtract a charge from all requiem mods installed on parazon const loadout = (await Loadout.findById(inventory.LoadOutPresets, "DATAKNIFE"))!; const dataknifeLoadout = loadout.DATAKNIFE.id( - inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE].$oid + fromDbOid(inventory.CurrentLoadOutIds[LoadoutIndex.DATAKNIFE]) ); const dataknifeConfigIndex = dataknifeLoadout?.s?.mod ?? 0; const dataknifeUpgrades = inventory.DataKnives[0].Configs[dataknifeConfigIndex].Upgrades!; diff --git a/src/controllers/api/placeDecoInComponentController.ts b/src/controllers/api/placeDecoInComponentController.ts index fc1ef445..5c26a3e4 100644 --- a/src/controllers/api/placeDecoInComponentController.ts +++ b/src/controllers/api/placeDecoInComponentController.ts @@ -10,7 +10,7 @@ import { import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; import { ExportDojoRecipes, ExportResources } from "warframe-public-export-plus"; import { config } from "@/src/services/configService"; diff --git a/src/controllers/api/playedParkourTutorialController.ts b/src/controllers/api/playedParkourTutorialController.ts index a37689f2..242ec24c 100644 --- a/src/controllers/api/playedParkourTutorialController.ts +++ b/src/controllers/api/playedParkourTutorialController.ts @@ -1,6 +1,6 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const playedParkourTutorialController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/playerSkillsController.ts b/src/controllers/api/playerSkillsController.ts index d160686f..02d123e7 100644 --- a/src/controllers/api/playerSkillsController.ts +++ b/src/controllers/api/playerSkillsController.ts @@ -1,9 +1,9 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addConsumables, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IPlayerSkills } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IPlayerSkills } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; export const playerSkillsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/postGuildAdvertisementController.ts b/src/controllers/api/postGuildAdvertisementController.ts index 69b28323..5135c19d 100644 --- a/src/controllers/api/postGuildAdvertisementController.ts +++ b/src/controllers/api/postGuildAdvertisementController.ts @@ -11,8 +11,8 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getVendorManifestByTypeName } from "@/src/services/serversideVendorsService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { IPurchaseParams } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IPurchaseParams } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; export const postGuildAdvertisementController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/projectionManagerController.ts b/src/controllers/api/projectionManagerController.ts index f419e964..c2c2cf76 100644 --- a/src/controllers/api/projectionManagerController.ts +++ b/src/controllers/api/projectionManagerController.ts @@ -1,15 +1,15 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; -import { ExportRelics, IRelic } from "warframe-public-export-plus"; -import { config } from "@/src/services/configService"; +import type { IRelic } from "warframe-public-export-plus"; +import { ExportRelics } from "warframe-public-export-plus"; export const projectionManagerController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); - const inventory = await getInventory(accountId); + const inventory = await getInventory(accountId, "MiscItems dontSubtractVoidTraces"); const request = JSON.parse(String(req.body)) as IProjectionUpgradeRequest; const [era, category, currentQuality] = parseProjection(request.projectionType); - const upgradeCost = config.dontSubtractVoidTraces + const upgradeCost = inventory.dontSubtractVoidTraces ? 0 : qualityNumberToCost[request.qualityTag] - qualityNumberToCost[qualityKeywordToNumber[currentQuality]]; const newProjectionType = findProjection(era, category, qualityNumberToKeyword[request.qualityTag]); diff --git a/src/controllers/api/purchaseController.ts b/src/controllers/api/purchaseController.ts index 69175739..b021366d 100644 --- a/src/controllers/api/purchaseController.ts +++ b/src/controllers/api/purchaseController.ts @@ -1,6 +1,6 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IPurchaseRequest } from "@/src/types/purchaseTypes"; +import type { IPurchaseRequest } from "@/src/types/purchaseTypes"; import { handlePurchase } from "@/src/services/purchaseService"; import { getInventory } from "@/src/services/inventoryService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; diff --git a/src/controllers/api/questControlController.ts b/src/controllers/api/questControlController.ts index 0a6e0781..e9e346ea 100644 --- a/src/controllers/api/questControlController.ts +++ b/src/controllers/api/questControlController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; // Basic shim handling action=sync to login on U21 export const questControlController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/queueDojoComponentDestructionController.ts b/src/controllers/api/queueDojoComponentDestructionController.ts index 037b5c27..15248f17 100644 --- a/src/controllers/api/queueDojoComponentDestructionController.ts +++ b/src/controllers/api/queueDojoComponentDestructionController.ts @@ -3,7 +3,7 @@ import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermissio import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const queueDojoComponentDestructionController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/redeemPromoCodeController.ts b/src/controllers/api/redeemPromoCodeController.ts index f0e615bc..edce905a 100644 --- a/src/controllers/api/redeemPromoCodeController.ts +++ b/src/controllers/api/redeemPromoCodeController.ts @@ -1,5 +1,5 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import glyphCodes from "@/static/fixed_responses/glyphsCodes.json"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addItem, getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/api/releasePetController.ts b/src/controllers/api/releasePetController.ts index 09e8cc6f..3faa1ed6 100644 --- a/src/controllers/api/releasePetController.ts +++ b/src/controllers/api/releasePetController.ts @@ -2,7 +2,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const releasePetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/removeFriendController.ts b/src/controllers/api/removeFriendController.ts index 24b39c2e..ccf94f0a 100644 --- a/src/controllers/api/removeFriendController.ts +++ b/src/controllers/api/removeFriendController.ts @@ -4,10 +4,10 @@ import { Friendship } from "@/src/models/friendModel"; import { Account } from "@/src/models/loginModel"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; import { parallelForeach } from "@/src/utils/async-utils"; -import { RequestHandler } from "express"; -import { Types } from "mongoose"; +import type { RequestHandler } from "express"; +import type { Types } from "mongoose"; export const removeFriendGetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/removeFromAllianceController.ts b/src/controllers/api/removeFromAllianceController.ts index f6dc8acc..3390c736 100644 --- a/src/controllers/api/removeFromAllianceController.ts +++ b/src/controllers/api/removeFromAllianceController.ts @@ -2,7 +2,7 @@ import { AllianceMember, Guild, GuildMember } from "@/src/models/guildModel"; import { deleteAlliance } from "@/src/services/guildService"; import { getAccountForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const removeFromAllianceController: RequestHandler = async (req, res) => { // Check requester is a warlord in their guild diff --git a/src/controllers/api/removeFromGuildController.ts b/src/controllers/api/removeFromGuildController.ts index db5a2ea3..bad9cca3 100644 --- a/src/controllers/api/removeFromGuildController.ts +++ b/src/controllers/api/removeFromGuildController.ts @@ -6,7 +6,7 @@ import { createMessage } from "@/src/services/inboxService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const removeFromGuildController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); diff --git a/src/controllers/api/removeIgnoredUserController.ts b/src/controllers/api/removeIgnoredUserController.ts index 73613ce6..20fad8cb 100644 --- a/src/controllers/api/removeIgnoredUserController.ts +++ b/src/controllers/api/removeIgnoredUserController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Account, Ignore } from "@/src/models/loginModel"; import { getAccountForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const removeIgnoredUserController: RequestHandler = async (req, res) => { const accountId = await getAccountForRequest(req); diff --git a/src/controllers/api/renamePetController.ts b/src/controllers/api/renamePetController.ts index f3fe0c89..6e7155f3 100644 --- a/src/controllers/api/renamePetController.ts +++ b/src/controllers/api/renamePetController.ts @@ -2,8 +2,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; export const renamePetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/rerollRandomModController.ts b/src/controllers/api/rerollRandomModController.ts index 20e7218a..7c3bea48 100644 --- a/src/controllers/api/rerollRandomModController.ts +++ b/src/controllers/api/rerollRandomModController.ts @@ -1,10 +1,11 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { createUnveiledRivenFingerprint, randomiseRivenStats, RivenFingerprint } from "@/src/helpers/rivenHelper"; +import type { RivenFingerprint } from "@/src/helpers/rivenHelper"; +import { createUnveiledRivenFingerprint, randomiseRivenStats } from "@/src/helpers/rivenHelper"; import { ExportUpgrades } from "warframe-public-export-plus"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; export const rerollRandomModController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/resetQuestProgressController.ts b/src/controllers/api/resetQuestProgressController.ts index 9d75a54a..ecb893fe 100644 --- a/src/controllers/api/resetQuestProgressController.ts +++ b/src/controllers/api/resetQuestProgressController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const resetQuestProgressController: RequestHandler = (_req, res) => { res.send("1").end(); diff --git a/src/controllers/api/retrievePetFromStasisController.ts b/src/controllers/api/retrievePetFromStasisController.ts index eb332f9c..d02cb2cd 100644 --- a/src/controllers/api/retrievePetFromStasisController.ts +++ b/src/controllers/api/retrievePetFromStasisController.ts @@ -2,7 +2,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { Status } from "@/src/types/equipmentTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const retrievePetFromStasisController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/saveDialogueController.ts b/src/controllers/api/saveDialogueController.ts index dcbd04e2..48eee78e 100644 --- a/src/controllers/api/saveDialogueController.ts +++ b/src/controllers/api/saveDialogueController.ts @@ -1,15 +1,14 @@ -import { config } from "@/src/services/configService"; import { addEmailItem, getDialogue, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; export const saveDialogueController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const request = JSON.parse(String(req.body)) as SaveDialogueRequest; if ("YearIteration" in request) { - const inventory = await getInventory(accountId, "DialogueHistory"); + const inventory = await getInventory(accountId, "DialogueHistory noKimCooldowns"); inventory.DialogueHistory ??= {}; inventory.DialogueHistory.YearIteration = request.YearIteration; await inventory.save(); @@ -17,7 +16,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => { } else { const inventory = await getInventory(accountId); const inventoryChanges: IInventoryChanges = {}; - const tomorrowAt0Utc = config.noKimCooldowns + const tomorrowAt0Utc = inventory.noKimCooldowns ? Date.now() : (Math.trunc(Date.now() / 86400_000) + 1) * 86400_000; const dialogue = getDialogue(inventory, request.DialogueName); diff --git a/src/controllers/api/saveLoadoutController.ts b/src/controllers/api/saveLoadoutController.ts index c5383e1c..b8573521 100644 --- a/src/controllers/api/saveLoadoutController.ts +++ b/src/controllers/api/saveLoadoutController.ts @@ -1,5 +1,5 @@ -import { RequestHandler } from "express"; -import { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes"; +import type { RequestHandler } from "express"; +import type { ISaveLoadoutRequest } from "@/src/types/saveLoadoutTypes"; import { handleInventoryItemConfigChange } from "@/src/services/saveLoadoutService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; diff --git a/src/controllers/api/saveSettingsController.ts b/src/controllers/api/saveSettingsController.ts index 8aba0cfe..42e98dee 100644 --- a/src/controllers/api/saveSettingsController.ts +++ b/src/controllers/api/saveSettingsController.ts @@ -1,8 +1,8 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; -import { ISettings } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; +import type { ISettings } from "@/src/types/inventoryTypes/inventoryTypes"; interface ISaveSettingsRequest { Settings: ISettings; diff --git a/src/controllers/api/saveVaultAutoContributeController.ts b/src/controllers/api/saveVaultAutoContributeController.ts index 5c5f51c5..9133404e 100644 --- a/src/controllers/api/saveVaultAutoContributeController.ts +++ b/src/controllers/api/saveVaultAutoContributeController.ts @@ -4,7 +4,7 @@ import { hasGuildPermission } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const saveVaultAutoContributeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/sellController.ts b/src/controllers/api/sellController.ts index b19cf2dc..698cb2d8 100644 --- a/src/controllers/api/sellController.ts +++ b/src/controllers/api/sellController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, @@ -15,8 +15,8 @@ import { } from "@/src/services/inventoryService"; import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { ExportDojoRecipes } from "warframe-public-export-plus"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { sendWsBroadcastEx } from "@/src/services/wsService"; import { parseFusionTreasure } from "@/src/helpers/inventoryHelpers"; diff --git a/src/controllers/api/sendMsgToInBoxController.ts b/src/controllers/api/sendMsgToInBoxController.ts index 7cad8c15..5598e88a 100644 --- a/src/controllers/api/sendMsgToInBoxController.ts +++ b/src/controllers/api/sendMsgToInBoxController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { createMessage } from "@/src/services/inboxService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const sendMsgToInBoxController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setActiveQuestController.ts b/src/controllers/api/setActiveQuestController.ts index 7a0204f6..374bd2d4 100644 --- a/src/controllers/api/setActiveQuestController.ts +++ b/src/controllers/api/setActiveQuestController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setActiveQuestController: RequestHandler< Record, diff --git a/src/controllers/api/setActiveShipController.ts b/src/controllers/api/setActiveShipController.ts index 9592915a..3ae4b7a8 100644 --- a/src/controllers/api/setActiveShipController.ts +++ b/src/controllers/api/setActiveShipController.ts @@ -1,7 +1,7 @@ import { getPersonalRooms } from "@/src/services/personalRoomsService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { parseString } from "@/src/helpers/general"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { Types } from "mongoose"; export const setActiveShipController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/setAllianceGuildPermissionsController.ts b/src/controllers/api/setAllianceGuildPermissionsController.ts index ce3caaf8..f4a8f365 100644 --- a/src/controllers/api/setAllianceGuildPermissionsController.ts +++ b/src/controllers/api/setAllianceGuildPermissionsController.ts @@ -1,7 +1,7 @@ import { AllianceMember, GuildMember } from "@/src/models/guildModel"; import { getAccountForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setAllianceGuildPermissionsController: RequestHandler = async (req, res) => { // Check requester is a warlord in their guild diff --git a/src/controllers/api/setBootLocationController.ts b/src/controllers/api/setBootLocationController.ts index dfccd1d7..5bc20f02 100644 --- a/src/controllers/api/setBootLocationController.ts +++ b/src/controllers/api/setBootLocationController.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { TBootLocation } from "@/src/types/personalRoomsTypes"; +import type { TBootLocation } from "@/src/types/personalRoomsTypes"; import { getInventory } from "@/src/services/inventoryService"; export const setBootLocationController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/setDojoComponentColorsController.ts b/src/controllers/api/setDojoComponentColorsController.ts index ac069242..a68a43de 100644 --- a/src/controllers/api/setDojoComponentColorsController.ts +++ b/src/controllers/api/setDojoComponentColorsController.ts @@ -3,7 +3,7 @@ import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermissio import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setDojoComponentColorsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setDojoComponentMessageController.ts b/src/controllers/api/setDojoComponentMessageController.ts index 92931a54..2cb08ad3 100644 --- a/src/controllers/api/setDojoComponentMessageController.ts +++ b/src/controllers/api/setDojoComponentMessageController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getDojoClient, getGuildForRequest } from "@/src/services/guildService"; export const setDojoComponentMessageController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/setDojoComponentSettingsController.ts b/src/controllers/api/setDojoComponentSettingsController.ts index 1286ba25..f9d8c88e 100644 --- a/src/controllers/api/setDojoComponentSettingsController.ts +++ b/src/controllers/api/setDojoComponentSettingsController.ts @@ -3,7 +3,7 @@ import { getDojoClient, getGuildForRequestEx, hasAccessToDojo, hasGuildPermissio import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setDojoComponentSettingsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setEquippedInstrumentController.ts b/src/controllers/api/setEquippedInstrumentController.ts index bb80a815..f99cbe7c 100644 --- a/src/controllers/api/setEquippedInstrumentController.ts +++ b/src/controllers/api/setEquippedInstrumentController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; diff --git a/src/controllers/api/setFriendNoteController.ts b/src/controllers/api/setFriendNoteController.ts index c12543da..c13103ef 100644 --- a/src/controllers/api/setFriendNoteController.ts +++ b/src/controllers/api/setFriendNoteController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Friendship } from "@/src/models/friendModel"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setFriendNoteController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setGuildMotdController.ts b/src/controllers/api/setGuildMotdController.ts index 1e09ab28..a0096440 100644 --- a/src/controllers/api/setGuildMotdController.ts +++ b/src/controllers/api/setGuildMotdController.ts @@ -3,8 +3,9 @@ import { Alliance, Guild, GuildMember } from "@/src/models/guildModel"; import { hasGuildPermissionEx } from "@/src/services/guildService"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, getSuffixedName } from "@/src/services/loginService"; -import { GuildPermission, ILongMOTD } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { ILongMOTD } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; export const setGuildMotdController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); diff --git a/src/controllers/api/setHubNpcCustomizationsController.ts b/src/controllers/api/setHubNpcCustomizationsController.ts index 6e199933..a84efe12 100644 --- a/src/controllers/api/setHubNpcCustomizationsController.ts +++ b/src/controllers/api/setHubNpcCustomizationsController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IHubNpcCustomization } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IHubNpcCustomization } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const setHubNpcCustomizationsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setPlacedDecoInfoController.ts b/src/controllers/api/setPlacedDecoInfoController.ts index 25073023..a842cb43 100644 --- a/src/controllers/api/setPlacedDecoInfoController.ts +++ b/src/controllers/api/setPlacedDecoInfoController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ISetPlacedDecoInfoRequest } from "@/src/types/personalRoomsTypes"; -import { RequestHandler } from "express"; +import type { ISetPlacedDecoInfoRequest } from "@/src/types/personalRoomsTypes"; +import type { RequestHandler } from "express"; import { handleSetPlacedDecoInfo } from "@/src/services/shipCustomizationsService"; export const setPlacedDecoInfoController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/setShipCustomizationsController.ts b/src/controllers/api/setShipCustomizationsController.ts index 286e416b..a0d1d63c 100644 --- a/src/controllers/api/setShipCustomizationsController.ts +++ b/src/controllers/api/setShipCustomizationsController.ts @@ -1,8 +1,8 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { setShipCustomizations } from "@/src/services/shipCustomizationsService"; -import { ISetShipCustomizationsRequest } from "@/src/types/personalRoomsTypes"; +import type { ISetShipCustomizationsRequest } from "@/src/types/personalRoomsTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setShipCustomizationsController: RequestHandler = async (req, res) => { try { diff --git a/src/controllers/api/setShipFavouriteLoadoutController.ts b/src/controllers/api/setShipFavouriteLoadoutController.ts index 07b646df..02d49608 100644 --- a/src/controllers/api/setShipFavouriteLoadoutController.ts +++ b/src/controllers/api/setShipFavouriteLoadoutController.ts @@ -1,9 +1,9 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; import { Types } from "mongoose"; -import { IFavouriteLoadoutDatabase, TBootLocation } from "@/src/types/personalRoomsTypes"; +import type { IFavouriteLoadoutDatabase, TBootLocation } from "@/src/types/personalRoomsTypes"; export const setShipFavouriteLoadoutController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setShipVignetteController.ts b/src/controllers/api/setShipVignetteController.ts index a1d991da..595afc29 100644 --- a/src/controllers/api/setShipVignetteController.ts +++ b/src/controllers/api/setShipVignetteController.ts @@ -1,9 +1,9 @@ import { addMiscItems, combineInventoryChanges, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setShipVignetteController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setSuitInfectionController.ts b/src/controllers/api/setSuitInfectionController.ts index 84bd0a4b..511bd968 100644 --- a/src/controllers/api/setSuitInfectionController.ts +++ b/src/controllers/api/setSuitInfectionController.ts @@ -2,8 +2,8 @@ import { fromMongoDate, fromOid } from "@/src/helpers/inventoryHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { RequestHandler } from "express"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { RequestHandler } from "express"; export const setSuitInfectionController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/setSupportedSyndicateController.ts b/src/controllers/api/setSupportedSyndicateController.ts index 40ce4af3..4107556c 100644 --- a/src/controllers/api/setSupportedSyndicateController.ts +++ b/src/controllers/api/setSupportedSyndicateController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; diff --git a/src/controllers/api/setWeaponSkillTreeController.ts b/src/controllers/api/setWeaponSkillTreeController.ts index a750c3ce..59c587eb 100644 --- a/src/controllers/api/setWeaponSkillTreeController.ts +++ b/src/controllers/api/setWeaponSkillTreeController.ts @@ -1,8 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; -import { equipmentKeys, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; export const setWeaponSkillTreeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/shipDecorationsController.ts b/src/controllers/api/shipDecorationsController.ts index 69c959a5..1259140e 100644 --- a/src/controllers/api/shipDecorationsController.ts +++ b/src/controllers/api/shipDecorationsController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IShipDecorationsRequest, IResetShipDecorationsRequest } from "@/src/types/personalRoomsTypes"; -import { RequestHandler } from "express"; +import type { IShipDecorationsRequest, IResetShipDecorationsRequest } from "@/src/types/personalRoomsTypes"; +import type { RequestHandler } from "express"; import { handleResetShipDecorations, handleSetShipDecorations } from "@/src/services/shipCustomizationsService"; export const shipDecorationsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/startCollectibleEntryController.ts b/src/controllers/api/startCollectibleEntryController.ts index ffc440c1..1e373fa6 100644 --- a/src/controllers/api/startCollectibleEntryController.ts +++ b/src/controllers/api/startCollectibleEntryController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IIncentiveState } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IIncentiveState } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const startCollectibleEntryController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/startDojoRecipeController.ts b/src/controllers/api/startDojoRecipeController.ts index 0773f252..42a7ad67 100644 --- a/src/controllers/api/startDojoRecipeController.ts +++ b/src/controllers/api/startDojoRecipeController.ts @@ -1,5 +1,6 @@ -import { RequestHandler } from "express"; -import { GuildPermission, IDojoComponentClient } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; +import type { IDojoComponentClient } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; import { getDojoClient, getGuildForRequestEx, diff --git a/src/controllers/api/startLibraryDailyTaskController.ts b/src/controllers/api/startLibraryDailyTaskController.ts index e8b8425b..3c8bb2ce 100644 --- a/src/controllers/api/startLibraryDailyTaskController.ts +++ b/src/controllers/api/startLibraryDailyTaskController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const startLibraryDailyTaskController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/startLibraryPersonalTargetController.ts b/src/controllers/api/startLibraryPersonalTargetController.ts index 7bfa5ff6..ac03f9b6 100644 --- a/src/controllers/api/startLibraryPersonalTargetController.ts +++ b/src/controllers/api/startLibraryPersonalTargetController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const startLibraryPersonalTargetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/startRecipeController.ts b/src/controllers/api/startRecipeController.ts index 42f138e5..c91c7bd6 100644 --- a/src/controllers/api/startRecipeController.ts +++ b/src/controllers/api/startRecipeController.ts @@ -1,16 +1,17 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getRecipe } from "@/src/services/itemDataService"; import { addItem, addKubrowPet, freeUpSlot, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { unixTimesInMs } from "@/src/constants/timeConstants"; import { Types } from "mongoose"; -import { InventorySlot, ISpectreLoadout } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { ISpectreLoadout } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { fromOid, toOid } from "@/src/helpers/inventoryHelpers"; import { ExportWeapons } from "warframe-public-export-plus"; import { getRandomElement } from "@/src/services/rngService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; interface IStartRecipeRequest { RecipeName: string; diff --git a/src/controllers/api/stepSequencersController.ts b/src/controllers/api/stepSequencersController.ts index 3d86c1ac..361e258f 100644 --- a/src/controllers/api/stepSequencersController.ts +++ b/src/controllers/api/stepSequencersController.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; -import { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes"; export const stepSequencersController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/surveysController.ts b/src/controllers/api/surveysController.ts index 2a593e47..18e92fe2 100644 --- a/src/controllers/api/surveysController.ts +++ b/src/controllers/api/surveysController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const surveysController: RequestHandler = (_req, res) => { const data = Buffer.from([ diff --git a/src/controllers/api/syndicateSacrificeController.ts b/src/controllers/api/syndicateSacrificeController.ts index cdd640d0..d28719d5 100644 --- a/src/controllers/api/syndicateSacrificeController.ts +++ b/src/controllers/api/syndicateSacrificeController.ts @@ -1,10 +1,11 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { ExportSyndicates, ISyndicateSacrifice } from "warframe-public-export-plus"; +import type { ISyndicateSacrifice } from "warframe-public-export-plus"; +import { ExportSyndicates } from "warframe-public-export-plus"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; import { addMiscItem, combineInventoryChanges, getInventory, updateCurrency } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { toStoreItem } from "@/src/services/itemDataService"; import { logger } from "@/src/utils/logger"; diff --git a/src/controllers/api/syndicateStandingBonusController.ts b/src/controllers/api/syndicateStandingBonusController.ts index 1691aa68..1e5411c6 100644 --- a/src/controllers/api/syndicateStandingBonusController.ts +++ b/src/controllers/api/syndicateStandingBonusController.ts @@ -1,11 +1,12 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, addStanding, freeUpSlot, getInventory } from "@/src/services/inventoryService"; -import { IMiscItem, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IOid } from "@/src/types/commonTypes"; +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IOid } from "@/src/types/commonTypes"; import { ExportSyndicates, ExportWeapons } from "warframe-public-export-plus"; import { logger } from "@/src/utils/logger"; -import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; import { EquipmentFeatures } from "@/src/types/equipmentTypes"; export const syndicateStandingBonusController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/tauntHistoryController.ts b/src/controllers/api/tauntHistoryController.ts index a2e489ea..24c49402 100644 --- a/src/controllers/api/tauntHistoryController.ts +++ b/src/controllers/api/tauntHistoryController.ts @@ -1,7 +1,7 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; -import { ITaunt } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { ITaunt } from "@/src/types/inventoryTypes/inventoryTypes"; import { logger } from "@/src/utils/logger"; export const tauntHistoryController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/tradingController.ts b/src/controllers/api/tradingController.ts index af6e94f9..27868e2e 100644 --- a/src/controllers/api/tradingController.ts +++ b/src/controllers/api/tradingController.ts @@ -2,7 +2,7 @@ import { getGuildForRequestEx, hasAccessToDojo, hasGuildPermission } from "@/src import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { GuildPermission } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const tradingController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/trainingResultController.ts b/src/controllers/api/trainingResultController.ts index 0e436386..6bf37eda 100644 --- a/src/controllers/api/trainingResultController.ts +++ b/src/controllers/api/trainingResultController.ts @@ -1,12 +1,11 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; -import { IMongoDate } from "@/src/types/commonTypes"; -import { RequestHandler } from "express"; +import type { IMongoDate } from "@/src/types/commonTypes"; +import type { RequestHandler } from "express"; import { unixTimesInMs } from "@/src/constants/timeConstants"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { createMessage } from "@/src/services/inboxService"; -import { config } from "@/src/services/configService"; interface ITrainingResultsRequest { numLevelsGained: number; @@ -23,11 +22,11 @@ const trainingResultController: RequestHandler = async (req, res): Promise const trainingResults = getJSONfromString(String(req.body)); - const inventory = await getInventory(accountId, "TrainingDate PlayerLevel TradesRemaining"); + const inventory = await getInventory(accountId, "TrainingDate PlayerLevel TradesRemaining noMasteryRankUpCooldown"); if (trainingResults.numLevelsGained == 1) { let time = Date.now(); - if (!config.noMasteryRankUpCooldown) { + if (!inventory.noMasteryRankUpCooldown) { time += unixTimesInMs.hour * 23; } inventory.TrainingDate = new Date(time); diff --git a/src/controllers/api/umbraController.ts b/src/controllers/api/umbraController.ts index 88529662..89c8e9fa 100644 --- a/src/controllers/api/umbraController.ts +++ b/src/controllers/api/umbraController.ts @@ -2,8 +2,8 @@ import { fromMongoDate, fromOid } from "@/src/helpers/inventoryHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addMiscItem, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { RequestHandler } from "express"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { RequestHandler } from "express"; export const umbraController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/unlockShipFeatureController.ts b/src/controllers/api/unlockShipFeatureController.ts index 4a3ecd1e..76640b60 100644 --- a/src/controllers/api/unlockShipFeatureController.ts +++ b/src/controllers/api/unlockShipFeatureController.ts @@ -1,6 +1,6 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { updateShipFeature } from "@/src/services/personalRoomsService"; -import { IUnlockShipFeatureRequest } from "@/src/types/requestTypes"; +import type { IUnlockShipFeatureRequest } from "@/src/types/requestTypes"; import { parseString } from "@/src/helpers/general"; export const unlockShipFeatureController: RequestHandler = async (req, res) => { diff --git a/src/controllers/api/updateAlignmentController.ts b/src/controllers/api/updateAlignmentController.ts index 2942ad6f..4ba48f3c 100644 --- a/src/controllers/api/updateAlignmentController.ts +++ b/src/controllers/api/updateAlignmentController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IAlignment } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IAlignment } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const updateAlignmentController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/updateChallengeProgressController.ts b/src/controllers/api/updateChallengeProgressController.ts index e0547c7f..58734251 100644 --- a/src/controllers/api/updateChallengeProgressController.ts +++ b/src/controllers/api/updateChallengeProgressController.ts @@ -1,9 +1,9 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountForRequest } from "@/src/services/loginService"; import { addCalendarProgress, addChallenges, getInventory } from "@/src/services/inventoryService"; -import { IChallengeProgress, ISeasonChallenge } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IAffiliationMods } from "@/src/types/purchaseTypes"; +import type { IChallengeProgress, ISeasonChallenge } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IAffiliationMods } from "@/src/types/purchaseTypes"; import { getEntriesUnsafe } from "@/src/utils/ts-utils"; import { logger } from "@/src/utils/logger"; diff --git a/src/controllers/api/updateQuestController.ts b/src/controllers/api/updateQuestController.ts index c251094f..bcf8937b 100644 --- a/src/controllers/api/updateQuestController.ts +++ b/src/controllers/api/updateQuestController.ts @@ -1,9 +1,10 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { parseString } from "@/src/helpers/general"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { updateQuestKey, IUpdateQuestRequest } from "@/src/services/questService"; +import type { IUpdateQuestRequest } from "@/src/services/questService"; +import { updateQuestKey } from "@/src/services/questService"; import { getInventory } from "@/src/services/inventoryService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; export const updateQuestController: RequestHandler = async (req, res) => { const accountId = parseString(req.query.accountId); diff --git a/src/controllers/api/updateSessionController.ts b/src/controllers/api/updateSessionController.ts index 1bffbdb9..1644f815 100644 --- a/src/controllers/api/updateSessionController.ts +++ b/src/controllers/api/updateSessionController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { updateSession } from "@/src/managers/sessionManager"; const updateSessionGetController: RequestHandler = (_req, res) => { diff --git a/src/controllers/api/updateSongChallengeController.ts b/src/controllers/api/updateSongChallengeController.ts index e0a10fc8..c9cb2f2b 100644 --- a/src/controllers/api/updateSongChallengeController.ts +++ b/src/controllers/api/updateSongChallengeController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { addShipDecorations, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { RequestHandler } from "express"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { RequestHandler } from "express"; export const updateSongChallengeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/updateThemeController.ts b/src/controllers/api/updateThemeController.ts index ce31d27d..e3716a18 100644 --- a/src/controllers/api/updateThemeController.ts +++ b/src/controllers/api/updateThemeController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getInventory } from "@/src/services/inventoryService"; export const updateThemeController: RequestHandler = async (request, response) => { diff --git a/src/controllers/api/upgradesController.ts b/src/controllers/api/upgradesController.ts index 54aab912..0104e644 100644 --- a/src/controllers/api/upgradesController.ts +++ b/src/controllers/api/upgradesController.ts @@ -1,14 +1,15 @@ -import { RequestHandler } from "express"; -import { IUpgradesRequest } from "@/src/types/requestTypes"; -import { ArtifactPolarity, IAbilityOverride } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { IInventoryClient, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; +import type { IUpgradesRequest } from "@/src/types/requestTypes"; +import type { ArtifactPolarity, IAbilityOverride } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { IInventoryClient, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getRecipeByResult } from "@/src/services/itemDataService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { addInfestedFoundryXP, applyCheatsToInfestedFoundry } from "@/src/services/infestedFoundryService"; import { sendWsBroadcastTo } from "@/src/services/wsService"; -import { EquipmentFeatures, IEquipmentDatabase } from "@/src/types/equipmentTypes"; +import type { IEquipmentDatabase } from "@/src/types/equipmentTypes"; +import { EquipmentFeatures } from "@/src/types/equipmentTypes"; export const upgradesController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/valenceSwapController.ts b/src/controllers/api/valenceSwapController.ts index 0c3976b0..b02c9f8c 100644 --- a/src/controllers/api/valenceSwapController.ts +++ b/src/controllers/api/valenceSwapController.ts @@ -1,8 +1,8 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; -import { IInnateDamageFingerprint, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IOid } from "@/src/types/commonTypes"; +import type { IInnateDamageFingerprint, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const valenceSwapController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/api/wishlistController.ts b/src/controllers/api/wishlistController.ts index cfef2329..3be802b9 100644 --- a/src/controllers/api/wishlistController.ts +++ b/src/controllers/api/wishlistController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const wishlistController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/abilityOverrideController.ts b/src/controllers/custom/abilityOverrideController.ts index e67afb1e..ce100fad 100644 --- a/src/controllers/custom/abilityOverrideController.ts +++ b/src/controllers/custom/abilityOverrideController.ts @@ -1,7 +1,7 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const abilityOverrideController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/addCurrencyController.ts b/src/controllers/custom/addCurrencyController.ts index be14b8a3..347d8c4e 100644 --- a/src/controllers/custom/addCurrencyController.ts +++ b/src/controllers/custom/addCurrencyController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addFusionPoints, getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/custom/addItemsController.ts b/src/controllers/custom/addItemsController.ts index 30edd917..812476fb 100644 --- a/src/controllers/custom/addItemsController.ts +++ b/src/controllers/custom/addItemsController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, addItem } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const addItemsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/addMissingHelminthBlueprintsController.ts b/src/controllers/custom/addMissingHelminthBlueprintsController.ts index 4de501fe..c62ffdf5 100644 --- a/src/controllers/custom/addMissingHelminthBlueprintsController.ts +++ b/src/controllers/custom/addMissingHelminthBlueprintsController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory, addRecipes } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportRecipes } from "warframe-public-export-plus"; export const addMissingHelminthBlueprintsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/addMissingMaxRankModsController.ts b/src/controllers/custom/addMissingMaxRankModsController.ts index 99cd09ec..c89fa34c 100644 --- a/src/controllers/custom/addMissingMaxRankModsController.ts +++ b/src/controllers/custom/addMissingMaxRankModsController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportArcanes, ExportUpgrades } from "warframe-public-export-plus"; export const addMissingMaxRankModsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/addXpController.ts b/src/controllers/custom/addXpController.ts index 575fe978..876b5837 100644 --- a/src/controllers/custom/addXpController.ts +++ b/src/controllers/custom/addXpController.ts @@ -1,9 +1,9 @@ import { applyClientEquipmentUpdates, getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IOid } from "@/src/types/commonTypes"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IOid } from "@/src/types/commonTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; import { ExportMisc } from "warframe-public-export-plus"; export const addXpController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/changeModularPartsController.ts b/src/controllers/custom/changeModularPartsController.ts index ee1fd8f3..c3c43eaf 100644 --- a/src/controllers/custom/changeModularPartsController.ts +++ b/src/controllers/custom/changeModularPartsController.ts @@ -1,7 +1,7 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const changeModularPartsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/completeAllMissionsController.ts b/src/controllers/custom/completeAllMissionsController.ts index 0d53135f..d363e81e 100644 --- a/src/controllers/custom/completeAllMissionsController.ts +++ b/src/controllers/custom/completeAllMissionsController.ts @@ -3,8 +3,8 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addFixedLevelRewards } from "@/src/services/missionInventoryUpdateService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { IMissionReward } from "@/src/types/missionTypes"; -import { RequestHandler } from "express"; +import type { IMissionReward } from "@/src/types/missionTypes"; +import type { RequestHandler } from "express"; import { ExportRegions } from "warframe-public-export-plus"; export const completeAllMissionsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/configController.ts b/src/controllers/custom/configController.ts index fa1b4a2c..de1adc5c 100644 --- a/src/controllers/custom/configController.ts +++ b/src/controllers/custom/configController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { config, syncConfigWithDatabase } from "@/src/services/configService"; import { getAccountForRequest, isAdministrator } from "@/src/services/loginService"; import { saveConfig } from "@/src/services/configWriterService"; diff --git a/src/controllers/custom/createAccountController.ts b/src/controllers/custom/createAccountController.ts index bac12508..e74782c2 100644 --- a/src/controllers/custom/createAccountController.ts +++ b/src/controllers/custom/createAccountController.ts @@ -1,6 +1,6 @@ import { toCreateAccount, toDatabaseAccount } from "@/src/helpers/customHelpers/customHelpers"; import { createAccount, isNameTaken } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const createAccountController: RequestHandler = async (req, res) => { const createAccountData = toCreateAccount(req.body); diff --git a/src/controllers/custom/createMessageController.ts b/src/controllers/custom/createMessageController.ts index af67fd2d..5922f7e6 100644 --- a/src/controllers/custom/createMessageController.ts +++ b/src/controllers/custom/createMessageController.ts @@ -1,5 +1,6 @@ -import { createMessage, IMessageCreationTemplate } from "@/src/services/inboxService"; -import { RequestHandler } from "express"; +import type { IMessageCreationTemplate } from "@/src/services/inboxService"; +import { createMessage } from "@/src/services/inboxService"; +import type { RequestHandler } from "express"; export const createMessageController: RequestHandler = async (req, res) => { const message = req.body as (IMessageCreationTemplate & { ownerId: string })[] | undefined; diff --git a/src/controllers/custom/deleteAccountController.ts b/src/controllers/custom/deleteAccountController.ts index abe33315..f3c0869f 100644 --- a/src/controllers/custom/deleteAccountController.ts +++ b/src/controllers/custom/deleteAccountController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { Account, Ignore } from "@/src/models/loginModel"; import { Inbox } from "@/src/models/inboxModel"; diff --git a/src/controllers/custom/editSuitInvigorationUpgradeController.ts b/src/controllers/custom/editSuitInvigorationUpgradeController.ts index bc624911..0bebc979 100644 --- a/src/controllers/custom/editSuitInvigorationUpgradeController.ts +++ b/src/controllers/custom/editSuitInvigorationUpgradeController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const DEFAULT_UPGRADE_EXPIRY_MS = 7 * 24 * 60 * 60 * 1000; // 7 days diff --git a/src/controllers/custom/getAccountInfoController.ts b/src/controllers/custom/getAccountInfoController.ts index 668aebf4..e4038c55 100644 --- a/src/controllers/custom/getAccountInfoController.ts +++ b/src/controllers/custom/getAccountInfoController.ts @@ -1,7 +1,7 @@ import { AllianceMember, Guild, GuildMember } from "@/src/models/guildModel"; import { getInventory } from "@/src/services/inventoryService"; import { getAccountForRequest, isAdministrator } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getAccountInfoController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 23dd643f..3d46baff 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -1,5 +1,6 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getDict, getItemName, getString } from "@/src/services/itemDataService"; +import type { TRelicQuality } from "warframe-public-export-plus"; import { ExportAbilities, ExportArcanes, @@ -18,8 +19,7 @@ import { ExportSyndicates, ExportUpgrades, ExportWarframes, - ExportWeapons, - TRelicQuality + ExportWeapons } from "warframe-public-export-plus"; import allIncarnons from "@/static/fixed_responses/allIncarnonList.json"; import varzia from "@/static/fixed_responses/worldState/varzia.json"; diff --git a/src/controllers/custom/getNameController.ts b/src/controllers/custom/getNameController.ts index bc4a94f3..72a83fbc 100644 --- a/src/controllers/custom/getNameController.ts +++ b/src/controllers/custom/getNameController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest } from "@/src/services/loginService"; export const getNameController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/importController.ts b/src/controllers/custom/importController.ts index b6b5571b..70b61550 100644 --- a/src/controllers/custom/importController.ts +++ b/src/controllers/custom/importController.ts @@ -3,9 +3,9 @@ import { getInventory } from "@/src/services/inventoryService"; import { getLoadout } from "@/src/services/loadoutService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getPersonalRooms } from "@/src/services/personalRoomsService"; -import { IInventoryClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IGetShipResponse } from "@/src/types/personalRoomsTypes"; -import { RequestHandler } from "express"; +import type { IInventoryClient } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IGetShipResponse } from "@/src/types/personalRoomsTypes"; +import type { RequestHandler } from "express"; export const importController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -21,7 +21,11 @@ export const importController: RequestHandler = async (req, res) => { await loadout.save(); } - if ("Ship" in request.inventory || "Apartment" in request.inventory || "TailorShop" in request.inventory) { + if ( + request.inventory.Ship?.Rooms || // very old accounts may have Ship with { Features: [ ... ] } + "Apartment" in request.inventory || + "TailorShop" in request.inventory + ) { const personalRooms = await getPersonalRooms(accountId); importPersonalRooms(personalRooms, request.inventory); await personalRooms.save(); diff --git a/src/controllers/custom/ircDroppedController.ts b/src/controllers/custom/ircDroppedController.ts index 1621defc..c0af17ca 100644 --- a/src/controllers/custom/ircDroppedController.ts +++ b/src/controllers/custom/ircDroppedController.ts @@ -1,5 +1,5 @@ import { Account } from "@/src/models/loginModel"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const ircDroppedController: RequestHandler = async (req, res) => { if (!req.query.accountId) { diff --git a/src/controllers/custom/manageQuestsController.ts b/src/controllers/custom/manageQuestsController.ts index 365fb29c..88626935 100644 --- a/src/controllers/custom/manageQuestsController.ts +++ b/src/controllers/custom/manageQuestsController.ts @@ -7,7 +7,7 @@ import { giveKeyChainStageTriggered } from "@/src/services/questService"; import { logger } from "@/src/utils/logger"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportKeys } from "warframe-public-export-plus"; export const manageQuestsController: RequestHandler = async (req, res) => { diff --git a/src/controllers/custom/popArchonCrystalUpgradeController.ts b/src/controllers/custom/popArchonCrystalUpgradeController.ts index d6ef86e0..b7240682 100644 --- a/src/controllers/custom/popArchonCrystalUpgradeController.ts +++ b/src/controllers/custom/popArchonCrystalUpgradeController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/custom/pushArchonCrystalUpgradeController.ts b/src/controllers/custom/pushArchonCrystalUpgradeController.ts index 0db365fb..0dbf4d60 100644 --- a/src/controllers/custom/pushArchonCrystalUpgradeController.ts +++ b/src/controllers/custom/pushArchonCrystalUpgradeController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; diff --git a/src/controllers/custom/renameAccountController.ts b/src/controllers/custom/renameAccountController.ts index 11c28a22..e850b027 100644 --- a/src/controllers/custom/renameAccountController.ts +++ b/src/controllers/custom/renameAccountController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountForRequest, isAdministrator, isNameTaken } from "@/src/services/loginService"; import { config } from "@/src/services/configService"; import { saveConfig } from "@/src/services/configWriterService"; diff --git a/src/controllers/custom/setAccountCheatController.ts b/src/controllers/custom/setAccountCheatController.ts index 9647d2ad..75d0a71d 100644 --- a/src/controllers/custom/setAccountCheatController.ts +++ b/src/controllers/custom/setAccountCheatController.ts @@ -1,7 +1,7 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { IAccountCheats } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import type { IAccountCheats } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; export const setAccountCheatController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/setBoosterController.ts b/src/controllers/custom/setBoosterController.ts index b0a1ddbf..daa8c623 100644 --- a/src/controllers/custom/setBoosterController.ts +++ b/src/controllers/custom/setBoosterController.ts @@ -1,6 +1,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { getInventory } from "@/src/services/inventoryService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { ExportBoosters } from "warframe-public-export-plus"; const I32_MAX = 0x7fffffff; diff --git a/src/controllers/custom/setEvolutionProgressController.ts b/src/controllers/custom/setEvolutionProgressController.ts index 45c7c68b..80784e0b 100644 --- a/src/controllers/custom/setEvolutionProgressController.ts +++ b/src/controllers/custom/setEvolutionProgressController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const setEvolutionProgressController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/tunablesController.ts b/src/controllers/custom/tunablesController.ts index 535b90ee..87419fcc 100644 --- a/src/controllers/custom/tunablesController.ts +++ b/src/controllers/custom/tunablesController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; // This endpoint is specific to the OpenWF Bootstrapper: https://openwf.io/bootstrapper-manual diff --git a/src/controllers/custom/unlockAllIntrinsicsController.ts b/src/controllers/custom/unlockAllIntrinsicsController.ts index cd48bdcc..309ef40b 100644 --- a/src/controllers/custom/unlockAllIntrinsicsController.ts +++ b/src/controllers/custom/unlockAllIntrinsicsController.ts @@ -1,6 +1,6 @@ import { getInventory } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const unlockAllIntrinsicsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/updateFingerprintController.ts b/src/controllers/custom/updateFingerprintController.ts index df82d412..0aab7e38 100644 --- a/src/controllers/custom/updateFingerprintController.ts +++ b/src/controllers/custom/updateFingerprintController.ts @@ -1,7 +1,7 @@ import { getInventory } from "@/src/services/inventoryService"; -import { WeaponTypeInternal } from "@/src/services/itemDataService"; +import type { WeaponTypeInternal } from "@/src/services/itemDataService"; import { getAccountIdForRequest } from "@/src/services/loginService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const updateFingerprintController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/controllers/custom/webuiFileChangeDetectedController.ts b/src/controllers/custom/webuiFileChangeDetectedController.ts index 5078b679..a9144c49 100644 --- a/src/controllers/custom/webuiFileChangeDetectedController.ts +++ b/src/controllers/custom/webuiFileChangeDetectedController.ts @@ -1,6 +1,6 @@ import { args } from "@/src/helpers/commandLineArguments"; import { sendWsBroadcast } from "@/src/services/wsService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const webuiFileChangeDetectedController: RequestHandler = (req, res) => { if (args.dev && args.secret && req.query.secret == args.secret) { diff --git a/src/controllers/dynamic/aggregateSessionsController.ts b/src/controllers/dynamic/aggregateSessionsController.ts index a12c8d40..a205bdf3 100644 --- a/src/controllers/dynamic/aggregateSessionsController.ts +++ b/src/controllers/dynamic/aggregateSessionsController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import aggregateSessions from "@/static/fixed_responses/aggregateSessions.json"; const aggregateSessionsController: RequestHandler = (_req, res) => { diff --git a/src/controllers/dynamic/getGuildAdsController.ts b/src/controllers/dynamic/getGuildAdsController.ts index 1dbe8217..e4684fb7 100644 --- a/src/controllers/dynamic/getGuildAdsController.ts +++ b/src/controllers/dynamic/getGuildAdsController.ts @@ -1,7 +1,7 @@ import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; import { GuildAd } from "@/src/models/guildModel"; -import { IGuildAdInfoClient } from "@/src/types/guildTypes"; -import { RequestHandler } from "express"; +import type { IGuildAdInfoClient } from "@/src/types/guildTypes"; +import type { RequestHandler } from "express"; export const getGuildAdsController: RequestHandler = async (req, res) => { const ads = await GuildAd.find(req.query.tier ? { Tier: req.query.tier } : {}); diff --git a/src/controllers/dynamic/getProfileViewingDataController.ts b/src/controllers/dynamic/getProfileViewingDataController.ts index b89ab917..ccf404be 100644 --- a/src/controllers/dynamic/getProfileViewingDataController.ts +++ b/src/controllers/dynamic/getProfileViewingDataController.ts @@ -1,12 +1,15 @@ -import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; -import { Guild, GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel"; -import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import { fromDbOid, toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; +import type { TGuildDatabaseDocument } from "@/src/models/guildModel"; +import { Guild, GuildMember } from "@/src/models/guildModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; import { Account } from "@/src/models/loginModel"; -import { Stats, TStatsDatabaseDocument } from "@/src/models/statsModel"; +import type { TStatsDatabaseDocument } from "@/src/models/statsModel"; +import { Stats } from "@/src/models/statsModel"; import { allDailyAffiliationKeys } from "@/src/services/inventoryService"; -import { IMongoDate, IOid } from "@/src/types/commonTypes"; -import { +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IAffiliation, IAlignment, IChallengeProgress, @@ -15,14 +18,15 @@ import { IPlayerSkills, ITypeXPItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { RequestHandler } from "express"; +import { LoadoutIndex } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { RequestHandler } from "express"; import { catBreadHash, getJSONfromString } from "@/src/helpers/stringHelpers"; import { ExportCustoms, ExportDojoRecipes } from "warframe-public-export-plus"; -import { IStatsClient } from "@/src/types/statTypes"; +import type { IStatsClient } from "@/src/types/statTypes"; import { toStoreItem } from "@/src/services/itemDataService"; -import { FlattenMaps } from "mongoose"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { ILoadoutConfigClient } from "@/src/types/saveLoadoutTypes"; +import type { FlattenMaps } from "mongoose"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { ILoadoutConfigClient } from "@/src/types/saveLoadoutTypes"; const getProfileViewingDataByPlayerIdImpl = async (playerId: string): Promise => { const account = await Account.findById(playerId, "DisplayName"); @@ -298,30 +302,32 @@ const populateLoadout = async ( ): Promise => { if (inventory.CurrentLoadOutIds.length) { const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!; - result.LoadOutPreset = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!.toJSON(); + result.LoadOutPreset = loadout.NORMAL.id( + fromDbOid(inventory.CurrentLoadOutIds[LoadoutIndex.NORMAL]) + )!.toJSON(); result.LoadOutPreset.ItemId = undefined; const skins = new Set(); - if (result.LoadOutPreset.s) { + if (result.LoadOutPreset.s?.ItemId) { result.LoadOutInventory.Suits = [ - inventory.Suits.id(result.LoadOutPreset.s.ItemId.$oid)!.toJSON() + inventory.Suits.id(fromDbOid(result.LoadOutPreset.s.ItemId))!.toJSON() ]; resolveAndCollectSkins(inventory, skins, result.LoadOutInventory.Suits[0]); } - if (result.LoadOutPreset.p) { + if (result.LoadOutPreset.p?.ItemId) { result.LoadOutInventory.Pistols = [ - inventory.Pistols.id(result.LoadOutPreset.p.ItemId.$oid)!.toJSON() + inventory.Pistols.id(fromDbOid(result.LoadOutPreset.p.ItemId))!.toJSON() ]; resolveAndCollectSkins(inventory, skins, result.LoadOutInventory.Pistols[0]); } - if (result.LoadOutPreset.l) { + if (result.LoadOutPreset.l?.ItemId) { result.LoadOutInventory.LongGuns = [ - inventory.LongGuns.id(result.LoadOutPreset.l.ItemId.$oid)!.toJSON() + inventory.LongGuns.id(fromDbOid(result.LoadOutPreset.l.ItemId))!.toJSON() ]; resolveAndCollectSkins(inventory, skins, result.LoadOutInventory.LongGuns[0]); } - if (result.LoadOutPreset.m) { + if (result.LoadOutPreset.m?.ItemId) { result.LoadOutInventory.Melee = [ - inventory.Melee.id(result.LoadOutPreset.m.ItemId.$oid)!.toJSON() + inventory.Melee.id(fromDbOid(result.LoadOutPreset.m.ItemId))!.toJSON() ]; resolveAndCollectSkins(inventory, skins, result.LoadOutInventory.Melee[0]); } diff --git a/src/controllers/dynamic/worldStateController.ts b/src/controllers/dynamic/worldStateController.ts index 556eb91e..f6b538d5 100644 --- a/src/controllers/dynamic/worldStateController.ts +++ b/src/controllers/dynamic/worldStateController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getWorldState, populateDailyDeal, populateFissures } from "@/src/services/worldStateService"; import { version_compare } from "@/src/helpers/inventoryHelpers"; diff --git a/src/controllers/pay/getSkuCatalogController.ts b/src/controllers/pay/getSkuCatalogController.ts index baf79d58..8495c316 100644 --- a/src/controllers/pay/getSkuCatalogController.ts +++ b/src/controllers/pay/getSkuCatalogController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const getSkuCatalogController: RequestHandler = (_req, res) => { res.sendFile("static/fixed_responses/getSkuCatalog.json", { root: "./" }); diff --git a/src/controllers/pay/steamPacksController.ts b/src/controllers/pay/steamPacksController.ts index f0885786..ea4c5b89 100644 --- a/src/controllers/pay/steamPacksController.ts +++ b/src/controllers/pay/steamPacksController.ts @@ -1,4 +1,4 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; const steamPacksController: RequestHandler = (_req, res) => { res.sendStatus(200); diff --git a/src/controllers/stats/leaderboardController.ts b/src/controllers/stats/leaderboardController.ts index f5550f2b..cf321b1f 100644 --- a/src/controllers/stats/leaderboardController.ts +++ b/src/controllers/stats/leaderboardController.ts @@ -1,5 +1,5 @@ import { getLeaderboard } from "@/src/services/leaderboardService"; -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; export const leaderboardController: RequestHandler = async (req, res) => { const payload = JSON.parse(String(req.body)) as ILeaderboardRequest; diff --git a/src/controllers/stats/uploadController.ts b/src/controllers/stats/uploadController.ts index c1c1d2e5..8089677e 100644 --- a/src/controllers/stats/uploadController.ts +++ b/src/controllers/stats/uploadController.ts @@ -1,8 +1,8 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { updateStats } from "@/src/services/statsService"; -import { IStatsUpdate } from "@/src/types/statTypes"; -import { RequestHandler } from "express"; +import type { IStatsUpdate } from "@/src/types/statTypes"; +import type { RequestHandler } from "express"; const uploadController: RequestHandler = async (req, res) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/controllers/stats/viewController.ts b/src/controllers/stats/viewController.ts index 3ff5a848..3835e944 100644 --- a/src/controllers/stats/viewController.ts +++ b/src/controllers/stats/viewController.ts @@ -1,11 +1,11 @@ -import { RequestHandler } from "express"; +import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { config } from "@/src/services/configService"; import allScans from "@/static/fixed_responses/allScans.json"; import { ExportEnemies } from "warframe-public-export-plus"; import { getInventory } from "@/src/services/inventoryService"; import { getStats } from "@/src/services/statsService"; -import { IStatsClient } from "@/src/types/statTypes"; +import type { IStatsClient } from "@/src/types/statTypes"; const viewController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); diff --git a/src/helpers/customHelpers/customHelpers.ts b/src/helpers/customHelpers/customHelpers.ts index 0f920406..8732b681 100644 --- a/src/helpers/customHelpers/customHelpers.ts +++ b/src/helpers/customHelpers/customHelpers.ts @@ -1,5 +1,5 @@ -import { IAccountCreation } from "@/src/types/customTypes"; -import { IDatabaseAccountRequiredFields } from "@/src/types/loginTypes"; +import type { IAccountCreation } from "@/src/types/customTypes"; +import type { IDatabaseAccountRequiredFields } from "@/src/types/loginTypes"; import crypto from "crypto"; import { isString, parseEmail, parseString } from "@/src/helpers/general"; diff --git a/src/helpers/inventoryHelpers.ts b/src/helpers/inventoryHelpers.ts index 552ab3ec..74faaf15 100644 --- a/src/helpers/inventoryHelpers.ts +++ b/src/helpers/inventoryHelpers.ts @@ -1,7 +1,7 @@ -import { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; +import type { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; import { Types } from "mongoose"; -import { TRarity } from "warframe-public-export-plus"; -import { IFusionTreasure } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { TRarity } from "warframe-public-export-plus"; +import type { IFusionTreasure } from "@/src/types/inventoryTypes/inventoryTypes"; export const version_compare = (a: string, b: string): number => { const a_digits = a @@ -44,6 +44,11 @@ export const fromOid = (oid: IOidWithLegacySupport): string => { return (oid.$oid ?? oid.$id)!; }; +// For oids that may have been stored incorrectly +export const fromDbOid = (x: Types.ObjectId | IOid): Types.ObjectId => { + return "$oid" in x ? new Types.ObjectId(x.$oid) : x; +}; + export const toMongoDate = (date: Date): IMongoDate => { return { $date: { $numberLong: date.getTime().toString() } }; }; diff --git a/src/helpers/modularWeaponHelper.ts b/src/helpers/modularWeaponHelper.ts index 3e00531d..2849ae55 100644 --- a/src/helpers/modularWeaponHelper.ts +++ b/src/helpers/modularWeaponHelper.ts @@ -1,4 +1,4 @@ -import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; export const modularWeaponTypes: Record = { "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns", diff --git a/src/helpers/nemesisHelpers.ts b/src/helpers/nemesisHelpers.ts index 50eeef97..6b50e9fe 100644 --- a/src/helpers/nemesisHelpers.ts +++ b/src/helpers/nemesisHelpers.ts @@ -1,8 +1,8 @@ import { ExportRegions, ExportWarframes } from "warframe-public-export-plus"; -import { IInfNode, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInfNode, TNemesisFaction } from "@/src/types/inventoryTypes/inventoryTypes"; import { generateRewardSeed, getRewardAtPercentage, SRng } from "@/src/services/rngService"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { IOid } from "@/src/types/commonTypes"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IOid } from "@/src/types/commonTypes"; import { isArchwingMission } from "@/src/services/worldStateService"; type TInnateDamageTag = diff --git a/src/helpers/purchaseHelpers.ts b/src/helpers/purchaseHelpers.ts index 0685f457..8a460b41 100644 --- a/src/helpers/purchaseHelpers.ts +++ b/src/helpers/purchaseHelpers.ts @@ -1,4 +1,4 @@ -import { SlotPurchase, SlotPurchaseName } from "@/src/types/purchaseTypes"; +import type { SlotPurchase, SlotPurchaseName } from "@/src/types/purchaseTypes"; export const slotPurchaseNameToSlotName: SlotPurchase = { SuitSlotItem: { name: "SuitBin", purchaseQuantity: 1 }, diff --git a/src/helpers/relicHelper.ts b/src/helpers/relicHelper.ts index 5a34d342..8c34e683 100644 --- a/src/helpers/relicHelper.ts +++ b/src/helpers/relicHelper.ts @@ -1,11 +1,13 @@ -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { IVoidTearParticipantInfo } from "@/src/types/requestTypes"; -import { ExportRelics, ExportRewards, TRarity } from "warframe-public-export-plus"; -import { getRandomWeightedReward, IRngResult } from "@/src/services/rngService"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IVoidTearParticipantInfo } from "@/src/types/requestTypes"; +import type { TRarity } from "warframe-public-export-plus"; +import { ExportRelics, ExportRewards } from "warframe-public-export-plus"; +import type { IRngResult } from "@/src/services/rngService"; +import { getRandomWeightedReward } from "@/src/services/rngService"; import { logger } from "@/src/utils/logger"; import { addMiscItems, combineInventoryChanges } from "@/src/services/inventoryService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { config } from "@/src/services/configService"; export const crackRelic = async ( diff --git a/src/helpers/rivenHelper.ts b/src/helpers/rivenHelper.ts index 7b2be304..f89e9c70 100644 --- a/src/helpers/rivenHelper.ts +++ b/src/helpers/rivenHelper.ts @@ -1,4 +1,4 @@ -import { IUpgrade } from "warframe-public-export-plus"; +import type { IUpgrade } from "warframe-public-export-plus"; import { getRandomElement, getRandomInt, getRandomReward } from "@/src/services/rngService"; export type RivenFingerprint = IVeiledRivenFingerprint | IUnveiledRivenFingerprint; diff --git a/src/helpers/syndicateStandingHelper.ts b/src/helpers/syndicateStandingHelper.ts index ac478dda..ec9c939e 100644 --- a/src/helpers/syndicateStandingHelper.ts +++ b/src/helpers/syndicateStandingHelper.ts @@ -1,4 +1,4 @@ -import { ISyndicate } from "warframe-public-export-plus"; +import type { ISyndicate } from "warframe-public-export-plus"; export const getMaxStanding = (syndicate: ISyndicate, title: number): number => { if (!syndicate.titles) { diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts index ed397823..b6a11224 100644 --- a/src/managers/sessionManager.ts +++ b/src/managers/sessionManager.ts @@ -1,4 +1,4 @@ -import { ISession, IFindSessionRequest } from "@/src/types/session"; +import type { ISession, IFindSessionRequest } from "@/src/types/session"; import { logger } from "@/src/utils/logger"; import { JSONParse } from "json-with-bigint"; import { Types } from "mongoose"; diff --git a/src/middleware/errorHandler.ts b/src/middleware/errorHandler.ts index 92b30f6f..92c72d6c 100644 --- a/src/middleware/errorHandler.ts +++ b/src/middleware/errorHandler.ts @@ -1,4 +1,4 @@ -import { NextFunction, Request, Response } from "express"; +import type { NextFunction, Request, Response } from "express"; import { logError } from "@/src/utils/logger"; export const errorHandler = (err: Error, req: Request, res: Response, _next: NextFunction): void => { diff --git a/src/middleware/middleware.ts b/src/middleware/middleware.ts index 96fe391c..e611982b 100644 --- a/src/middleware/middleware.ts +++ b/src/middleware/middleware.ts @@ -1,5 +1,5 @@ import { logger } from "@/src/utils/logger"; -import { /*NextFunction,*/ Request, Response } from "express"; +import type { /*NextFunction,*/ Request, Response } from "express"; const unknownEndpointHandler = (request: Request, response: Response): void => { logger.error(`unknown endpoint ${request.method} ${request.path}`); diff --git a/src/models/commonModel.ts b/src/models/commonModel.ts index dd0ad85e..9c570fd2 100644 --- a/src/models/commonModel.ts +++ b/src/models/commonModel.ts @@ -1,5 +1,5 @@ import { Schema } from "mongoose"; -import { IColor, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { IColor, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes"; export const colorSchema = new Schema( { diff --git a/src/models/friendModel.ts b/src/models/friendModel.ts index f253101a..33d7721b 100644 --- a/src/models/friendModel.ts +++ b/src/models/friendModel.ts @@ -1,4 +1,4 @@ -import { IFriendship } from "@/src/types/friendTypes"; +import type { IFriendship } from "@/src/types/friendTypes"; import { model, Schema } from "mongoose"; const friendshipSchema = new Schema({ diff --git a/src/models/guildModel.ts b/src/models/guildModel.ts index eb005144..17c05203 100644 --- a/src/models/guildModel.ts +++ b/src/models/guildModel.ts @@ -1,4 +1,4 @@ -import { +import type { IGuildDatabase, IDojoComponentDatabase, ITechProjectDatabase, @@ -13,13 +13,14 @@ import { IDojoLeaderboardEntry, IGuildAdDatabase, IAllianceDatabase, - IAllianceMemberDatabase, - GuildPermission + IAllianceMemberDatabase } from "@/src/types/guildTypes"; -import { Document, Model, model, Schema, Types } from "mongoose"; +import { GuildPermission } from "@/src/types/guildTypes"; +import type { Document, Model } from "mongoose"; +import { model, Schema, Types } from "mongoose"; import { fusionTreasuresSchema, typeCountSchema } from "@/src/models/inventoryModels/inventoryModel"; import { pictureFrameInfoSchema } from "@/src/models/personalRoomsModel"; -import { IGoalProgressClient, IGoalProgressDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IGoalProgressClient, IGoalProgressDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; import { toOid } from "@/src/helpers/inventoryHelpers"; const dojoDecoSchema = new Schema({ diff --git a/src/models/inboxModel.ts b/src/models/inboxModel.ts index 27a5f0a7..47b8a709 100644 --- a/src/models/inboxModel.ts +++ b/src/models/inboxModel.ts @@ -1,7 +1,8 @@ -import { model, Schema, Types } from "mongoose"; +import type { Types } from "mongoose"; +import { model, Schema } from "mongoose"; import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; import { typeCountSchema } from "@/src/models/inventoryModels/inventoryModel"; -import { IMongoDate, IOid, ITypeCount } from "@/src/types/commonTypes"; +import type { IMongoDate, IOid, ITypeCount } from "@/src/types/commonTypes"; export interface IMessageClient extends Omit< diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 5d4bf32e..d13c2ef0 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1,5 +1,6 @@ -import { Document, Model, Schema, Types, model } from "mongoose"; -import { +import type { Document, Model } from "mongoose"; +import { Schema, Types, model } from "mongoose"; +import type { IRawUpgrade, IMiscItem, IInventoryDatabase, @@ -45,7 +46,6 @@ import { IDialogueClient, IUpgradeDatabase, TEquipmentKey, - equipmentKeys, IKubrowPetEggDatabase, IKubrowPetEggClient, ICustomMarkers, @@ -90,8 +90,9 @@ import { IKubrowPetPrintClient, IKubrowPetPrintDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IOid, ITypeCount } from "@/src/types/commonTypes"; -import { +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IOid, ITypeCount } from "@/src/types/commonTypes"; +import type { IAbilityOverride, ICrewShipCustomization, IFlavourItem, @@ -100,17 +101,17 @@ import { IOperatorConfigDatabase, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; -import { EquipmentSelectionSchema, oidSchema } from "@/src/models/inventoryModels/loadoutModel"; -import { ICountedStoreItem } from "warframe-public-export-plus"; +import { fromDbOid, toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; +import { EquipmentSelectionSchema } from "@/src/models/inventoryModels/loadoutModel"; +import type { ICountedStoreItem } from "warframe-public-export-plus"; import { colorSchema, shipCustomizationSchema } from "@/src/models/commonModel"; -import { +import type { IArchonCrystalUpgrade, ICrewShipMemberClient, ICrewShipMemberDatabase, ICrewShipMembersDatabase, - ICrewShipWeapon, - ICrewShipWeaponEmplacements, + ICrewShipWeaponDatabase, + ICrewShipWeaponEmplacementsDatabase, IEquipmentClient, IEquipmentDatabase, IKubrowPetDetailsClient, @@ -847,7 +848,6 @@ const endlessXpProgressSchema = new Schema( }, { _id: false } ); - endlessXpProgressSchema.set("toJSON", { transform(_doc, ret: Record) { const db = ret as IEndlessXpProgressDatabase; @@ -861,7 +861,8 @@ endlessXpProgressSchema.set("toJSON", { } } }); -const crewShipWeaponEmplacementsSchema = new Schema( + +const crewShipWeaponEmplacementsSchema = new Schema( { PRIMARY_A: EquipmentSelectionSchema, PRIMARY_B: EquipmentSelectionSchema, @@ -871,7 +872,7 @@ const crewShipWeaponEmplacementsSchema = new Schema { _id: false } ); -const crewShipWeaponSchema = new Schema( +const crewShipWeaponSchema = new Schema( { PILOT: crewShipWeaponEmplacementsSchema, PORT_GUNS: crewShipWeaponEmplacementsSchema, @@ -1427,11 +1428,33 @@ const inventorySchema = new Schema( accountOwnerId: Schema.Types.ObjectId, // SNS account cheats + dontSubtractPurchaseCreditCost: Boolean, + dontSubtractPurchasePlatinumCost: Boolean, + dontSubtractPurchaseItemCost: Boolean, + dontSubtractPurchaseStandingCost: Boolean, + dontSubtractVoidTraces: Boolean, + dontSubtractConsumables: Boolean, infiniteCredits: Boolean, infinitePlatinum: Boolean, infiniteEndo: Boolean, infiniteRegalAya: Boolean, infiniteHelminthMaterials: Boolean, + universalPolarityEverywhere: Boolean, + unlockDoubleCapacityPotatoesEverywhere: Boolean, + unlockExilusEverywhere: Boolean, + unlockArcanesEverywhere: Boolean, + syndicateMissionsRepeatable: Boolean, + instantFinishRivenChallenge: Boolean, + noDailyStandingLimits: Boolean, + noDailyFocusLimit: Boolean, + noArgonCrystalDecay: Boolean, + noMasteryRankUpCooldown: Boolean, + noVendorPurchaseLimits: Boolean, + noDeathMarks: Boolean, + noKimCooldowns: Boolean, + claimingBlueprintRefundsIngredients: Boolean, + instantResourceExtractorDrones: Boolean, + noResourceExtractorDronesDamage: Boolean, SubscribedToEmails: { type: Number, default: 0 }, SubscribedToEmailsPersonalized: { type: Number, default: 0 }, @@ -1748,7 +1771,7 @@ const inventorySchema = new Schema( HasContributedToDojo: Boolean, HWIDProtectEnabled: Boolean, LoadOutPresets: { type: Schema.Types.ObjectId, ref: "Loadout" }, - CurrentLoadOutIds: [oidSchema], + CurrentLoadOutIds: [Schema.Types.Mixed], // should be Types.ObjectId[] but might be IOid[] because of old commits RandomUpgradesIdentified: Number, BountyScore: Number, //ChallengeInstanceStates: [Schema.Types.Mixed], @@ -1808,12 +1831,15 @@ inventorySchema.set("toJSON", { const inventoryDatabase = returnedObject as Partial; const inventoryResponse = returnedObject as IInventoryClient; - if (inventoryDatabase.TrainingDate) { - inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate); - } if (inventoryDatabase.Created) { inventoryResponse.Created = toMongoDate(inventoryDatabase.Created); } + if (inventoryDatabase.CurrentLoadOutIds) { + inventoryResponse.CurrentLoadOutIds = inventoryDatabase.CurrentLoadOutIds.map(x => toOid(fromDbOid(x))); + } + if (inventoryDatabase.TrainingDate) { + inventoryResponse.TrainingDate = toMongoDate(inventoryDatabase.TrainingDate); + } if (inventoryDatabase.GuildId) { inventoryResponse.GuildId = toOid(inventoryDatabase.GuildId); } diff --git a/src/models/inventoryModels/loadoutModel.ts b/src/models/inventoryModels/loadoutModel.ts index c98a8025..1bb761db 100644 --- a/src/models/inventoryModels/loadoutModel.ts +++ b/src/models/inventoryModels/loadoutModel.ts @@ -1,21 +1,14 @@ -import { IOid } from "@/src/types/commonTypes"; -import { IEquipmentSelection } from "@/src/types/equipmentTypes"; -import { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; -import { Document, Model, Schema, Types, model } from "mongoose"; - -export const oidSchema = new Schema( - { - $oid: String - }, - { - _id: false - } -); +import { fromDbOid, toOid } from "@/src/helpers/inventoryHelpers"; +import type { IOid } from "@/src/types/commonTypes"; +import type { IEquipmentSelectionClient, IEquipmentSelectionDatabase } from "@/src/types/equipmentTypes"; +import type { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; +import type { Document, Model, Types } from "mongoose"; +import { Schema, model } from "mongoose"; //create a mongoose schema based on interface M -export const EquipmentSelectionSchema = new Schema( +export const EquipmentSelectionSchema = new Schema( { - ItemId: oidSchema, + ItemId: Schema.Types.Mixed, // should be Types.ObjectId but might be IOid because of old commits mod: Number, cus: Number, hide: Boolean @@ -24,6 +17,17 @@ export const EquipmentSelectionSchema = new Schema( _id: false } ); +EquipmentSelectionSchema.set("toJSON", { + virtuals: true, + transform(_doc, ret: Record) { + const db = ret as IEquipmentSelectionDatabase; + const client = ret as IEquipmentSelectionClient; + + if (db.ItemId) { + client.ItemId = toOid(fromDbOid(db.ItemId)); + } + } +}); export const loadoutConfigSchema = new Schema( { diff --git a/src/models/leaderboardModel.ts b/src/models/leaderboardModel.ts index a7375e0f..ceeb20f1 100644 --- a/src/models/leaderboardModel.ts +++ b/src/models/leaderboardModel.ts @@ -1,5 +1,6 @@ -import { Document, model, Schema, Types } from "mongoose"; -import { ILeaderboardEntryDatabase } from "@/src/types/leaderboardTypes"; +import type { Document, Types } from "mongoose"; +import { model, Schema } from "mongoose"; +import type { ILeaderboardEntryDatabase } from "@/src/types/leaderboardTypes"; const leaderboardEntrySchema = new Schema( { diff --git a/src/models/loginModel.ts b/src/models/loginModel.ts index a42a7229..c7331d83 100644 --- a/src/models/loginModel.ts +++ b/src/models/loginModel.ts @@ -1,5 +1,6 @@ -import { IDatabaseAccountJson, IIgnore } from "@/src/types/loginTypes"; -import { model, Schema, SchemaOptions } from "mongoose"; +import type { IDatabaseAccountJson, IIgnore } from "@/src/types/loginTypes"; +import type { SchemaOptions } from "mongoose"; +import { model, Schema } from "mongoose"; const opts = { toJSON: { virtuals: true }, diff --git a/src/models/personalRoomsModel.ts b/src/models/personalRoomsModel.ts index f812a8e6..5735014c 100644 --- a/src/models/personalRoomsModel.ts +++ b/src/models/personalRoomsModel.ts @@ -1,5 +1,5 @@ import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers"; -import { +import type { IApartmentDatabase, ICustomizationInfoDatabase, IFavouriteLoadoutDatabase, @@ -16,7 +16,8 @@ import { ITailorShopDatabase, PersonalRoomsModelType } from "@/src/types/personalRoomsTypes"; -import { Schema, Types, model } from "mongoose"; +import type { Types } from "mongoose"; +import { Schema, model } from "mongoose"; import { colorSchema, shipCustomizationSchema } from "@/src/models/commonModel"; import { loadoutConfigSchema } from "@/src/models/inventoryModels/loadoutModel"; diff --git a/src/models/shipModel.ts b/src/models/shipModel.ts index ee8df2fe..d6dd5ad9 100644 --- a/src/models/shipModel.ts +++ b/src/models/shipModel.ts @@ -1,8 +1,9 @@ -import { Document, Schema, Types, model } from "mongoose"; -import { IShipDatabase } from "@/src/types/shipTypes"; +import type { Document, Types } from "mongoose"; +import { Schema, model } from "mongoose"; +import type { IShipDatabase } from "@/src/types/shipTypes"; import { toOid } from "@/src/helpers/inventoryHelpers"; import { colorSchema } from "@/src/models/commonModel"; -import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes"; const shipSchema = new Schema( { diff --git a/src/models/statsModel.ts b/src/models/statsModel.ts index af015cc0..53a06228 100644 --- a/src/models/statsModel.ts +++ b/src/models/statsModel.ts @@ -1,5 +1,15 @@ -import { Document, Schema, Types, model } from "mongoose"; -import { IEnemy, IMission, IScan, ITutorial, IAbility, IWeapon, IStatsDatabase, IRace } from "@/src/types/statTypes"; +import type { Document, Types } from "mongoose"; +import { Schema, model } from "mongoose"; +import type { + IEnemy, + IMission, + IScan, + ITutorial, + IAbility, + IWeapon, + IStatsDatabase, + IRace +} from "@/src/types/statTypes"; const abilitySchema = new Schema( { diff --git a/src/models/worldStateModel.ts b/src/models/worldStateModel.ts index e7a712fe..3fae89c7 100644 --- a/src/models/worldStateModel.ts +++ b/src/models/worldStateModel.ts @@ -1,4 +1,4 @@ -import { IDailyDealDatabase, IFissureDatabase } from "@/src/types/worldStateTypes"; +import type { IDailyDealDatabase, IFissureDatabase } from "@/src/types/worldStateTypes"; import { model, Schema } from "mongoose"; const fissureSchema = new Schema({ diff --git a/src/services/configService.ts b/src/services/configService.ts index 1ecba208..dabb8af7 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -4,7 +4,7 @@ import { repoDir } from "@/src/helpers/pathHelper"; import { args } from "@/src/helpers/commandLineArguments"; import { Inbox } from "@/src/models/inboxModel"; -export interface IConfig { +export interface IConfig extends IConfigRemovedOptions { mongodbUrl: string; logger: { files: boolean; @@ -20,38 +20,16 @@ export interface IConfig { skipTutorial?: boolean; skipAllDialogue?: boolean; unlockAllScans?: boolean; - claimingBlueprintRefundsIngredients?: boolean; - dontSubtractPurchaseCreditCost?: boolean; - dontSubtractPurchasePlatinumCost?: boolean; - dontSubtractPurchaseItemCost?: boolean; - dontSubtractPurchaseStandingCost?: boolean; - dontSubtractVoidTraces?: boolean; - dontSubtractConsumables?: boolean; unlockAllShipFeatures?: boolean; unlockAllShipDecorations?: boolean; unlockAllFlavourItems?: boolean; unlockAllSkins?: boolean; unlockAllCapturaScenes?: boolean; unlockAllDecoRecipes?: boolean; - universalPolarityEverywhere?: boolean; - unlockDoubleCapacityPotatoesEverywhere?: boolean; - unlockExilusEverywhere?: boolean; - unlockArcanesEverywhere?: boolean; - noDailyStandingLimits?: boolean; - noDailyFocusLimit?: boolean; - noArgonCrystalDecay?: boolean; - noMasteryRankUpCooldown?: boolean; - noVendorPurchaseLimits?: boolean; - noDeathMarks?: boolean; - noKimCooldowns?: boolean; fullyStockedVendors?: boolean; baroAlwaysAvailable?: boolean; baroFullyStocked?: boolean; - syndicateMissionsRepeatable?: boolean; unlockAllProfitTakerStages?: boolean; - instantFinishRivenChallenge?: boolean; - instantResourceExtractorDrones?: boolean; - noResourceExtractorDronesDamage?: boolean; skipClanKeyCrafting?: boolean; noDojoRoomBuildStage?: boolean; noDojoDecoBuildStage?: boolean; @@ -115,6 +93,40 @@ export interface IConfig { }; } +export const configRemovedOptionsKeys = [ + "infiniteCredits", + "infinitePlatinum", + "infiniteEndo", + "infiniteRegalAya", + "infiniteHelminthMaterials", + "claimingBlueprintRefundsIngredients", + "dontSubtractPurchaseCreditCost", + "dontSubtractPurchasePlatinumCost", + "dontSubtractPurchaseItemCost", + "dontSubtractPurchaseStandingCost", + "dontSubtractVoidTraces", + "dontSubtractConsumables", + "universalPolarityEverywhere", + "unlockDoubleCapacityPotatoesEverywhere", + "unlockExilusEverywhere", + "unlockArcanesEverywhere", + "noDailyStandingLimits", + "noDailyFocusLimit", + "noArgonCrystalDecay", + "noMasteryRankUpCooldown", + "noVendorPurchaseLimits", + "noDeathMarks", + "noKimCooldowns", + "syndicateMissionsRepeatable", + "instantFinishRivenChallenge", + "instantResourceExtractorDrones", + "noResourceExtractorDronesDamage" +] as const; + +type IConfigRemovedOptions = { + [K in (typeof configRemovedOptionsKeys)[number]]?: boolean; +}; + export const configPath = path.join(repoDir, args.configPath ?? "config.json"); export const config: IConfig = { diff --git a/src/services/configWatcherService.ts b/src/services/configWatcherService.ts index d028b8ee..19b5c870 100644 --- a/src/services/configWatcherService.ts +++ b/src/services/configWatcherService.ts @@ -1,6 +1,12 @@ import chokidar from "chokidar"; import { logger } from "@/src/utils/logger"; -import { config, configPath, loadConfig, syncConfigWithDatabase } from "@/src/services/configService"; +import { + config, + configPath, + configRemovedOptionsKeys, + loadConfig, + syncConfigWithDatabase +} from "@/src/services/configService"; import { saveConfig, shouldReloadConfig } from "@/src/services/configWriterService"; import { getWebPorts, startWebServer, stopWebServer } from "@/src/services/webService"; import { sendWsBroadcast } from "@/src/services/wsService"; @@ -34,6 +40,13 @@ chokidar.watch(configPath).on("change", () => { export const validateConfig = (): void => { let modified = false; + for (const key of configRemovedOptionsKeys) { + if (config[key] !== undefined) { + logger.debug(`Spotted removed option ${key} with value ${config[key]} in config.json.`); + delete config[key]; + modified = true; + } + } if (config.administratorNames) { if (!Array.isArray(config.administratorNames)) { config.administratorNames = [config.administratorNames]; diff --git a/src/services/friendService.ts b/src/services/friendService.ts index 125dfda1..fd8e24bb 100644 --- a/src/services/friendService.ts +++ b/src/services/friendService.ts @@ -1,8 +1,8 @@ -import { IFriendInfo } from "@/src/types/friendTypes"; +import type { IFriendInfo } from "@/src/types/friendTypes"; import { getInventory } from "@/src/services/inventoryService"; import { config } from "@/src/services/configService"; import { Account } from "@/src/models/loginModel"; -import { Types } from "mongoose"; +import type { Types } from "mongoose"; import { Friendship } from "@/src/models/friendModel"; import { fromOid, toMongoDate } from "@/src/helpers/inventoryHelpers"; diff --git a/src/services/guildService.ts b/src/services/guildService.ts index cd7ee147..d1276202 100644 --- a/src/services/guildService.ts +++ b/src/services/guildService.ts @@ -1,10 +1,11 @@ -import { Request } from "express"; -import { getAccountIdForRequest, TAccountDocument } from "@/src/services/loginService"; +import type { Request } from "express"; +import type { TAccountDocument } from "@/src/services/loginService"; +import { getAccountIdForRequest } from "@/src/services/loginService"; import { addLevelKeys, addRecipes, combineInventoryChanges, getInventory } from "@/src/services/inventoryService"; -import { Alliance, AllianceMember, Guild, GuildAd, GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { - GuildPermission, +import type { TGuildDatabaseDocument } from "@/src/models/guildModel"; +import { Alliance, AllianceMember, Guild, GuildAd, GuildMember } from "@/src/models/guildModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IAllianceClient, IAllianceDatabase, IAllianceMemberClient, @@ -20,20 +21,22 @@ import { IGuildVault, ITechProjectDatabase } from "@/src/types/guildTypes"; +import { GuildPermission } from "@/src/types/guildTypes"; import { toMongoDate, toOid, toOid2 } from "@/src/helpers/inventoryHelpers"; -import { Types } from "mongoose"; -import { ExportDojoRecipes, ExportResources, IDojoBuild, IDojoResearch } from "warframe-public-export-plus"; +import type { Types } from "mongoose"; +import type { IDojoBuild, IDojoResearch } from "warframe-public-export-plus"; +import { ExportDojoRecipes, ExportResources } from "warframe-public-export-plus"; import { logger } from "@/src/utils/logger"; import { config } from "@/src/services/configService"; import { getRandomInt } from "@/src/services/rngService"; import { Inbox } from "@/src/models/inboxModel"; -import { IFusionTreasure } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IFusionTreasure } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import { parallelForeach } from "@/src/utils/async-utils"; import allDecoRecipes from "@/static/fixed_responses/allDecoRecipes.json"; import { createMessage } from "@/src/services/inboxService"; import { addAccountDataToFriendInfo, addInventoryDataToFriendInfo } from "@/src/services/friendService"; -import { ITypeCount } from "@/src/types/commonTypes"; +import type { ITypeCount } from "@/src/types/commonTypes"; export const getGuildForRequest = async (req: Request): Promise => { const accountId = await getAccountIdForRequest(req); diff --git a/src/services/importService.ts b/src/services/importService.ts index 518dacf8..493f8735 100644 --- a/src/services/importService.ts +++ b/src/services/importService.ts @@ -1,12 +1,11 @@ import { Types } from "mongoose"; -import { +import type { IItemConfig, IOperatorConfigClient, IOperatorConfigDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { IMongoDate } from "@/src/types/commonTypes"; -import { - equipmentKeys, +import type { IMongoDate } from "@/src/types/commonTypes"; +import type { IDialogueClient, IDialogueDatabase, IDialogueHistoryClient, @@ -26,25 +25,32 @@ import { IWeaponSkinClient, IWeaponSkinDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { ILoadoutConfigClient, ILoadoutConfigDatabase, ILoadoutDatabase, ILoadOutPresets } from "@/src/types/saveLoadoutTypes"; import { slotNames } from "@/src/types/purchaseTypes"; -import { +import type { ICrewShipMemberClient, ICrewShipMemberDatabase, ICrewShipMembersClient, ICrewShipMembersDatabase, + ICrewShipWeaponClient, + ICrewShipWeaponDatabase, + ICrewShipWeaponEmplacementsClient, + ICrewShipWeaponEmplacementsDatabase, IEquipmentClient, IEquipmentDatabase, + IEquipmentSelectionClient, + IEquipmentSelectionDatabase, IKubrowPetDetailsClient, IKubrowPetDetailsDatabase } from "@/src/types/equipmentTypes"; -import { +import type { IApartmentClient, IApartmentDatabase, ICustomizationInfoClient, @@ -84,7 +90,8 @@ const convertEquipment = (client: IEquipmentClient): IEquipmentDatabase => { Expiry: convertOptionalDate(client.Expiry), UpgradesExpiry: convertOptionalDate(client.UpgradesExpiry), UmbraDate: convertOptionalDate(client.UmbraDate), - CrewMembers: client.CrewMembers ? convertCrewShipMembers(client.CrewMembers) : undefined, + Weapon: client.Weapon ? importCrewShipWeapon(client.Weapon) : undefined, + CrewMembers: client.CrewMembers ? importCrewShipMembers(client.CrewMembers) : undefined, Details: client.Details ? convertKubrowDetails(client.Details) : undefined, // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition Configs: client.Configs @@ -133,14 +140,43 @@ const replaceSlots = (db: ISlots, client: ISlots): void => { db.Slots = client.Slots; }; -export const importCrewMemberId = (crewMemberId: ICrewShipMemberClient): ICrewShipMemberDatabase => { +const convertEquipmentSelection = (es: IEquipmentSelectionClient): IEquipmentSelectionDatabase => { + const { ItemId, ...rest } = es; + return { + ...rest, + ItemId: ItemId ? new Types.ObjectId(ItemId.$oid) : undefined + }; +}; + +const convertCrewShipWeaponEmplacements = ( + obj: ICrewShipWeaponEmplacementsClient +): ICrewShipWeaponEmplacementsDatabase => { + return { + PRIMARY_A: obj.PRIMARY_A ? convertEquipmentSelection(obj.PRIMARY_A) : undefined, + PRIMARY_B: obj.PRIMARY_B ? convertEquipmentSelection(obj.PRIMARY_B) : undefined, + SECONDARY_A: obj.SECONDARY_A ? convertEquipmentSelection(obj.SECONDARY_A) : undefined, + SECONDARY_B: obj.SECONDARY_B ? convertEquipmentSelection(obj.SECONDARY_B) : undefined + }; +}; + +export const importCrewShipWeapon = (weapon: ICrewShipWeaponClient): ICrewShipWeaponDatabase => { + return { + PILOT: weapon.PILOT ? convertCrewShipWeaponEmplacements(weapon.PILOT) : undefined, + PORT_GUNS: weapon.PORT_GUNS ? convertCrewShipWeaponEmplacements(weapon.PORT_GUNS) : undefined, + STARBOARD_GUNS: weapon.STARBOARD_GUNS ? convertCrewShipWeaponEmplacements(weapon.STARBOARD_GUNS) : undefined, + ARTILLERY: weapon.ARTILLERY ? convertCrewShipWeaponEmplacements(weapon.ARTILLERY) : undefined, + SCANNER: weapon.SCANNER ? convertCrewShipWeaponEmplacements(weapon.SCANNER) : undefined + }; +}; + +const importCrewMemberId = (crewMemberId: ICrewShipMemberClient): ICrewShipMemberDatabase => { if (crewMemberId.ItemId) { return { ItemId: new Types.ObjectId(crewMemberId.ItemId.$oid) }; } return { NemesisFingerprint: BigInt(crewMemberId.NemesisFingerprint ?? 0) }; }; -const convertCrewShipMembers = (client: ICrewShipMembersClient): ICrewShipMembersDatabase => { +export const importCrewShipMembers = (client: ICrewShipMembersClient): ICrewShipMembersDatabase => { return { SLOT_A: client.SLOT_A ? importCrewMemberId(client.SLOT_A) : undefined, SLOT_B: client.SLOT_B ? importCrewMemberId(client.SLOT_B) : undefined, @@ -429,34 +465,40 @@ export const importInventory = (db: TInventoryDatabaseDocument, client: Partial< } }; -const convertLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => { +export const importLoadOutConfig = (client: ILoadoutConfigClient): ILoadoutConfigDatabase => { const { ItemId, ...rest } = client; return { ...rest, - _id: new Types.ObjectId(ItemId.$oid) + _id: new Types.ObjectId(ItemId.$oid), + s: client.s ? convertEquipmentSelection(client.s) : undefined, + p: client.p ? convertEquipmentSelection(client.p) : undefined, + l: client.l ? convertEquipmentSelection(client.l) : undefined, + m: client.m ? convertEquipmentSelection(client.m) : undefined, + h: client.h ? convertEquipmentSelection(client.h) : undefined, + a: client.a ? convertEquipmentSelection(client.a) : undefined }; }; export const importLoadOutPresets = (db: ILoadoutDatabase, client: ILoadOutPresets): void => { - db.NORMAL = client.NORMAL.map(convertLoadOutConfig); - db.SENTINEL = client.SENTINEL.map(convertLoadOutConfig); - db.ARCHWING = client.ARCHWING.map(convertLoadOutConfig); - db.NORMAL_PVP = client.NORMAL_PVP.map(convertLoadOutConfig); - db.LUNARO = client.LUNARO.map(convertLoadOutConfig); - db.OPERATOR = client.OPERATOR.map(convertLoadOutConfig); - db.GEAR = client.GEAR?.map(convertLoadOutConfig); - db.KDRIVE = client.KDRIVE.map(convertLoadOutConfig); - db.DATAKNIFE = client.DATAKNIFE.map(convertLoadOutConfig); - db.MECH = client.MECH.map(convertLoadOutConfig); - db.OPERATOR_ADULT = client.OPERATOR_ADULT.map(convertLoadOutConfig); - db.DRIFTER = client.DRIFTER.map(convertLoadOutConfig); + db.NORMAL = client.NORMAL.map(importLoadOutConfig); + db.SENTINEL = client.SENTINEL.map(importLoadOutConfig); + db.ARCHWING = client.ARCHWING.map(importLoadOutConfig); + db.NORMAL_PVP = client.NORMAL_PVP.map(importLoadOutConfig); + db.LUNARO = client.LUNARO.map(importLoadOutConfig); + db.OPERATOR = client.OPERATOR.map(importLoadOutConfig); + db.GEAR = client.GEAR?.map(importLoadOutConfig); + db.KDRIVE = client.KDRIVE.map(importLoadOutConfig); + db.DATAKNIFE = client.DATAKNIFE.map(importLoadOutConfig); + db.MECH = client.MECH.map(importLoadOutConfig); + db.OPERATOR_ADULT = client.OPERATOR_ADULT.map(importLoadOutConfig); + db.DRIFTER = client.DRIFTER.map(importLoadOutConfig); }; export const convertCustomizationInfo = (client: ICustomizationInfoClient): ICustomizationInfoDatabase => { return { ...client, - LoadOutPreset: client.LoadOutPreset ? convertLoadOutConfig(client.LoadOutPreset) : undefined, - VehiclePreset: client.VehiclePreset ? convertLoadOutConfig(client.VehiclePreset) : undefined + LoadOutPreset: client.LoadOutPreset ? importLoadOutConfig(client.LoadOutPreset) : undefined, + VehiclePreset: client.VehiclePreset ? importLoadOutConfig(client.VehiclePreset) : undefined }; }; @@ -481,7 +523,7 @@ const convertShip = (client: IOrbiterClient): IOrbiterDatabase => { ...client, ShipInterior: { ...client.ShipInterior, - Colors: Array.isArray(client.ShipInterior.Colors) ? {} : client.ShipInterior.Colors + Colors: typeof client.ShipInterior == "object" ? client.ShipInterior.Colors : undefined }, Rooms: client.Rooms.map(convertRoom), FavouriteLoadoutId: client.FavouriteLoadoutId ? new Types.ObjectId(client.FavouriteLoadoutId.$oid) : undefined @@ -528,7 +570,7 @@ const convertTailorShop = (client: ITailorShop): ITailorShopDatabase => { }; export const importPersonalRooms = (db: IPersonalRoomsDatabase, client: Partial): void => { - if (client.Ship !== undefined) db.Ship = convertShip(client.Ship); + if (client.Ship?.Rooms) db.Ship = convertShip(client.Ship); if (client.Apartment !== undefined) db.Apartment = convertApartment(client.Apartment); if (client.TailorShop !== undefined) db.TailorShop = convertTailorShop(client.TailorShop); }; diff --git a/src/services/inboxService.ts b/src/services/inboxService.ts index ce8bddbb..f503fdd0 100644 --- a/src/services/inboxService.ts +++ b/src/services/inboxService.ts @@ -1,7 +1,9 @@ -import { IMessageDatabase, Inbox } from "@/src/models/inboxModel"; +import type { IMessageDatabase } from "@/src/models/inboxModel"; +import { Inbox } from "@/src/models/inboxModel"; import { getAccountForRequest } from "@/src/services/loginService"; -import { HydratedDocument, Types } from "mongoose"; -import { Request } from "express"; +import type { HydratedDocument } from "mongoose"; +import { Types } from "mongoose"; +import type { Request } from "express"; import { unixTimesInMs } from "@/src/constants/timeConstants"; import { config } from "@/src/services/configService"; diff --git a/src/services/infestedFoundryService.ts b/src/services/infestedFoundryService.ts index bfef29ab..66177e25 100644 --- a/src/services/infestedFoundryService.ts +++ b/src/services/infestedFoundryService.ts @@ -1,12 +1,12 @@ import { ExportRecipes } from "warframe-public-export-plus"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; -import { +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { IAccountCheats, IInfestedFoundryClient, IInfestedFoundryDatabase } from "@/src/types/inventoryTypes/inventoryTypes"; import { addRecipes } from "@/src/services/inventoryService"; -import { ITypeCount } from "@/src/types/commonTypes"; +import type { ITypeCount } from "@/src/types/commonTypes"; export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundryDatabase, delta: number): ITypeCount[] => { const recipeChanges: ITypeCount[] = []; diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index bf679f1b..9069e9d6 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -1,14 +1,15 @@ -import { Inventory, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { config } from "@/src/services/configService"; import { Types } from "mongoose"; -import { SlotNames, IInventoryChanges, IBinChanges, slotNames, IAffiliationMods } from "@/src/types/purchaseTypes"; -import { +import type { SlotNames, IInventoryChanges, IBinChanges, IAffiliationMods } from "@/src/types/purchaseTypes"; +import { slotNames } from "@/src/types/purchaseTypes"; +import type { IChallengeProgress, IMiscItem, IMission, IRawUpgrade, ISeasonChallenge, - InventorySlot, IWeaponSkinClient, TEquipmentKey, IFusionTreasure, @@ -25,14 +26,15 @@ import { INemesisWeaponTargetFingerprint, INemesisPetTargetFingerprint, IDialogueDatabase, - IKubrowPetPrintClient, - equipmentKeys + IKubrowPetPrintClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IGenericUpdate, IUpdateNodeIntrosResponse } from "@/src/types/genericUpdate"; -import { IKeyChainRequest, IMissionInventoryUpdateRequest } from "@/src/types/requestTypes"; +import { InventorySlot, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IGenericUpdate, IUpdateNodeIntrosResponse } from "@/src/types/genericUpdate"; +import type { IKeyChainRequest, IMissionInventoryUpdateRequest } from "@/src/types/requestTypes"; import { logger } from "@/src/utils/logger"; import { convertInboxMessage, fromStoreItem, getKeyChainItems } from "@/src/services/itemDataService"; -import { IFlavourItem, IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { IFlavourItem, IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { IDefaultUpgrade, IPowersuit, ISentinel, TStandingLimitBin } from "warframe-public-export-plus"; import { ExportArcanes, ExportBoosters, @@ -54,22 +56,19 @@ import { ExportSyndicates, ExportUpgrades, ExportWarframes, - ExportWeapons, - IDefaultUpgrade, - IPowersuit, - ISentinel, - TStandingLimitBin + ExportWeapons } from "warframe-public-export-plus"; import { createShip } from "@/src/services/shipService"; +import type { TTraitsPool } from "@/src/helpers/inventoryHelpers"; import { catbrowDetails, + fromDbOid, fromMongoDate, fromOid, kubrowDetails, kubrowFurPatternsWeights, kubrowWeights, - toOid, - TTraitsPool + toOid } from "@/src/helpers/inventoryHelpers"; import { addQuestKey, completeQuest } from "@/src/services/questService"; import { handleBundleAcqusition } from "@/src/services/purchaseService"; @@ -81,23 +80,24 @@ import { getRandomWeightedReward, SRng } from "@/src/services/rngService"; -import { createMessage, IMessageCreationTemplate } from "@/src/services/inboxService"; +import type { IMessageCreationTemplate } from "@/src/services/inboxService"; +import { createMessage } from "@/src/services/inboxService"; import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper"; import { getNightwaveSyndicateTag, getWorldState } from "@/src/services/worldStateService"; -import { ICalendarSeason } from "@/src/types/worldStateTypes"; -import { generateNemesisProfile, INemesisProfile } from "@/src/helpers/nemesisHelpers"; -import { TAccountDocument } from "@/src/services/loginService"; +import type { ICalendarSeason } from "@/src/types/worldStateTypes"; +import type { INemesisProfile } from "@/src/helpers/nemesisHelpers"; +import { generateNemesisProfile } from "@/src/helpers/nemesisHelpers"; +import type { TAccountDocument } from "@/src/services/loginService"; import { unixTimesInMs } from "@/src/constants/timeConstants"; import { addString } from "@/src/helpers/stringHelpers"; -import { - EquipmentFeatures, +import type { IEquipmentClient, IEquipmentDatabase, IKubrowPetDetailsDatabase, - ITraits, - Status + ITraits } from "@/src/types/equipmentTypes"; -import { ITypeCount } from "@/src/types/commonTypes"; +import { EquipmentFeatures, Status } from "@/src/types/equipmentTypes"; +import type { ITypeCount } from "@/src/types/commonTypes"; export const createInventory = async ( accountOwnerId: Types.ObjectId, @@ -1299,15 +1299,19 @@ const standingLimitBinToInventoryKey: Record< export const allDailyAffiliationKeys: (keyof IDailyAffiliations)[] = Object.values(standingLimitBinToInventoryKey); -const getStandingLimit = (inventory: IDailyAffiliations, bin: TStandingLimitBin): number => { - if (bin == "STANDING_LIMIT_BIN_NONE" || config.noDailyStandingLimits) { +const getStandingLimit = (inventory: TInventoryDatabaseDocument, bin: TStandingLimitBin): number => { + if (bin == "STANDING_LIMIT_BIN_NONE" || inventory.noDailyStandingLimits) { return Number.MAX_SAFE_INTEGER; } return inventory[standingLimitBinToInventoryKey[bin]]; }; -const updateStandingLimit = (inventory: IDailyAffiliations, bin: TStandingLimitBin, subtrahend: number): void => { - if (bin != "STANDING_LIMIT_BIN_NONE" && !config.noDailyStandingLimits) { +const updateStandingLimit = ( + inventory: TInventoryDatabaseDocument, + bin: TStandingLimitBin, + subtrahend: number +): void => { + if (bin != "STANDING_LIMIT_BIN_NONE" && !inventory.noDailyStandingLimits) { inventory[standingLimitBinToInventoryKey[bin]] -= subtrahend; } }; @@ -1922,7 +1926,7 @@ export const addFocusXpIncreases = (inventory: TInventoryDatabaseDocument, focus inventory.FocusXP.AP_WARD += focusXpPlus[FocusType.AP_WARD]; } - if (!config.noDailyFocusLimit) { + if (!inventory.noDailyFocusLimit) { inventory.DailyFocus -= focusXpPlus.reduce((a, b) => a + b, 0); } }; @@ -2232,6 +2236,8 @@ export const setupKahlSyndicate = (inventory: TInventoryDatabaseDocument): void }; export const cleanupInventory = (inventory: TInventoryDatabaseDocument): void => { + inventory.CurrentLoadOutIds = inventory.CurrentLoadOutIds.map(fromDbOid); + let index = inventory.MiscItems.findIndex(x => x.ItemType == ""); if (index != -1) { inventory.MiscItems.splice(index, 1); diff --git a/src/services/itemDataService.ts b/src/services/itemDataService.ts index 96d80c1a..ccb0175c 100644 --- a/src/services/itemDataService.ts +++ b/src/services/itemDataService.ts @@ -1,4 +1,12 @@ -import { IKeyChainRequest } from "@/src/types/requestTypes"; +import type { IKeyChainRequest } from "@/src/types/requestTypes"; +import type { + IDefaultUpgrade, + IInboxMessage, + IKey, + IMissionReward, + IRecipe, + TReward +} from "warframe-public-export-plus"; import { dict_de, dict_en, @@ -26,15 +34,9 @@ import { ExportResources, ExportSentinels, ExportWarframes, - ExportWeapons, - IDefaultUpgrade, - IInboxMessage, - IKey, - IMissionReward, - IRecipe, - TReward + ExportWeapons } from "warframe-public-export-plus"; -import { IMessage } from "@/src/models/inboxModel"; +import type { IMessage } from "@/src/models/inboxModel"; import { logger } from "@/src/utils/logger"; export type WeaponTypeInternal = diff --git a/src/services/leaderboardService.ts b/src/services/leaderboardService.ts index ff22f0c9..17507597 100644 --- a/src/services/leaderboardService.ts +++ b/src/services/leaderboardService.ts @@ -1,6 +1,7 @@ import { Guild } from "@/src/models/guildModel"; -import { Leaderboard, TLeaderboardEntryDocument } from "@/src/models/leaderboardModel"; -import { ILeaderboardEntryClient } from "@/src/types/leaderboardTypes"; +import type { TLeaderboardEntryDocument } from "@/src/models/leaderboardModel"; +import { Leaderboard } from "@/src/models/leaderboardModel"; +import type { ILeaderboardEntryClient } from "@/src/types/leaderboardTypes"; import { handleGuildGoalProgress } from "@/src/services/guildService"; import { getWorldState } from "@/src/services/worldStateService"; import { Types } from "mongoose"; diff --git a/src/services/loadoutService.ts b/src/services/loadoutService.ts index 265a8150..49f86149 100644 --- a/src/services/loadoutService.ts +++ b/src/services/loadoutService.ts @@ -1,4 +1,5 @@ -import { Loadout, TLoadoutDatabaseDocument } from "@/src/models/inventoryModels/loadoutModel"; +import type { TLoadoutDatabaseDocument } from "@/src/models/inventoryModels/loadoutModel"; +import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; export const getLoadout = async (accountId: string): Promise => { const loadout = await Loadout.findOne({ loadoutOwnerId: accountId }); diff --git a/src/services/loginRewardService.ts b/src/services/loginRewardService.ts index 548ba1bb..27e3e368 100644 --- a/src/services/loginRewardService.ts +++ b/src/services/loginRewardService.ts @@ -1,8 +1,8 @@ import randomRewards from "@/static/fixed_responses/loginRewards/randomRewards.json"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; -import { TAccountDocument } from "@/src/services/loginService"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { TAccountDocument } from "@/src/services/loginService"; import { mixSeeds, SRng } from "@/src/services/rngService"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { addBooster, updateCurrency } from "@/src/services/inventoryService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; import { diff --git a/src/services/loginService.ts b/src/services/loginService.ts index e929fce3..c41ac4e7 100644 --- a/src/services/loginService.ts +++ b/src/services/loginService.ts @@ -1,11 +1,11 @@ import { Account } from "@/src/models/loginModel"; import { createInventory } from "@/src/services/inventoryService"; -import { IDatabaseAccountJson, IDatabaseAccountRequiredFields } from "@/src/types/loginTypes"; +import type { IDatabaseAccountJson, IDatabaseAccountRequiredFields } from "@/src/types/loginTypes"; import { createShip } from "@/src/services/shipService"; -import { Document, Types } from "mongoose"; +import type { Document, Types } from "mongoose"; import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; import { PersonalRooms } from "@/src/models/personalRoomsModel"; -import { Request } from "express"; +import type { Request } from "express"; import { config } from "@/src/services/configService"; import { createStats } from "@/src/services/statsService"; import crc32 from "crc-32"; diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 87d62b38..b60cdd1e 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -1,17 +1,17 @@ +import type { IMissionReward as IMissionRewardExternal, IRegion, IReward } from "warframe-public-export-plus"; import { ExportEnemies, ExportFusionBundles, ExportRegions, ExportRelics, - ExportRewards, - IMissionReward as IMissionRewardExternal, - IRegion, - IReward + ExportRewards } from "warframe-public-export-plus"; -import { IMissionInventoryUpdateRequest, IRewardInfo } from "@/src/types/requestTypes"; +import type { IMissionInventoryUpdateRequest, IRewardInfo } from "@/src/types/requestTypes"; import { logger } from "@/src/utils/logger"; -import { IRngResult, SRng, generateRewardSeed, getRandomElement, getRandomReward } from "@/src/services/rngService"; -import { equipmentKeys, IMission, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IRngResult } from "@/src/services/rngService"; +import { SRng, generateRewardSeed, getRandomElement, getRandomReward } from "@/src/services/rngService"; +import type { IMission, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; import { addBooster, addCalendarProgress, @@ -44,14 +44,15 @@ import { } from "@/src/services/inventoryService"; import { updateQuestKey } from "@/src/services/questService"; import { Types } from "mongoose"; -import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; import { fromStoreItem, getLevelKeyRewards, isStoreItem, toStoreItem } from "@/src/services/itemDataService"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { getEntriesUnsafe } from "@/src/utils/ts-utils"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; -import { IMissionCredits, IMissionReward } from "@/src/types/missionTypes"; +import type { IMissionCredits, IMissionReward } from "@/src/types/missionTypes"; import { crackRelic } from "@/src/helpers/relicHelper"; -import { createMessage, IMessageCreationTemplate } from "@/src/services/inboxService"; +import type { IMessageCreationTemplate } from "@/src/services/inboxService"; +import { createMessage } from "@/src/services/inboxService"; import kuriaMessage50 from "@/static/fixed_responses/kuriaMessages/fiftyPercent.json"; import kuriaMessage75 from "@/static/fixed_responses/kuriaMessages/seventyFivePercent.json"; import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPercent.json"; @@ -65,7 +66,6 @@ import { getNemesisPasscode } from "@/src/helpers/nemesisHelpers"; import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; -import { ILoadoutConfigDatabase } from "@/src/types/saveLoadoutTypes"; import { getLiteSortie, getSortie, @@ -77,13 +77,14 @@ import { } from "@/src/services/worldStateService"; import { config } from "@/src/services/configService"; import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json"; -import { IGoal, ISyndicateMissionInfo } from "@/src/types/worldStateTypes"; +import type { IGoal, ISyndicateMissionInfo } from "@/src/types/worldStateTypes"; import { fromOid } from "@/src/helpers/inventoryHelpers"; -import { TAccountDocument } from "@/src/services/loginService"; -import { ITypeCount } from "@/src/types/commonTypes"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { TAccountDocument } from "@/src/services/loginService"; +import type { ITypeCount } from "@/src/types/commonTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; import { Guild } from "@/src/models/guildModel"; import { handleGuildGoalProgress } from "@/src/services/guildService"; +import { importLoadOutConfig } from "@/src/services/importService"; const getRotations = (rewardInfo: IRewardInfo, tierOverride?: number): number[] => { // Disruption missions just tell us (https://onlyg.it/OpenWF/SpaceNinjaServer/issues/2599) @@ -296,7 +297,7 @@ export const addMissionInventoryUpdates = async ( addMiscItems(inventory, value); break; case "Consumables": - if (config.dontSubtractConsumables) { + if (inventory.dontSubtractConsumables) { addConsumables( inventory, value.filter(x => x.ItemCount > 0) @@ -467,7 +468,7 @@ export const addMissionInventoryUpdates = async ( }); break; case "SyndicateId": { - if (!config.syndicateMissionsRepeatable) { + if (!inventory.syndicateMissionsRepeatable) { inventory.CompletedSyndicates.push(value); } break; @@ -487,7 +488,7 @@ export const addMissionInventoryUpdates = async ( break; } case "DeathMarks": { - if (!config.noDeathMarks) { + if (!inventory.noDeathMarks) { for (const bossName of value) { if (inventory.DeathMarks.indexOf(bossName) == -1) { // It's a new death mark; we have to say the line. @@ -602,11 +603,7 @@ export const addMissionInventoryUpdates = async ( const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId }); if (loadout) { for (const [loadoutId, loadoutConfig] of Object.entries(value.LoadOuts.NORMAL)) { - const { ItemId, ...loadoutConfigItemIdRemoved } = loadoutConfig; - const loadoutConfigDatabase: ILoadoutConfigDatabase = { - _id: new Types.ObjectId(ItemId.$oid), - ...loadoutConfigItemIdRemoved - }; + const loadoutConfigDatabase = importLoadOutConfig(loadoutConfig); const dbConfig = loadout.NORMAL.id(loadoutId); if (dbConfig) { dbConfig.overwrite(loadoutConfigDatabase); @@ -1249,12 +1246,6 @@ export const addMissionRewards = async ( } ]); } - - // Consume netracells search pulse. Moved here to only cover successful completions. Discussed in https://onlyg.it/OpenWF/SpaceNinjaServer/issues/2673 - if (missions.Tag == "SolNode720") { - updateEntratiVault(inventory); - inventory.EntratiVaultCountLastPeriod! += 1; - } } if (rewardInfo.useVaultManifest) { @@ -1421,6 +1412,12 @@ export const addMissionRewards = async ( logger.error(`unknown droptable ${si.DropTable} for DROP_MISC_ITEM`); } } + + if (si.DropTable == "/Lotus/Types/DropTables/ContainerDropTables/VoidVaultMissionRewardsDropTable") { + // Consume netracells search pulse; only when the container reward was picked up. Discussed in https://onlyg.it/OpenWF/SpaceNinjaServer/issues/2673 + updateEntratiVault(inventory); + inventory.EntratiVaultCountLastPeriod! += 1; + } } } @@ -1591,7 +1588,7 @@ export const addMissionRewards = async ( const dialogue = getDialogue(inventory, buddy); if (Date.now() >= dialogue.BountyChemExpiry.getTime()) { logger.debug(`Giving 20 chemistry for ${buddy}`); - const tomorrowAt0Utc = config.noKimCooldowns + const tomorrowAt0Utc = inventory.noKimCooldowns ? Date.now() : (Math.trunc(Date.now() / 86400_000) + 1) * 86400_000; dialogue.Chemistry += 20; diff --git a/src/services/personalRoomsService.ts b/src/services/personalRoomsService.ts index 2ce19289..55c9c23f 100644 --- a/src/services/personalRoomsService.ts +++ b/src/services/personalRoomsService.ts @@ -1,6 +1,6 @@ import { PersonalRooms } from "@/src/models/personalRoomsModel"; import { addItem, getInventory } from "@/src/services/inventoryService"; -import { IGardeningDatabase, TPersonalRoomsDatabaseDocument } from "@/src/types/personalRoomsTypes"; +import type { IGardeningDatabase, TPersonalRoomsDatabaseDocument } from "@/src/types/personalRoomsTypes"; import { getRandomElement } from "@/src/services/rngService"; export const getPersonalRooms = async ( diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index 11d3de82..ec8680fb 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -10,16 +10,17 @@ import { } from "@/src/services/inventoryService"; import { getRandomReward, getRandomWeightedRewardUc } from "@/src/services/rngService"; import { applyStandingToVendorManifest, getVendorManifestByOid } from "@/src/services/serversideVendorsService"; -import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; -import { +import type { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IPurchaseRequest, IPurchaseResponse, IInventoryChanges, - PurchaseSource, IPurchaseParams } from "@/src/types/purchaseTypes"; +import { PurchaseSource } from "@/src/types/purchaseTypes"; import { logger } from "@/src/utils/logger"; import { getWorldState } from "@/src/services/worldStateService"; +import type { TRarity } from "warframe-public-export-plus"; import { ExportBoosterPacks, ExportBoosters, @@ -28,11 +29,9 @@ import { ExportMisc, ExportResources, ExportSyndicates, - ExportVendors, - TRarity + ExportVendors } from "warframe-public-export-plus"; -import { config } from "@/src/services/configService"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { fromStoreItem, toStoreItem } from "@/src/services/itemDataService"; import { DailyDeal } from "@/src/models/worldStateModel"; import { fromMongoDate, toMongoDate } from "@/src/helpers/inventoryHelpers"; @@ -63,7 +62,7 @@ const tallyVendorPurchase = ( numPurchased: number, Expiry: Date ): void => { - if (!config.noVendorPurchaseLimits) { + if (!inventory.noVendorPurchaseLimits) { inventory.RecentVendorPurchases ??= []; let vendorPurchases = inventory.RecentVendorPurchases.find(x => x.VendorType == VendorType); if (!vendorPurchases) { @@ -130,12 +129,12 @@ export const handlePurchase = async ( if (!offer) { throw new Error(`unknown vendor offer: ${ItemId ? ItemId : purchaseRequest.PurchaseParams.StoreItem}`); } - if (!config.dontSubtractPurchaseCreditCost) { + if (!inventory.dontSubtractPurchaseCreditCost) { if (offer.RegularPrice) { updateCurrency(inventory, offer.RegularPrice[0], false, prePurchaseInventoryChanges); } } - if (!config.dontSubtractPurchasePlatinumCost) { + if (!inventory.dontSubtractPurchasePlatinumCost) { if (offer.PremiumPrice) { updateCurrency(inventory, offer.PremiumPrice[0], true, prePurchaseInventoryChanges); } @@ -156,7 +155,7 @@ export const handlePurchase = async ( }); } } - if (!config.dontSubtractPurchaseItemCost) { + if (!inventory.dontSubtractPurchaseItemCost) { if (offer.ItemPrices) { handleItemPrices( inventory, @@ -223,14 +222,14 @@ export const handlePurchase = async ( x => x.ItemType == purchaseRequest.PurchaseParams.StoreItem ); if (offer) { - if (!config.dontSubtractPurchaseCreditCost) { + if (!inventory.dontSubtractPurchaseCreditCost) { updateCurrency(inventory, offer.RegularPrice, false, purchaseResponse.InventoryChanges); } if (purchaseRequest.PurchaseParams.ExpectedPrice) { throw new Error(`vendor purchase should not have an expected price`); } - if (offer.PrimePrice && !config.dontSubtractPurchaseItemCost) { + if (offer.PrimePrice && !inventory.dontSubtractPurchaseItemCost) { const invItem: IMiscItem = { ItemType: "/Lotus/Types/Items/MiscItems/PrimeBucks", ItemCount: offer.PrimePrice * purchaseRequest.PurchaseParams.Quantity * -1 @@ -267,7 +266,7 @@ export const handlePurchase = async ( Title: lastTitle } ]; - } else if (!config.dontSubtractPurchaseStandingCost) { + } else if (!inventory.dontSubtractPurchaseStandingCost) { const syndicate = ExportSyndicates[syndicateTag]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (syndicate) { @@ -301,13 +300,13 @@ export const handlePurchase = async ( const vendor = ExportVendors[purchaseRequest.PurchaseParams.SourceId!]; const offer = vendor.items.find(x => x.storeItem == purchaseRequest.PurchaseParams.StoreItem); if (offer) { - if (typeof offer.credits == "number" && !config.dontSubtractPurchaseCreditCost) { + if (typeof offer.credits == "number" && !inventory.dontSubtractPurchaseCreditCost) { updateCurrency(inventory, offer.credits, false, purchaseResponse.InventoryChanges); } - if (typeof offer.platinum == "number" && !config.dontSubtractPurchasePlatinumCost) { + if (typeof offer.platinum == "number" && !inventory.dontSubtractPurchasePlatinumCost) { updateCurrency(inventory, offer.platinum, true, purchaseResponse.InventoryChanges); } - if (offer.itemPrices && !config.dontSubtractPurchaseItemCost) { + if (offer.itemPrices && !inventory.dontSubtractPurchaseItemCost) { handleItemPrices( inventory, offer.itemPrices, @@ -335,7 +334,7 @@ export const handlePurchase = async ( ); if (offer) { if (offer.RegularPrice) { - if (!config.dontSubtractPurchaseItemCost) { + if (!inventory.dontSubtractPurchaseItemCost) { const invItem: IMiscItem = { ItemType: "/Lotus/Types/Items/MiscItems/SchismKey", ItemCount: offer.RegularPrice * purchaseRequest.PurchaseParams.Quantity * -1 @@ -394,11 +393,11 @@ export const handleDailyDealPurchase = async ( dailyDeal.AmountSold += 1; await dailyDeal.save(); - if (!config.dontSubtractPurchasePlatinumCost) { + if (!inventory.dontSubtractPurchasePlatinumCost) { updateCurrency(inventory, dailyDeal.SalePrice, true, purchaseResponse.InventoryChanges); } - if (!config.noVendorPurchaseLimits) { + if (!inventory.noVendorPurchaseLimits) { inventory.UsedDailyDeals.push(purchaseParams.StoreItem); purchaseResponse.DailyDealUsed = purchaseParams.StoreItem; } diff --git a/src/services/questService.ts b/src/services/questService.ts index c34cae6b..f1f05060 100644 --- a/src/services/questService.ts +++ b/src/services/questService.ts @@ -1,17 +1,17 @@ -import { IKeyChainRequest } from "@/src/types/requestTypes"; +import type { IKeyChainRequest } from "@/src/types/requestTypes"; import { isEmptyObject } from "@/src/helpers/general"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { createMessage } from "@/src/services/inboxService"; import { addItem, addItems, addKeyChainItems, setupKahlSyndicate } from "@/src/services/inventoryService"; import { fromStoreItem, getKeyChainMessage, getLevelKeyRewards } from "@/src/services/itemDataService"; -import { IQuestKeyClient, IQuestKeyDatabase, IQuestStage } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IQuestKeyClient, IQuestKeyDatabase, IQuestStage } from "@/src/types/inventoryTypes/inventoryTypes"; import { logger } from "@/src/utils/logger"; -import { Types } from "mongoose"; +import type { Types } from "mongoose"; import { ExportKeys } from "warframe-public-export-plus"; import { addFixedLevelRewards } from "@/src/services/missionInventoryUpdateService"; -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; import questCompletionItems from "@/static/fixed_responses/questCompletionRewards.json"; -import { ITypeCount } from "@/src/types/commonTypes"; +import type { ITypeCount } from "@/src/types/commonTypes"; export interface IUpdateQuestRequest { QuestKeys: Omit[]; diff --git a/src/services/rngService.ts b/src/services/rngService.ts index 876d7584..c5791a0d 100644 --- a/src/services/rngService.ts +++ b/src/services/rngService.ts @@ -1,4 +1,4 @@ -import { TRarity } from "warframe-public-export-plus"; +import type { TRarity } from "warframe-public-export-plus"; export interface IRngResult { type: string; diff --git a/src/services/saveLoadoutService.ts b/src/services/saveLoadoutService.ts index c3f63a0a..c55aed6b 100644 --- a/src/services/saveLoadoutService.ts +++ b/src/services/saveLoadoutService.ts @@ -1,20 +1,20 @@ -import { +import type { IItemEntry, ILoadoutClient, ILoadoutEntry, - ILoadoutConfigDatabase, IOperatorConfigEntry, ISaveLoadoutRequestNoUpgradeVer } from "@/src/types/saveLoadoutTypes"; import { Loadout } from "@/src/models/inventoryModels/loadoutModel"; import { getInventory } from "@/src/services/inventoryService"; -import { IOid } from "@/src/types/commonTypes"; +import type { IOid } from "@/src/types/commonTypes"; import { Types } from "mongoose"; import { isEmptyObject } from "@/src/helpers/general"; import { logger } from "@/src/utils/logger"; -import { equipmentKeys, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { importCrewMemberId } from "@/src/services/importService"; +import type { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import type { IItemConfig } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import { importCrewShipMembers, importCrewShipWeapon, importLoadOutConfig } from "@/src/services/importService"; //TODO: setup default items on account creation or like originally in giveStartingItems.php @@ -88,20 +88,17 @@ export const handleInventoryItemConfigChange = async ( const oldLoadoutConfig = loadout[loadoutSlot].id(loadoutId); - const { ItemId, ...loadoutConfigItemIdRemoved } = loadoutConfig; - const loadoutConfigDatabase: ILoadoutConfigDatabase = { - _id: new Types.ObjectId(ItemId.$oid), - ...loadoutConfigItemIdRemoved - }; + const loadoutConfigDatabase = importLoadOutConfig(loadoutConfig); // if no config with this id exists, create a new one if (!oldLoadoutConfig) { //save the new object id and assign it for every ffff return at the end - if (ItemId.$oid === "ffffffffffffffffffffffff") { + if (loadoutConfigDatabase._id.toString() === "ffffffffffffffffffffffff") { if (!newLoadoutId) { newLoadoutId = new Types.ObjectId(); } - loadout[loadoutSlot].push({ _id: newLoadoutId, ...loadoutConfigItemIdRemoved }); + loadoutConfigDatabase._id = newLoadoutId; + loadout[loadoutSlot].push(loadoutConfigDatabase); continue; } @@ -218,15 +215,11 @@ export const handleInventoryItemConfigChange = async ( if ("Customization" in itemConfigEntries) { inventoryItem.Customization = itemConfigEntries.Customization; } - if ("Weapon" in itemConfigEntries) { - inventoryItem.Weapon = itemConfigEntries.Weapon; + if (itemConfigEntries.Weapon) { + inventoryItem.Weapon = importCrewShipWeapon(itemConfigEntries.Weapon); } if (itemConfigEntries.CrewMembers) { - inventoryItem.CrewMembers = { - SLOT_A: importCrewMemberId(itemConfigEntries.CrewMembers.SLOT_A ?? {}), - SLOT_B: importCrewMemberId(itemConfigEntries.CrewMembers.SLOT_B ?? {}), - SLOT_C: importCrewMemberId(itemConfigEntries.CrewMembers.SLOT_C ?? {}) - }; + inventoryItem.CrewMembers = importCrewShipMembers(itemConfigEntries.CrewMembers); } } break; diff --git a/src/services/serversideVendorsService.ts b/src/services/serversideVendorsService.ts index 50232776..ad641dc9 100644 --- a/src/services/serversideVendorsService.ts +++ b/src/services/serversideVendorsService.ts @@ -1,11 +1,12 @@ import { unixTimesInMs } from "@/src/constants/timeConstants"; import { args } from "@/src/helpers/commandLineArguments"; import { catBreadHash } from "@/src/helpers/stringHelpers"; -import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; +import type { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { mixSeeds, SRng } from "@/src/services/rngService"; -import { IItemManifest, IVendorInfo, IVendorManifest } from "@/src/types/vendorTypes"; +import type { IItemManifest, IVendorInfo, IVendorManifest } from "@/src/types/vendorTypes"; import { logger } from "@/src/utils/logger"; -import { ExportVendors, IRange, IVendor, IVendorOffer } from "warframe-public-export-plus"; +import type { IRange, IVendor, IVendorOffer } from "warframe-public-export-plus"; +import { ExportVendors } from "warframe-public-export-plus"; import { config } from "@/src/services/configService"; interface IGeneratableVendorInfo extends Omit { diff --git a/src/services/shipCustomizationsService.ts b/src/services/shipCustomizationsService.ts index 1fdcf7d5..12ede5e6 100644 --- a/src/services/shipCustomizationsService.ts +++ b/src/services/shipCustomizationsService.ts @@ -1,6 +1,6 @@ import { getPersonalRooms } from "@/src/services/personalRoomsService"; import { getShip } from "@/src/services/shipService"; -import { +import type { IResetShipDecorationsRequest, IResetShipDecorationsResponse, ISetPlacedDecoInfoRequest, diff --git a/src/services/shipService.ts b/src/services/shipService.ts index 7552fb97..6c8ad60e 100644 --- a/src/services/shipService.ts +++ b/src/services/shipService.ts @@ -1,5 +1,6 @@ -import { Ship, TShipDatabaseDocument } from "@/src/models/shipModel"; -import { Types } from "mongoose"; +import type { TShipDatabaseDocument } from "@/src/models/shipModel"; +import { Ship } from "@/src/models/shipModel"; +import type { Types } from "mongoose"; export const createShip = async ( accountOwnerId: Types.ObjectId, diff --git a/src/services/statsService.ts b/src/services/statsService.ts index d7dbc40c..abf5d25f 100644 --- a/src/services/statsService.ts +++ b/src/services/statsService.ts @@ -1,5 +1,6 @@ -import { Stats, TStatsDatabaseDocument } from "@/src/models/statsModel"; -import { +import type { TStatsDatabaseDocument } from "@/src/models/statsModel"; +import { Stats } from "@/src/models/statsModel"; +import type { IStatsAdd, IStatsMax, IStatsSet, diff --git a/src/services/webService.ts b/src/services/webService.ts index e8162663..af1e49bf 100644 --- a/src/services/webService.ts +++ b/src/services/webService.ts @@ -4,7 +4,7 @@ import fs from "node:fs"; import { config } from "@/src/services/configService"; import { logger } from "@/src/utils/logger"; import { app } from "@/src/app"; -import { AddressInfo } from "node:net"; +import type { AddressInfo } from "node:net"; import { Agent, WebSocket as UnidiciWebSocket } from "undici"; import { startWsServer, startWssServer, stopWsServers } from "@/src/services/wsService"; diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index d054282e..c2a575a7 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -13,8 +13,9 @@ import { buildConfig } from "@/src/services/buildConfigService"; import { unixTimesInMs } from "@/src/constants/timeConstants"; import { config } from "@/src/services/configService"; import { getRandomElement, getRandomInt, sequentiallyUniqueRandomElement, SRng } from "@/src/services/rngService"; -import { eMissionType, ExportRegions, ExportSyndicates, IMissionReward, IRegion } from "warframe-public-export-plus"; -import { +import type { IMissionReward, IRegion } from "warframe-public-export-plus"; +import { eMissionType, ExportRegions, ExportSyndicates } from "warframe-public-export-plus"; +import type { ICalendarDay, ICalendarEvent, ICalendarSeason, diff --git a/src/services/wsService.ts b/src/services/wsService.ts index e55293cd..930ee84a 100644 --- a/src/services/wsService.ts +++ b/src/services/wsService.ts @@ -1,10 +1,10 @@ -import http from "http"; -import https from "https"; +import type http from "http"; +import type https from "https"; import ws from "ws"; import { Account } from "@/src/models/loginModel"; import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "@/src/services/loginService"; -import { IDatabaseAccountJson } from "@/src/types/loginTypes"; -import { HydratedDocument } from "mongoose"; +import type { IDatabaseAccountJson } from "@/src/types/loginTypes"; +import type { HydratedDocument } from "mongoose"; import { logError } from "@/src/utils/logger"; let wsServer: ws.Server | undefined; diff --git a/src/types/equipmentTypes.ts b/src/types/equipmentTypes.ts index 4053430a..3ee5c42c 100644 --- a/src/types/equipmentTypes.ts +++ b/src/types/equipmentTypes.ts @@ -1,20 +1,24 @@ -import { Types } from "mongoose"; -import { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; -import { +import type { Types } from "mongoose"; +import type { IMongoDate, IOid, IOidWithLegacySupport } from "@/src/types/commonTypes"; +import type { ICrewShipCustomization, IFlavourItem, IItemConfig, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -export interface IEquipmentSelection { - ItemId: IOid; +export interface IEquipmentSelectionClient { + ItemId?: IOid; mod?: number; cus?: number; ItemType?: string; hide?: boolean; } +export interface IEquipmentSelectionDatabase extends Omit { + ItemId?: Types.ObjectId | IOid; // should be Types.ObjectId but might be IOid because of old commits +} + export enum EquipmentFeatures { DOUBLE_CAPACITY = 1, UTILITY_SLOT = 2, @@ -51,7 +55,7 @@ export interface IEquipmentDatabase { UpgradesExpiry?: Date; UmbraDate?: Date; // related to scrapped "echoes of umbra" feature ArchonCrystalUpgrades?: IArchonCrystalUpgrade[]; - Weapon?: ICrewShipWeapon; + Weapon?: ICrewShipWeaponDatabase; Customization?: ICrewShipCustomization; RailjackImage?: IFlavourItem; CrewMembers?: ICrewShipMembersDatabase; @@ -64,13 +68,14 @@ export interface IEquipmentDatabase { export interface IEquipmentClient extends Omit< IEquipmentDatabase, - "_id" | "InfestationDate" | "Expiry" | "UpgradesExpiry" | "UmbraDate" | "CrewMembers" | "Details" + "_id" | "InfestationDate" | "Expiry" | "UpgradesExpiry" | "UmbraDate" | "Weapon" | "CrewMembers" | "Details" > { ItemId: IOidWithLegacySupport; InfestationDate?: IMongoDate; Expiry?: IMongoDate; UpgradesExpiry?: IMongoDate; UmbraDate?: IMongoDate; + Weapon?: ICrewShipWeaponClient; CrewMembers?: ICrewShipMembersClient; Details?: IKubrowPetDetailsClient; } @@ -117,19 +122,34 @@ export enum Status { } // inventory.CrewShips[0].Weapon -export interface ICrewShipWeapon { - PILOT?: ICrewShipWeaponEmplacements; - PORT_GUNS?: ICrewShipWeaponEmplacements; - STARBOARD_GUNS?: ICrewShipWeaponEmplacements; - ARTILLERY?: ICrewShipWeaponEmplacements; - SCANNER?: ICrewShipWeaponEmplacements; +export interface ICrewShipWeaponClient { + PILOT?: ICrewShipWeaponEmplacementsClient; + PORT_GUNS?: ICrewShipWeaponEmplacementsClient; + STARBOARD_GUNS?: ICrewShipWeaponEmplacementsClient; + ARTILLERY?: ICrewShipWeaponEmplacementsClient; + SCANNER?: ICrewShipWeaponEmplacementsClient; } -export interface ICrewShipWeaponEmplacements { - PRIMARY_A?: IEquipmentSelection; - PRIMARY_B?: IEquipmentSelection; - SECONDARY_A?: IEquipmentSelection; - SECONDARY_B?: IEquipmentSelection; +export interface ICrewShipWeaponDatabase { + PILOT?: ICrewShipWeaponEmplacementsDatabase; + PORT_GUNS?: ICrewShipWeaponEmplacementsDatabase; + STARBOARD_GUNS?: ICrewShipWeaponEmplacementsDatabase; + ARTILLERY?: ICrewShipWeaponEmplacementsDatabase; + SCANNER?: ICrewShipWeaponEmplacementsDatabase; +} + +export interface ICrewShipWeaponEmplacementsClient { + PRIMARY_A?: IEquipmentSelectionClient; + PRIMARY_B?: IEquipmentSelectionClient; + SECONDARY_A?: IEquipmentSelectionClient; + SECONDARY_B?: IEquipmentSelectionClient; +} + +export interface ICrewShipWeaponEmplacementsDatabase { + PRIMARY_A?: IEquipmentSelectionDatabase; + PRIMARY_B?: IEquipmentSelectionDatabase; + SECONDARY_A?: IEquipmentSelectionDatabase; + SECONDARY_B?: IEquipmentSelectionDatabase; } export interface ICrewShipMembersClient { diff --git a/src/types/friendTypes.ts b/src/types/friendTypes.ts index 0318c0ae..666293ce 100644 --- a/src/types/friendTypes.ts +++ b/src/types/friendTypes.ts @@ -1,5 +1,5 @@ -import { Types } from "mongoose"; -import { IMongoDate, IOidWithLegacySupport } from "@/src/types/commonTypes"; +import type { Types } from "mongoose"; +import type { IMongoDate, IOidWithLegacySupport } from "@/src/types/commonTypes"; export interface IFriendInfo { _id: IOidWithLegacySupport; diff --git a/src/types/genericUpdate.ts b/src/types/genericUpdate.ts index e51d41bc..006de5f5 100644 --- a/src/types/genericUpdate.ts +++ b/src/types/genericUpdate.ts @@ -1,4 +1,4 @@ -import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IInventoryChanges } from "@/src/types/purchaseTypes"; export interface IGenericUpdate { NodeIntrosCompleted: string | string[]; diff --git a/src/types/guildTypes.ts b/src/types/guildTypes.ts index 791099c3..e392e697 100644 --- a/src/types/guildTypes.ts +++ b/src/types/guildTypes.ts @@ -1,13 +1,13 @@ -import { Types } from "mongoose"; -import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes"; -import { +import type { Types } from "mongoose"; +import type { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes"; +import type { IFusionTreasure, IMiscItem, IGoalProgressDatabase, IGoalProgressClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IPictureFrameInfo } from "@/src/types/personalRoomsTypes"; -import { IFriendInfo } from "@/src/types/friendTypes"; +import type { IPictureFrameInfo } from "@/src/types/personalRoomsTypes"; +import type { IFriendInfo } from "@/src/types/friendTypes"; export interface IGuildClient { _id: IOidWithLegacySupport; diff --git a/src/types/inventoryTypes/commonInventoryTypes.ts b/src/types/inventoryTypes/commonInventoryTypes.ts index 3e40d104..0f72ecf2 100644 --- a/src/types/inventoryTypes/commonInventoryTypes.ts +++ b/src/types/inventoryTypes/commonInventoryTypes.ts @@ -1,5 +1,5 @@ -import { IOid } from "@/src/types/commonTypes"; -import { Types } from "mongoose"; +import type { IOid } from "@/src/types/commonTypes"; +import type { Types } from "mongoose"; export interface IPolarity { Slot: number; diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 9139a677..33a0bfa8 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -1,6 +1,6 @@ -import { Types } from "mongoose"; -import { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes"; -import { +import type { Types } from "mongoose"; +import type { IOid, IMongoDate, IOidWithLegacySupport, ITypeCount } from "@/src/types/commonTypes"; +import type { IColor, IItemConfig, IOperatorConfigClient, @@ -9,11 +9,11 @@ import { ILotusCustomization, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { IFingerprintStat, RivenFingerprint } from "@/src/helpers/rivenHelper"; -import { IOrbiterClient } from "@/src/types/personalRoomsTypes"; -import { ICountedStoreItem } from "warframe-public-export-plus"; -import { IEquipmentClient, IEquipmentDatabase, ITraits } from "@/src/types/equipmentTypes"; -import { ILoadOutPresets } from "@/src/types/saveLoadoutTypes"; +import type { IFingerprintStat, RivenFingerprint } from "@/src/helpers/rivenHelper"; +import type { IOrbiterClient } from "@/src/types/personalRoomsTypes"; +import type { ICountedStoreItem } from "warframe-public-export-plus"; +import type { IEquipmentClient, IEquipmentDatabase, ITraits } from "@/src/types/equipmentTypes"; +import type { ILoadOutPresets } from "@/src/types/saveLoadoutTypes"; export type InventoryDatabaseEquipment = { [_ in TEquipmentKey]: IEquipmentDatabase[]; @@ -21,11 +21,33 @@ export type InventoryDatabaseEquipment = { // Fields specific to SNS export interface IAccountCheats { + dontSubtractPurchaseCreditCost?: boolean; + dontSubtractPurchasePlatinumCost?: boolean; + dontSubtractPurchaseItemCost?: boolean; + dontSubtractPurchaseStandingCost?: boolean; + dontSubtractVoidTraces?: boolean; + dontSubtractConsumables?: boolean; infiniteCredits?: boolean; infinitePlatinum?: boolean; infiniteEndo?: boolean; infiniteRegalAya?: boolean; infiniteHelminthMaterials?: boolean; + universalPolarityEverywhere?: boolean; + unlockDoubleCapacityPotatoesEverywhere?: boolean; + unlockExilusEverywhere?: boolean; + unlockArcanesEverywhere?: boolean; + syndicateMissionsRepeatable?: boolean; + instantFinishRivenChallenge?: boolean; + noDailyStandingLimits?: boolean; + noDailyFocusLimit?: boolean; + noArgonCrystalDecay?: boolean; + noMasteryRankUpCooldown?: boolean; + noVendorPurchaseLimits?: boolean; + noDeathMarks?: boolean; + noKimCooldowns?: boolean; + claimingBlueprintRefundsIngredients?: boolean; + instantResourceExtractorDrones?: boolean; + noResourceExtractorDronesDamage?: boolean; } export interface IInventoryDatabase @@ -68,12 +90,14 @@ export interface IInventoryDatabase | "LastInventorySync" | "EndlessXP" | "PersonalGoalProgress" + | "CurrentLoadOutIds" | TEquipmentKey >, InventoryDatabaseEquipment, IAccountCheats { accountOwnerId: Types.ObjectId; Created: Date; + CurrentLoadOutIds: Types.ObjectId[] | IOid[]; // should be Types.ObjectId[] but might be IOid[] because of old commits TrainingDate: Date; LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population //Mailbox?: IMailboxDatabase; @@ -254,7 +278,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu ActiveQuest: string; FlavourItems: IFlavourItem[]; LoadOutPresets: ILoadOutPresets; - CurrentLoadOutIds: IOid[]; // we store it in the database using this representation as well :/ + CurrentLoadOutIds: IOid[]; Missions: IMission[]; RandomUpgradesIdentified?: number; LastRegionPlayed: TSolarMapRegion; diff --git a/src/types/leaderboardTypes.ts b/src/types/leaderboardTypes.ts index 69dbc3d9..4d7fbea2 100644 --- a/src/types/leaderboardTypes.ts +++ b/src/types/leaderboardTypes.ts @@ -1,4 +1,4 @@ -import { Types } from "mongoose"; +import type { Types } from "mongoose"; export interface ILeaderboardEntryDatabase { leaderboard: string; diff --git a/src/types/loginTypes.ts b/src/types/loginTypes.ts index 305386d6..630a21c3 100644 --- a/src/types/loginTypes.ts +++ b/src/types/loginTypes.ts @@ -1,4 +1,4 @@ -import { Types } from "mongoose"; +import type { Types } from "mongoose"; export interface IAccountAndLoginResponseCommons { DisplayName: string; diff --git a/src/types/missionTypes.ts b/src/types/missionTypes.ts index 3da1fa70..c8e796ec 100644 --- a/src/types/missionTypes.ts +++ b/src/types/missionTypes.ts @@ -1,4 +1,4 @@ -import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; +import type { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes"; export const inventoryFields = ["RawUpgrades", "MiscItems", "Consumables", "Recipes"] as const; export type IInventoryFieldType = (typeof inventoryFields)[number]; diff --git a/src/types/personalRoomsTypes.ts b/src/types/personalRoomsTypes.ts index 45479e2e..1e8ea8c0 100644 --- a/src/types/personalRoomsTypes.ts +++ b/src/types/personalRoomsTypes.ts @@ -1,7 +1,7 @@ -import { IColor, IShipAttachments, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { Document, Model, Types } from "mongoose"; -import { ILoadoutClient, ILoadoutConfigClient, ILoadoutConfigDatabase } from "@/src/types/saveLoadoutTypes"; -import { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IColor, IShipAttachments, IShipCustomization } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { Document, Model, Types } from "mongoose"; +import type { ILoadoutClient, ILoadoutConfigClient, ILoadoutConfigDatabase } from "@/src/types/saveLoadoutTypes"; +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; export interface IGetShipResponse { ShipOwnerId: string; @@ -16,8 +16,8 @@ export type TBootLocation = "LISET" | "DRIFTER_CAMP" | "APARTMENT" | "SHOP"; export interface IOrbiterClient { Features: string[]; ShipId: IOid; - ShipInterior: IShipCustomization; Rooms: IRoomClient[]; + ShipInterior?: IShipCustomization; VignetteFish?: string[]; FavouriteLoadoutId?: IOid; Wallpaper?: string; diff --git a/src/types/purchaseTypes.ts b/src/types/purchaseTypes.ts index a6764a35..c7588010 100644 --- a/src/types/purchaseTypes.ts +++ b/src/types/purchaseTypes.ts @@ -1,6 +1,6 @@ -import { ITypeCount } from "@/src/types/commonTypes"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; -import { +import type { ITypeCount } from "@/src/types/commonTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { IDroneClient, IInfestedFoundryClient, IMiscItem, diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 714dfd99..967a4d26 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -1,6 +1,6 @@ -import { IOid, ITypeCount } from "@/src/types/commonTypes"; -import { ArtifactPolarity, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { +import type { IOid, ITypeCount } from "@/src/types/commonTypes"; +import type { ArtifactPolarity, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { IBooster, IChallengeProgress, IEvolutionProgress, @@ -23,9 +23,9 @@ import { IKubrowPetEggClient, INemesisClient } from "@/src/types/inventoryTypes/inventoryTypes"; -import { IGroup } from "@/src/types/loginTypes"; -import { ILoadOutPresets } from "@/src/types/saveLoadoutTypes"; -import { IEquipmentClient } from "@/src/types/equipmentTypes"; +import type { IGroup } from "@/src/types/loginTypes"; +import type { ILoadOutPresets } from "@/src/types/saveLoadoutTypes"; +import type { IEquipmentClient } from "@/src/types/equipmentTypes"; export interface IAffiliationChange { Tag: string; diff --git a/src/types/saveLoadoutTypes.ts b/src/types/saveLoadoutTypes.ts index 33ff9708..68c51a39 100644 --- a/src/types/saveLoadoutTypes.ts +++ b/src/types/saveLoadoutTypes.ts @@ -1,13 +1,18 @@ -import { IOid } from "@/src/types/commonTypes"; -import { +import type { IOid } from "@/src/types/commonTypes"; +import type { ICrewShipCustomization, IFlavourItem, IItemConfig, ILotusCustomization, IOperatorConfigClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { Types } from "mongoose"; -import { ICrewShipMembersClient, ICrewShipWeapon, IEquipmentSelection } from "@/src/types/equipmentTypes"; +import type { Types } from "mongoose"; +import type { + ICrewShipMembersClient, + ICrewShipWeaponClient, + IEquipmentSelectionClient, + IEquipmentSelectionDatabase +} from "@/src/types/equipmentTypes"; export interface ISaveLoadoutRequest { LoadOuts: ILoadoutClient; @@ -53,10 +58,12 @@ export interface IOperatorConfigEntry { [configId: string]: IOperatorConfigClient; } +// client export interface IItemEntry { [itemId: string]: IConfigEntry; } +// client export type IConfigEntry = { [configId in "0" | "1" | "2" | "3" | "4" | "5"]: IItemConfig; } & { @@ -66,7 +73,7 @@ export type IConfigEntry = { ItemName?: string; RailjackImage?: IFlavourItem; Customization?: ICrewShipCustomization; - Weapon?: ICrewShipWeapon; + Weapon?: ICrewShipWeaponClient; CrewMembers?: ICrewShipMembersClient; }; @@ -108,10 +115,6 @@ export interface ILoadoutEntry { [key: string]: ILoadoutConfigClient; } -export interface ILoadoutConfigDatabase extends Omit { - _id: Types.ObjectId; -} - export enum FocusSchool { Attack = "AP_ATTACK", Defense = "AP_DEFENSE", @@ -125,12 +128,23 @@ export interface ILoadoutConfigClient { PresetIcon?: string; Favorite?: boolean; n?: string; // Loadout name - s?: IEquipmentSelection; // Suit - p?: IEquipmentSelection; // Secondary weapon - l?: IEquipmentSelection; // Primary weapon - m?: IEquipmentSelection; // Melee weapon - h?: IEquipmentSelection; // Gravimag weapon - a?: IEquipmentSelection; // Necromech exalted weapon + s?: IEquipmentSelectionClient; // Suit + p?: IEquipmentSelectionClient; // Secondary weapon + l?: IEquipmentSelectionClient; // Primary weapon + m?: IEquipmentSelectionClient; // Melee weapon + h?: IEquipmentSelectionClient; // Gravimag weapon + a?: IEquipmentSelectionClient; // Necromech exalted weapon ItemId: IOid; Remove?: boolean; // when client wants to remove a config, it only includes ItemId & Remove. } + +export interface ILoadoutConfigDatabase + extends Omit { + _id: Types.ObjectId; + s?: IEquipmentSelectionDatabase; + p?: IEquipmentSelectionDatabase; + l?: IEquipmentSelectionDatabase; + m?: IEquipmentSelectionDatabase; + h?: IEquipmentSelectionDatabase; + a?: IEquipmentSelectionDatabase; +} diff --git a/src/types/session.ts b/src/types/session.ts index 65007172..056cc150 100644 --- a/src/types/session.ts +++ b/src/types/session.ts @@ -1,4 +1,4 @@ -import { Types } from "mongoose"; +import type { Types } from "mongoose"; export interface ISession { sessionId: Types.ObjectId; diff --git a/src/types/shipTypes.ts b/src/types/shipTypes.ts index 4b070f65..5649f4f7 100644 --- a/src/types/shipTypes.ts +++ b/src/types/shipTypes.ts @@ -1,5 +1,5 @@ -import { Types } from "mongoose"; -import { IColor, IShipAttachments } from "@/src/types/inventoryTypes/commonInventoryTypes"; +import type { Types } from "mongoose"; +import type { IColor, IShipAttachments } from "@/src/types/inventoryTypes/commonInventoryTypes"; export interface IShipDatabase { ItemType: string; diff --git a/src/types/statTypes.ts b/src/types/statTypes.ts index 08f2bcf9..52bf45e0 100644 --- a/src/types/statTypes.ts +++ b/src/types/statTypes.ts @@ -1,4 +1,4 @@ -import { Types } from "mongoose"; +import type { Types } from "mongoose"; export interface IStatsClient { CiphersSolved?: number; diff --git a/src/types/vendorTypes.ts b/src/types/vendorTypes.ts index 2b64b5a3..2a74488c 100644 --- a/src/types/vendorTypes.ts +++ b/src/types/vendorTypes.ts @@ -1,4 +1,4 @@ -import { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; export interface IItemPrice { ItemType: string; diff --git a/src/types/worldStateTypes.ts b/src/types/worldStateTypes.ts index 883b95e5..3f4d233e 100644 --- a/src/types/worldStateTypes.ts +++ b/src/types/worldStateTypes.ts @@ -1,5 +1,5 @@ -import { IMissionReward } from "warframe-public-export-plus"; -import { IMongoDate, IOid } from "@/src/types/commonTypes"; +import type { IMissionReward } from "warframe-public-export-plus"; +import type { IMongoDate, IOid } from "@/src/types/commonTypes"; export interface IWorldState { Version: number; // for goals diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 75366808..52644079 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,4 +1,5 @@ -import { createLogger, format, transports, Logger, LeveledLogMethod, addColors } from "winston"; +import type { Logger, LeveledLogMethod } from "winston"; +import { createLogger, format, transports, addColors } from "winston"; import "winston-daily-rotate-file"; import { config } from "@/src/services/configService"; import * as util from "util"; diff --git a/static/webui/index.html b/static/webui/index.html index fc60a986..52e278f2 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -645,6 +645,137 @@
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + + + + + +
+
+ +
+ + +
+
+
+
+
+
+
@@ -663,34 +794,6 @@
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
@@ -715,50 +818,6 @@
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
@@ -771,26 +830,10 @@
-
- - -
-
- - -
-
- - -
-
- - -
@@ -867,49 +910,6 @@
-
-
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - - - - - -
-
- -
- - -
-
-
-
diff --git a/static/webui/translations/es.js b/static/webui/translations/es.js index d1695e54..e5ddb59d 100644 --- a/static/webui/translations/es.js +++ b/static/webui/translations/es.js @@ -266,7 +266,7 @@ dict = { worldState_eightClaw: `Octava Garra`, worldState_eightClawProgressOverride: `Progreso de Octava Garra`, worldState_thermiaFractures: `Fracturas Thermia`, - worldState_thermiaFracturesProgressOverride: `[UNTRANSLATED] Thermia Fractures Progress`, + worldState_thermiaFracturesProgressOverride: `Progreso de Fracturas Thermia`, worldState_from_year: `de |VAL|`, worldState_pre_year: `antes de |VAL|`, worldState_week: `Semana |VAL|`,