Starsector API
Loading...
Searching...
No Matches
BaseGroundRaidObjectivePluginImpl.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.graid;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.campaign.CargoStackAPI;
6import com.fs.starfarer.api.campaign.econ.Industry;
7import com.fs.starfarer.api.campaign.econ.MarketAPI;
8import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD;
9import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.MarketCMD.RaidDangerLevel;
10import com.fs.starfarer.api.ui.IconGroupAPI;
11import com.fs.starfarer.api.ui.TooltipMakerAPI;
12import com.fs.starfarer.api.util.Misc;
13
15
16// protected String commodityId;
17// protected String nameOverride;
18// protected CargoItemType type = CargoItemType.RESOURCES;
19// protected boolean isSpecificItem;
20
21 protected String id;
22 protected MarketAPI market;
23 protected Industry source;
24 protected int marinesAssigned;
25 protected int marinesRequired;
26 protected String nameOverride;
27 protected String assignedForcesColumnText;
28 protected Color assignedForcesColumnColor = Misc.getNegativeHighlightColor();
29
30 protected int quantityLooted;
31 protected int xpGained;
32
33 public BaseGroundRaidObjectivePluginImpl(MarketAPI market, String id) {
34 this.market = market;
35 this.id = id;
36 }
37
38 public abstract float getQuantity(int marines);
39 public abstract int getValue(int marines);
40
41 public int getCargoSpaceNeeded() { return 0; }
42 public int getFuelSpaceNeeded() { return 0; }
43
44 public CargoStackAPI getStackForIcon() {
45 return null;
46 }
47
48 public String getIconName() {
49 return null;
50 }
51
52 public void addIcons(IconGroupAPI iconGroup) {
53
54 }
55 public int getDeficitCaused() {
56 return 0;
57 }
58
59 public String getDisruptedAlreadyString() {
60 return "";
61 }
62 public Color getDisruptedAlreadyColor() {
63 return Misc.getHighlightColor();
64 }
65
66 public int getDisruptionDaysSort(int marines) {
67 return 0;
68 }
69
70 public String getDisruptionDaysString(int marines) {
71 return "";
72 }
73 public Color getDisruptionDaysColor(int marines) {
74 if (marines <= 0) {
75 return Misc.getGrayColor();
76 }
77 return Misc.getHighlightColor();
78 }
79
80
81// public int getQuantitySortValue() {
82// CommoditySpecAPI spec = getCommoditySpec();
83// SpecialItemSpecAPI item = getItemSpec();
84// if (isSpecificItem()) {
85// int add = 0;
86// if (spec != null) {
87// add = (int) spec.getOrder();
88// } else if (item != null) {
89// add = (int) item.getOrder() + 1000;
90// }
91// return 1000000 + add;
92// }
93// return (int) getQuantity(0);
94// }
95
96// public CommoditySpecAPI getCommoditySpec() {
97// return Global.getSettings().getCommoditySpec(commodityId);
98// }
99//
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
193 return null;
194 }
195
198 }
199
201 this.assignedForcesColumnText = assignedForcesColumnText;
202 }
203
206 }
207
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
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}