返回提交历史
Modified
src/controllers/api/inventoryController.ts
+4
-2
Modified
src/services/inventoryService.ts
+1
-1
XFEstudio/XFESpaceNinjaServer
fix: don't remove consumed argon crystals from FoundToday (#1447)
This fixes a possible mongo conflict when ticking them, and this is probably more desirable as you wanna consume unstable crystals first. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1447 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
d918b0c9
代码差异
2 个文件
+5
-3
@@ -51,9 +51,11 @@ export const inventoryController: RequestHandler = async (request, response) =>
51
51
if (numArgonCrystals == 0) {
52
52
break;
53
53
}
54
const numStableArgonCrystals =
54
const numStableArgonCrystals = Math.min(
55
numArgonCrystals,
55
56
inventory.FoundToday?.find(x => x.ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal")
56
?.ItemCount ?? 0;
57
?.ItemCount ?? 0
58
);
57
59
const numDecayingArgonCrystals = numArgonCrystals - numStableArgonCrystals;
58
60
const numDecayingArgonCrystalsToRemove = Math.ceil(numDecayingArgonCrystals / 2);
59
61
logger.debug(`ticking argon crystals for day ${i + 1} of ${daysPassed}`, {
@@ -1119,7 +1119,7 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
1119
1119
1120
1120
MiscItems[itemIndex].ItemCount += ItemCount;
1121
1121
1122
if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal") {
1122
if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal" && ItemCount > 0) {
1123
1123
inventory.FoundToday ??= [];
1124
1124
let foundTodayIndex = inventory.FoundToday.findIndex(x => x.ItemType == ItemType);
1125
1125
if (foundTodayIndex == -1) {