72 CompetitorData data =
new CompetitorData(commodityId);
74 for (MarketAPI market :
Global.
getSector().getEconomy().getMarketsCopy()) {
75 CommodityOnMarketAPI com = market.getCommodityData(commodityId);
76 if (com ==
null)
continue;
78 int prod = com.getMaxSupply();
79 if (prod <= 0)
continue;
81 if (factionId.equals(market.getFactionId())) {
82 data.factionProdTotal += prod;
83 data.factionProducers.add(market);
84 data.factionMaxProd = Math.max(data.factionMaxProd, prod);
85 }
else if (competitorId.equals(market.getFactionId())) {
86 data.competitorProdTotal += prod;
87 data.competitorMaxProd = Math.max(data.competitorMaxProd, prod);
88 data.competitorProducers.add(market);
90 data.competitorMaxMarketSize = Math.max(data.competitorMaxMarketSize, market.getSize());
93 data.allProdTotal += prod;
100 String factionId = Factions.TRITACHYON;
102 Set<String> commodities =
new LinkedHashSet<String>();
103 for (MarketAPI market :
Global.
getSector().getEconomy().getMarketsCopy()) {
104 if (!factionId.equals(market.getFactionId()))
continue;
106 for (CommodityOnMarketAPI com : market.getCommoditiesCopy()) {
107 if (com.isPersonnel())
continue;
108 if (com.getId().equals(Commodities.SHIPS))
continue;
109 if (com.getId().equals(Commodities.SHIP_WEAPONS))
continue;
111 int prod = com.getMaxSupply();
114 commodities.add(com.getId());
119 List<CompetitorData> result =
new ArrayList<CompetitorData>();
121 for (String commodityId : commodities) {
143 public void createTooltip(TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
146 Color h = Misc.getHighlightColor();
147 Color tc = Misc.getTextColor();
149 tooltip.addPara(
"Your colony production of certain commodities that the Tri-Tachyon corporation "
150 +
"has an interest in is high enough "
151 +
"to be viewed as competition.", 0f);
161 tooltip.beginTable(player, 20f,
"Commodity", getTooltipWidth(tooltipParam) - 150f,
"Production", 150f);
162 for (
final CompetitorData data : comp) {
163 tooltip.addRow(Alignment.LMID, tc, Misc.ucFirst(data.spec.getLowerCaseName()),
164 Alignment.MID, h,
"" + (int) data.competitorMaxProd);
166 tooltip.addTable(
"", 0, opad);
167 tooltip.addSpacer(5f);
169 tooltip.addPara(
"Event progress is based on the maximum production of each commodity. "
170 +
"%s below %s per colony, or reducing the scope of the competition to a single commodity,"
171 +
" should be enough to divert "
172 +
"Tri-Tachyon's attention.", opad,
174 "Reducing production levels",
178 tooltip.addPara(
"%s are also possible.", opad,
179 h,
"Reciprocal solutions");
182 if (system !=
null) {
183 tooltip.addPara(
"The Tri-Tachyon Corporation's base of power is in the " +
184 system.getNameWithLowercaseType() +
".", opad);
186 MapParams params =
new MapParams();
187 params.showSystem(system);
188 float width = tooltip.getWidthSoFar();
189 float height = Math.round(width / 1.6f);
190 params.positionToShowAllMarkersAndSystems(
true, Math.min(width, height));
191 UIPanelAPI map = tooltip.createSectorMap(width, height, params, system.getNameWithLowercaseTypeShort());
192 tooltip.addCustom(map, opad);
234 for (CompetitorData data : comp) {
235 for (MarketAPI market : data.competitorProducers) {
236 if (market.getContainingLocation() == system) {
237 CommodityOnMarketAPI com = market.getCommodityData(data.commodityId);
238 float prod = com.getMaxSupply();
245 mag = Math.round(mag * 100f) / 100f;