From 7e67e54c0bc411512dc0abca00d198e6fbf97e5b Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 22 Jun 2024 20:40:18 +0200 Subject: [PATCH] feat: add universalPolarityEverywhere --- config.json.example | 1 + src/controllers/api/inventoryController.ts | 20 ++++++++++++++- src/services/configService.ts | 1 + src/types/inventoryTypes/inventoryTypes.ts | 24 ++++++++++------- static/webui/index.html | 30 ++++++++++++++-------- 5 files changed, 55 insertions(+), 21 deletions(-) diff --git a/config.json.example b/config.json.example index e874d450..12843a76 100644 --- a/config.json.example +++ b/config.json.example @@ -20,5 +20,6 @@ "unlockAllShipDecorations": true, "unlockAllFlavourItems": true, "unlockAllSkins": true, + "universalPolarityEverywhere": true, "spoofMasteryRank": -1 } diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 03383df8..021a7558 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -5,7 +5,8 @@ import { Inventory } from "@/src/models/inventoryModels/inventoryModel"; import { config } from "@/src/services/configService"; import allMissions from "@/static/fixed_responses/allMissions.json"; import { ILoadoutDatabase } from "@/src/types/saveLoadoutTypes"; -import { IShipInventory } from "@/src/types/inventoryTypes/inventoryTypes"; +import { IShipInventory, equipmentKeys } from "@/src/types/inventoryTypes/inventoryTypes"; +import { IPolarity, ArtifactPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { ExportCustoms, ExportFlavour, ExportKeys, ExportResources } from "warframe-public-export-plus"; // eslint-disable-next-line @typescript-eslint/no-misused-promises @@ -118,6 +119,23 @@ const inventoryController: RequestHandler = async (request, response) => { } } + if (config.universalPolarityEverywhere) { + const Polarity: IPolarity[] = []; + for (let i = 0; i != 10; ++i) { + Polarity.push({ + Slot: i, + Value: ArtifactPolarity.Any + }); + } + for (const key of equipmentKeys) { + if (key in inventoryResponse) { + for (const equipment of inventoryResponse[key]) { + equipment.Polarity = Polarity; + } + } + } + } + response.json(inventoryResponse); }; diff --git a/src/services/configService.ts b/src/services/configService.ts index 785c0f0b..272f50ac 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -37,6 +37,7 @@ interface IConfig { unlockAllShipDecorations?: boolean; unlockAllFlavourItems?: boolean; unlockAllSkins?: boolean; + universalPolarityEverywhere?: boolean; spoofMasteryRank?: number; } diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 74508bcf..b9547458 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -59,15 +59,21 @@ export interface ITypeCount { ItemCount: number; } -export type TEquipmentKey = - | "Suits" - | "LongGuns" - | "Pistols" - | "Melee" - | "SpecialItems" - | "Sentinels" - | "SentinelWeapons" - | "SpaceGuns"; +export const equipmentKeys = [ + "Suits", + "LongGuns", + "Pistols", + "Melee", + "SpecialItems", + "Sentinels", + "SentinelWeapons", + "SpaceSuits", + "SpaceGuns", + "SpaceMelee", + "Hoverboards" +] as const; + +export type TEquipmentKey = (typeof equipmentKeys)[number]; export interface IDuviriInfo { Seed: number; diff --git a/static/webui/index.html b/static/webui/index.html index d19f125a..4db8f2ef 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -231,9 +231,9 @@
- +
@@ -241,22 +241,30 @@
- +
- +
-
- +
+ + +
+
+