From cf00a91b1ebd079300a05df0a220758038e7df83 Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:20:33 +0100 Subject: [PATCH] feat(webui): change SupportedSyndicate Closes #829 --- .../custom/getItemListsController.ts | 8 +++++++ static/webui/index.html | 6 +++++ static/webui/script.js | 23 +++++++++++++++++++ static/webui/translations/en.js | 3 +++ static/webui/translations/ru.js | 5 +++- 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/controllers/custom/getItemListsController.ts b/src/controllers/custom/getItemListsController.ts index 14bdc021..38add971 100644 --- a/src/controllers/custom/getItemListsController.ts +++ b/src/controllers/custom/getItemListsController.ts @@ -8,6 +8,7 @@ import { ExportRecipes, ExportResources, ExportSentinels, + ExportSyndicates, ExportUpgrades, ExportWarframes, ExportWeapons @@ -36,6 +37,7 @@ const getItemListsController: RequestHandler = (req, response) => { res.SpaceSuits = []; res.MechSuits = []; res.miscitems = []; + res.Syndicates = []; for (const [uniqueName, item] of Object.entries(ExportWarframes)) { if ( item.productCategory == "Suits" || @@ -160,6 +162,12 @@ const getItemListsController: RequestHandler = (req, response) => { badItems[uniqueName] = true; } } + for (const [uniqueName, syndicate] of Object.entries(ExportSyndicates)) { + res.Syndicates.push({ + uniqueName, + name: getString(syndicate.name, lang) + }); + } response.json({ badItems, diff --git a/static/webui/index.html b/static/webui/index.html index 92dd82d0..0401dcc7 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -465,6 +465,11 @@

+
+ + + +
@@ -489,6 +494,7 @@ + diff --git a/static/webui/script.js b/static/webui/script.js index 0d89cca5..94a7ba33 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -191,6 +191,15 @@ function fetchItemList() { }); } else if (type == "uniqueLevelCaps") { uniqueLevelCaps = items; + } else if (type == "Syndicates") { + items.forEach(item => { + if (item.uniqueName.startsWith("RadioLegion")) item.name += " (" + item.uniqueName + ")"; + const option = document.createElement("option"); + option.setAttribute("data-key", item.uniqueName); + option.value = item.name; + document.getElementById("datalist-" + type).appendChild(option); + itemMap[item.uniqueName] = { ...item, type }; + }); } else if (type != "badItems") { items.forEach(item => { if (item.uniqueName in data.badItems) { @@ -524,6 +533,10 @@ function updateInventory() { single.loadRoute("/webui/inventory"); } } + + document.querySelector("label[for='changeSyndicate']").innerText = loc("cheats_changeSupportedSyndicate") + .split("|SYNDICATE|") + .join(itemMap[data.SupportedSyndicate]?.name || loc("cheats_none")); }); }); } @@ -1096,3 +1109,13 @@ function doImport() { }); }); } + +function doChangeSupportedSyndicate() { + const uniqueName = getKey(document.getElementById("changeSyndicate")) ?? ""; + revalidateAuthz(() => { + $.get("/api/setSupportedSyndicate.php?" + window.authz + "&syndicate=" + uniqueName).done(function () { + document.getElementById("changeSyndicate").value = ""; + updateInventory(); + }); + }); +} diff --git a/static/webui/translations/en.js b/static/webui/translations/en.js index 134a91a9..5720a2f3 100644 --- a/static/webui/translations/en.js +++ b/static/webui/translations/en.js @@ -106,6 +106,9 @@ dict = { cheats_account: `Account`, cheats_unlockAllFocusSchools: `Unlock All Focus Schools`, cheats_helminthUnlockAll: `Fully Level Up Helminth`, + cheats_changeSupportedSyndicate: `Change supported syndicate. Current: |SYNDICATE|`, + cheats_changeButton: `Change`, + cheats_none: `None`, import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer will be overwritten in your account.`, import_submit: `Submit`, } \ No newline at end of file diff --git a/static/webui/translations/ru.js b/static/webui/translations/ru.js index d4d1eee4..87024996 100644 --- a/static/webui/translations/ru.js +++ b/static/webui/translations/ru.js @@ -107,6 +107,9 @@ dict = { cheats_account: `Аккаунт`, cheats_unlockAllFocusSchools: `Разблокировать все школы фокуса`, cheats_helminthUnlockAll: `Полностью улучшить Гельминта`, + cheats_changeSupportedSyndicate: `Изменить поддерживаемый синдикат. Текущий: |SYNDICATE|`, + cheats_changeButton: `Изменить`, + cheats_none: `Отсутствует`, import_importNote: `Вы можете загрузить полный или частичный ответ инвентаря (клиентское представление) здесь. Все поддерживаемые поля будут перезаписаны в вашем аккаунте.`, import_submit: `Отправить`, -} +} \ No newline at end of file