feat: handle EmailItems received during mission #1088
@ -946,11 +946,16 @@ export const addEmailItem = async (
 | 
				
			|||||||
    typeName: string,
 | 
					    typeName: string,
 | 
				
			||||||
    inventoryChanges: IInventoryChanges = {}
 | 
					    inventoryChanges: IInventoryChanges = {}
 | 
				
			||||||
): Promise<IInventoryChanges> => {
 | 
					): Promise<IInventoryChanges> => {
 | 
				
			||||||
    const emailItem = ExportEmailItems[typeName];
 | 
					    const meta = ExportEmailItems[typeName];
 | 
				
			||||||
    if (!emailItem.sendOnlyOnce || !inventory.EmailItems.find(x => x.ItemType == typeName)) {
 | 
					    const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
 | 
				
			||||||
        await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(emailItem.message)]);
 | 
					    if (!emailItem || !meta.sendOnlyOnce) {
 | 
				
			||||||
 | 
					        await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(meta.message)]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (emailItem) {
 | 
				
			||||||
 | 
					            emailItem.ItemCount += 1;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            inventory.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
 | 
					            inventory.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        inventoryChanges.EmailItems ??= [];
 | 
					        inventoryChanges.EmailItems ??= [];
 | 
				
			||||||
        inventoryChanges.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
 | 
					        inventoryChanges.EmailItems.push({ ItemType: typeName, ItemCount: 1 });
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user