feat: bulk max rank weapons and warframes
This commit is contained in:
parent
d73d14bc48
commit
90f1cb70d3
@ -110,9 +110,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
<h5 class="card-header">Bulk Actions</h5>
|
<h5 class="card-header">Bulk Actions</h5>
|
||||||
<div class="card-body">
|
<div class="card-body d-flex flex-wrap gap-2">
|
||||||
<button class="btn btn-primary" onclick="addMissingWarframes();">Add Missing Warframes</button>
|
<button class="btn btn-primary flex-grow-1" onclick="addMissingWarframes();">Add Missing Warframes</button>
|
||||||
<button class="btn btn-primary" onclick="addMissingWeapons();">Add Missing Weapons</button>
|
<button class="btn btn-primary flex-grow-1" onclick="addMissingWeapons();">Add Missing Weapons</button>
|
||||||
|
<button class="btn btn-primary flex-grow-1" onclick="maxRankAllWarframes()">Max Rank All Warframes</button>
|
||||||
|
<button class="btn btn-primary flex-grow-1" onclick="maxRankAllWeapons()">Max Rank All Weapons</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -605,6 +605,46 @@ function addMissingWarframes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maxRankAllWarframes() {
|
||||||
|
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
|
||||||
|
|
||||||
|
req.done(data => {
|
||||||
|
window.itemListPromise.then(itemMap => {
|
||||||
|
const batchData = { Suits: [], SpecialItems: [] };
|
||||||
|
|
||||||
|
data.Suits.forEach(item => {
|
||||||
|
if (item.XP < 1_600_000) {
|
||||||
|
batchData.Suits.push({
|
||||||
|
ItemId: { $oid: item.ItemId.$oid },
|
||||||
|
XP: 1_600_000 - 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);
|
||||||
|
if (exaltedItem) {
|
||||||
|
const exaltedCap = itemMap[exaltedType]?.type == "weapons" ? 800_000 : 1_600_000;
|
||||||
|
if (exaltedItem.XP < exaltedCap) {
|
||||||
|
batchData.SpecialItems.push({
|
||||||
|
ItemId: { $oid: exaltedItem.ItemId.$oid },
|
||||||
|
XP: exaltedCap
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (batchData.Suits.length > 0 || batchData.SpecialItems.length > 0) {
|
||||||
|
return sendBatchGearExp(batchData);
|
||||||
|
}
|
||||||
|
|
||||||
|
alert("No Warframes to rank up.");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function addMissingWeapons() {
|
function addMissingWeapons() {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
document.querySelectorAll("#datalist-weapons option").forEach(elm => {
|
document.querySelectorAll("#datalist-weapons option").forEach(elm => {
|
||||||
@ -620,6 +660,34 @@ function addMissingWeapons() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maxRankAllWeapons() {
|
||||||
|
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
|
||||||
|
|
||||||
|
req.done(data => {
|
||||||
|
const batchData = {};
|
||||||
|
|
||||||
|
["LongGuns", "Pistols", "Melee"].forEach(category => {
|
||||||
|
data[category].forEach(item => {
|
||||||
|
if (item.XP < 800_000) {
|
||||||
|
if (!batchData[category]) {
|
||||||
|
batchData[category] = [];
|
||||||
|
}
|
||||||
|
batchData[category].push({
|
||||||
|
ItemId: { $oid: item.ItemId.$oid },
|
||||||
|
XP: 800_000 - item.XP
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (Object.keys(batchData).length > 0) {
|
||||||
|
return sendBatchGearExp(batchData);
|
||||||
|
}
|
||||||
|
|
||||||
|
alert("No weapons to rank up.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function addGearExp(category, oid, xp) {
|
function addGearExp(category, oid, xp) {
|
||||||
const data = {};
|
const data = {};
|
||||||
data[category] = [
|
data[category] = [
|
||||||
@ -641,6 +709,18 @@ function addGearExp(category, oid, xp) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendBatchGearExp(data) {
|
||||||
|
revalidateAuthz(() => {
|
||||||
|
$.post({
|
||||||
|
url: "/api/missionInventoryUpdate.php?" + window.authz,
|
||||||
|
contentType: "text/plain",
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
}).done(() => {
|
||||||
|
updateInventory();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function renameGear(category, oid, name) {
|
function renameGear(category, oid, name) {
|
||||||
revalidateAuthz(() => {
|
revalidateAuthz(() => {
|
||||||
$.post({
|
$.post({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user