1package com.fs.starfarer.api.impl.campaign.intel.misc;
4import java.util.ArrayList;
5import java.util.Collections;
6import java.util.Comparator;
7import java.util.LinkedHashMap;
11import com.fs.starfarer.api.Global;
12import com.fs.starfarer.api.campaign.CargoAPI;
13import com.fs.starfarer.api.campaign.FactionAPI;
14import com.fs.starfarer.api.campaign.SectorEntityToken;
15import com.fs.starfarer.api.campaign.econ.MarketAPI;
16import com.fs.starfarer.api.fleet.FleetMemberAPI;
17import com.fs.starfarer.api.impl.campaign.ids.Factions;
18import com.fs.starfarer.api.impl.campaign.ids.Tags;
19import com.fs.starfarer.api.ui.Alignment;
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.CountingMap;
24import com.fs.starfarer.api.util.Misc;
28 public static class ProductionData {
29 public LinkedHashMap<String, CargoAPI> data =
new LinkedHashMap<String, CargoAPI>();
31 public CargoAPI getCargo(String name) {
32 CargoAPI cargo = data.get(name);
35 cargo.initMothballedShips(Factions.PLAYER);
36 data.put(name, cargo);
40 public boolean isEmpty() {
41 for (CargoAPI cargo : data.values()) {
42 if (!cargo.isEmpty())
return false;
43 if (cargo.getMothballedShips() !=
null && !cargo.getMothballedShips().getMembersListCopy().isEmpty())
return false;
50 protected ProductionData
data;
68 Color h = Misc.getHighlightColor();
69 Color g = Misc.getGrayColor();
74 if (mode == ListInfoMode.IN_DESC) initPad = opad;
81 if (!
data.isEmpty()) {
84 info.addPara(
"Items delivered to %s",
88 LabelAPI label = info.addPara(
"Items delivered to %s %s " +
getDaysString(days) +
" ago",
96 info.addPara(
"Cost this month: %s", initPad, tc, h, Misc.getDGSCredits(
totalCost));
118 info.addPara(
getName(), c, 0f);
124 Color h = Misc.getHighlightColor();
125 Color g = Misc.getGrayColor();
126 Color tc = Misc.getTextColor();
132 data =
new ProductionData();
144 info.addPara(
"A total of %s worth of production effort has been put into projects that have not yet been " +
145 "completed.", opad, Misc.getHighlightColor(),
"" + Misc.getDGSCredits(
accrued));
149 info.addPara(
"No production work was done this month due to a lack of funds.", opad);
152 if (!
data.isEmpty()) {
153 info.addPara(
"Production and other resource and ship hull acquisition completed during the last month.", opad);
163 List<String> keys =
new ArrayList<String>(
data.data.keySet());
164 Collections.sort(keys,
new Comparator<String>() {
165 public int compare(String o1, String o2) {
166 return o1.compareTo(o2);
170 for (String key : keys) {
171 CargoAPI cargo =
data.data.get(key);
172 if (cargo.isEmpty() &&
173 ((cargo.getMothballedShips() ==
null ||
174 cargo.getMothballedShips().getMembersListCopy().isEmpty()))) {
178 info.addSectionHeading(key, Alignment.MID, opad);
180 float valueWidth = 30;
181 if (!cargo.getStacksCopy().isEmpty()) {
182 info.addPara(
"Weapons, supplies, and other cargo:", opad);
184 info.showCargo(cargo, 20,
true, opad);
194 if (!cargo.getMothballedShips().getMembersListCopy().isEmpty()) {
195 CountingMap<String> counts =
new CountingMap<String>();
196 for (FleetMemberAPI member : cargo.getMothballedShips().getMembersListCopy()) {
198 counts.add(member.getVariant().getHullSpec().getHullName() +
" " + member.getVariant().getDesignation());
201 info.addPara(
"Ship hulls with basic armaments:", opad);
203 info.showShips(cargo.getMothballedShips().getMembersListCopy(), 20,
true, opad);
229 Set<String> tags = super.getIntelTags(map);
230 tags.add(Tags.INTEL_PRODUCTION);
239 return "Production Report";
260 return super.shouldRemoveIntel();
static SettingsAPI getSettings()
static FactoryAPI getFactory()
static SectorAPI getSector()
String getDays(float days)
void unindent(TooltipMakerAPI info)
Color getBulletColorForMode(ListInfoMode mode)
float getDaysSincePlayerVisible()
static String getDaysString(float days)
void bullet(TooltipMakerAPI info)
Color getTitleColor(ListInfoMode mode)
void setDuration(float days)
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
FactionAPI getFactionForUIColors()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
Set< String > getIntelTags(SectorMapAPI map)
String getSmallDescriptionTitle()
SectorEntityToken getMapLocation(SectorMapAPI map)
boolean shouldRemoveIntel()
ProductionReportIntel(MarketAPI gatheringPoint, ProductionData data, int totalCost, int accrued, boolean noProductionThisMonth)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
boolean noProductionThisMonth
CargoAPI createCargo(boolean unlimitedStacks)
String getSpriteName(String category, String id)