68 Set<PirateBaseIntel> seen =
new LinkedHashSet<PirateBaseIntel>();
69 for (
final StarSystemAPI system : Misc.getSystemsWithPlayerColonies(
false)) {
71 if (base ==
null || seen.contains(base))
continue;
75 final List<String> affected =
new ArrayList<String>();
77 affected.add(curr.getNameWithNoType());
78 numColonies += Misc.getMarketsInLocation(curr, Factions.PLAYER).size();
80 if (affected.isEmpty())
continue;
85 final String colonies = numColonies != 1 ?
"colonies" :
"colony";
86 final String isOrAre = numColonies != 1 ?
"are" :
"is";
88 String desc =
"Hidden pirate base near your " + colonies;
89 if (base.isPlayerVisible()) {
90 desc =
"Pirate base in the " + base.getSystem().getNameWithLowercaseTypeShort() +
"";
95 String progressStr =
"+" + progress;
96 if (progress < 0) progressStr =
"" + progress;
103 if (base.playerHasDealWithBaseCommander()) {
106 progressStr =
"+" + p;
107 if (p < 0) progressStr =
"" + p;
108 descColor = Misc.getTextColor();
111 descColor = Misc.getGrayColor();
113 progressColor = Misc.getPositiveHighlightColor();
116 descColor = Misc.getTextColor();
120 info.addRowWithGlow(Alignment.LMID, descColor,
" " + desc,
121 Alignment.RMID, progressColor, progressStr);
125 public void createTooltip(TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
128 String aStr = Misc.getAndJoined(affected);
129 String systems =
"systems";
130 if (affected.size() == 1) systems =
"system";
132 MapParams params =
new MapParams();
134 params.showSystem(curr);
136 if (base.playerHasDealWithBaseCommander() || base.isPlayerVisible()) {
137 params.showMarket(base.getMarket(), 1f);
147 float w = tooltip.getWidthSoFar();
148 float h = Math.round(w / 1.6f);
149 params.positionToShowAllMarkersAndSystems(
true, Math.min(w, h));
152 UIPanelAPI map = tooltip.createSectorMap(w, h, params, aStr +
" " + systems);
154 if (base.playerHasDealWithBaseCommander()) {
155 String systemStr =
"in the " + base.getSystem().getNameWithLowercaseTypeShort() +
"";
156 tooltip.addPara(
"Your " + colonies +
" in the " + aStr +
" " + systems +
157 " " + isOrAre +
" within range of a pirate base located " + systemStr +
". " +
158 "You have an agreement with "
159 +
"the base commander, and fleets from this base do not, as a rule, "
160 +
"harass your colonies or shipping.", 0f,
161 Misc.getPositiveHighlightColor(),
"agreement");
163 int payment = HA_CMD.computePirateProtectionPaymentPerMonth(base);
166 extra =
" instead of providing a reduction in progress";
168 tooltip.addPara(
"Assuming current colony income levels, this agreement costs "
169 +
"you %s per month. If it was not in effect, "
170 +
"this base would contribute %s points of event progress per month" + extra +
".", opad,
171 Misc.getHighlightColor(),
172 Misc.getDGSCredits(payment),
"" + progress);
175 String systemStr =
"in a nearby system";
176 if (base.isPlayerVisible()) {
177 systemStr =
"in the " + base.getSystem().getNameWithLowercaseTypeShort() +
"";
179 tooltip.addPara(
"Your " + colonies +
" in the " + aStr +
" " + systems +
180 " " + isOrAre +
" within range of a pirate base located " + systemStr +
". " +
181 "This results in a greater volume of pirate "
182 +
"fleets preying on trade. %s should address this.", 0f,
183 Misc.getHighlightColor(),
"Dealing with the base");
186 tooltip.addCustom(map, opad);
189 info.addTooltipToAddedRow(t, TooltipLocation.RIGHT,
false);
278 List<MarketAPI> markets = Misc.getMarketsInLocation(system, Factions.PLAYER);
280 for (MarketAPI market : markets) {
281 maxSize = Math.max(maxSize, market.getSize());
285 float mag = SlipstreamPirateEPEC.getPirateBaseProximityFactor(base, system.getLocation());
290 mag *= (float)(base.getTier().ordinal() + 1f) / 5f;
294 mag = Math.round(mag * 100f) / 100f;
296 if (base !=
null && base.playerHasDealWithBaseCommander() && !ignoreDeal) {