001package com.fs.starfarer.api.campaign.econ; 002 003import java.util.List; 004 005import com.fs.starfarer.api.campaign.LocationAPI; 006import com.fs.starfarer.api.campaign.StarSystemAPI; 007 008 009public interface EconomyAPI { 010 011 /** 012 * Called whenever economy data is recalculated, i.e. both when time passes and 013 * when the player opens the trade screen etc. 014 * 015 * Needs to be added via EconomyAPI.addUpdateListener(); should not be added to SectorAPI.getListenerManager(). 016 * 017 * Copyright 2018 Fractal Softworks, LLC 018 */ 019 public static interface EconomyUpdateListener { 020 void commodityUpdated(String commodityId); 021 void economyUpdated(); 022 boolean isEconomyListenerExpired(); 023 } 024 025 void addMarket(MarketAPI market, boolean withJunkAndChatter); 026 void removeMarket(MarketAPI market); 027 028 MarketAPI getMarket(String id); 029 030 void advance(float amount); 031 032 List<MarketAPI> getMarketsCopy(); 033 034 boolean isSimMode(); 035 List<String> getAllCommodityIds(); 036 CommoditySpecAPI getCommoditySpec(String commodityId); 037// void clearReachMap(); 038// void restoreReachMap(); 039 int getNumMarkets(); 040 041 /** 042 * Should only be called from UI interactions, not from scripts that run in the background. 043 * Calling this method is likely to take longer than the time to render a single frame. 044 */ 045 void nextStep(); 046 047 048 /** 049 * Equivalent to calling nextStep() three times. 050 * Generally enough or almost enough to fully stabilize the economy. 051 * 052 * Should only be called from UI interactions, not from scripts that run in the background. 053 * Calling this method is likely to take longer than the time to render a single frame. 054 */ 055 void tripleStep(); 056 057 void addUpdateListener(EconomyUpdateListener listener); 058 void removeUpdateListener(EconomyUpdateListener listener); 059 List<EconomyUpdateListener> getUpdateListeners(); 060 061 062 void forceStockpileUpdate(MarketAPI market); 063 List<MarketAPI> getMarketsWithSameGroup(MarketAPI market); 064 List<MarketAPI> getMarketsWithSameGroup(MarketAPI market, List<MarketAPI> markets); 065 066 //WaystationBonus getWaystationBonus(String marketId, String otherId); 067 068 List<MarketAPI> getMarkets(LocationAPI loc); 069 List<LocationAPI> getLocationsWithMarkets(); 070 List<StarSystemAPI> getStarSystemsWithMarkets(); 071 List<MarketAPI> getMarketsInGroup(String group); 072 073 /** 074 * Equivalent to calling nextStep() two times. 075 * 076 * Should only be called from UI interactions, not from scripts that run in the background. 077 * Calling this method is likely to take longer than the time to render a single frame. 078 */ 079 void doubleStep(); 080} 081 082 083