Rework payMoney() to handle taking money from post-raid therapist healing

This commit is contained in:
Dev 2023-11-14 17:06:11 +00:00
parent 844cb12cc1
commit bb8677bc65

View File

@ -46,9 +46,7 @@ export class PaymentService
// Track the amounts of each type of currency involved in the trade. // Track the amounts of each type of currency involved in the trade.
const currencyAmounts: { [key: string]: number } = {}; const currencyAmounts: { [key: string]: number } = {};
// Delete barter items and track currencies if the action is "TradingConfirm". // Delete barter items and track currencies
if (request.Action === "TradingConfirm")
{
for (const index in request.scheme_items) for (const index in request.scheme_items)
{ {
// Find the corresponding item in the player's inventory. // Find the corresponding item in the player's inventory.
@ -67,14 +65,10 @@ export class PaymentService
currencyAmounts[item._tpl] = (currencyAmounts[item._tpl] || 0) + request.scheme_items[index].count; currencyAmounts[item._tpl] = (currencyAmounts[item._tpl] || 0) + request.scheme_items[index].count;
} }
} }
} else
}
// Needs specific handling, add up currency amounts for insured items
if (request.Action === "SptInsure")
{
for (const index in request.scheme_items)
{ {
// Used by `SptInsure`
// Handle differently, `id` is the money type tpl
const currencyTpl = request.scheme_items[index].id; const currencyTpl = request.scheme_items[index].id;
currencyAmounts[currencyTpl] = (currencyAmounts[currencyTpl] || 0) + request.scheme_items[index].count; currencyAmounts[currencyTpl] = (currencyAmounts[currencyTpl] || 0) + request.scheme_items[index].count;
} }