fix: don't remove consumed argon crystals from FoundToday
All checks were successful
Build / build (22) (push) Successful in 40s
Build / build (20) (push) Successful in 1m15s
Build / build (18) (push) Successful in 1m9s
Build / build (18) (pull_request) Successful in 43s
Build / build (20) (pull_request) Successful in 1m14s
Build / build (22) (pull_request) Successful in 1m8s

This fixes a possible mongo conflict when ticking them, and this is probably more desirable as you wanna consume unstable crystals first.
This commit is contained in:
Sainan 2025-04-03 15:13:20 +02:00
parent d4d887a5a4
commit 110c08835a
2 changed files with 5 additions and 3 deletions

View File

@ -51,9 +51,11 @@ export const inventoryController: RequestHandler = async (request, response) =>
if (numArgonCrystals == 0) {
break;
}
const numStableArgonCrystals =
const numStableArgonCrystals = Math.min(
numArgonCrystals,
inventory.FoundToday?.find(x => x.ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal")
?.ItemCount ?? 0;
?.ItemCount ?? 0
);
const numDecayingArgonCrystals = numArgonCrystals - numStableArgonCrystals;
const numDecayingArgonCrystalsToRemove = Math.ceil(numDecayingArgonCrystals / 2);
logger.debug(`ticking argon crystals for day ${i + 1} of ${daysPassed}`, {

View File

@ -1119,7 +1119,7 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
MiscItems[itemIndex].ItemCount += ItemCount;
if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal") {
if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal" && ItemCount > 0) {
inventory.FoundToday ??= [];
let foundTodayIndex = inventory.FoundToday.findIndex(x => x.ItemType == ItemType);
if (foundTodayIndex == -1) {