feat(webui): Add list of owned rivens #241
							
								
								
									
										1177
									
								
								static/webui/RivenParser.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1177
									
								
								static/webui/RivenParser.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -87,7 +87,7 @@
 | 
			
		||||
                            <div class="card mb-4">
 | 
			
		||||
                                <h5 class="card-header">Warframes</h5>
 | 
			
		||||
                                <div class="card-body">
 | 
			
		||||
                                    <table class="table table-striped w-100">
 | 
			
		||||
                                    <table class="table table-hover w-100">
 | 
			
		||||
                                        <tbody id="warframe-list"></tbody>
 | 
			
		||||
                                    </table>
 | 
			
		||||
                                    <form class="input-group" onsubmit="doAcquireWarframe();return false;">
 | 
			
		||||
@ -105,7 +105,7 @@
 | 
			
		||||
                            <div class="card mb-4">
 | 
			
		||||
                                <h5 class="card-header">Weapons</h5>
 | 
			
		||||
                                <div class="card-body">
 | 
			
		||||
                                    <table class="table table-striped w-100">
 | 
			
		||||
                                    <table class="table table-hover w-100">
 | 
			
		||||
                                        <tbody id="weapon-list"></tbody>
 | 
			
		||||
                                    </table>
 | 
			
		||||
                                    <form class="input-group" onsubmit="doAcquireWeapon();return false;">
 | 
			
		||||
@ -139,6 +139,14 @@
 | 
			
		||||
                            <a href="https://riven.builds.wf/" target="_blank">Need help with the fingerprint?</a>
 | 
			
		||||
                        </form>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="card mb-4 col-xxl-6">
 | 
			
		||||
                        <h5 class="card-header">Rivens</h5>
 | 
			
		||||
                        <div class="card-body">
 | 
			
		||||
                            <table class="table table-hover w-100">
 | 
			
		||||
                                <tbody id="riven-list"></tbody>
 | 
			
		||||
                            </table>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
@ -152,6 +160,7 @@
 | 
			
		||||
        ></script>
 | 
			
		||||
        <script src="https://cdn.jsdelivr.net/gh/angeal185/whirlpool-js/dist/whirlpool-js.min.js"></script>
 | 
			
		||||
        <script src="single.js"></script>
 | 
			
		||||
        <script src="RivenParser.js"></script>
 | 
			
		||||
        <script src="script.js"></script>
 | 
			
		||||
        <script
 | 
			
		||||
            src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
 | 
			
		||||
 | 
			
		||||
@ -95,6 +95,14 @@ 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 => {
 | 
			
		||||
@ -180,6 +188,57 @@ function updateInventory() {
 | 
			
		||||
                    document.getElementById("weapon-list").appendChild(tr);
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            document.getElementById("riven-list").innerHTML = "";
 | 
			
		||||
            data.Upgrades.forEach(item => {
 | 
			
		||||
                if (item.ItemType.substr(0, 32) == "/Lotus/Upgrades/Mods/Randomized/") {
 | 
			
		||||
                    const rivenType = item.ItemType.substr(32);
 | 
			
		||||
                    const fingerprint = JSON.parse(item.UpgradeFingerprint);
 | 
			
		||||
 | 
			
		||||
                    const tr = document.createElement("tr");
 | 
			
		||||
                    {
 | 
			
		||||
                        const td = document.createElement("td");
 | 
			
		||||
                        td.textContent = itemMap[fingerprint.compat]?.name ?? rivenGenericCompatNames[fingerprint.compat] ?? fingerprint.compat;
 | 
			
		||||
                        td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name;
 | 
			
		||||
                        td.innerHTML += " <span title='Number of buffs'>▲ " + fingerprint.buffs.length + "</span>";
 | 
			
		||||
                        td.innerHTML += " <span title='Number of curses'>▼ " + fingerprint.curses.length + "</span>";
 | 
			
		||||
                        td.innerHTML += " <span title='Number of rerolls'>⟳ " + fingerprint.rerolls + "</span>";
 | 
			
		||||
                        tr.appendChild(td);
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        const td = document.createElement("td");
 | 
			
		||||
                        td.classList = "text-end";
 | 
			
		||||
                        {
 | 
			
		||||
                            const a = document.createElement("a");
 | 
			
		||||
                            a.href = "https://riven.builds.wf/#" + encodeURIComponent(JSON.stringify({
 | 
			
		||||
                                rivenType: rivenType,
 | 
			
		||||
                                omegaAttenuation: 1,
 | 
			
		||||
                                fingerprint: fingerprint
 | 
			
		||||
                            }));
 | 
			
		||||
                            a.target = "_blank";
 | 
			
		||||
                            a.textContent = "View Stats";
 | 
			
		||||
                            td.appendChild(a);
 | 
			
		||||
                        }
 | 
			
		||||
                        {
 | 
			
		||||
                            const span = document.createElement("span");
 | 
			
		||||
                            span.innerHTML = " · ";
 | 
			
		||||
                            td.appendChild(span);
 | 
			
		||||
                        }
 | 
			
		||||
                        {
 | 
			
		||||
                            const a = document.createElement("a");
 | 
			
		||||
                            a.href = "#";
 | 
			
		||||
                            a.onclick = function (event) {
 | 
			
		||||
                                event.preventDefault();
 | 
			
		||||
                                disposeOfGear("Upgrades", item.ItemId.$oid);
 | 
			
		||||
                            };
 | 
			
		||||
                            a.textContent = "Remove";
 | 
			
		||||
                            td.appendChild(a);
 | 
			
		||||
                        }
 | 
			
		||||
                        tr.appendChild(td);
 | 
			
		||||
                    }
 | 
			
		||||
                    document.getElementById("riven-list").appendChild(tr);
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@ -272,7 +331,8 @@ function disposeOfGear(category, oid) {
 | 
			
		||||
    };
 | 
			
		||||
    data.Items[category] = [
 | 
			
		||||
        {
 | 
			
		||||
            String: oid
 | 
			
		||||
            String: oid,
 | 
			
		||||
            Count: 0
 | 
			
		||||
        }
 | 
			
		||||
    ];
 | 
			
		||||
    revalidateAuthz(() => {
 | 
			
		||||
@ -365,7 +425,8 @@ function doAcquireRiven() {
 | 
			
		||||
                                FusionPointCost: 0
 | 
			
		||||
                            })
 | 
			
		||||
                        }).done(function () {
 | 
			
		||||
                            alert("Successfully added.");
 | 
			
		||||
                            $("#addriven-fingerprint").val("");
 | 
			
		||||
                            updateInventory();
 | 
			
		||||
                        });
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user