Class TradeEconomy

java.lang.Object
forgottentowns.mod.api.TradeEconomy

public final class TradeEconomy extends Object
Shared authored economy reader used by independent trade and map policies, without engine imports.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Type
    Method
    Description
    int
    Returns the estimate ceiling per product.
    int
    Returns the authored product cap.
    int
    price(int baseValue, boolean buying)
    Applies authored buy or sell pricing to a resource's registry value.
    int
    seasonalGold(int roll)
    Converts the host's uniform draw into an inclusive authored gold range.
    int
    Resolves an authored biome journey.
    double
    Returns the retained legacy workstation-utilization coefficient.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TradeEconomy

      public TradeEconomy(ModSettings settings)
      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 range
      NullPointerException - 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 durations
      minimumGold - inclusive seasonal income minimum within 0..100000
      maximumGold - inclusive seasonal income maximum within minimumGold..100000
      maximumExports - distinct export limit within 1..64
      maximumEstimate - per-product seasonal estimate ceiling within 1..100000
      utilization - workstation utilization within 0..1
      buyMultiplier - multiplier for purchases within 0..100
      sellMultiplier - multiplier for sales within 0..100
      Throws:
      IllegalArgumentException - if bounds are invalid or a multiplier is not finite
      NullPointerException - if travel is null
  • Method Details

    • travelDays

      public int travelDays(String biome)
      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 zero
      buying - 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