From 36c05a7d66c51485a5cd8e6ea7512b5ff4d95d9b Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Sun, 14 Sep 2025 17:07:03 +0200 Subject: [PATCH 1/5] feat(webui): ship decorations Re #2361 --- config-vanilla.json | 1 - src/controllers/api/inventoryController.ts | 9 --- .../custom/getItemListsController.ts | 11 ++- src/services/configService.ts | 2 +- src/services/shipCustomizationsService.ts | 38 +++++------ static/webui/index.html | 27 ++++++-- static/webui/script.js | 68 +++++++++++++++++-- static/webui/translations/de.js | 3 +- static/webui/translations/en.js | 3 +- static/webui/translations/es.js | 3 +- static/webui/translations/fr.js | 3 +- static/webui/translations/ru.js | 3 +- static/webui/translations/uk.js | 3 +- static/webui/translations/zh.js | 3 +- 14 files changed, 123 insertions(+), 54 deletions(-) diff --git a/config-vanilla.json b/config-vanilla.json index e6f716ac..5e907ab2 100644 --- a/config-vanilla.json +++ b/config-vanilla.json @@ -11,7 +11,6 @@ "administratorNames": [], "autoCreateAccount": true, "skipTutorial": false, - "unlockAllShipDecorations": false, "unlockAllFlavourItems": false, "unlockAllSkins": false, "fullyStockedVendors": false, diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 1af5c350..ce6bb775 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -321,15 +321,6 @@ export const getInventoryResponse = async ( } } - if (config.unlockAllShipDecorations) { - inventoryResponse.ShipDecorations = []; - for (const [uniqueName, item] of Object.entries(ExportResources)) { - if (item.productCategory == "ShipDecorations") { - inventoryResponse.ShipDecorations.push({ ItemType: uniqueName, ItemCount: 999_999 }); - } - } - } - if (config.unlockAllFlavourItems) { inventoryResponse.FlavourItems = []; for (const uniqueName in ExportFlavour) { diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 063d7cfa..e35e8a86 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -62,6 +62,7 @@ interface ItemLists { Abilities: ListedItem[]; TechProjects: ListedItem[]; VaultDecoRecipes: ListedItem[]; + ShipDecorations: ListedItem[]; //circuitGameModes: ListedItem[]; } @@ -102,7 +103,8 @@ const getItemListsController: RequestHandler = (req, response) => { VarziaOffers: [], Abilities: [], TechProjects: [], - VaultDecoRecipes: [] + VaultDecoRecipes: [], + ShipDecorations: [] /*circuitGameModes: [ { uniqueName: "Survival", @@ -230,7 +232,12 @@ const getItemListsController: RequestHandler = (req, response) => { } } } - if ( + if (item.productCategory == "ShipDecorations") { + res.ShipDecorations.push({ + uniqueName: uniqueName, + name: name + }); + } else if ( name && uniqueName.substring(0, 30) != "/Lotus/Types/Game/Projections/" && uniqueName != "/Lotus/Types/Gameplay/EntratiLab/Resources/EntratiLanthornBundle" diff --git a/src/services/configService.ts b/src/services/configService.ts index 162de999..12812f07 100644 --- a/src/services/configService.ts +++ b/src/services/configService.ts @@ -21,7 +21,6 @@ export interface IConfig { administratorNames?: string[]; autoCreateAccount?: boolean; skipTutorial?: boolean; - unlockAllShipDecorations?: boolean; unlockAllFlavourItems?: boolean; unlockAllSkins?: boolean; fullyStockedVendors?: boolean; @@ -128,6 +127,7 @@ export const configRemovedOptionsKeys = [ "noDojoResearchCosts", "noDojoResearchTime", "fastClanAscension", + "unlockAllShipDecorations", "unlockAllDecoRecipes" ]; diff --git a/src/services/shipCustomizationsService.ts b/src/services/shipCustomizationsService.ts index 2358fe41..d018b73b 100644 --- a/src/services/shipCustomizationsService.ts +++ b/src/services/shipCustomizationsService.ts @@ -137,15 +137,13 @@ export const handleSetShipDecorations = async ( roomToPlaceIn.MaxCapacity += meta.capacityCost; await personalRooms.save(); - if (!config.unlockAllShipDecorations) { - const inventory = await getInventory(accountId); - if (deco.Sockets !== undefined) { - addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: deco.Sockets, ItemCount: 1 }]); - } else { - addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]); - } - await inventory.save(); + const inventory = await getInventory(accountId); + if (deco.Sockets !== undefined) { + addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: deco.Sockets, ItemCount: 1 }]); + } else { + addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]); } + await inventory.save(); return { DecoId: placedDecoration.RemoveId, @@ -155,15 +153,13 @@ export const handleSetShipDecorations = async ( }; } - if (!config.unlockAllShipDecorations) { - const inventory = await getInventory(accountId); - if (placedDecoration.Sockets !== undefined) { - addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: placedDecoration.Sockets, ItemCount: -1 }]); - } else { - addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: -1 }]); - } - await inventory.save(); + const inventory = await getInventory(accountId); + if (placedDecoration.Sockets !== undefined) { + addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: placedDecoration.Sockets, ItemCount: -1 }]); + } else { + addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: -1 }]); } + await inventory.save(); //place decoration const decoId = new Types.ObjectId(); @@ -221,12 +217,10 @@ export const handleResetShipDecorations = async ( } // refund item - if (!config.unlockAllShipDecorations) { - if (deco.Sockets !== undefined) { - addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: deco.Sockets, ItemCount: 1 }]); - } else { - addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]); - } + if (deco.Sockets !== undefined) { + addFusionTreasures(inventory, [{ ItemType: itemType, Sockets: deco.Sockets, ItemCount: 1 }]); + } else { + addShipDecorations(inventory, [{ ItemType: itemType, ItemCount: 1 }]); } // refund capacity diff --git a/static/webui/index.html b/static/webui/index.html index 2ad2751d..f27a1aad 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -108,9 +108,9 @@