Function calculateItem

  • Calculates the cost and how many items you can buy.

    Parameters

    • value: DecimalSource

      The current value of the currency.

    • item: Item

      The item object to calculate.

    • tier: DecimalSource = Decimal.dOne

      The tier of the item to buy. Defaults to 1.

    • target: DecimalSource = Decimal.dInf

      The target quantity to reach for the item. If not provided, it will buy the maximum amount of items possible (using target = Infinity).

    Returns [amount: Decimal, cost: Decimal]

    [amount, cost] - Returns the amount of items you can buy and the cost of the items. If you can't afford any, it returns [Decimal.dZero, Decimal.dZero].