From da73156f231adbb105067d258811ce2994389dd5 Mon Sep 17 00:00:00 2001 From: Sainan Date: Thu, 30 May 2024 10:49:51 +0200 Subject: [PATCH] improve(webui): hard-code Grimoire's uniqueName as a temp fix for it not being in most data sources --- static/webui/script.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/static/webui/script.js b/static/webui/script.js index 83fd7789..5f437737 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -81,7 +81,16 @@ single.on("route_load", function (event) { window.itemListPromise = new Promise(resolve => { const req = $.get("/custom/getItemLists"); req.done(data => { - const itemMap = {}; + const itemMap = { + // Generics for rivens + "/Lotus/Weapons/Tenno/Archwing/Primary/ArchGun": { name: "Archgun" }, + "/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon": { name: "Melee" }, + "/Lotus/Weapons/Tenno/Pistol/LotusPistol": { name: "Pistol" }, + "/Lotus/Weapons/Tenno/Rifle/LotusRifle": { name: "Rifle" }, + "/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": { name: "Shotgun" }, + // Missing in data sources + "/Lotus/Weapons/Tenno/Grimoire/TnGrimoire": { name: "Grimoire" } + }; for (const [type, items] of Object.entries(data)) { items.forEach(item => { const option = document.createElement("option"); @@ -95,14 +104,6 @@ window.itemListPromise = new Promise(resolve => { }); }); -const rivenGenericCompatNames = { - "/Lotus/Weapons/Tenno/Archwing/Primary/ArchGun": "Archgun", - "/Lotus/Weapons/Tenno/Melee/PlayerMeleeWeapon": "Melee", - "/Lotus/Weapons/Tenno/Pistol/LotusPistol": "Pistol", - "/Lotus/Weapons/Tenno/Rifle/LotusRifle": "Rifle", - "/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": "Shotgun" -}; - function updateInventory() { const req = $.get("/api/inventory.php?" + window.authz); req.done(data => { @@ -198,10 +199,7 @@ function updateInventory() { const tr = document.createElement("tr"); { const td = document.createElement("td"); - td.textContent = - itemMap[fingerprint.compat]?.name ?? - rivenGenericCompatNames[fingerprint.compat] ?? - fingerprint.compat; + td.textContent = itemMap[fingerprint.compat]?.name ?? fingerprint.compat; td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name; td.innerHTML += " ▲ " + fingerprint.buffs.length + ""; td.innerHTML += " ▼ " + fingerprint.curses.length + "";