From eadc9c4ecb2eeb429c7a4caad03b47ed64a06722 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Fri, 20 Jun 2025 14:00:39 -0700 Subject: [PATCH] feat(webui): max rank plexus (#2219) Closes #1740 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2219 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- static/webui/index.html | 3 ++ static/webui/script.js | 82 ++++++++++++++++++++++----------- 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/zh.js | 3 +- 8 files changed, 70 insertions(+), 33 deletions(-) diff --git a/static/webui/index.html b/static/webui/index.html index e80d9fe7..5b92f727 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -452,6 +452,9 @@ +
+ +
diff --git a/static/webui/script.js b/static/webui/script.js index bd32266f..f4c43175 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -594,8 +594,9 @@ function updateInventory() { a.onclick = function (event) { event.preventDefault(); revalidateAuthz(() => { + const promises = []; if (item.XP < maxXP) { - addGearExp(category, item.ItemId.$oid, maxXP - item.XP); + promises.push(addGearExp(category, item.ItemId.$oid, maxXP - item.XP)); } if ("exalted" in itemMap[item.ItemType]) { for (const exaltedType of itemMap[item.ItemType].exalted) { @@ -604,15 +605,20 @@ function updateInventory() { const exaltedCap = itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000; if (exaltedItem.XP < exaltedCap) { - addGearExp( - "SpecialItems", - exaltedItem.ItemId.$oid, - exaltedCap - exaltedItem.XP + promises.push( + addGearExp( + "SpecialItems", + exaltedItem.ItemId.$oid, + exaltedCap - exaltedItem.XP + ) ); } } } } + Promise.all(promises).then(() => { + updateInventory(); + }); }); }; a.title = loc("code_maxRank"); @@ -761,6 +767,13 @@ function updateInventory() { giveAllQEvolutionProgress.disabled = true; } + if (data.CrewShipHarnesses?.length) { + window.plexus = { + id: data.CrewShipHarnesses[0].ItemId.$oid, + xp: data.CrewShipHarnesses[0].XP + }; + } + // Populate quests route document.getElementById("QuestKeys-list").innerHTML = ""; data.QuestKeys.forEach(item => { @@ -1443,20 +1456,17 @@ function maxRankAllEquipment(categories) { XP: maxXP }); } - if (category === "Suits") { - if ("exalted" in itemMap[item.ItemType]) { - for (const exaltedType of itemMap[item.ItemType].exalted) { - const exaltedItem = data["SpecialItems"].find(x => x.ItemType == exaltedType); - if (exaltedItem) { - const exaltedCap = - itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000; - if (exaltedItem.XP < exaltedCap) { - batchData["SpecialItems"] ??= []; - batchData["SpecialItems"].push({ - ItemId: { $oid: exaltedItem.ItemId.$oid }, - XP: exaltedCap - }); - } + if (item.ItemType in itemMap && "exalted" in itemMap[item.ItemType]) { + for (const exaltedType of itemMap[item.ItemType].exalted) { + const exaltedItem = data["SpecialItems"].find(x => x.ItemType == exaltedType); + if (exaltedItem) { + const exaltedCap = itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000; + if (exaltedItem.XP < exaltedCap) { + batchData["SpecialItems"] ??= []; + batchData["SpecialItems"].push({ + ItemId: { $oid: exaltedItem.ItemId.$oid }, + XP: exaltedCap + }); } } } @@ -1483,14 +1493,14 @@ function addGearExp(category, oid, xp) { XP: xp } ]; - $.post({ - url: "/custom/addXp?" + window.authz, - contentType: "application/json", - data: JSON.stringify(data) - }).done(function () { - if (category != "SpecialItems") { - updateInventory(); - } + return new Promise((resolve, reject) => { + $.post({ + url: "/custom/addXp?" + window.authz, + contentType: "application/json", + data: JSON.stringify(data) + }) + .done(resolve) + .fail(reject); }); } @@ -2249,3 +2259,21 @@ function formatDatetime(fmt, date) { } }); } + +const calls_in_flight = new Set(); + +async function debounce(func, ...args) { + calls_in_flight.add(func); + await func(...args); + calls_in_flight.delete(func); +} + +async function doMaxPlexus() { + if ((window.plexus?.xp ?? 0) < 900_000) { + await addGearExp("CrewShipHarnesses", window.plexus.id, 900_000 - window.plexus.xp); + window.plexus.xp = 900_000; + toast(loc("code_succRankUp")); + } else { + toast(loc("code_noEquipmentToRankUp")); + } +} diff --git a/static/webui/translations/de.js b/static/webui/translations/de.js index b84df0f2..0401beb9 100644 --- a/static/webui/translations/de.js +++ b/static/webui/translations/de.js @@ -86,6 +86,7 @@ dict = { inventory_moaPets: `Moas`, inventory_kubrowPets: `Bestien`, inventory_evolutionProgress: `Incarnon-Entwicklungsfortschritte`, + inventory_Boosters: `[UNTRANSLATED] Boosters`, inventory_bulkAddSuits: `Fehlende Warframes hinzufügen`, inventory_bulkAddWeapons: `Fehlende Waffen hinzufügen`, inventory_bulkAddSpaceSuits: `Fehlende Archwings hinzufügen`, @@ -100,7 +101,7 @@ dict = { inventory_bulkRankUpSentinels: `Alle Wächter auf Max. Rang`, inventory_bulkRankUpSentinelWeapons: `Alle Wächter-Waffen auf Max. Rang`, inventory_bulkRankUpEvolutionProgress: `Alle Incarnon-Entwicklungsfortschritte auf Max. Rang`, - inventory_Boosters: `[UNTRANSLATED] Boosters`, + inventory_maxPlexus: `[UNTRANSLATED] Max Rank Plexus`, quests_list: `Quests`, quests_completeAll: `Alle Quests abschließen`, diff --git a/static/webui/translations/en.js b/static/webui/translations/en.js index 7f5b5aca..28bd1e48 100644 --- a/static/webui/translations/en.js +++ b/static/webui/translations/en.js @@ -85,6 +85,7 @@ dict = { inventory_moaPets: `Moas`, inventory_kubrowPets: `Beasts`, inventory_evolutionProgress: `Incarnon Evolution Progress`, + inventory_Boosters: `Boosters`, inventory_bulkAddSuits: `Add Missing Warframes`, inventory_bulkAddWeapons: `Add Missing Weapons`, inventory_bulkAddSpaceSuits: `Add Missing Archwings`, @@ -99,7 +100,7 @@ dict = { inventory_bulkRankUpSentinels: `Max Rank All Sentinels`, inventory_bulkRankUpSentinelWeapons: `Max Rank All Sentinel Weapons`, inventory_bulkRankUpEvolutionProgress: `Max Rank All Incarnon Evolution Progress`, - inventory_Boosters: `Boosters`, + inventory_maxPlexus: `Max Rank Plexus`, quests_list: `Quests`, quests_completeAll: `Complete All Quests`, diff --git a/static/webui/translations/es.js b/static/webui/translations/es.js index da50fe7e..e46bcedd 100644 --- a/static/webui/translations/es.js +++ b/static/webui/translations/es.js @@ -86,6 +86,7 @@ dict = { inventory_moaPets: `Moas`, inventory_kubrowPets: `Bestias`, inventory_evolutionProgress: `Progreso de evolución Incarnon`, + inventory_Boosters: `Potenciadores`, inventory_bulkAddSuits: `Agregar Warframes faltantes`, inventory_bulkAddWeapons: `Agregar armas faltantes`, inventory_bulkAddSpaceSuits: `Agregar Archwings faltantes`, @@ -100,7 +101,7 @@ dict = { inventory_bulkRankUpSentinels: `Maximizar rango de todos los centinelas`, inventory_bulkRankUpSentinelWeapons: `Maximizar rango de todas las armas de centinela`, inventory_bulkRankUpEvolutionProgress: `Maximizar todo el progreso de evolución Incarnon`, - inventory_Boosters: `Potenciadores`, + inventory_maxPlexus: `[UNTRANSLATED] Max Rank Plexus`, quests_list: `Misiones`, quests_completeAll: `Completar todas las misiones`, diff --git a/static/webui/translations/fr.js b/static/webui/translations/fr.js index 4a8fae03..4958dd8e 100644 --- a/static/webui/translations/fr.js +++ b/static/webui/translations/fr.js @@ -86,6 +86,7 @@ dict = { inventory_moaPets: `Moas`, inventory_kubrowPets: `Bêtes`, inventory_evolutionProgress: `Progrès de l'évolution Incarnon`, + inventory_Boosters: `[UNTRANSLATED] Boosters`, inventory_bulkAddSuits: `Ajouter les Warframes manquantes`, inventory_bulkAddWeapons: `Ajouter les armes manquantes`, inventory_bulkAddSpaceSuits: `Ajouter les Archwings manquants`, @@ -100,7 +101,7 @@ dict = { inventory_bulkRankUpSentinels: `Toutes les Sentinelles au rang max`, inventory_bulkRankUpSentinelWeapons: `Toutes les armes de Sentinelles au rang max`, inventory_bulkRankUpEvolutionProgress: `Toutes les évolutions Incarnon au rang max`, - inventory_Boosters: `[UNTRANSLATED] Boosters`, + inventory_maxPlexus: `[UNTRANSLATED] Max Rank Plexus`, quests_list: `Quêtes`, quests_completeAll: `Compléter toutes les quêtes`, diff --git a/static/webui/translations/ru.js b/static/webui/translations/ru.js index 612555b3..d7369199 100644 --- a/static/webui/translations/ru.js +++ b/static/webui/translations/ru.js @@ -86,6 +86,7 @@ dict = { inventory_moaPets: `МОА`, inventory_kubrowPets: `Звери`, inventory_evolutionProgress: `Прогресс эволюции Инкарнонов`, + inventory_Boosters: `[UNTRANSLATED] Boosters`, inventory_bulkAddSuits: `Добавить отсутствующие варфреймы`, inventory_bulkAddWeapons: `Добавить отсутствующее оружие`, inventory_bulkAddSpaceSuits: `Добавить отсутствующие арчвинги`, @@ -100,7 +101,7 @@ dict = { inventory_bulkRankUpSentinels: `Максимальный ранг всех стражей`, inventory_bulkRankUpSentinelWeapons: `Максимальный ранг всего оружия стражей`, inventory_bulkRankUpEvolutionProgress: `Максимальный ранг всех эволюций Инкарнонов`, - inventory_Boosters: `[UNTRANSLATED] Boosters`, + inventory_maxPlexus: `[UNTRANSLATED] Max Rank Plexus`, quests_list: `Квесты`, quests_completeAll: `Завершить все квесты`, diff --git a/static/webui/translations/zh.js b/static/webui/translations/zh.js index 6b1d4b7f..1bd23d49 100644 --- a/static/webui/translations/zh.js +++ b/static/webui/translations/zh.js @@ -86,6 +86,7 @@ dict = { inventory_moaPets: `恐鸟`, inventory_kubrowPets: `动物同伴`, inventory_evolutionProgress: `灵化之源进度`, + inventory_Boosters: `加成器`, inventory_bulkAddSuits: `添加缺失战甲`, inventory_bulkAddWeapons: `添加缺失武器`, inventory_bulkAddSpaceSuits: `添加缺失Archwing`, @@ -100,7 +101,7 @@ dict = { inventory_bulkRankUpSentinels: `所有守护升满级`, inventory_bulkRankUpSentinelWeapons: `所有守护武器升满级`, inventory_bulkRankUpEvolutionProgress: `所有灵化之源最大等级`, - inventory_Boosters: `加成器`, + inventory_maxPlexus: `[UNTRANSLATED] Max Rank Plexus`, quests_list: `任务`, quests_completeAll: `完成所有任务`,