31 CompetitorData data =
new CompetitorData(commodityId);
33 for (MarketAPI market :
Global.
getSector().getEconomy().getMarketsCopy()) {
34 CommodityOnMarketAPI com = market.getCommodityData(commodityId);
35 if (com ==
null)
continue;
37 int prod = com.getMaxSupply();
38 if (prod <= 0)
continue;
40 if (factionId.equals(market.getFactionId())) {
41 data.factionProdTotal += prod;
42 data.factionProducers.add(market);
43 data.factionMaxProd = Math.max(data.factionMaxProd, prod);
44 }
else if (competitorId.equals(market.getFactionId())) {
45 data.competitorProdTotal += prod;
46 data.competitorMaxProd = Math.max(data.competitorMaxProd, prod);
47 data.competitorProducers.add(market);
49 data.competitorMaxMarketSize = Math.max(data.competitorMaxMarketSize, market.getSize());
52 data.allProdTotal += prod;
59 String factionId = Factions.DIKTAT;
61 List<String> commodities =
new ArrayList<String>();
62 for (MarketAPI market :
Global.
getSector().getEconomy().getMarketsCopy()) {
63 if (!factionId.equals(market.getFactionId()))
continue;
65 for (CommodityOnMarketAPI com : market.getCommoditiesCopy()) {
66 if (!com.isFuel())
continue;
67 int prod = com.getMaxSupply();
69 commodities.add(com.getId());
74 List<CompetitorData> result =
new ArrayList<CompetitorData>();
76 for (String commodityId : commodities) {
98 public void createTooltip(TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
101 Color h = Misc.getHighlightColor();
102 Color tc = Misc.getTextColor();
104 tooltip.addPara(
"Your colony production of fuel is high enough for the Sindrian Diktat - "
105 +
"which depends on its own fuel production for much of its economy - to take notice.", 0f);
110 tooltip.beginTable(player, 20f,
"Commodity", getTooltipWidth(tooltipParam) - 150f,
"Production", 150f);
111 for (
final CompetitorData data : comp) {
112 tooltip.addRow(Alignment.LMID, tc, Misc.ucFirst(data.spec.getLowerCaseName()),
113 Alignment.MID, h,
"" + (int) data.competitorMaxProd);
115 tooltip.addTable(
"", 0, opad);
116 tooltip.addSpacer(5f);
118 tooltip.addPara(
"Event progress is based on maximum fuel production. "
119 +
"%s below %s per colony should be enough to divert "
120 +
"the Diktat's attention.", opad,
123 tooltip.addPara(
"Knocking the Diktat out of the fuel production game is also an option. Much of "
124 +
"their fuel production depends on a Domain-era Synchrotron Core installed in "
125 +
"their production facilities on Sindria.", opad,
126 h,
"Synchrotron Core");
129 if (sindria !=
null && sindria.getStarSystem() !=
null) {
130 MapParams params =
new MapParams();
131 params.showSystem(sindria.getStarSystem());
132 float w = tooltip.getWidthSoFar();
133 float ht = Math.round(w / 1.6f);
134 params.positionToShowAllMarkersAndSystems(
true, Math.min(w, ht));
135 UIPanelAPI map = tooltip.createSectorMap(w, ht, params, sindria.getName() +
" (" + sindria.getStarSystem().getNameWithLowercaseTypeShort() +
")");
136 tooltip.addCustom(map, opad);
173 for (CompetitorData data : comp) {
174 for (MarketAPI market : data.competitorProducers) {
175 if (market.getContainingLocation() == system) {
176 CommodityOnMarketAPI com = market.getCommodityData(data.commodityId);
177 float prod = com.getMaxSupply();
184 mag = Math.round(mag * 100f) / 100f;