From c4b8a71c5affbb99de264840d8d7b9a3d9c6cd74 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:00:04 -0700 Subject: [PATCH] chore(webui): provide "max rank" option when only exalted needs it (#1776) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1776 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- static/webui/script.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/static/webui/script.js b/static/webui/script.js index a2b8619c..d570d1b9 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -443,12 +443,28 @@ function updateInventory() { maxXP /= 2; } - if (item.XP < maxXP) { + let anyExaltedMissingXP = false; + if (item.XP >= maxXP && "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) { + anyExaltedMissingXP = true; + break; + } + } + } + } + + if (item.XP < maxXP || anyExaltedMissingXP) { const a = document.createElement("a"); a.href = "#"; a.onclick = function (event) { event.preventDefault(); - addGearExp(category, item.ItemId.$oid, maxXP - item.XP); + if (item.XP < maxXP) { + addGearExp(category, item.ItemId.$oid, maxXP - item.XP); + } if ("exalted" in itemMap[item.ItemType]) { for (const exaltedType of itemMap[item.ItemType].exalted) { const exaltedItem = data.SpecialItems.find(x => x.ItemType == exaltedType);