Updated addPaymentToOutput()
to ensure it validates and fixes money stacks without a upd property
This commit is contained in:
parent
cdf542ea59
commit
1eee0ff120
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user