001package com.fs.starfarer.api.campaign.econ; 002 003import java.util.List; 004import java.util.Random; 005 006import com.fs.starfarer.api.campaign.CargoAPI; 007import com.fs.starfarer.api.campaign.SpecialItemData; 008import com.fs.starfarer.api.campaign.econ.MarketAPI.MarketInteractionMode; 009import com.fs.starfarer.api.combat.MutableStat; 010import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD.RaidDangerLevel; 011import com.fs.starfarer.api.loading.IndustrySpecAPI; 012import com.fs.starfarer.api.ui.TooltipMakerAPI; 013import com.fs.starfarer.api.util.Pair; 014 015public interface Industry { 016 017 public static enum ImprovementDescriptionMode { 018 MENU_BUTTON, 019 STORY_POINT_USE_DIALOG, 020 INDUSTRY_TOOLTIP, 021 } 022 023 public static enum AICoreDescriptionMode { 024 INDUSTRY_TOOLTIP, 025 MANAGE_CORE_TOOLTIP, 026 MANAGE_CORE_DIALOG_LIST, 027 MANAGE_CORE_DIALOG_INSTALLED, 028 } 029 030 public static enum IndustryTooltipMode { 031 NORMAL, 032 ADD_INDUSTRY, 033 UPGRADE, 034 DOWNGRADE, 035 QUEUED, 036 } 037 038 039 /** 040 * Used when loading market from an economy .json file. Params are the special items/AI cores/etc 041 * that this industry has installed; this method should sort out what they all are based on IDs and 042 * install as appropriate. 043 * @param params 044 */ 045 void initWithParams(List<String> params); 046 047 public MarketAPI getMarket(); 048 049 void apply(); 050 void unapply(); 051 052 /** 053 * Calls unapply() and then reapply(). 054 */ 055 void reapply(); 056 057 void advance(float amount); 058 059 List<MutableCommodityQuantity> getAllSupply(); 060 List<MutableCommodityQuantity> getAllDemand(); 061 MutableCommodityQuantity getSupply(String id); 062 MutableCommodityQuantity getDemand(String id); 063 064 MutableStat getIncome(); 065 MutableStat getUpkeep(); 066 067 void init(String id, MarketAPI market); 068 069 String getId(); 070 IndustrySpecAPI getSpec(); 071 072 Pair<String, Integer> getMaxDeficit(String ... commodityIds); 073 List<Pair<String, Integer>> getAllDeficit(String ... commodityIds); 074 List<Pair<String, Integer>> getAllDeficit(); 075 076 void doPreSaveCleanup(); 077 void doPostSaveRestore(); 078 079 String getCurrentImage(); 080 String getCurrentName(); 081 082 /** 083 * Building OR upgrading. 084 * @return 085 */ 086 boolean isBuilding(); 087 088 /** 089 * Upgrading, but not the initial building process. 090 * @return 091 */ 092 boolean isUpgrading(); 093 void startBuilding(); 094 void finishBuildingOrUpgrading(); 095 void startUpgrading(); 096 float getBuildOrUpgradeProgress(); 097 098 float getBuildTime(); 099 float getBuildCost(); 100 float getBaseUpkeep(); 101 //float getActualUpkeep(); 102 103 boolean isAvailableToBuild(); 104 boolean showWhenUnavailable(); 105 String getUnavailableReason(); 106 107 String getBuildOrUpgradeProgressText(); 108 109 /** 110 * Building and not upgrading. 111 * @return 112 */ 113 boolean isFunctional(); 114 115 boolean isTooltipExpandable(); 116 float getTooltipWidth(); 117 void createTooltip(IndustryTooltipMode mode, TooltipMakerAPI tooltip, boolean expanded); 118 119 void updateIncomeAndUpkeep(); 120 121 String getAICoreId(); 122 void setAICoreId(String aiCoreId); 123 124 void supply(String modId, String commodityId, int quantity, String desc); 125 126 void downgrade(); 127 128 void cancelUpgrade(); 129 130 131 boolean showShutDown(); 132 boolean canShutDown(); 133 String getCanNotShutDownReason(); 134 135 boolean canUpgrade(); 136 boolean canDowngrade(); 137 138 void addAICoreSection(TooltipMakerAPI tooltip, AICoreDescriptionMode mode); 139 void addAICoreSection(TooltipMakerAPI tooltip, String coreId, AICoreDescriptionMode mode); 140 141 boolean isSupplyLegal(CommodityOnMarketAPI com); 142 boolean isDemandLegal(CommodityOnMarketAPI com); 143 144 MutableStat getDemandReduction(); 145 MutableStat getSupplyBonus(); 146 147 List<SpecialItemData> getVisibleInstalledItems(); 148 149 List<InstallableIndustryItemPlugin> getInstallableItems(); 150 151 void notifyBeingRemoved(MarketInteractionMode mode, boolean forUpgrade); 152 153 boolean isHidden(); 154 155 void setDisrupted(float days); 156 void setDisrupted(float days, boolean useMax); 157 float getDisruptedDays(); 158 boolean isDisrupted(); 159 boolean canBeDisrupted(); 160 161 float getPatherInterest(); 162 163 String getCargoTitleForGatheringPoint(); 164 CargoAPI generateCargoForGatheringPoint(Random random); 165 166 SpecialItemData getSpecialItem(); 167 void setSpecialItem(SpecialItemData special); 168 169 String getNameForModifier(); 170 171 172 /** 173 * Return false if already using one of that type, unless the other one is better. 174 * @param data 175 * @return 176 */ 177 boolean wantsToUseSpecialItem(SpecialItemData data); 178 179 boolean isIndustry(); 180 boolean isStructure(); 181 boolean isOther(); 182 183 String getBuildOrUpgradeDaysText(); 184 185 void notifyColonyRenamed(); 186 187 boolean canImprove(); 188 boolean isImproved(); 189 void setImproved(boolean improved); 190 String getImproveMenuText(); 191 void addImproveDesc(TooltipMakerAPI info, ImprovementDescriptionMode mode); 192 int getImproveStoryPoints(); 193 float getImproveBonusXP(); 194 String getImproveSoundId(); 195 String getImproveDialogTitle(); 196 197 198 RaidDangerLevel adjustCommodityDangerLevel(String commodityId, RaidDangerLevel level); 199 /** 200 * Includes nonecon "commodities" such as AI cores. Rule of thumb: if it requires a set number of 201 * marine tokens to raid, then this method determines the danger level. Otherwise, it's getCommodityDangerLevel(). 202 * @param itemId 203 * @return 204 */ 205 RaidDangerLevel adjustItemDangerLevel(String itemId, String data, RaidDangerLevel level); 206 int adjustMarineTokensToRaidItem(String itemId, String data, int marineTokens); 207 208 boolean canInstallAICores(); 209 210 MutableStat getDemandReductionFromOther(); 211 MutableStat getSupplyBonusFromOther(); 212 213 void setHidden(boolean hidden); 214} 215 216 217 218 219 220 221