1package com.fs.starfarer.api.impl.campaign.intel.events;
3import java.util.ArrayList;
4import java.util.LinkedHashSet;
10import com.fs.starfarer.api.Global;
11import com.fs.starfarer.api.campaign.StarSystemAPI;
12import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
13import com.fs.starfarer.api.campaign.econ.MarketAPI;
14import com.fs.starfarer.api.impl.campaign.enc.SlipstreamPirateEPEC;
15import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetRouteManager;
16import com.fs.starfarer.api.impl.campaign.ids.Factions;
17import com.fs.starfarer.api.impl.campaign.intel.bases.PirateBaseIntel;
18import com.fs.starfarer.api.impl.campaign.rulecmd.HA_CMD;
19import com.fs.starfarer.api.ui.Alignment;
20import com.fs.starfarer.api.ui.MapParams;
21import com.fs.starfarer.api.ui.TooltipMakerAPI;
22import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator;
23import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipLocation;
24import com.fs.starfarer.api.ui.UIPanelAPI;
25import com.fs.starfarer.api.util.Misc;
26import com.fs.starfarer.api.util.Range;
36 List<MarketAPI> result =
new ArrayList<MarketAPI>();
44 List<StarSystemAPI> result =
new ArrayList<StarSystemAPI>();
57 if (system ==
null)
return null;
62 transient boolean ignoreDeal =
false;
70 Set<PirateBaseIntel> seen =
new LinkedHashSet<PirateBaseIntel>();
73 if (base ==
null || seen.contains(base))
continue;
77 final List<String> affected =
new ArrayList<String>();
79 affected.add(curr.getNameWithNoType());
82 if (affected.isEmpty())
continue;
87 final String colonies = numColonies != 1 ?
"colonies" :
"colony";
88 final String isOrAre = numColonies != 1 ?
"are" :
"is";
90 String desc =
"Hidden pirate base near your " + colonies;
97 String progressStr =
"+" + progress;
98 if (progress < 0) progressStr =
"" + progress;
108 progressStr =
"+" + p;
109 if (p < 0) progressStr =
"" + p;
127 public void createTooltip(
TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
131 String systems =
"systems";
132 if (affected.size() == 1) systems =
"system";
150 float h = Math.round(w / 1.6f);
158 tooltip.
addPara(
"Your " + colonies +
" in the " + aStr +
" " + systems +
159 " " + isOrAre +
" within range of a pirate base located " + systemStr +
". " +
160 "You have an agreement with "
161 +
"the base commander, and fleets from this base do not, as a rule, "
162 +
"harass your colonies or shipping.", 0f,
168 extra =
" instead of providing a reduction in progress";
170 tooltip.
addPara(
"Assuming current colony income levels, this agreement costs "
171 +
"you %s per month. If it was not in effect, "
172 +
"this base would contribute %s points of event progress per month" + extra +
".", opad,
177 String systemStr =
"in a nearby system";
181 tooltip.
addPara(
"Your " + colonies +
" in the " + aStr +
" " + systems +
182 " " + isOrAre +
" within range of a pirate base located " + systemStr +
". " +
183 "This results in a greater volume of pirate "
184 +
"fleets preying on trade. %s should address this.", 0f,
229 boolean ignore = ignoreDeal;
254 if (mag <= 0)
return 0;
256 if (mag > 1f) mag = 1f;
257 Range r =
new Range(
"pirateBaseProximityPoints");
287 maxSize = Math.max(maxSize, market.getSize());
296 mag *= (float)(base.
getTier().ordinal() + 1f) / 5f;
300 mag = Math.round(mag * 100f) / 100f;
static SectorAPI getSector()
static PirateBaseIntel getClosestPirateBase(Vector2f locInHyper)
static float getPirateBaseProximityFactor(PirateBaseIntel base, Vector2f locInHyper)
static boolean ENEMY_STRENGTH_CHECK_EXCLUDE_PIRATES
static final String PLAYER
boolean isPlayerVisible()
StarSystemAPI getSystem()
boolean playerHasDealWithBaseCommander()
Color getProgressColor(BaseEventIntel intel)
HostileActivityEventIntel intel
Color getDescColor(BaseEventIntel intel)
boolean playerHasDealWithAnyBases()
PirateBasePirateActivityCause2(HostileActivityEventIntel intel)
int getProgressForBase(PirateBaseIntel base)
static List< MarketAPI > getColoniesAffectedBy(PirateBaseIntel base)
static boolean DEAL_PROVIDES_NEGATIVE_PROGRESS
static PirateBaseIntel getBaseIntel(StarSystemAPI system)
int getProgressForSystem(StarSystemAPI system)
static List< StarSystemAPI > getSystemsAffectedBy(PirateBaseIntel base)
float getMagnitudeContribution(StarSystemAPI system)
void addExtraRows(TooltipMakerAPI info, BaseEventIntel intel)
static boolean isDefeatedLargePirateRaid()
static int computePirateProtectionPaymentPerMonth(PirateBaseIntel intel)
void showSystem(StarSystemAPI system)
void positionToShowAllMarkersAndSystems(boolean showPlayerFleet, float heightOnScreen)
void showMarket(MarketAPI market)
static Color getTextColor()
static String getDGSCredits(float num)
static List< StarSystemAPI > getSystemsWithPlayerColonies(boolean includeNonPlayerFaction)
static List< MarketAPI > getMarketsInLocation(LocationAPI location, String factionId)
static Color getGrayColor()
static Color getHighlightColor()
static String getAndJoined(List< String > strings)
static Color getPositiveHighlightColor()
String getNameWithLowercaseTypeShort()
IntelManagerAPI getIntelManager()
List< IntelInfoPlugin > getIntel()
static String NEGATED_FACTOR_PROGRESS