Fix all items being free

This commit is contained in:
Dev 2024-01-19 22:49:31 +00:00
parent 879af0377a
commit 4fd37e3a92
2 changed files with 6 additions and 6 deletions

View File

@ -636,7 +636,7 @@ export class ItemHelper
: (item._id === barterId);
});
matchingItems.push(...this.jsonUtil.clone(filterResult));
matchingItems.push(...filterResult);
}
if (matchingItems.length === 0)

View File

@ -306,19 +306,19 @@ export class PaymentService
}
let leftToPay = amountToPay;
for (const moneyItem of moneyItemsInInventory)
for (const profileMoneyItem of moneyItemsInInventory)
{
const itemAmount = moneyItem.upd.StackObjectsCount;
const itemAmount = profileMoneyItem.upd.StackObjectsCount;
if (leftToPay >= itemAmount)
{
leftToPay -= itemAmount;
this.inventoryHelper.removeItem(pmcData, moneyItem._id, sessionID, output);
this.inventoryHelper.removeItem(pmcData, profileMoneyItem._id, sessionID, output);
}
else
{
moneyItem.upd.StackObjectsCount -= leftToPay;
profileMoneyItem.upd.StackObjectsCount -= leftToPay;
leftToPay = 0;
output.profileChanges[sessionID].items.change.push(moneyItem);
output.profileChanges[sessionID].items.change.push(profileMoneyItem);
}
if (leftToPay === 0)