1package com.fs.starfarer.api.impl.campaign.intel.misc;
3import java.util.ArrayList;
9import com.fs.starfarer.api.Global;
10import com.fs.starfarer.api.campaign.CampaignTerrainAPI;
11import com.fs.starfarer.api.campaign.CustomEntitySpecAPI;
12import com.fs.starfarer.api.campaign.PlanetAPI;
13import com.fs.starfarer.api.campaign.SectorEntityToken;
14import com.fs.starfarer.api.campaign.StarSystemAPI;
15import com.fs.starfarer.api.campaign.comm.IntelInfoPlugin;
16import com.fs.starfarer.api.campaign.econ.MarketAPI;
17import com.fs.starfarer.api.campaign.econ.MarketAPI.SurveyLevel;
18import com.fs.starfarer.api.impl.campaign.ids.Conditions;
19import com.fs.starfarer.api.impl.campaign.ids.Entities;
20import com.fs.starfarer.api.impl.campaign.ids.Tags;
21import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
22import com.fs.starfarer.api.impl.campaign.terrain.DebrisFieldTerrainPlugin;
23import com.fs.starfarer.api.ui.SectorMapAPI;
24import com.fs.starfarer.api.ui.TooltipMakerAPI;
25import com.fs.starfarer.api.util.Misc;
29 public static enum SalvageValue {
34 private String valueString;
35 private SalvageValue(String value) {
36 this.valueString = value;
38 public String getValueString() {
44 public static class SalvorsTally {
50 public SalvageValue value;
51 public List<SectorEntityToken> all =
new ArrayList<>();
70 if (tally.value == SalvageValue.NONE) {
77 return super.shouldRemoveIntel();
95 if (mode != ListInfoMode.IN_DESC) {
97 if (tally.value == SalvageValue.NONE) highlight = tc;
98 info.
addPara(
"Projected value: %s", initPad, tc, highlight, tally.value.getValueString());
101 if (tally.ruins > 0) {
102 String s = tally.ruins > 1 ?
"s" :
"";
104 info.
addPara(
"%s unexplored planetside ruin" + s, initPad, tc, h,
"" + tally.ruins);
107 if (tally.orbital > 0) {
108 String s = tally.orbital > 1 ?
"s" :
"";
109 info.
addPara(
"%s orbital installation" + s, initPad, tc, h,
"" + tally.orbital);
112 if (tally.derelicts > 0) {
113 String s = tally.derelicts > 1 ?
"s" :
"";
114 info.
addPara(
"%s derelict ship" + s, initPad, tc, h,
"" + tally.derelicts);
117 if (tally.debris > 0) {
118 String s = tally.debris > 1 ?
"s" :
"";
119 info.
addPara(
"%s unexplored debris field" + s, initPad, tc, h,
"" + tally.debris);
122 if (tally.other > 0) {
123 String s = tally.other > 1 ?
"s" :
"";
124 info.
addPara(
"%s other source" + s +
" of salvage", initPad, tc, h,
"" + tally.other);
145 if (tally.value == SalvageValue.NONE) {
148 info.
addPara(
"A log of the salvage known to be available in the " +
150 opad, h, tally.value.getValueString());
155 info.
addPara(
"Other, as yet undiscovered, salvage may be present in the system.", opad);
165 if (tally.value == SalvageValue.NONE) {
167 }
else if (tally.value == SalvageValue.LOW) {
169 }
else if (tally.value == SalvageValue.MEDIUM) {
178 Set<String> tags = super.getIntelTags(map);
181 if (tally.value != SalvageValue.NONE && tally.value != SalvageValue.LOW) {
192 if (tally.all.size() == 1) {
193 return tally.all.get(0);
205 return super.getCommMessageSound();
223 SalvorsTally tally =
new SalvorsTally();
227 if (entity.isDiscoverable())
continue;
238 }
else if (station) {
249 tally.all.add(entity);
253 if (entity.isDiscoverable())
continue;
265 tally.all.add(entity);
270 if (planet.isStar())
continue;
273 if (market ==
null)
continue;
279 tally.all.add(planet);
292 tally.value = SalvageValue.NONE;
293 }
else if (value < 10) {
294 tally.value = SalvageValue.LOW;
295 }
else if (value < 20) {
296 tally.value = SalvageValue.MEDIUM;
298 tally.value = SalvageValue.HIGH;
314 boolean station =
false;
317 if (spec.
getShortName().toLowerCase().contains(
"station") ||
318 spec.
getShortName().toLowerCase().contains(
"habitat") ||
319 spec.
getShortName().toLowerCase().contains(
"orbital") ||
320 entity.
hasTag(
"salvor_orbital")) {
static SettingsAPI getSettings()
static SectorAPI getSector()
static final String RUINS_WIDESPREAD
static final String RUINS_SCATTERED
static final String RUINS_EXTENSIVE
static final String RUINS_VAST
static final String WRECK
String getSortStringNewestFirst()
void addLogTimestamp(TooltipMakerAPI info, Color tc, float opad)
void unindent(TooltipMakerAPI info)
void addDeleteButton(TooltipMakerAPI info, float width)
void bullet(TooltipMakerAPI info)
SalvorsTallyIntel(StarSystemAPI system)
String getCommMessageSound()
transient SalvorsTally cached
transient long tallyTimestamp
SectorEntityToken getMapLocation(SectorMapAPI map)
static SalvorsTallyIntel getSalvorsTallyIntel(StarSystemAPI system)
long removalCheckTimestamp
StarSystemAPI getSystem()
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode, boolean isUpdate, Color tc, float initPad)
boolean shouldRemoveIntel()
static boolean isDerelictShip(SectorEntityToken entity)
float daysUntilRemoveCheck
Set< String > getIntelTags(SectorMapAPI map)
static boolean isOrbitalInstallation(SectorEntityToken entity)
SalvorsTally computeTally()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
static Color getTextColor()
static Color getGrayColor()
static boolean hasUnexploredRuins(MarketAPI market)
static Color getHighlightColor()
String getSpriteName(String category, String id)
float getElapsedDaysSince(long timestamp)
List< SectorEntityToken > getEntitiesWithTag(String tag)
List< PlanetAPI > getPlanets()
List< CampaignTerrainAPI > getTerrainCopy()
SectorEntityToken createToken(float x, float y)
boolean isCurrentLocation()
String getNameWithLowercaseTypeShort()
CampaignClockAPI getClock()
IntelManagerAPI getIntelManager()
String getCustomEntityType()
boolean hasTag(String tag)
CustomEntitySpecAPI getCustomEntitySpec()
List< IntelInfoPlugin > getIntel()
SurveyLevel getSurveyLevel()
boolean hasCondition(String id)