feat(webui): remove unranked mods (#1778)
Some checks failed
Build / build (push) Has been cancelled
Build Docker image / docker (push) Has been cancelled

Reviewed-on: #1778
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
Sainan 2025-04-22 10:00:10 -07:00 committed by Sainan
parent c4b8a71c5a
commit 409f41d3bf
10 changed files with 39 additions and 3 deletions

View File

@ -26,7 +26,7 @@ app.use((req, _res, next) => {
app.use(bodyParser.raw());
app.use(express.json({ limit: "4mb" }));
app.use(bodyParser.text());
app.use(bodyParser.text({ limit: "4mb" }));
app.use(requestLogger);
app.use("/api", apiRouter);

View File

@ -29,6 +29,7 @@ interface ListedItem {
badReason?: "starter" | "frivolous" | "notraw";
partType?: string;
chainLength?: number;
parazon?: boolean;
}
const relicQualitySuffixes: Record<TRelicQuality, string> = {
@ -196,6 +197,9 @@ const getItemListsController: RequestHandler = (req, response) => {
} else if (upgrade.upgradeEntries) {
mod.badReason = "notraw";
}
if (upgrade.type == "PARAZON") {
mod.parazon = true;
}
res.mods.push(mod);
}
for (const [uniqueName, upgrade] of Object.entries(ExportAvionics)) {

View File

@ -490,8 +490,9 @@
</div>
<div class="card mb-3">
<h5 class="card-header" data-loc="general_bulkActions"></h5>
<div class="card-body">
<div class="card-body d-flex flex-wrap gap-2">
<button class="btn btn-primary" onclick="doAddAllMods();" data-loc="mods_bulkAddMods"></button>
<button class="btn btn-danger" onclick="doRemoveUnrankedMods();" data-loc="mods_removeUnranked"></button>
</div>
</div>
</div>

View File

@ -804,7 +804,7 @@ function updateInventory() {
{
const td = document.createElement("td");
td.classList = "text-end text-nowrap";
{
if (maxRank != 0) {
const a = document.createElement("a");
a.href = "#";
a.onclick = function (event) {
@ -1612,6 +1612,31 @@ function doAddAllMods() {
});
}
function doRemoveUnrankedMods() {
revalidateAuthz(() => {
const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
req.done(inventory => {
window.itemListPromise.then(itemMap => {
$.post({
url: "/api/sell.php?" + window.authz,
contentType: "text/plain",
data: JSON.stringify({
SellCurrency: "SC_RegularCredits",
SellPrice: 0,
Items: {
Upgrades: inventory.RawUpgrades.filter(
x => !itemMap[x.ItemType]?.parazon && x.ItemCount > 0
).map(x => ({ String: x.ItemType, Count: x.ItemCount }))
}
})
}).done(function () {
updateInventory();
});
});
});
});
}
// Powersuit Route
single.getRoute("#powersuit-route").on("beforeload", function () {

View File

@ -115,6 +115,7 @@ dict = {
mods_rivens: `Rivens`,
mods_mods: `Mods`,
mods_bulkAddMods: `Fehlende Mods hinzufügen`,
mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
cheats_administratorRequirement: `Du musst Administrator sein, um diese Funktion nutzen zu können. Um Administrator zu werden, füge <code>|DISPLAYNAME|</code> zu <code>administratorNames</code> in der config.json hinzu.`,
cheats_server: `Server`,
cheats_skipTutorial: `Tutorial überspringen`,

View File

@ -114,6 +114,7 @@ dict = {
mods_rivens: `Rivens`,
mods_mods: `Mods`,
mods_bulkAddMods: `Add Missing Mods`,
mods_removeUnranked: `Remove Unranked Mods`,
cheats_administratorRequirement: `You must be an administrator to use this feature. To become an administrator, add <code>|DISPLAYNAME|</code> to <code>administratorNames</code> in the config.json.`,
cheats_server: `Server`,
cheats_skipTutorial: `Skip Tutorial`,

View File

@ -115,6 +115,7 @@ dict = {
mods_rivens: `Agrietados`,
mods_mods: `Mods`,
mods_bulkAddMods: `Agregar mods faltantes`,
mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
cheats_administratorRequirement: `Debes ser administrador para usar esta función. Para convertirte en administrador, agrega <code>|DISPLAYNAME|</code> a <code>administratorNames</code> en el archivo config.json.`,
cheats_server: `Servidor`,
cheats_skipTutorial: `Omitir tutorial`,

View File

@ -115,6 +115,7 @@ dict = {
mods_rivens: `Rivens`,
mods_mods: `Mods`,
mods_bulkAddMods: `Ajouter les mods manquants`,
mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
cheats_administratorRequirement: `Rôle d'administrateur requis pour cette fonctionnalité. Ajoutez <code>|DISPLAYNAME|</code> à la ligne <code>administratorNames</code> dans le fichier config.json.`,
cheats_server: `Serveur`,
cheats_skipTutorial: `Passer le tutoriel`,

View File

@ -115,6 +115,7 @@ dict = {
mods_rivens: `Моды Разлома`,
mods_mods: `Моды`,
mods_bulkAddMods: `Добавить отсутствующие моды`,
mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
cheats_administratorRequirement: `Вы должны быть администратором для использования этой функции. Чтобы стать администратором, добавьте <code>\"|DISPLAYNAME|\"</code> в <code>administratorNames</code> в config.json.`,
cheats_server: `Сервер`,
cheats_skipTutorial: `Пропустить обучение`,

View File

@ -115,6 +115,7 @@ dict = {
mods_rivens: `裂罅MOD`,
mods_mods: `Mods`,
mods_bulkAddMods: `添加缺失MOD`,
mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
cheats_administratorRequirement: `您必须是管理员才能使用此功能。要成为管理员,请将 <code>|DISPLAYNAME|</code> 添加到 config.json 的 <code>administratorNames</code> 中。`,
cheats_server: `服务器`,
cheats_skipTutorial: `跳过教程`,