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

XFESpaceNinjaServer

A simple server for a small space ninja game

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

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
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

2 个文件 +5 -3
Modified src/controllers/api/inventoryController.ts +4 -2
@@ -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}`, {
Modified src/services/inventoryService.ts +1 -1
@@ -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) {