feat(webui): add Mods tab with "Add Riven" option
This commit is contained in:
parent
b38b59de06
commit
a670dbc3f7
@ -21,6 +21,9 @@ webuiRouter.use("/webui", (req, res, next) => {
|
|||||||
webuiRouter.get("/webui/inventory", (_req, res) => {
|
webuiRouter.get("/webui/inventory", (_req, res) => {
|
||||||
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||||
});
|
});
|
||||||
|
webuiRouter.get("/webui/mods", (_req, res) => {
|
||||||
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||||
|
});
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files
|
||||||
webuiRouter.use("/webui", express.static(path.join(rootDir, "static/webui")));
|
webuiRouter.use("/webui", express.static(path.join(rootDir, "static/webui")));
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
<div class="offcanvas-body">
|
<div class="offcanvas-body">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/webui/inventory">Inventory</a></li>
|
<li><a href="/webui/inventory">Inventory</a></li>
|
||||||
|
<li><a href="/webui/mods">Mods</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -116,6 +117,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-route="/webui/mods">
|
||||||
|
<div class="card mb-4">
|
||||||
|
<h5 class="card-header">Add Riven</h5>
|
||||||
|
<form class="card-body" onsubmit="doAcquireRiven();return false;">
|
||||||
|
<select class="form-control mb-3" id="addriven-type">
|
||||||
|
<option value="LotusArchgunRandomModRare">LotusArchgunRandomModRare</option>
|
||||||
|
<option value="LotusModularMeleeRandomModRare">LotusModularMeleeRandomModRare</option>
|
||||||
|
<option value="LotusModularPistolRandomModRare">LotusModularPistolRandomModRare</option>
|
||||||
|
<option value="LotusPistolRandomModRare">LotusPistolRandomModRare</option>
|
||||||
|
<option value="LotusRifleRandomModRare" selected>LotusRifleRandomModRare</option>
|
||||||
|
<option value="LotusShotgunRandomModRare">LotusShotgunRandomModRare</option>
|
||||||
|
<option value="PlayerMeleeWeaponRandomModRare">PlayerMeleeWeaponRandomModRare</option>
|
||||||
|
</select>
|
||||||
|
<textarea
|
||||||
|
id="addriven-fingerprint"
|
||||||
|
class="form-control mb-3"
|
||||||
|
placeholder="Fingerprint"
|
||||||
|
></textarea>
|
||||||
|
<button class="btn btn-primary" style="margin-right: 5px" type="submit">Add</button>
|
||||||
|
<a href="https://riven.builds.wf/" target="_blank">Need help with the fingerprint?</a>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<datalist id="datalist-warframes"></datalist>
|
<datalist id="datalist-warframes"></datalist>
|
||||||
|
@ -282,3 +282,66 @@ function doAcquireMiscItems() {
|
|||||||
$("#miscitem-name").on("input", () => {
|
$("#miscitem-name").on("input", () => {
|
||||||
$("#miscitem-name").removeClass("is-invalid");
|
$("#miscitem-name").removeClass("is-invalid");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function doAcquireRiven() {
|
||||||
|
let fingerprint;
|
||||||
|
try {
|
||||||
|
fingerprint = JSON.parse($("#addriven-fingerprint").val());
|
||||||
|
if (typeof fingerprint !== "object") {
|
||||||
|
fingerprint = JSON.parse(fingerprint);
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
if (
|
||||||
|
typeof fingerprint !== "object" ||
|
||||||
|
!("compat" in fingerprint) ||
|
||||||
|
!("pol" in fingerprint) ||
|
||||||
|
!("buffs" in fingerprint)
|
||||||
|
) {
|
||||||
|
$("#addriven-fingerprint").addClass("is-invalid").focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const uniqueName = "/Lotus/Upgrades/Mods/Randomized/" + $("#addriven-type").val();
|
||||||
|
// Add riven type to inventory
|
||||||
|
$.post({
|
||||||
|
url: "/api/missionInventoryUpdate.php?" + window.authz,
|
||||||
|
contentType: "text/plain",
|
||||||
|
data: JSON.stringify({
|
||||||
|
RawUpgrades: [
|
||||||
|
{
|
||||||
|
ItemType: uniqueName,
|
||||||
|
ItemCount: 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}).done(function () {
|
||||||
|
// Get riven's assigned id
|
||||||
|
$.get("/api/inventory.php?" + window.authz).done(data => {
|
||||||
|
for (const rawUpgrade of data.RawUpgrades) {
|
||||||
|
if (rawUpgrade.ItemType === uniqueName) {
|
||||||
|
// Add fingerprint to riven
|
||||||
|
$.post({
|
||||||
|
url: "/api/artifacts.php?" + window.authz,
|
||||||
|
contentType: "text/plain",
|
||||||
|
data: JSON.stringify({
|
||||||
|
Upgrade: {
|
||||||
|
ItemType: uniqueName,
|
||||||
|
UpgradeFingerprint: JSON.stringify(fingerprint),
|
||||||
|
ItemId: rawUpgrade.LastAdded
|
||||||
|
},
|
||||||
|
LevelDiff: 0,
|
||||||
|
Cost: 0,
|
||||||
|
FusionPointCost: 0
|
||||||
|
})
|
||||||
|
}).done(function () {
|
||||||
|
alert("Successfully added.");
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#addriven-fingerprint").on("input", () => {
|
||||||
|
$("#addriven-fingerprint").removeClass("is-invalid");
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user