From 56367dbf15850f20f0c288480500b0b5cdb15d8e Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 20 Jan 2025 11:55:25 +0100 Subject: [PATCH] feat(webui): add necramechs --- src/controllers/custom/addItemsController.ts | 15 ++++++++---- .../custom/getItemListsController.ts | 9 ++++++-- static/webui/index.html | 23 +++++++++++++++---- static/webui/script.js | 19 +++++++++------ 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/controllers/custom/addItemsController.ts b/src/controllers/custom/addItemsController.ts index d064a6e3..eb8814be 100644 --- a/src/controllers/custom/addItemsController.ts +++ b/src/controllers/custom/addItemsController.ts @@ -1,5 +1,5 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; -import { addEquipment, addPowerSuit, getInventory, updateSlots } from "@/src/services/inventoryService"; +import { addEquipment, addPowerSuit, addMechSuit, getInventory, updateSlots } from "@/src/services/inventoryService"; import { SlotNames } from "@/src/types/purchaseTypes"; import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes"; import { RequestHandler } from "express"; @@ -9,14 +9,17 @@ export const addItemsController: RequestHandler = async (req, res) => { const requests = req.body as IAddItemRequest[]; const inventory = await getInventory(accountId); for (const request of requests) { + updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1); switch (request.type) { case ItemType.Suits: - updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1); addPowerSuit(inventory, request.internalName); break; + case ItemType.MechSuits: + addMechSuit(inventory, request.internalName); + break; + default: - updateSlots(inventory, productCategoryToSlotName[request.type], 0, 1); addEquipment(inventory, request.type, request.internalName); break; } @@ -34,7 +37,8 @@ const productCategoryToSlotName: Record = { SpaceGuns: InventorySlot.SPACESUITS, SpaceMelee: InventorySlot.SPACESUITS, Sentinels: InventorySlot.SENTINELS, - SentinelWeapons: InventorySlot.SENTINELS + SentinelWeapons: InventorySlot.SENTINELS, + MechSuits: InventorySlot.MECHSUITS }; enum ItemType { @@ -46,7 +50,8 @@ enum ItemType { SpaceGuns = "SpaceGuns", SpaceMelee = "SpaceMelee", SentinelWeapons = "SentinelWeapons", - Sentinels = "Sentinels" + Sentinels = "Sentinels", + MechSuits = "MechSuits" } interface IAddItemRequest { diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 5033d492..535cb292 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -22,6 +22,7 @@ interface ListedItem { const getItemListsController: RequestHandler = (req, response) => { const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en"); const res: Record = {}; + res.Suits = []; res.LongGuns = []; res.Melee = []; res.ModularParts = []; @@ -31,10 +32,14 @@ const getItemListsController: RequestHandler = (req, response) => { res.SpaceGuns = []; res.SpaceMelee = []; res.SpaceSuits = []; - res.Suits = []; + res.MechSuits = []; res.miscitems = []; for (const [uniqueName, item] of Object.entries(ExportWarframes)) { - if (item.productCategory == "Suits" || item.productCategory == "SpaceSuits") { + if ( + item.productCategory == "Suits" || + item.productCategory == "SpaceSuits" || + item.productCategory == "MechSuits" + ) { res[item.productCategory].push({ uniqueName, name: getString(item.name, lang), diff --git a/static/webui/index.html b/static/webui/index.html index 10587a6b..5cb7565f 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -201,14 +201,14 @@
-
Sentinel Weapons
+
Necramechs
-
- + +
- +
@@ -229,6 +229,20 @@
+
+
+
Sentinel Weapons
+
+
+ + +
+ + +
+
+
+
@@ -505,6 +519,7 @@ + diff --git a/static/webui/script.js b/static/webui/script.js index c4b86f07..95e5652f 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -205,7 +205,8 @@ function updateInventory() { "SpaceMelee", "SentinelWeapons", "Hoverboards", - "OperatorAmps" + "OperatorAmps", + "MechSuits" ].forEach(category => { document.getElementById(category + "-list").innerHTML = ""; data[category].forEach(item => { @@ -230,14 +231,18 @@ function updateInventory() { const td = document.createElement("td"); td.classList = "text-end"; const maxXP = - category === "Suits" || - category === "SpaceSuits" || - category === "Sentinels" || - category === "Hoverboards" + category == "Suits" || + category == "SpaceSuits" || + category == "Sentinels" || + category == "Hoverboards" || + category == "MechSuits" ? 1_600_000 : 800_000; - if (item.XP < maxXP) { + if ( + item.XP < maxXP && + category != "MechSuits" // missionInventoryUpdate currently doesn't handle this category + ) { const a = document.createElement("a"); a.href = "#"; a.onclick = function (event) { @@ -260,7 +265,7 @@ function updateInventory() { } } }; - a.title = "Make Rank 30"; + a.title = "Max Rank"; a.innerHTML = ``; td.appendChild(a); }