chore(webui): split weapons by category (#820)
This commit is contained in:
parent
45c32b087d
commit
4ce03ad523
@ -17,25 +17,32 @@ interface ListedItem {
|
|||||||
fusionLimit?: number;
|
fusionLimit?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getItemListsController: RequestHandler = (req, res) => {
|
const getItemListsController: RequestHandler = (req, response) => {
|
||||||
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
|
const lang = getDict(typeof req.query.lang == "string" ? req.query.lang : "en");
|
||||||
const weapons = [];
|
const res: Record<string, ListedItem[]> = {};
|
||||||
const miscitems = [];
|
res.LongGuns = [];
|
||||||
|
res.Pistols = [];
|
||||||
|
res.Melee = [];
|
||||||
|
res.miscitems = [];
|
||||||
for (const [uniqueName, item] of Object.entries(ExportWeapons)) {
|
for (const [uniqueName, item] of Object.entries(ExportWeapons)) {
|
||||||
if (item.productCategory !== "OperatorAmps") {
|
|
||||||
if (item.totalDamage !== 0) {
|
if (item.totalDamage !== 0) {
|
||||||
weapons.push({
|
if (
|
||||||
|
item.productCategory == "LongGuns" ||
|
||||||
|
item.productCategory == "Pistols" ||
|
||||||
|
item.productCategory == "Melee"
|
||||||
|
) {
|
||||||
|
res[item.productCategory].push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
name: getString(item.name, lang)
|
name: getString(item.name, lang)
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else if (!item.excludeFromCodex) {
|
} else if (!item.excludeFromCodex) {
|
||||||
miscitems.push({
|
res.miscitems.push({
|
||||||
uniqueName: "MiscItems:" + uniqueName,
|
uniqueName: "MiscItems:" + uniqueName,
|
||||||
name: getString(item.name, lang)
|
name: getString(item.name, lang)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (const [uniqueName, item] of Object.entries(ExportResources)) {
|
for (const [uniqueName, item] of Object.entries(ExportResources)) {
|
||||||
let name = getString(item.name, lang);
|
let name = getString(item.name, lang);
|
||||||
if ("dissectionParts" in item) {
|
if ("dissectionParts" in item) {
|
||||||
@ -48,13 +55,13 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
|
name = name.split("|FISH_SIZE|").join(getString("/Lotus/Language/Fish/FishSizeSmallAbbrev", lang));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
miscitems.push({
|
res.miscitems.push({
|
||||||
uniqueName: item.productCategory + ":" + uniqueName,
|
uniqueName: item.productCategory + ":" + uniqueName,
|
||||||
name: name
|
name: name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const [uniqueName, item] of Object.entries(ExportGear)) {
|
for (const [uniqueName, item] of Object.entries(ExportGear)) {
|
||||||
miscitems.push({
|
res.miscitems.push({
|
||||||
uniqueName: "Consumables:" + uniqueName,
|
uniqueName: "Consumables:" + uniqueName,
|
||||||
name: getString(item.name, lang)
|
name: getString(item.name, lang)
|
||||||
});
|
});
|
||||||
@ -64,7 +71,7 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
if (!item.hidden) {
|
if (!item.hidden) {
|
||||||
const resultName = getItemName(item.resultType);
|
const resultName = getItemName(item.resultType);
|
||||||
if (resultName) {
|
if (resultName) {
|
||||||
miscitems.push({
|
res.miscitems.push({
|
||||||
uniqueName: "Recipes:" + uniqueName,
|
uniqueName: "Recipes:" + uniqueName,
|
||||||
name: recipeNameTemplate.replace("|ITEM|", getString(resultName, lang))
|
name: recipeNameTemplate.replace("|ITEM|", getString(resultName, lang))
|
||||||
});
|
});
|
||||||
@ -72,10 +79,10 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mods: ListedItem[] = [];
|
res.mods = [];
|
||||||
const badItems: Record<string, boolean> = {};
|
const badItems: Record<string, boolean> = {};
|
||||||
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {
|
||||||
mods.push({
|
res.mods.push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
name: getString(upgrade.name, lang),
|
name: getString(upgrade.name, lang),
|
||||||
fusionLimit: upgrade.fusionLimit
|
fusionLimit: upgrade.fusionLimit
|
||||||
@ -85,7 +92,7 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
for (const [uniqueName, arcane] of Object.entries(ExportArcanes)) {
|
||||||
mods.push({
|
res.mods.push({
|
||||||
uniqueName,
|
uniqueName,
|
||||||
name: getString(arcane.name, lang)
|
name: getString(arcane.name, lang)
|
||||||
});
|
});
|
||||||
@ -94,7 +101,7 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json({
|
response.json({
|
||||||
warframes: Object.entries(ExportWarframes)
|
warframes: Object.entries(ExportWarframes)
|
||||||
.filter(([_uniqueName, warframe]) => warframe.productCategory == "Suits")
|
.filter(([_uniqueName, warframe]) => warframe.productCategory == "Suits")
|
||||||
.map(([uniqueName, warframe]) => {
|
.map(([uniqueName, warframe]) => {
|
||||||
@ -104,11 +111,9 @@ const getItemListsController: RequestHandler = (req, res) => {
|
|||||||
exalted: warframe.exalted
|
exalted: warframe.exalted
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
weapons,
|
|
||||||
miscitems,
|
|
||||||
mods,
|
|
||||||
badItems,
|
badItems,
|
||||||
archonCrystalUpgrades
|
archonCrystalUpgrades,
|
||||||
|
...res
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="card mb-3" style="height: 480px;">
|
<div class="card mb-3" style="height: 400px;">
|
||||||
<h5 class="card-header">Warframes</h5>
|
<h5 class="card-header">Warframes</h5>
|
||||||
<div class="card-body overflow-auto">
|
<div class="card-body overflow-auto">
|
||||||
<form class="input-group mb-3" onsubmit="doAcquireWarframe();return false;">
|
<form class="input-group mb-3" onsubmit="doAcquireWarframe();return false;">
|
||||||
@ -110,15 +110,45 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="card mb-3" style="height: 480px;">
|
<div class="card mb-3" style="height: 400px;">
|
||||||
<h5 class="card-header">Weapons</h5>
|
<h5 class="card-header">Primary Weapons</h5>
|
||||||
<div class="card-body overflow-auto">
|
<div class="card-body overflow-auto">
|
||||||
<form class="input-group mb-3" onsubmit="doAcquireWeapon();return false;">
|
<form class="input-group mb-3" onsubmit="doAcquireWeapon('LongGuns');return false;">
|
||||||
<input class="form-control" id="weapon-to-acquire" list="datalist-weapons" />
|
<input class="form-control" id="acquire-type-LongGuns" list="datalist-LongGuns" />
|
||||||
<button class="btn btn-primary" type="submit">Add</button>
|
<button class="btn btn-primary" type="submit">Add</button>
|
||||||
</form>
|
</form>
|
||||||
<table class="table table-hover w-100">
|
<table class="table table-hover w-100">
|
||||||
<tbody id="weapon-list"></tbody>
|
<tbody id="LongGuns-list"></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card mb-3" style="height: 400px;">
|
||||||
|
<h5 class="card-header">Secondary Weapons</h5>
|
||||||
|
<div class="card-body overflow-auto">
|
||||||
|
<form class="input-group mb-3" onsubmit="doAcquireWeapon('Pistols');return false;">
|
||||||
|
<input class="form-control" id="acquire-type-Pistols" list="datalist-Pistols" />
|
||||||
|
<button class="btn btn-primary" type="submit">Add</button>
|
||||||
|
</form>
|
||||||
|
<table class="table table-hover w-100">
|
||||||
|
<tbody id="Pistols-list"></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card mb-3" style="height: 400px;">
|
||||||
|
<h5 class="card-header">Melee Weapons</h5>
|
||||||
|
<div class="card-body overflow-auto">
|
||||||
|
<form class="input-group mb-3" onsubmit="doAcquireWeapon('Melee');return false;">
|
||||||
|
<input class="form-control" id="acquire-type-Melee" list="datalist-Melee" />
|
||||||
|
<button class="btn btn-primary" type="submit">Add</button>
|
||||||
|
</form>
|
||||||
|
<table class="table table-hover w-100">
|
||||||
|
<tbody id="Melee-list"></tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -355,7 +385,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<datalist id="datalist-warframes"></datalist>
|
<datalist id="datalist-warframes"></datalist>
|
||||||
<datalist id="datalist-weapons"></datalist>
|
<datalist id="datalist-LongGuns"></datalist>
|
||||||
|
<datalist id="datalist-Pistols"></datalist>
|
||||||
|
<datalist id="datalist-Melee"></datalist>
|
||||||
<datalist id="datalist-miscitems"></datalist>
|
<datalist id="datalist-miscitems"></datalist>
|
||||||
<datalist id="datalist-mods">
|
<datalist id="datalist-mods">
|
||||||
<option data-key="/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser" value="Legendary Core"></option>
|
<option data-key="/Lotus/Upgrades/Mods/Fusers/LegendaryModFuser" value="Legendary Core"></option>
|
||||||
|
@ -265,8 +265,8 @@ function updateInventory() {
|
|||||||
}
|
}
|
||||||
document.getElementById("warframe-list").appendChild(tr);
|
document.getElementById("warframe-list").appendChild(tr);
|
||||||
});
|
});
|
||||||
document.getElementById("weapon-list").innerHTML = "";
|
|
||||||
["LongGuns", "Pistols", "Melee"].forEach(category => {
|
["LongGuns", "Pistols", "Melee"].forEach(category => {
|
||||||
|
document.getElementById(category + "-list").innerHTML = "";
|
||||||
data[category].forEach(item => {
|
data[category].forEach(item => {
|
||||||
const tr = document.createElement("tr");
|
const tr = document.createElement("tr");
|
||||||
tr.setAttribute("data-item-type", item.ItemType);
|
tr.setAttribute("data-item-type", item.ItemType);
|
||||||
@ -319,7 +319,7 @@ function updateInventory() {
|
|||||||
}
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
}
|
}
|
||||||
document.getElementById("weapon-list").appendChild(tr);
|
document.getElementById(category + "-list").appendChild(tr);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -548,14 +548,16 @@ function doAcquireWarframe() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#warframe-to-acquire").on("input", () => {
|
$("input[list]").on("input", function () {
|
||||||
$("#warframe-to-acquire").removeClass("is-invalid");
|
$(this).removeClass("is-invalid");
|
||||||
});
|
});
|
||||||
|
|
||||||
function doAcquireWeapon() {
|
function doAcquireWeapon(category) {
|
||||||
const uniqueName = getKey(document.getElementById("weapon-to-acquire"));
|
const uniqueName = getKey(document.getElementById("acquire-type-" + category));
|
||||||
if (!uniqueName) {
|
if (!uniqueName) {
|
||||||
$("#weapon-to-acquire").addClass("is-invalid").focus();
|
$("#acquire-type-" + category)
|
||||||
|
.addClass("is-invalid")
|
||||||
|
.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
revalidateAuthz(() => {
|
revalidateAuthz(() => {
|
||||||
@ -570,16 +572,12 @@ function doAcquireWeapon() {
|
|||||||
])
|
])
|
||||||
});
|
});
|
||||||
req.done(() => {
|
req.done(() => {
|
||||||
document.getElementById("weapon-to-acquire").value = "";
|
document.getElementById("acquire-type-" + category).value = "";
|
||||||
updateInventory();
|
updateInventory();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#weapon-to-acquire").on("input", () => {
|
|
||||||
$("#weapon-to-acquire").removeClass("is-invalid");
|
|
||||||
});
|
|
||||||
|
|
||||||
function dispatchAddItemsRequestsBatch(requests) {
|
function dispatchAddItemsRequestsBatch(requests) {
|
||||||
revalidateAuthz(() => {
|
revalidateAuthz(() => {
|
||||||
const req = $.post({
|
const req = $.post({
|
||||||
@ -650,7 +648,9 @@ function maxRankAllWarframes() {
|
|||||||
|
|
||||||
function addMissingWeapons() {
|
function addMissingWeapons() {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
document.querySelectorAll("#datalist-weapons option").forEach(elm => {
|
document
|
||||||
|
.querySelectorAll("#datalist-LongGuns option, #datalist-Pistols option, #datalist-Melee option")
|
||||||
|
.forEach(elm => {
|
||||||
if (!document.querySelector("#weapon-list [data-item-type='" + elm.getAttribute("data-key") + "']")) {
|
if (!document.querySelector("#weapon-list [data-item-type='" + elm.getAttribute("data-key") + "']")) {
|
||||||
requests.push({ type: "Weapon", internalName: elm.getAttribute("data-key") });
|
requests.push({ type: "Weapon", internalName: elm.getAttribute("data-key") });
|
||||||
}
|
}
|
||||||
@ -809,10 +809,6 @@ function doAcquireMiscItems() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#miscitem-type").on("input", () => {
|
|
||||||
$("#miscitem-type").removeClass("is-invalid");
|
|
||||||
});
|
|
||||||
|
|
||||||
function doAcquireRiven() {
|
function doAcquireRiven() {
|
||||||
let fingerprint;
|
let fingerprint;
|
||||||
try {
|
try {
|
||||||
@ -925,10 +921,6 @@ function doAcquireMod() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#mod-to-acquire").on("input", () => {
|
|
||||||
$("#mod-to-acquire").removeClass("is-invalid");
|
|
||||||
});
|
|
||||||
|
|
||||||
const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id);
|
const uiConfigs = [...$("#server-settings input[id]")].map(x => x.id);
|
||||||
|
|
||||||
function doChangeSettings() {
|
function doChangeSettings() {
|
||||||
@ -1155,10 +1147,6 @@ function doPushArchonCrystalUpgrade() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("[list='datalist-archonCrystalUpgrades']").on("input", () => {
|
|
||||||
$("[list='datalist-archonCrystalUpgrades']").removeClass("is-invalid");
|
|
||||||
});
|
|
||||||
|
|
||||||
function doPopArchonCrystalUpgrade(type) {
|
function doPopArchonCrystalUpgrade(type) {
|
||||||
revalidateAuthz(() => {
|
revalidateAuthz(() => {
|
||||||
$.get(
|
$.get(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user