001package com.fs.starfarer.api.campaign.econ; 002 003import com.fs.starfarer.api.combat.MutableStat; 004import com.fs.starfarer.api.combat.MutableStatWithTempMods; 005import com.fs.starfarer.api.combat.StatBonus; 006 007/** 008 * 009 * 010 * @author Alex Mosolov 011 * 012 * Copyright 2018 Fractal Softworks, LLC 013 */ 014public interface CommodityOnMarketAPI { 015 016 String getId(); 017 018 MutableStat getGreed(); 019 020 float getGreedValue(); 021 022 CommoditySpecAPI getCommodity(); 023 024 float getStockpile(); 025 void setStockpile(float stockpile); 026 027 void addToStockpile(float quantity); 028 void removeFromStockpile(float quantity); 029 030 MarketAPI getMarket(); 031 032 String getDemandClass(); 033 MarketDemandAPI getDemand(); 034 035 float getUtilityOnMarket(); 036 037 boolean isPersonnel(); 038 boolean isFuel(); 039 040 //StatBonus getPlayerPriceMod(); 041 042 boolean isNonEcon(); 043 044 int getMaxSupply(); 045 void setMaxSupply(int maxSupply); 046 int getMaxDemand(); 047 void setMaxDemand(int maxDemand); 048 049 void updateMaxSupplyAndDemand(); 050 051 int getAvailable(); 052 053 054 MutableStatWithTempMods getAvailableStat(); 055 056 /** 057 * Actual quantity in "inventory" units. Gets translated into econ-unit-scale "market units" 058 * and applied to the available quantity. 059 * @return 060 */ 061 MutableStatWithTempMods getTradeMod(); 062 MutableStatWithTempMods getTradeModPlus(); 063 MutableStatWithTempMods getTradeModMinus(); 064 065 void reapplyEventMod(); 066 float getModValueForQuantity(float quantity); 067 068 boolean isIllegal(); 069 070 boolean isIllegalAssumePrimary(); 071 072 float getQuantityForModValue(float modValue); 073 074 075// LinkedHashMap<String, MutableStatWithTempMods> getPiracy(); 076// void addPiracy(String sourceMarket, int penalty, float days); 077// void clearPiracy(); 078// void clearPiracy(String sourceMarket); 079// int getPiracy(String sourceMarket); 080 081 int getExportIncome(); 082 083 boolean isSupplyLegal(); 084 void setSupplyLegal(boolean isSupplyLegal); 085 boolean isDemandLegal(); 086 void setDemandLegal(boolean isDemandLegal); 087 088 089 //void addTradeMod(String source, float quantity, float days, String desc); 090 /** 091 * Can result in both positive and negative econ-unit changes. 092 * @param source 093 * @param quantity 094 * @param days 095 */ 096 void addTradeMod(String source, float quantity, float days); 097 /** 098 * Only positive econ-unit changes (but value may be negative; just gets clamped to 0). 099 * @param source 100 * @param quantity 101 * @param days 102 */ 103 void addTradeModPlus(String source, float quantity, float days); 104 105 /** 106 * Only negative econ-unit changes (but value may be positive; just gets clamped to 0). 107 * @param source 108 * @param quantity 109 * @param days 110 */ 111 void addTradeModMinus(String source, float quantity, float days); 112 113 /** 114 * tradeMod + modPlus if positive + modMinus if negative. 115 * @return 116 */ 117 float getCombinedTradeModQuantity(); 118 119 boolean isMeta(); 120 121 int getDemandValue(); 122 123 CommodityMarketDataAPI getCommodityMarketData(); 124 125 126 /** 127 * Quantity that can be sold at a higher price. 128 * @return 129 */ 130 int getDeficitQuantity(); 131 132 /** 133 * Quantity that can be bought at a lower price. 134 * @return 135 */ 136 int getExcessQuantity(); 137 138 /** 139 * Returns net bought/sold, minus what was used to change economy units available on market. 140 * For example, if 400 units of supplies are sold by to a colony, this method will return 0. 141 * If 399 units are sold, it will return 399. 142 * 143 * >0 means player sold stuff recently, <0 means bought. 144 * 145 * @return 146 */ 147 int getPlayerTradeNetQuantity(); 148 149 //StatBonus getPlayerPriceMod(); 150 151 StatBonus getPlayerSupplyPriceMod(); 152 StatBonus getPlayerDemandPriceMod(); 153 154} 155 156 157 158