fix(webui): properly handle unique level caps

This commit is contained in:
Sainan 2025-01-20 12:40:36 +01:00
parent 7bb857a17a
commit cd5f501d26
2 changed files with 16 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import {
ExportArcanes, ExportArcanes,
ExportAvionics, ExportAvionics,
ExportGear, ExportGear,
ExportMisc,
ExportRecipes, ExportRecipes,
ExportResources, ExportResources,
ExportSentinels, ExportSentinels,
@ -163,6 +164,7 @@ const getItemListsController: RequestHandler = (req, response) => {
response.json({ response.json({
badItems, badItems,
archonCrystalUpgrades, archonCrystalUpgrades,
uniqueLevelCaps: ExportMisc.uniqueLevelCaps,
...res ...res
}); });
}; };

View File

@ -126,6 +126,7 @@ function setLanguage(lang) {
updateInventory(); updateInventory();
} }
let uniqueLevelCaps = {};
function fetchItemList() { function fetchItemList() {
window.itemListPromise = new Promise(resolve => { window.itemListPromise = new Promise(resolve => {
const req = $.get("/custom/getItemLists?lang=" + window.lang); const req = $.get("/custom/getItemLists?lang=" + window.lang);
@ -167,6 +168,8 @@ function fetchItemList() {
option.value = name; option.value = name;
document.getElementById("datalist-" + type).appendChild(option); document.getElementById("datalist-" + type).appendChild(option);
}); });
} else if (type == "uniqueLevelCaps") {
uniqueLevelCaps = items;
} else if (type != "badItems") { } else if (type != "badItems") {
items.forEach(item => { items.forEach(item => {
if (item.uniqueName in data.badItems) { if (item.uniqueName in data.badItems) {
@ -235,14 +238,17 @@ function updateInventory() {
{ {
const td = document.createElement("td"); const td = document.createElement("td");
td.classList = "text-end text-nowrap"; td.classList = "text-end text-nowrap";
const maxXP = let maxXP = Math.pow(uniqueLevelCaps[item.ItemType] ?? 30, 2) * 1000;
category == "Suits" || if (
category == "SpaceSuits" || category != "Suits" &&
category == "Sentinels" || category != "SpaceSuits" &&
category == "Hoverboards" || category != "Sentinels" &&
category == "MechSuits" category != "Hoverboards" &&
? 1_600_000 category != "MechSuits"
: 800_000; )
{
maxXP /= 2;
}
if ( if (
item.XP < maxXP && item.XP < maxXP &&