1package com.fs.starfarer.api.impl.campaign.intel.misc;
4import java.util.ArrayList;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.FactionAPI;
10import com.fs.starfarer.api.campaign.SectorEntityToken;
11import com.fs.starfarer.api.campaign.econ.CommodityOnMarketAPI;
12import com.fs.starfarer.api.campaign.econ.CommoditySpecAPI;
13import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetAssignmentAI.CargoQuantityData;
14import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetAssignmentAI.EconomyRouteData;
15import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetRouteManager;
16import com.fs.starfarer.api.impl.campaign.fleets.RouteManager.RouteData;
17import com.fs.starfarer.api.impl.campaign.ids.Tags;
18import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
19import com.fs.starfarer.api.ui.IconRenderMode;
20import com.fs.starfarer.api.ui.LabelAPI;
21import com.fs.starfarer.api.ui.SectorMapAPI;
22import com.fs.starfarer.api.ui.TooltipMakerAPI;
23import com.fs.starfarer.api.util.Misc;
31 transient protected boolean goods;
34 transient protected boolean large;
36 transient protected EconomyRouteData
data;
51 if (
large) prob += 0.1f;
56 boolean sameLoc =
data.from.getPrimaryEntity().getContainingLocation() !=
null &&
57 data.from.getPrimaryEntity().getContainingLocation() ==
59 !
data.from.getPrimaryEntity().getContainingLocation().isHyperspace();
60 if (sameLoc) prob = 1f;
65 float probMult = Misc.getProbabilityMult(target, numAlready, 0.5f);
66 if (probMult > 1) probMult = 1;
73 if (Math.random() > prob) {
77 float postingRange = Math.max(0f,
data.size - 6f);
79 postingRange = Math.max(3f, postingRange);
90 data = (EconomyRouteData)
route.getCustom();
93 returnList =
new ArrayList<CargoQuantityData>();
97 large = data.size >= 6;
99 for (CargoQuantityData curr :
data.cargoDeliver) {
100 CommoditySpecAPI c = curr.getCommodity();
101 if (c.getBasePrice() >= 100 && !c.isPersonnel()) {
107 }
else if (!c.isPersonnel()) {
112 for (CargoQuantityData curr :
data.cargoReturn) {
132 Color h = Misc.getHighlightColor();
133 Color g = Misc.getGrayColor();
138 if (mode == ListInfoMode.IN_DESC) initPad = opad;
145 if (mode != ListInfoMode.IN_DESC) {
146 info.addPara(
"Faction: " +
faction.getDisplayName(), initPad, tc,
160 if (mode != ListInfoMode.IN_DESC) {
161 LabelAPI label = info.addPara(
"From " +
data.from.getName() +
" to " +
data.to.getName(), tc, initPad);
162 label.setHighlight(
data.from.getName(),
data.to.getName());
163 label.setHighlightColors(
data.from.getFaction().getBaseUIColor(),
data.to.getFaction().getBaseUIColor());
168 info.addPara(
"Fleet launched", tc, initPad);
170 float delay =
route.getDelay();
172 addDays(info,
"until departure", delay, tc, initPad);
174 info.addPara(
"Recently launched", tc, initPad);
182 String what =
"goods and materiel";
184 if (!
goods) what =
"materiel";
190 Color h = Misc.getHighlightColor();
191 Color g = Misc.getGrayColor();
198 LabelAPI label = info.addPara(
getName(), c, 0f);
209 Color h = Misc.getHighlightColor();
210 Color g = Misc.getGrayColor();
211 Color tc = Misc.getTextColor();
215 info.addImage(
faction.getLogo(), width, 128, opad);
217 float tier =
data.size;
230 LabelAPI label = info.addPara(
"Your contacts " +
data.from.getOnOrAt() +
" " +
data.from.getName() +
231 " let you know that " +
232 faction.getPersonNamePrefixAOrAn() +
" " +
233 faction.getPersonNamePrefix() +
" " + fleetType +
" is preparing for a voyage and will soon depart for " +
234 data.to.getName() +
".",
237 faction.getPersonNamePrefix());
239 label.setHighlight(
data.from.getName(),
faction.getPersonNamePrefix(),
data.to.getName());
240 label.setHighlightColors(
data.from.getFaction().getBaseUIColor(),
faction.getBaseUIColor(),
data.to.getFaction().getBaseUIColor());
248 info.addPara(
"On the outward trip to " +
data.to.getName() +
" the fleet will carry " +
249 EconomyRouteData.getCargoList(
deliverList) +
".", opad);
251 info.beginIconGroup();
252 info.setIconSpacingMedium();
255 CommodityOnMarketAPI com =
data.from.getCommodityData(curr.cargo);
256 info.addIcons(com, curr.units, IconRenderMode.NORMAL);
258 info.addIconGroup(32, 1, opad);
260 info.addPara(
"The fleet will carry nothing of note on the trip to " +
data.to.getName() +
".", opad);
263 info.addPara(
"On the trip back to " +
data.from.getName() +
" the fleet will carry " +
264 EconomyRouteData.getCargoList(
returnList) +
".", opad);
266 info.beginIconGroup();
267 info.setIconSpacingMedium();
269 CommodityOnMarketAPI com =
data.to.getCommodityData(curr.cargo);
270 info.addIcons(com, curr.units, IconRenderMode.NORMAL);
272 info.addIconGroup(32, 1, opad);
274 info.addPara(
"The fleet will carry nothing of note on the trip back to " +
data.from.getName() +
".", opad);
278 info.addPara(
"It's noteworthy because it's carrying a large quantity of valuable " + what +
".", opad);
280 info.addPara(
"It's noteworthy because it's carrying valuable " + what +
".", opad);
282 info.addPara(
"It's noteworthy because it's carrying a large quantity of " + what +
".", opad);
285 if (
data.smuggling) {
286 info.addPara(
"Smugglers often operate in a gray legal and moral area. " +
287 "Thus, if one comes to an unfortunate end - as so often happens in their line of work - " +
288 "it's unlikely to cause a unified response from whatever " +
289 "faction or organization they're nominally affiliated with.", g, opad);
296 if (
data.smuggling) {
308 Set<String> tags = super.getIntelTags(map);
309 tags.add(Tags.INTEL_FLEET_DEPARTURES);
314 data = (EconomyRouteData)
route.getCustom();
315 if (
data.smuggling) {
316 tags.add(Tags.INTEL_SMUGGLING);
324 return "Trade Fleet Departure";
328 float tier =
data.size;
329 String typeId = EconomyFleetRouteManager.getFleetTypeIdForTier(tier,
data.smuggling);
330 String fleetType =
faction.getFleetTypeName(typeId);
331 if (fleetType ==
null) {
332 fleetType =
"Trade Fleet";
355 return route.getMarket().getPrimaryEntity();
362 super.advanceImpl(amount);
364 if (
route.getDelay() > 0)
return;
368 if (sinceLaunched <= 0 && amount > 0) {
372 float days = Misc.getDays(amount);
377 float f =
route.getDelay() / 30f;
384 if (
route.getDelay() > 0)
return false;
407 super.reportRemovedIntel();
413 List<ArrowData> result =
new ArrayList<ArrowData>();
415 if (
data.from.getContainingLocation() ==
data.to.getContainingLocation() &&
416 data.from.getContainingLocation() !=
null &&
417 !
data.from.getContainingLocation().isHyperspace()) {
421 SectorEntityToken entityFrom =
data.from.getPrimaryEntity();
423 SectorEntityToken iconEntity = map.getIntelIconEntity(
this);
424 if (iconEntity !=
null) {
425 entityFrom = iconEntity;
429 data = (EconomyRouteData)
route.getCustom();
430 ArrowData arrow =
new ArrowData(entityFrom,
data.to.getPrimaryEntity());
static SettingsAPI getSettings()
static SectorAPI getSector()
void setPostingLocation(SectorEntityToken postingLocation)
void unindent(TooltipMakerAPI info)
void addDays(TooltipMakerAPI info, String after, float days)
void sendUpdateIfPlayerHasIntel(Object listInfoParam, TextPanelAPI textPanel)
Object getListInfoParam()
Color getBulletColorForMode(ListInfoMode mode)
void bullet(TooltipMakerAPI info)
float getBaseDaysAfterEnd()
Color getTitleColor(ListInfoMode mode)
void setPostingRangeLY(Float postingRangeLY)
boolean shouldRemoveIntel()
transient boolean materiel
transient List< CargoQuantityData > deliverList
Set< String > getIntelTags(SectorMapAPI map)
void advanceImpl(float amount)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
SectorEntityToken getMapLocation(SectorMapAPI map)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
String getFleetTypeName()
void setImportant(Boolean important)
transient EconomyRouteData data
void reportRemovedIntel()
String getSmallDescriptionTitle()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
TradeFleetDepartureIntel(RouteData route)
FactionAPI getFactionForUIColors()
transient List< CargoQuantityData > returnList
transient FactionAPI faction
List< ArrowData > getArrowData(SectorMapAPI map)
float getTimeRemainingFraction()
transient boolean valuable
String getSpriteName(String category, String id)
float getFloat(String key)