From 463ed2db45649b8f2c08c1dadc805834e2ccce87 Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Sun, 14 Sep 2025 16:39:49 +0200 Subject: [PATCH] feat(webui): flavour Items Re #2361 --- config-vanilla.json | 1 - src/controllers/api/inventoryController.ts | 7 +- .../custom/getItemListsController.ts | 12 ++- .../custom/removeCustomizationController.ts | 14 ++++ src/routes/custom.ts | 2 + src/services/configService.ts | 4 +- static/webui/index.html | 22 +++++- static/webui/script.js | 76 +++++++++++++++++++ static/webui/translations/de.js | 7 +- static/webui/translations/en.js | 7 +- static/webui/translations/es.js | 7 +- static/webui/translations/fr.js | 7 +- static/webui/translations/ru.js | 7 +- static/webui/translations/uk.js | 7 +- static/webui/translations/zh.js | 7 +- 15 files changed, 166 insertions(+), 21 deletions(-) create mode 100644 src/controllers/custom/removeCustomizationController.ts diff --git a/config-vanilla.json b/config-vanilla.json index e6f716ac..56f93879 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -12,7 +12,6 @@ "autoCreateAccount": true, "skipTutorial": false, "unlockAllShipDecorations": false, - "unlockAllFlavourItems": false, "unlockAllSkins": false, "fullyStockedVendors": false, "skipClanKeyCrafting": false, diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 1af5c350..00c825af 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -330,12 +330,7 @@ export const getInventoryResponse = async ( } } - if (config.unlockAllFlavourItems) { - inventoryResponse.FlavourItems = []; - for (const uniqueName in ExportFlavour) { - inventoryResponse.FlavourItems.push({ ItemType: uniqueName }); - } - } else if (config.worldState?.baroTennoConRelay) { + if (config.worldState?.baroTennoConRelay) { [ "/Lotus/Types/Items/Events/TennoConRelay2022EarlyAccess", "/Lotus/Types/Items/Events/TennoConRelay2023EarlyAccess", diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 063d7cfa..3296ad1c 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -10,6 +10,7 @@ import { ExportDojoRecipes, ExportDrones, ExportFactions, + ExportFlavour, ExportGear, ExportKeys, ExportRailjackWeapons, @@ -62,6 +63,7 @@ interface ItemLists { Abilities: ListedItem[]; TechProjects: ListedItem[]; VaultDecoRecipes: ListedItem[]; + FlavourItems: ListedItem[]; //circuitGameModes: ListedItem[]; } @@ -102,7 +104,8 @@ const getItemListsController: RequestHandler = (req, response) => { VarziaOffers: [], Abilities: [], TechProjects: [], - VaultDecoRecipes: [] + VaultDecoRecipes: [], + FlavourItems: [] /*circuitGameModes: [ { uniqueName: "Survival", @@ -443,6 +446,13 @@ const getItemListsController: RequestHandler = (req, response) => { }); } + for (const [uniqueName, item] of Object.entries(ExportFlavour)) { + res.FlavourItems.push({ + uniqueName: uniqueName, + name: getString(item.name, lang) + }); + } + response.json(res); }; diff --git a/src/controllers/custom/removeCustomizationController.ts b/src/controllers/custom/removeCustomizationController.ts new file mode 100644 index 00000000..a1b84f56 --- /dev/null +++ b/src/controllers/custom/removeCustomizationController.ts @@ -0,0 +1,14 @@ +import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { getInventory } from "../../services/inventoryService.ts"; +import type { RequestHandler } from "express"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; + +export const removeCustomizationController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const ItemType = req.query.itemType as string; + const inventory = await getInventory(accountId, "FlavourItems"); + inventory.FlavourItems.pull({ ItemType }); + await inventory.save(); + res.end(); + broadcastInventoryUpdate(req); +}; diff --git a/src/routes/custom.ts b/src/routes/custom.ts index ce0082db..457f0d99 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -21,6 +21,7 @@ import { unlockAllSimarisResearchEntriesController } from "../controllers/custom import { unlockAllScansController } from "../controllers/custom/unlockAllScansController.ts"; import { unlockAllShipFeaturesController } from "../controllers/custom/unlockAllShipFeaturesController.ts"; import { unlockAllCapturaScenesController } from "../controllers/custom/unlockAllCapturaScenesController.ts"; +import { removeCustomizationController } from "../controllers/custom/removeCustomizationController.ts"; import { abilityOverrideController } from "../controllers/custom/abilityOverrideController.ts"; import { createAccountController } from "../controllers/custom/createAccountController.ts"; @@ -70,6 +71,7 @@ customRouter.get("/unlockAllSimarisResearchEntries", unlockAllSimarisResearchEnt customRouter.get("/unlockAllScans", unlockAllScansController); customRouter.get("/unlockAllShipFeatures", unlockAllShipFeaturesController); customRouter.get("/unlockAllCapturaScenes", unlockAllCapturaScenesController); +customRouter.get("/removeCustomization", removeCustomizationController); customRouter.post("/abilityOverride", abilityOverrideController); customRouter.post("/createAccount", createAccountController); diff --git a/src/services/configService.ts b/src/services/configService.ts index 162de999..18348357 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -22,7 +22,6 @@ export interface IConfig { autoCreateAccount?: boolean; skipTutorial?: boolean; unlockAllShipDecorations?: boolean; - unlockAllFlavourItems?: boolean; unlockAllSkins?: boolean; fullyStockedVendors?: boolean; skipClanKeyCrafting?: boolean; @@ -128,7 +127,8 @@ export const configRemovedOptionsKeys = [ "noDojoResearchCosts", "noDojoResearchTime", "fastClanAscension", - "unlockAllDecoRecipes" + "unlockAllDecoRecipes", + "unlockAllFlavourItems" ]; export const configPath = path.join(repoDir, args.configPath ?? "config.json"); diff --git a/static/webui/index.html b/static/webui/index.html index 2ad2751d..a3449f8a 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -459,6 +459,22 @@ +