返回提交历史
Modified
src/controllers/custom/addItemsController.ts
+5
-4
Modified
static/webui/script.js
+9
-6
XFEstudio/SpaceNinjaServer
fix(webui): update inventory when raw add items added non-MiscItem (#4155)
Closes #4154 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4155 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
4ee7f0f7
代码差异
2 个文件
+14
-10
@@ -33,12 +33,13 @@ export const addItemsController: RequestHandler = async (req, res) => {
33
33
return;
34
34
}
35
35
}
36
if (inventory.isModified()) {
36
const modifiedPaths = inventory.modifiedPaths();
37
if (modifiedPaths.length) {
37
38
await inventory.save();
38
res.json(true);
39
}
40
res.json(modifiedPaths);
41
if (modifiedPaths.length) {
39
42
broadcastInventoryUpdate(req);
40
} else {
41
res.json(false);
42
43
}
43
44
};
44
45
@@ -2293,9 +2293,9 @@ function doAcquireEquipment(category) {
2293
2293
}
2294
2294
])
2295
2295
});
2296
req.done(didAnything => {
2296
req.done(modifiedPaths => {
2297
2297
document.getElementById("acquire-type-" + category).value = "";
2298
if (didAnything) {
2298
if (modifiedPaths.length) {
2299
2299
updateInventory();
2300
2300
} else {
2301
2301
toast(loc("code_nothingToDo"));
@@ -3167,8 +3167,8 @@ function doAcquireCountItems(category) {
3167
3167
}
3168
3168
])
3169
3169
})
3170
.done(function (didAnything) {
3171
if (didAnything) {
3170
.done(function (modifiedPaths) {
3171
if (modifiedPaths.length) {
3172
3172
if (count > 0) {
3173
3173
toast(loc("code_succAdded"));
3174
3174
} else {
@@ -3222,13 +3222,16 @@ function addItemByItemType() {
3222
3222
}
3223
3223
])
3224
3224
})
3225
.done(function (didAnything) {
3226
if (didAnything) {
3225
.done(function (modifiedPaths) {
3226
if (modifiedPaths.length) {
3227
3227
if (ItemCount > 0) {
3228
3228
toast(loc("code_succAdded"));
3229
3229
} else {
3230
3230
toast(loc("code_succRemoved"));
3231
3231
}
3232
if (modifiedPaths.some(x => !x.startsWith("MiscItems"))) {
3233
updateInventory();
3234
}
3232
3235
} else {
3233
3236
toast(loc("code_nothingToDo"));
3234
3237
}