Class PricingUtils
java.lang.Object
com.zetaplugins.cookieclickerz.util.PricingUtils
Utility class for pricing calculations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
pow
(BigDecimal a, int n) Efficiently computes a^n using exponentiation by squaring.static BigInteger
priceAtLevel
(BigInteger baseBI, double r, int level) Calculate the price of an item at a specific level.static BigInteger
totalCostForN
(BigInteger baseBI, double r, int currentLevel, int n) Calculate the total cost for purchasing 'n' levels starting from 'currentLevel'.
-
Method Details
-
priceAtLevel
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
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
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.
-