Updated addPaymentToOutput() to ensure it validates and fixes money stacks without a upd property

This commit is contained in:
Dev 2024-10-19 20:26:05 +01:00
parent cdf542ea59
commit 1eee0ff120

View File

@ -256,6 +256,12 @@ export class PaymentService {
currencyTpl, currencyTpl,
pmcData.Inventory.stash, pmcData.Inventory.stash,
); );
//Ensure all money items found have a upd
for (const moneyStack of moneyItemsInInventory) {
moneyStack.upd ??= { StackObjectsCount: 1 };
}
const amountAvailable = moneyItemsInInventory.reduce( const amountAvailable = moneyItemsInInventory.reduce(
(accumulator, item) => accumulator + item.upd.StackObjectsCount, (accumulator, item) => accumulator + item.upd.StackObjectsCount,
0, 0,