1package com.fs.starfarer.api.impl.campaign.rulecmd.salvage.special;
3import com.fs.starfarer.api.Global;
4import com.fs.starfarer.api.campaign.InteractionDialogAPI;
5import com.fs.starfarer.api.campaign.LocationAPI;
6import com.fs.starfarer.api.campaign.PlanetAPI;
7import com.fs.starfarer.api.campaign.SectorEntityToken;
8import com.fs.starfarer.api.campaign.StarSystemAPI;
9import com.fs.starfarer.api.impl.campaign.ids.StarTypes;
10import com.fs.starfarer.api.impl.campaign.intel.misc.BreadcrumbIntel;
11import com.fs.starfarer.api.impl.campaign.procgen.Constellation;
12import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.SalvageSpecialInteraction.SalvageSpecialData;
13import com.fs.starfarer.api.impl.campaign.rulecmd.salvage.SalvageSpecialInteraction.SalvageSpecialPlugin;
17 public static enum SpecialType {
31 public static class DomainSurveyDerelictSpecialData
implements SalvageSpecialData {
32 public SpecialType type = SpecialType.SCRAMBLED;
33 public String entityId =
null;
34 public String secondaryId =
null;
35 public DomainSurveyDerelictSpecialData(SpecialType type) {
38 public SalvageSpecialPlugin createSpecialPlugin() {
43 private DomainSurveyDerelictSpecialData data;
49 public void init(InteractionDialogAPI
dialog, Object specialData) {
50 super.init(
dialog, specialData);
52 data = (DomainSurveyDerelictSpecialData) specialData;
54 if (data.entityId !=
null) {
60 data.type = SpecialType.SCRAMBLED;
79 case LOCATION_SURVEY_SHIP:
80 initSurveyParentEntity();
82 case LOCATION_MOTHERSHIP:
83 initSurveyParentEntity();
106 return data !=
null && (
107 data.type == SpecialType.ACTIVATE_PROBE ||
108 data.type == SpecialType.ACTIVATE_SURVEY_SHIP
113 private void initSurveyParentEntity() {
114 if (data.entityId ==
null) {
119 SectorEntityToken parent =
Global.
getSector().getEntityById(data.entityId);
120 if (parent ==
null || !parent.hasSensorProfile()) {
125 String text1 =
"The $shortName's memory banks are partially accessible, and ";
126 String text1ForIntel =
"While exploring $aOrAn $nameInText, your crews found " +
127 "partially accessible memory banks that ";
129 String name = parent.getCustomEntitySpec().getNameInText();
130 String nameForTitle = parent.getCustomEntitySpec().getDefaultName();
133 String subject =
getString(
"Derelict " + nameForTitle +
" Location");
135 text1 +=
"contain information pointing to the location of a " + name +
". ";
136 text1ForIntel +=
"contain information pointing to the location of a " + name +
". ";
139 String located = BreadcrumbSpecial.getLocatedString(parent,
true);
141 text1 +=
"It was last seen by this $shortName " + located +
".";
142 text1ForIntel +=
"It was last seen by this $shortName " + located +
".";
148 BreadcrumbIntel intel =
new BreadcrumbIntel(
entity, parent);
162 addText(
"The $shortName's memory banks have been scrubbed clean by hard radiation, and the systems are largely inert and non-functional.");
336 LocationAPI loc =
entity.getContainingLocation();
338 return "in an unknown location nearby";
340 if (loc.isHyperspace()) {
341 return "in hyperspace nearby";
343 StarSystemAPI system = (StarSystemAPI) loc;
346 if (system.isNebula()) {
347 return "inside this nebula";
349 return "in this system";
352 return "in the " + system.getNameWithLowercaseType();
356 LocationAPI loc =
entity.getContainingLocation();
358 return "in an unknown location nearby";
360 if (loc.isHyperspace()) {
361 return "in hyperspace nearby";
363 StarSystemAPI system = (StarSystemAPI) loc;
366 if (system.isNebula()) {
367 return "inside this nebula";
369 return "in this system";
372 if (
entity.getConstellation() !=
null &&
entity.getConstellation() !=
Global.
getSector().getCurrentLocation().getConstellation()) {
373 Constellation c =
entity.getConstellation();
374 String cText =
"in the " + c.getNameWithLowercaseType();
375 if (c.getSystems().size() == 1) {
379 if (system.isNebula()) {
380 return "inside a nebula " + cText;
383 if (system.getTertiary() !=
null) {
384 return "in a trinary star system " + cText;
387 if (system.getSecondary() !=
null) {
388 return "in a binary star system " + cText;
395 if (system.isNebula()) {
396 return "inside a nearby nebula";
399 if (system.getTertiary() !=
null) {
400 return "in a nearby trinary star system";
403 if (system.getSecondary() !=
null) {
404 return "in a nearby binary star system";
414 String type = star.getTypeId();
416 if (type.equals(StarTypes.BLACK_HOLE))
return "a black hole";
417 if (type.equals(StarTypes.NEUTRON_STAR))
return "a neutron star";
419 if (type.equals(StarTypes.ORANGE) ||
420 type.equals(StarTypes.ORANGE_GIANT)) {
421 return "an orange star";
424 if (type.equals(StarTypes.RED_DWARF) ||
425 type.equals(StarTypes.RED_SUPERGIANT) ||
426 type.equals(StarTypes.RED_GIANT)) {
430 if (type.equals(StarTypes.BLUE_GIANT) ||
431 type.equals(StarTypes.BLUE_SUPERGIANT)) {
432 return "a blue star";
435 if (type.equals(StarTypes.BROWN_DWARF) ||
436 type.equals(StarTypes.WHITE_DWARF)) {
440 if (type.equals(StarTypes.YELLOW)) {
441 return "a yellow star";
444 return "a star of unknown type";
450 super.optionSelected(optionText, optionData);
452 if (
"continue".equals(optionData)) {
459 return super.endWithContinue();
static SectorAPI getSector()
void setDone(boolean done)
InteractionDialogAPI dialog
void addText(String format)
String getString(String format)
static String getLocationDescription(SectorEntityToken entity)
static String getLocationName(SectorEntityToken entity)
void optionSelected(String optionText, Object optionData)
boolean shouldShowAgain()
boolean endWithContinue()
DomainSurveyDerelictSpecial()
void init(InteractionDialogAPI dialog, Object specialData)
static String getStarDescription(PlanetAPI star)