返回提交历史
Modified
src/controllers/custom/addItemsController.ts
+2
-1
Modified
src/services/inventoryService.ts
+10
-0
Modified
static/webui/index.html
+1
-0
Modified
static/webui/script.js
+10
-2
Modified
static/webui/translations/de.js
+1
-0
Modified
static/webui/translations/en.js
+1
-0
Modified
static/webui/translations/es.js
+1
-0
Modified
static/webui/translations/fr.js
+1
-0
Modified
static/webui/translations/ru.js
+1
-0
Modified
static/webui/translations/zh.js
+1
-0
XFEstudio/XFESpaceNinjaServer
feat(webui): "add maxed" for mods (#2387)
Closes #2382 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2387 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
8c85cdcd
代码差异
10 个文件
+29
-3
@@ -7,7 +7,7 @@ export const addItemsController: RequestHandler = async (req, res) => {
7
7
const requests = req.body as IAddItemRequest[];
8
8
const inventory = await getInventory(accountId);
9
9
for (const request of requests) {
10
await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, undefined, true);
10
await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, request.Fingerprint, true);
11
11
}
12
12
await inventory.save();
13
13
res.end();
@@ -16,4 +16,5 @@ export const addItemsController: RequestHandler = async (req, res) => {
16
16
interface IAddItemRequest {
17
17
ItemType: string;
18
18
ItemCount: number;
19
Fingerprint?: string;
19
20
}
@@ -483,6 +483,16 @@ export const addItem = async (
483
483
return addCustomization(inventory, typeName);
484
484
}
485
485
if (typeName in ExportUpgrades || typeName in ExportArcanes) {
486
if (targetFingerprint) {
487
if (quantity != 1) {
488
logger.warn(`adding 1 of ${typeName} ${targetFingerprint} even tho quantity ${quantity} was requested`);
489
}
490
inventory.Upgrades.push({
491
ItemType: typeName,
492
UpgradeFingerprint: targetFingerprint
493
});
494
return {}; // there's not exactly a common "InventoryChanges" format for these
495
}
486
496
const changes = [
487
497
{
488
498
ItemType: typeName,
@@ -527,6 +527,7 @@
527
527
<form class="input-group mb-3" onsubmit="doAcquireMod();return false;">
528
528
<input class="form-control" id="mod-count" type="number" value="1"/>
529
529
<input class="form-control w-50" id="mod-to-acquire" list="datalist-mods" />
530
<button class="btn btn-success" onclick="window.maxed=true" type="submit" data-loc="mods_addMax"></button>
530
531
<button class="btn btn-primary" type="submit" data-loc="general_addButton"></button>
531
532
</form>
532
533
<table class="table table-hover w-100">
@@ -1873,6 +1873,8 @@ function setFingerprint(ItemType, ItemId, fingerprint) {
1873
1873
}
1874
1874
1875
1875
function doAcquireMod() {
1876
const maxed = !!window.maxed;
1877
window.maxed = false;
1876
1878
const uniqueName = getKey(document.getElementById("mod-to-acquire"));
1877
1879
if (!uniqueName) {
1878
1880
$("#mod-to-acquire").addClass("is-invalid").focus();
@@ -1880,14 +1882,15 @@ function doAcquireMod() {
1880
1882
}
1881
1883
const count = parseInt($("#mod-count").val());
1882
1884
if (count != 0) {
1883
revalidateAuthz().then(() => {
1885
Promise.all([window.itemListPromise, revalidateAuthz()]).then(([itemList]) => {
1884
1886
$.post({
1885
1887
url: "/custom/addItems?" + window.authz,
1886
1888
contentType: "application/json",
1887
1889
data: JSON.stringify([
1888
1890
{
1889
1891
ItemType: uniqueName,
1890
ItemCount: count
1892
ItemCount: count,
1893
Fingerprint: maxed ? JSON.stringify({ lvl: itemList[uniqueName].fusionLimit ?? 5 }) : undefined
1891
1894
}
1892
1895
])
1893
1896
}).done(function () {
@@ -1902,6 +1905,11 @@ function doAcquireMod() {
1902
1905
}
1903
1906
}
1904
1907
1908
function doAcquireModMax() {
1909
const uniqueName = getKey(document.getElementById("mod-to-acquire"));
1910
alert("doAcquireModMax: " + uniqueName);
1911
}
1912
1905
1913
const uiConfigs = [...$(".config-form input[id], .config-form select[id]")].map(x => x.id);
1906
1914
1907
1915
for (const id of uiConfigs) {
@@ -127,6 +127,7 @@ dict = {
127
127
mods_fingerprintHelp: `Benötigst du Hilfe mit dem Fingerabdruck?`,
128
128
mods_rivens: `Rivens`,
129
129
mods_mods: `Mods`,
130
mods_addMax: `[UNTRANSLATED] Add Maxed`,
130
131
mods_addMissingUnrankedMods: `Fehlende Mods ohne Rang hinzufügen`,
131
132
mods_removeUnranked: `Mods ohne Rang entfernen`,
132
133
mods_addMissingMaxRankMods: `Fehlende Mods mit Max. Rang hinzufügen`,
@@ -126,6 +126,7 @@ dict = {
126
126
mods_fingerprintHelp: `Need help with the fingerprint?`,
127
127
mods_rivens: `Rivens`,
128
128
mods_mods: `Mods`,
129
mods_addMax: `Add Maxed`,
129
130
mods_addMissingUnrankedMods: `Add Missing Unranked Mods`,
130
131
mods_removeUnranked: `Remove Unranked Mods`,
131
132
mods_addMissingMaxRankMods: `Add Missing Max Rank Mods`,
@@ -127,6 +127,7 @@ dict = {
127
127
mods_fingerprintHelp: `¿Necesitas ayuda con la huella digital?`,
128
128
mods_rivens: `Agrietados`,
129
129
mods_mods: `Mods`,
130
mods_addMax: `[UNTRANSLATED] Add Maxed`,
130
131
mods_addMissingUnrankedMods: `Agregar mods sin rango faltantes`,
131
132
mods_removeUnranked: `Quitar mods sin rango`,
132
133
mods_addMissingMaxRankMods: `Agregar mods de rango máximo faltantes`,
@@ -127,6 +127,7 @@ dict = {
127
127
mods_fingerprintHelp: `Besoin d'aide pour l'empreinte ?`,
128
128
mods_rivens: `Rivens`,
129
129
mods_mods: `Mods`,
130
mods_addMax: `[UNTRANSLATED] Add Maxed`,
130
131
mods_addMissingUnrankedMods: `Ajouter les mods sans rang manquants`,
131
132
mods_removeUnranked: `Retirer les mods sans rang`,
132
133
mods_addMissingMaxRankMods: `Ajouter les mods niveau max manquants`,
@@ -127,6 +127,7 @@ dict = {
127
127
mods_fingerprintHelp: `Нужна помощь с отпечатком?`,
128
128
mods_rivens: `Моды Разлома`,
129
129
mods_mods: `Моды`,
130
mods_addMax: `[UNTRANSLATED] Add Maxed`,
130
131
mods_addMissingUnrankedMods: `Добавить недостающие моды без ранга`,
131
132
mods_removeUnranked: `Удалить моды без ранга`,
132
133
mods_addMissingMaxRankMods: `Добавить недостающие моды максимального ранга`,
@@ -127,6 +127,7 @@ dict = {
127
127
mods_fingerprintHelp: `需要印记相关的帮助?`,
128
128
mods_rivens: `裂罅MOD`,
129
129
mods_mods: `Mods`,
130
mods_addMax: `[UNTRANSLATED] Add Maxed`,
130
131
mods_addMissingUnrankedMods: `添加所有缺失的Mods`,
131
132
mods_removeUnranked: `删除所有未升级的Mods`,
132
133
mods_addMissingMaxRankMods: `添加所有缺失的满级Mods`,