forked from OpenWF/SpaceNinjaServer
		
	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: OpenWF/SpaceNinjaServer#1447 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									05c0c9909c
								
							
						
					
					
						commit
						d918b0c982
					
				@ -51,9 +51,11 @@ export const inventoryController: RequestHandler = async (request, response) =>
 | 
				
			|||||||
                    if (numArgonCrystals == 0) {
 | 
					                    if (numArgonCrystals == 0) {
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    const numStableArgonCrystals =
 | 
					                    const numStableArgonCrystals = Math.min(
 | 
				
			||||||
 | 
					                        numArgonCrystals,
 | 
				
			||||||
                        inventory.FoundToday?.find(x => x.ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal")
 | 
					                        inventory.FoundToday?.find(x => x.ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal")
 | 
				
			||||||
                            ?.ItemCount ?? 0;
 | 
					                            ?.ItemCount ?? 0
 | 
				
			||||||
 | 
					                    );
 | 
				
			||||||
                    const numDecayingArgonCrystals = numArgonCrystals - numStableArgonCrystals;
 | 
					                    const numDecayingArgonCrystals = numArgonCrystals - numStableArgonCrystals;
 | 
				
			||||||
                    const numDecayingArgonCrystalsToRemove = Math.ceil(numDecayingArgonCrystals / 2);
 | 
					                    const numDecayingArgonCrystalsToRemove = Math.ceil(numDecayingArgonCrystals / 2);
 | 
				
			||||||
                    logger.debug(`ticking argon crystals for day ${i + 1} of ${daysPassed}`, {
 | 
					                    logger.debug(`ticking argon crystals for day ${i + 1} of ${daysPassed}`, {
 | 
				
			||||||
 | 
				
			|||||||
@ -1119,7 +1119,7 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        MiscItems[itemIndex].ItemCount += ItemCount;
 | 
					        MiscItems[itemIndex].ItemCount += ItemCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal") {
 | 
					        if (ItemType == "/Lotus/Types/Items/MiscItems/ArgonCrystal" && ItemCount > 0) {
 | 
				
			||||||
            inventory.FoundToday ??= [];
 | 
					            inventory.FoundToday ??= [];
 | 
				
			||||||
            let foundTodayIndex = inventory.FoundToday.findIndex(x => x.ItemType == ItemType);
 | 
					            let foundTodayIndex = inventory.FoundToday.findIndex(x => x.ItemType == ItemType);
 | 
				
			||||||
            if (foundTodayIndex == -1) {
 | 
					            if (foundTodayIndex == -1) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user