Class PricingUtils

java.lang.Object
com.zetaplugins.cookieclickerz.util.PricingUtils

public final class PricingUtils extends Object
Utility class for pricing calculations.
  • Method Details

    • priceAtLevel

      public static BigInteger priceAtLevel(BigInteger baseBI, double r, int level)
      Calculate the price of an item at a specific level.
      Parameters:
      baseBI - The base price as a BigInteger.
      r - The price multiplier (growth rate).
      level - The level of the item.
      Returns:
      The price at the specified level as a BigInteger.
    • totalCostForN

      public static BigInteger totalCostForN(BigInteger baseBI, double r, int currentLevel, int n)
      Calculate the total cost for purchasing 'n' levels starting from 'currentLevel'.
      Parameters:
      baseBI - The base price as a BigInteger.
      r - The price multiplier (growth rate).
      currentLevel - The current level of the item.
      n - The number of levels to purchase.
      Returns:
      The total cost for 'n' levels as a BigInteger.
    • pow

      public static BigDecimal pow(BigDecimal a, int n)
      Efficiently computes a^n using exponentiation by squaring.
      Parameters:
      a - The base as a BigDecimal.
      n - The exponent as an integer.
      Returns:
      The result of a raised to the power of n as a BigDecimal.