Package forgottentowns.mod.api
Class TradeEconomy
java.lang.Object
forgottentowns.mod.api.TradeEconomy
Shared authored economy reader used by independent trade and map policies, without engine imports.
-
Constructor Summary
ConstructorsConstructorDescriptionTradeEconomy(ModSettings settings) Legacy convenience reader retained for existing compiled packs.TradeEconomy(TravelRules travel, int minimumGold, int maximumGold, int maximumExports, int maximumEstimate, double utilization, double buyMultiplier, double sellMultiplier) Creates an economy from pack-owned configuration. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the estimate ceiling per product.intReturns the authored product cap.intprice(int baseValue, boolean buying) Applies authored buy or sell pricing to a resource's registry value.intseasonalGold(int roll) Converts the host's uniform draw into an inclusive authored gold range.inttravelDays(String biome) Resolves an authored biome journey.doubleReturns the retained legacy workstation-utilization coefficient.
-
Constructor Details
-
TradeEconomy
Legacy convenience reader retained for existing compiled packs. New packs should own their setting names and defaults and pass explicit values instead.- Parameters:
settings- typed captured settings reader- Throws:
IllegalArgumentException- if an economy value is malformed or out of rangeNullPointerException- if settings is null
-
TradeEconomy
public TradeEconomy(TravelRules travel, int minimumGold, int maximumGold, int maximumExports, int maximumEstimate, double utilization, double buyMultiplier, double sellMultiplier) Creates an economy from pack-owned configuration.- Parameters:
travel- authored journey durationsminimumGold- inclusive seasonal income minimum within 0..100000maximumGold- inclusive seasonal income maximum within minimumGold..100000maximumExports- distinct export limit within 1..64maximumEstimate- per-product seasonal estimate ceiling within 1..100000utilization- workstation utilization within 0..1buyMultiplier- multiplier for purchases within 0..100sellMultiplier- multiplier for sales within 0..100- Throws:
IllegalArgumentException- if bounds are invalid or a multiplier is not finiteNullPointerException- if travel is null
-
-
Method Details
-
travelDays
Resolves an authored biome journey.- Parameters:
biome- nonnull exact biome identity- Returns:
- days within 1..48
- Throws:
NullPointerException- if biome is null
-
seasonalGold
public int seasonalGold(int roll) Converts the host's uniform draw into an inclusive authored gold range.- Parameters:
roll- integer within 0..1000000- Returns:
- seasonal gold grant
- Throws:
IllegalArgumentException- if the random input is outside the documented range
-
maximumExports
public int maximumExports()Returns the authored product cap.- Returns:
- maximum distinct exports
-
maximumEstimate
public int maximumEstimate()Returns the estimate ceiling per product.- Returns:
- positive units per season
-
utilization
public double utilization()Returns the retained legacy workstation-utilization coefficient. Recorded packing output does not derive saleable goods from this theoretical capacity value.- Returns:
- utilization within 0..1
-
price
public int price(int baseValue, boolean buying) Applies authored buy or sell pricing to a resource's registry value.- Parameters:
baseValue- native resource value; negative values are treated as zerobuying- true to apply buyMultiplier, false to apply sellMultiplier- Returns:
- price rounded to the nearest whole unit and clamped to 0..100000; zero disables the transaction
-