Interface MarketAPI

All Superinterfaces:
HasMemory

public interface MarketAPI extends HasMemory
  • Method Details

    • getPrimaryEntity

      SectorEntityToken getPrimaryEntity()
    • getConnectedEntities

      Set<SectorEntityToken> getConnectedEntities()
    • getId

      String getId()
    • getName

      String getName()
    • getSize

      int getSize()
    • setSize

      void setSize(int size)
    • getAllCommodities

      List<CommodityOnMarketAPI> getAllCommodities()
    • getCommodityData

      CommodityOnMarketAPI getCommodityData(String commodityId)
    • getCommoditiesWithTag

      List<CommodityOnMarketAPI> getCommoditiesWithTag(String tag)
    • getCommoditiesWithTags

      List<CommodityOnMarketAPI> getCommoditiesWithTags(String... tags)
    • getDemand

      MarketDemandAPI getDemand(String demandClass)
    • getDemandWithTag

      List<MarketDemandAPI> getDemandWithTag(String tag)
    • getConditions

      List<MarketConditionAPI> getConditions()
    • addCondition

      String addCondition(String id)
      Returns token which can be used to remove this specific condition.
      Parameters:
      id -
      Returns:
    • addCondition

      String addCondition(String id, Object param)
      Returns token which can be used to remove this specific condition.
      Parameters:
      id -
      param -
      Returns:
    • removeCondition

      void removeCondition(String id)
      Removes all copies of this condition.
      Parameters:
      id -
    • removeSpecificCondition

      void removeSpecificCondition(String token)
      Removes specific copy of a condition.
      Parameters:
      token - return value from addCondition()
    • hasCondition

      boolean hasCondition(String id)
    • hasSpecificCondition

      boolean hasSpecificCondition(String token)
    • reapplyConditions

      void reapplyConditions()
    • reapplyCondition

      void reapplyCondition(String token)
    • getDemandData

      MarketDemandDataAPI getDemandData()
    • getTariff

      MutableStat getTariff()
    • getDemandPriceMod

      StatBonus getDemandPriceMod()
      Modifier for the price the market is willing to buy things at. Only the multiplier part of this works.
      Returns:
    • getSupplyPriceMod

      StatBonus getSupplyPriceMod()
      Modifier for the price the market is willing to sell things at.
      Returns:
    • getSupplyPrice

      float getSupplyPrice(String commodityId, double quantity, boolean isPlayerPrice)
      Price for the market selling quantity of given commodity, given the current stockpile/demand/etc.
      Parameters:
      commodityId -
      quantity -
      Returns:
    • getDemandPrice

      float getDemandPrice(String commodityId, double quantity, boolean isPlayerPrice)
      Price for the market buying quantity of given commodity, given the current stockpile/demand/etc.
      Parameters:
      commodityId -
      quantity -
      Returns:
    • getDemandPriceAssumingExistingTransaction

      float getDemandPriceAssumingExistingTransaction(String commodityId, double quantity, double existingTransactionUtility, boolean isPlayerPrice)
      Parameters:
      commodityId -
      quantity -
      existingTransactionUtility - positive for stuff sold to market, negative for stuff bought from market.
      isPlayerPrice -
      Returns:
    • getSupplyPriceAssumingExistingTransaction

      float getSupplyPriceAssumingExistingTransaction(String commodityId, double quantity, double existingTransactionUtility, boolean isPlayerPrice)
      Parameters:
      commodityId -
      quantity -
      existingTransactionUtility - positive for stuff sold to market, negative for stuff bought from market.
      isPlayerPrice -
      Returns:
    • isIllegal

      boolean isIllegal(String commodityId)
      Checks against FactionAPI.getIllegalCommodities() for the faction owning the market.
      Parameters:
      commodityId -
      Returns:
    • isIllegal

      boolean isIllegal(CommodityOnMarketAPI com)
      Checks against FactionAPI.getIllegalCommodities() for the faction owning the market.
      Parameters:
      com -
      Returns:
    • getStability

      MutableStatWithTempMods getStability()
    • getStabilityValue

      float getStabilityValue()
      Integer value from 0 to 10, inclusive.
      Returns:
    • getFaction

      FactionAPI getFaction()
    • getFactionId

      String getFactionId()
    • addSubmarket

      void addSubmarket(String specId)
    • hasSubmarket

      boolean hasSubmarket(String specId)
    • getSubmarketsCopy

      List<SubmarketAPI> getSubmarketsCopy()
    • removeSubmarket

      void removeSubmarket(String specId)
    • getSubmarket

      SubmarketAPI getSubmarket(String specId)
    • setFactionId

      void setFactionId(String factionId)
    • updatePriceMult

      void updatePriceMult()
      Updates the local price multiplier (based on stability).
    • getMemory

      MemoryAPI getMemory()
      Specified by:
      getMemory in interface HasMemory
    • getMemoryWithoutUpdate

      MemoryAPI getMemoryWithoutUpdate()
      Specified by:
      getMemoryWithoutUpdate in interface HasMemory
    • pickShipAndAddToFleet

      float pickShipAndAddToFleet(String role, FactionAPI.ShipPickParams params, CampaignFleetAPI fleet)
      May add more than one ship if a fallback specifies to add multiple ships. (For example, 2 small freighters if a medium freighter isn't available.) See FactionAPI.pickShipAndAddToFleet for return value explanation.
      Returns:
    • pickShipAndAddToFleet

      float pickShipAndAddToFleet(String role, String factionId, FactionAPI.ShipPickParams params, CampaignFleetAPI fleet)
    • getShipQualityFactor

      float getShipQualityFactor()
    • getStarSystem

      StarSystemAPI getStarSystem()
    • getContainingLocation

      LocationAPI getContainingLocation()
    • getLocationInHyperspace

      org.lwjgl.util.vector.Vector2f getLocationInHyperspace()
    • setPrimaryEntity

      void setPrimaryEntity(SectorEntityToken primaryEntity)
    • getCommDirectory

      CommDirectoryAPI getCommDirectory()
      Returns:
    • addPerson

      void addPerson(PersonAPI person)
    • removePerson

      void removePerson(PersonAPI person)
    • getPeopleCopy

      List<PersonAPI> getPeopleCopy()
    • getStats

    • pickShipsForRole

      List<ShipRolePick> pickShipsForRole(String role, FactionAPI.ShipPickParams params, Random random, ShipFilter filter)
    • pickShipsForRole

      List<ShipRolePick> pickShipsForRole(String role, String factionId, FactionAPI.ShipPickParams params, Random random, ShipFilter filter)
    • isPlanetConditionMarketOnly

      boolean isPlanetConditionMarketOnly()
    • setPlanetConditionMarketOnly

      void setPlanetConditionMarketOnly(boolean isPlanetConditionMarketOnly)
    • setName

      void setName(String name)
    • getHazard

      MutableStat getHazard()
    • getHazardValue

      float getHazardValue()
      1f = 100%.
      Returns:
    • getPlanetEntity

      PlanetAPI getPlanetEntity()
    • getSurveyLevel

      MarketAPI.SurveyLevel getSurveyLevel()
    • setSurveyLevel

      void setSurveyLevel(MarketAPI.SurveyLevel surveyLevel)
    • advance

      void advance(float amount)
    • isForceNoConvertOnSave

      boolean isForceNoConvertOnSave()
    • setForceNoConvertOnSave

      void setForceNoConvertOnSave(boolean forceNoConvertOnSave)
    • updatePrices

      void updatePrices()
    • getSpecificCondition

      MarketConditionAPI getSpecificCondition(String token)
      Get a condition using its unique id.
      Parameters:
      token -
      Returns:
    • getFirstCondition

      MarketConditionAPI getFirstCondition(String id)
      Get the first condition of a specific type; id is non-unique.
      Parameters:
      id -
      Returns:
    • isInEconomy

      boolean isInEconomy()
    • getIndustries

      List<Industry> getIndustries()
    • addIndustry

      void addIndustry(String id)
    • removeIndustry

      void removeIndustry(String id, MarketAPI.MarketInteractionMode mode, boolean forUpgrade)
      Pass in null for mode when calling this from API code.
      Parameters:
      id -
      mode -
    • reapplyIndustries

      void reapplyIndustries()
    • getLocation

      org.lwjgl.util.vector.Vector2f getLocation()
      Same as getLocationInHyperspace().
      Returns:
    • getIndustry

      Industry getIndustry(String id)
      In-system, i.e. not affected by fuel shortages etc.
      Returns:
    • hasIndustry

      boolean hasIndustry(String id)
    • getCommoditiesCopy

      List<CommodityOnMarketAPI> getCommoditiesCopy()
    • getCondition

      MarketConditionAPI getCondition(String id)
    • getIndustryUpkeep

      float getIndustryUpkeep()
    • getIndustryIncome

      float getIndustryIncome()
    • hasWaystation

      boolean hasWaystation()
    • instantiateIndustry

      Industry instantiateIndustry(String id)
    • clone

      MarketAPI clone()
    • clearCommodities

      void clearCommodities()
    • isPlayerOwned

      boolean isPlayerOwned()
    • setPlayerOwned

      void setPlayerOwned(boolean playerOwned)
    • getPrevStability

      float getPrevStability()
    • getExportIncome

      float getExportIncome(boolean withOverhead)
    • getNetIncome

      float getNetIncome()
    • getIncomeMult

      MutableStat getIncomeMult()
    • getUpkeepMult

      MutableStat getUpkeepMult()
    • getPopulation

      PopulationComposition getPopulation()
    • getIncoming

      PopulationComposition getIncoming()
    • setPopulation

      void setPopulation(PopulationComposition population)
    • setIncoming

      void setIncoming(PopulationComposition incoming)
    • getImmigrationModifiers

      LinkedHashSet<MarketImmigrationModifier> getImmigrationModifiers()
    • getTransientImmigrationModifiers

      LinkedHashSet<MarketImmigrationModifier> getTransientImmigrationModifiers()
    • addImmigrationModifier

      void addImmigrationModifier(MarketImmigrationModifier mod)
    • removeImmigrationModifier

      void removeImmigrationModifier(MarketImmigrationModifier mod)
    • addTransientImmigrationModifier

      void addTransientImmigrationModifier(MarketImmigrationModifier mod)
    • removeTransientImmigrationModifier

      void removeTransientImmigrationModifier(MarketImmigrationModifier mod)
    • getAllImmigrationModifiers

      List<MarketImmigrationModifier> getAllImmigrationModifiers()
    • getIncentiveCredits

      float getIncentiveCredits()
    • setIncentiveCredits

      void setIncentiveCredits(float incentiveCredits)
    • isImmigrationIncentivesOn

      boolean isImmigrationIncentivesOn()
    • setImmigrationIncentivesOn

      void setImmigrationIncentivesOn(Boolean incentivesOn)
    • isFreePort

      boolean isFreePort()
    • setFreePort

      void setFreePort(boolean freePort)
    • isImmigrationClosed

      boolean isImmigrationClosed()
    • setImmigrationClosed

      void setImmigrationClosed(boolean closed)
    • wasIncomingSetBefore

      boolean wasIncomingSetBefore()
    • addCondition

      void addCondition(MarketConditionAPI mc)
    • getAdmin

      PersonAPI getAdmin()
    • setAdmin

      void setAdmin(PersonAPI admin)
      The old admin, if any, is removed from the market and its comm directory.
      Parameters:
      admin -
    • getDaysInExistence

      float getDaysInExistence()
    • setDaysInExistence

      void setDaysInExistence(float daysInExistence)
    • getAccessibilityMod

      StatBonus getAccessibilityMod()
      o = 0%, 1 = 100%.
      Returns:
    • hasSpaceport

      boolean hasSpaceport()
    • setHasSpaceport

      void setHasSpaceport(boolean hasSpaceport)
    • setHasWaystation

      void setHasWaystation(boolean hasWaystation)
    • getEconGroup

      String getEconGroup()
      Markets with the same economy group will not be visible from markets outside this group (in "nearby markets" dialog etc) and will only trade with each other. null by default, which forms its own group.
      Returns:
    • setEconGroup

      void setEconGroup(String econGroup)
      Markets with the same economy group will not be visible from markets outside this group (in "nearby markets" dialog etc) and will only trade with each other. null by default, which forms its own group.
    • addIndustry

      void addIndustry(String id, List<String> params)
    • hasTag

      boolean hasTag(String tag)
    • addTag

      void addTag(String tag)
    • removeTag

      void removeTag(String tag)
    • getTags

      Collection<String> getTags()
    • clearTags

      void clearTags()
    • getOnOrAt

      String getOnOrAt()
    • getTextColorForFactionOrPlanet

      Color getTextColorForFactionOrPlanet()
    • getDarkColorForFactionOrPlanet

      Color getDarkColorForFactionOrPlanet()
    • isHidden

      boolean isHidden()
      Hidden markets do not offer missions or otherwise participate in events/intel/etc that would indirectly reveal their existence to the player.
      Returns:
    • setHidden

      void setHidden(Boolean hidden)
      Hidden markets do not offer missions or otherwise participate in events/intel/etc that would indirectly reveal their existence to the player. Hidden markets also do not participate in the economy.
    • isUseStockpilesForShortages

      boolean isUseStockpilesForShortages()
    • setUseStockpilesForShortages

      void setUseStockpilesForShortages(boolean useStockpilesForShortages)
    • getShortageCounteringCost

      float getShortageCounteringCost()
    • addSubmarket

      void addSubmarket(SubmarketAPI submarket)
    • getConstructionQueue

      ConstructionQueue getConstructionQueue()
    • isInHyperspace

      boolean isInHyperspace()
    • getSuppressedConditions

      LinkedHashSet<String> getSuppressedConditions()
    • isConditionSuppressed

      boolean isConditionSuppressed(String id)
    • suppressCondition

      void suppressCondition(String id)
    • unsuppressCondition

      void unsuppressCondition(String id)
    • getImmigrationIncentivesCost

      float getImmigrationIncentivesCost()
    • isInvalidMissionTarget

      boolean isInvalidMissionTarget()
    • setInvalidMissionTarget

      void setInvalidMissionTarget(Boolean invalidMissionTarget)
    • setSuppressedConditions

      void setSuppressedConditions(LinkedHashSet<String> suppressedConditions)
    • setRetainSuppressedConditionsSetWhenEmpty

      void setRetainSuppressedConditionsSetWhenEmpty(Boolean retainSuppressedConditionsSetWhenEmpty)
    • getGrossIncome

      float getGrossIncome()
    • hasFunctionalIndustry

      boolean hasFunctionalIndustry(String id)
    • setCachedFaction

      void setCachedFaction(FactionAPI faction)
      Transient. Do not use unless the market is a faked-up one.
      Parameters:
      faction -