001package com.fs.starfarer.api.impl.campaign.graid; 002 003import java.awt.Color; 004 005import com.fs.starfarer.api.campaign.CargoStackAPI; 006import com.fs.starfarer.api.campaign.econ.Industry; 007import com.fs.starfarer.api.campaign.econ.MarketAPI; 008import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD; 009import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD.RaidDangerLevel; 010import com.fs.starfarer.api.ui.IconGroupAPI; 011import com.fs.starfarer.api.ui.TooltipMakerAPI; 012import com.fs.starfarer.api.util.Misc; 013 014public abstract class BaseGroundRaidObjectivePluginImpl implements GroundRaidObjectivePlugin { 015 016// protected String commodityId; 017// protected String nameOverride; 018// protected CargoItemType type = CargoItemType.RESOURCES; 019// protected boolean isSpecificItem; 020 021 protected String id; 022 protected MarketAPI market; 023 protected Industry source; 024 protected int marinesAssigned; 025 protected int marinesRequired; 026 protected String nameOverride; 027 protected String assignedForcesColumnText; 028 protected Color assignedForcesColumnColor = Misc.getNegativeHighlightColor(); 029 030 protected int quantityLooted; 031 protected int xpGained; 032 033 public BaseGroundRaidObjectivePluginImpl(MarketAPI market, String id) { 034 this.market = market; 035 this.id = id; 036 } 037 038 public abstract float getQuantity(int marines); 039 public abstract int getValue(int marines); 040 041 public int getCargoSpaceNeeded() { return 0; } 042 public int getFuelSpaceNeeded() { return 0; } 043 044 public CargoStackAPI getStackForIcon() { 045 return null; 046 } 047 048 public String getIconName() { 049 return null; 050 } 051 052 public void addIcons(IconGroupAPI iconGroup) { 053 054 } 055 public int getDeficitCaused() { 056 return 0; 057 } 058 059 public String getDisruptedAlreadyString() { 060 return ""; 061 } 062 public Color getDisruptedAlreadyColor() { 063 return Misc.getHighlightColor(); 064 } 065 066 public int getDisruptionDaysSort(int marines) { 067 return 0; 068 } 069 070 public String getDisruptionDaysString(int marines) { 071 return ""; 072 } 073 public Color getDisruptionDaysColor(int marines) { 074 if (marines <= 0) { 075 return Misc.getGrayColor(); 076 } 077 return Misc.getHighlightColor(); 078 } 079 080 081// public int getQuantitySortValue() { 082// CommoditySpecAPI spec = getCommoditySpec(); 083// SpecialItemSpecAPI item = getItemSpec(); 084// if (isSpecificItem()) { 085// int add = 0; 086// if (spec != null) { 087// add = (int) spec.getOrder(); 088// } else if (item != null) { 089// add = (int) item.getOrder() + 1000; 090// } 091// return 1000000 + add; 092// } 093// return (int) getQuantity(0); 094// } 095 096// public CommoditySpecAPI getCommoditySpec() { 097// return Global.getSettings().getCommoditySpec(commodityId); 098// } 099// 100// public SpecialItemSpecAPI getItemSpec() { 101// return Global.getSettings().getSpecialItemSpec(commodityId); 102// } 103 104 public String getNameOverride() { 105 return nameOverride; 106 } 107 108 public void setNameOverride(String nameOverride) { 109 this.nameOverride = nameOverride; 110 } 111 112 public RaidDangerLevel getDangerLevel() { 113 return RaidDangerLevel.MEDIUM; 114 } 115 116 public String getQuantityString(int marines) { 117 return Misc.getWithDGS(getQuantity(Math.max(1, marines))); 118 } 119 120 public Color getQuantityColor(int marines) { 121 if (marines <= 0) { 122 return Misc.getGrayColor(); 123 } 124 return Misc.getHighlightColor(); 125 } 126 127 public String getValueString(int marines) { 128 return Misc.getDGSCredits(getValue(Math.max(1, marines))); 129 } 130 131 public Color getValueColor(int marines) { 132 if (marines <= 0) { 133 return Misc.getGrayColor(); 134 } 135 return Misc.getHighlightColor(); 136 } 137 138 139 public float getValueSortValue() { 140 float add = 100000000f; 141 if (getMarinesAssigned() == 0) add = 0f; 142 return getValue(Math.max(1, getMarinesAssigned())) + add; 143 } 144 145 public int getMarinesAssigned() { 146 return marinesAssigned; 147 } 148 149 public void setMarinesAssigned(int marines) { 150 marinesAssigned = marines; 151 } 152 153 public int getMarinesRequired() { 154 return marinesRequired; 155 } 156 157 public void setMarinesRequired(int marines) { 158 marines = Math.min(MarketCMD.MAX_MARINE_TOKENS, marines); 159 if (marines < 0) marines = 0; 160 marinesRequired = marines; 161 } 162 163 public String getSourceString() { 164 if (source != null) return source.getCurrentName(); 165 return ""; 166 } 167 168 public Industry getSource() { 169 return source; 170 } 171 172 public void setSource(Industry source) { 173 this.source = source; 174 } 175 176 public String getId() { 177 return id; 178 } 179 180 public void setId(String id) { 181 this.id = id; 182 } 183 184 public MarketAPI getMarket() { 185 return market; 186 } 187 188 public void setMarket(MarketAPI market) { 189 this.market = market; 190 } 191 192 public String getCommodityIdForDeficitIcons() { 193 return null; 194 } 195 196 public String getAssignedForcesColumnText() { 197 return assignedForcesColumnText; 198 } 199 200 public void setAssignedForcesColumnText(String assignedForcesColumnText) { 201 this.assignedForcesColumnText = assignedForcesColumnText; 202 } 203 204 public Color getAssignedForcesColumnColor() { 205 return assignedForcesColumnColor; 206 } 207 208 public void setAssignedForcesColumnColor(Color assignedForcesColumnColor) { 209 this.assignedForcesColumnColor = assignedForcesColumnColor; 210 } 211 212 213 public boolean hasTooltip() { 214 return false; 215 } 216 217 public void createTooltip(TooltipMakerAPI tooltip, boolean expanded) { 218 219 } 220 221 public float getTooltipWidth() { 222 return 500f; 223 } 224 225 public boolean isTooltipExpandable() { 226 return false; 227 } 228 229 230 public int getQuantityLooted() { 231 return quantityLooted; 232 } 233 234 public void setQuantityLooted(int quantityLooted) { 235 this.quantityLooted = quantityLooted; 236 } 237 238 public int getXpGained() { 239 return xpGained; 240 } 241 242 public void setXpGained(int xpGained) { 243 this.xpGained = xpGained; 244 } 245 246 public boolean withContinueBeforeResult() { 247 return false; 248 } 249 250}