XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

feat(webui): remove unranked mods (#1778)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1778 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

409f41d3
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

10 个文件 +39 -3
Modified src/app.ts +1 -1
@@ -26,7 +26,7 @@ app.use((req, _res, next) => {
26 26
27 27 app.use(bodyParser.raw());
28 28 app.use(express.json({ limit: "4mb" }));
29 app.use(bodyParser.text());
29 app.use(bodyParser.text({ limit: "4mb" }));
30 30 app.use(requestLogger);
31 31
32 32 app.use("/api", apiRouter);
Modified src/controllers/custom/getItemListsController.ts +4 -0
@@ -29,6 +29,7 @@ interface ListedItem {
29 29 badReason?: "starter" | "frivolous" | "notraw";
30 30 partType?: string;
31 31 chainLength?: number;
32 parazon?: boolean;
32 33 }
33 34
34 35 const relicQualitySuffixes: Record<TRelicQuality, string> = {
@@ -196,6 +197,9 @@ const getItemListsController: RequestHandler = (req, response) => {
196 197 } else if (upgrade.upgradeEntries) {
197 198 mod.badReason = "notraw";
198 199 }
200 if (upgrade.type == "PARAZON") {
201 mod.parazon = true;
202 }
199 203 res.mods.push(mod);
200 204 }
201 205 for (const [uniqueName, upgrade] of Object.entries(ExportAvionics)) {
Modified static/webui/index.html +2 -1
@@ -490,8 +490,9 @@
490 490 </div>
491 491 <div class="card mb-3">
492 492 <h5 class="card-header" data-loc="general_bulkActions"></h5>
493 <div class="card-body">
493 <div class="card-body d-flex flex-wrap gap-2">
494 494 <button class="btn btn-primary" onclick="doAddAllMods();" data-loc="mods_bulkAddMods"></button>
495 <button class="btn btn-danger" onclick="doRemoveUnrankedMods();" data-loc="mods_removeUnranked"></button>
495 496 </div>
496 497 </div>
497 498 </div>
Modified static/webui/script.js +26 -1
@@ -804,7 +804,7 @@ function updateInventory() {
804 804 {
805 805 const td = document.createElement("td");
806 806 td.classList = "text-end text-nowrap";
807 {
807 if (maxRank != 0) {
808 808 const a = document.createElement("a");
809 809 a.href = "#";
810 810 a.onclick = function (event) {
@@ -1612,6 +1612,31 @@ function doAddAllMods() {
1612 1612 });
1613 1613 }
1614 1614
1615 function doRemoveUnrankedMods() {
1616 revalidateAuthz(() => {
1617 const req = $.get("/api/inventory.php?" + window.authz + "&xpBasedLevelCapDisabled=1");
1618 req.done(inventory => {
1619 window.itemListPromise.then(itemMap => {
1620 $.post({
1621 url: "/api/sell.php?" + window.authz,
1622 contentType: "text/plain",
1623 data: JSON.stringify({
1624 SellCurrency: "SC_RegularCredits",
1625 SellPrice: 0,
1626 Items: {
1627 Upgrades: inventory.RawUpgrades.filter(
1628 x => !itemMap[x.ItemType]?.parazon && x.ItemCount > 0
1629 ).map(x => ({ String: x.ItemType, Count: x.ItemCount }))
1630 }
1631 })
1632 }).done(function () {
1633 updateInventory();
1634 });
1635 });
1636 });
1637 });
1638 }
1639
1615 1640 // Powersuit Route
1616 1641
1617 1642 single.getRoute("#powersuit-route").on("beforeload", function () {
Modified static/webui/translations/de.js +1 -0
@@ -115,6 +115,7 @@ dict = {
115 115 mods_rivens: `Rivens`,
116 116 mods_mods: `Mods`,
117 117 mods_bulkAddMods: `Fehlende Mods hinzufügen`,
118 mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
118 119 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.`,
119 120 cheats_server: `Server`,
120 121 cheats_skipTutorial: `Tutorial überspringen`,
Modified static/webui/translations/en.js +1 -0
@@ -114,6 +114,7 @@ dict = {
114 114 mods_rivens: `Rivens`,
115 115 mods_mods: `Mods`,
116 116 mods_bulkAddMods: `Add Missing Mods`,
117 mods_removeUnranked: `Remove Unranked Mods`,
117 118 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.`,
118 119 cheats_server: `Server`,
119 120 cheats_skipTutorial: `Skip Tutorial`,
Modified static/webui/translations/es.js +1 -0
@@ -115,6 +115,7 @@ dict = {
115 115 mods_rivens: `Agrietados`,
116 116 mods_mods: `Mods`,
117 117 mods_bulkAddMods: `Agregar mods faltantes`,
118 mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
118 119 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.`,
119 120 cheats_server: `Servidor`,
120 121 cheats_skipTutorial: `Omitir tutorial`,
Modified static/webui/translations/fr.js +1 -0
@@ -115,6 +115,7 @@ dict = {
115 115 mods_rivens: `Rivens`,
116 116 mods_mods: `Mods`,
117 117 mods_bulkAddMods: `Ajouter les mods manquants`,
118 mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
118 119 cheats_administratorRequirement: `Rôle d'administrateur requis pour cette fonctionnalité. Ajoutez <code>|DISPLAYNAME|</code> à la ligne <code>administratorNames</code> dans le fichier config.json.`,
119 120 cheats_server: `Serveur`,
120 121 cheats_skipTutorial: `Passer le tutoriel`,
Modified static/webui/translations/ru.js +1 -0
@@ -115,6 +115,7 @@ dict = {
115 115 mods_rivens: `Моды Разлома`,
116 116 mods_mods: `Моды`,
117 117 mods_bulkAddMods: `Добавить отсутствующие моды`,
118 mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
118 119 cheats_administratorRequirement: `Вы должны быть администратором для использования этой функции. Чтобы стать администратором, добавьте <code>\"|DISPLAYNAME|\"</code> в <code>administratorNames</code> в config.json.`,
119 120 cheats_server: `Сервер`,
120 121 cheats_skipTutorial: `Пропустить обучение`,
Modified static/webui/translations/zh.js +1 -0
@@ -115,6 +115,7 @@ dict = {
115 115 mods_rivens: `裂罅MOD`,
116 116 mods_mods: `Mods`,
117 117 mods_bulkAddMods: `添加缺失MOD`,
118 mods_removeUnranked: `[UNTRANSLATED] Remove Unranked Mods`,
118 119 cheats_administratorRequirement: `您必须是管理员才能使用此功能。要成为管理员,请将 <code>|DISPLAYNAME|</code> 添加到 config.json 的 <code>administratorNames</code> 中。`,
119 120 cheats_server: `服务器`,
120 121 cheats_skipTutorial: `跳过教程`,