57 public void init(InteractionDialogAPI
dialog, Object specialData) {
58 super.init(
dialog, specialData);
60 data = (SurveyDataSpecialData) specialData;
64 if (data.type == SurveyDataSpecialType.AUTO_PICK ||
65 data.type == SurveyDataSpecialType.AUTO_PICK_NOT_SYSTEM) {
66 WeightedRandomPicker<SurveyDataSpecialType> picker =
new WeightedRandomPicker<SurveyDataSpecialType>(
random);
67 picker.add(SurveyDataSpecialType.PLANET_INTERESTING_PROPERTY, 50f);
68 picker.add(SurveyDataSpecialType.PLANET_SURVEY_DATA, 20f);
70 if (data.type == SurveyDataSpecialType.AUTO_PICK) {
71 picker.add(SurveyDataSpecialType.SYSTEM_PRELIMINARY_SURVEY, 5f);
74 data.type = picker.pick();
77 if (data.type == SurveyDataSpecialType.PLANET_INTERESTING_PROPERTY) {
78 List<StarSystemAPI> systems = Misc.getSystemsInRange(
entity,
null,
true,
MAX_RANGE);
79 PlanetAPI planet = DerelictThemeGenerator.findInterestingPlanet(systems,
null,
false, data.includeRuins,
random);
80 String conditionId = DerelictThemeGenerator.getInterestingCondition(planet, data.includeRuins);
81 if (planet !=
null && conditionId !=
null) {
82 data.entityId = planet.getId();
83 data.secondaryId = conditionId;
85 }
else if (data.type == SurveyDataSpecialType.PLANET_SURVEY_DATA) {
86 List<StarSystemAPI> systems = Misc.getSystemsInRange(
entity,
null,
true,
MAX_RANGE);
87 PlanetAPI planet = DerelictThemeGenerator.findInterestingPlanet(systems,
null,
false, data.includeRuins,
random);
89 data.entityId = planet.getId();
91 }
else if (data.type == SurveyDataSpecialType.SYSTEM_PRELIMINARY_SURVEY) {
94 data.entityId = system.getId();
100 if (data.entityId !=
null) {
102 StarSystemAPI system =
Global.
getSector().getStarSystem(data.entityId);
103 if (
entity ==
null && system ==
null) {
104 data.entityId =
null;
105 data.type = SurveyDataSpecialType.SCRAMBLED;
108 data.type = SurveyDataSpecialType.SCRAMBLED;
116 case PLANET_INTERESTING_PROPERTY:
119 case PLANET_SURVEY_DATA:
122 case SYSTEM_PRELIMINARY_SURVEY:
136 if (data.entityId ==
null || data.secondaryId ==
null) {
141 PlanetAPI planet = (PlanetAPI)
Global.
getSector().getEntityById(data.entityId);
142 if (planet.getMarket() !=
null && planet.getMarket().getSurveyLevel() == SurveyLevel.FULL) {
147 String text1 =
getString(
"The $shortName's memory banks are partially accessible, and the data therein ");
148 boolean debris = Entities.DEBRIS_FIELD_SHARED.equals(
entity.getCustomEntityType());
150 text1 =
"Your salvage crews find a memory bank in the debris. The data therein ";
154 String world = planet.getSpec().getAOrAn() +
" " + planet.getTypeNameWithWorld().toLowerCase();
157 loc = loc.replaceFirst(
"located ",
"");
161 if (spec.getId().equals(Conditions.HABITABLE)) {
162 subject =
"Habitable World";
163 desc =
"points to the existence of " + world +
" with a low hazard rating " + loc;
166 subject = Misc.ucFirst(spec.getName()) +
" Location";
167 desc =
"contained information about " + spec.getName().toLowerCase() +
" on " + world +
" " + loc;
175 String text1ForIntel =
"While exploring $aOrAn $nameInText, your crews found " +
176 "partially accessible memory banks that ";
178 BreadcrumbIntel intel =
new BreadcrumbIntel(
entity, planet);
180 intel.setText(
getString(text1ForIntel + desc));
192 if (data.entityId ==
null) {
197 PlanetAPI planet = (PlanetAPI)
Global.
getSector().getEntityById(data.entityId);
198 if (planet.getMarket() !=
null && planet.getMarket().getSurveyLevel() == SurveyLevel.FULL) {
204 String name = planet.getName();
205 String world = planet.getSpec().getAOrAn() +
" " + planet.getTypeNameWithWorld().toLowerCase();
208 loc = loc.replaceFirst(
"located ",
"");
210 String text1 =
"The $shortName's memory banks are partially accessible, " +
211 "and contain full survey data for " + name +
", " + world +
" located " + loc +
".";
213 String text1ForIntel =
"While exploring $aOrAn $nameInText, your crews found " +
214 "partially accessible memory banks that contain full survey data for " +
215 name +
", " + world +
" located " + loc +
".";
217 boolean debris = Entities.DEBRIS_FIELD_SHARED.equals(
entity.getCustomEntityType());
219 text1 =
"Your salvage crews find a functional memory bank in the debris. " +
220 "It contains full survey data for " + name +
", " + world +
" located " + loc +
".";
223 String conditionId = DerelictThemeGenerator.getInterestingCondition(planet, data.includeRuins);
224 if (conditionId !=
null) {
227 text1 +=
" The world is notable for ";
228 text1ForIntel +=
" The world is notable for ";
229 if (conditionId.equals(Conditions.HABITABLE)) {
230 text1 +=
"being habitable.";
231 text1ForIntel +=
"being habitable.";
233 text1 +=
"having " + spec.getName().toLowerCase() +
".";
234 text1ForIntel +=
"having " + spec.getName().toLowerCase() +
".";
242 String subject =
"Survey Data for " + name;
245 Misc.setFullySurveyed(planet.getMarket(),
null,
false);
246 Misc.addSurveyDataFor(planet,
text);
254 long xp = plugin.getXP();
260 BreadcrumbIntel intel =
new BreadcrumbIntel(
entity, planet);
263 intel.setShowSpecificEntity(
true);
276 if (data.entityId ==
null) {
281 StarSystemAPI system =
Global.
getSector().getStarSystem(data.entityId);
282 if (system ==
null) {
287 String name = system.getNameWithLowercaseType();
288 String text1 =
"The $shortName's memory banks are partially accessible, " +
289 "and contain complete preliminary survey data for the " + name +
".";
291 String text1ForIntel =
"While exploring $aOrAn $nameInText, your crews found " +
292 "partially accessible memory banks that contain complete preliminary survey data for the " + name +
".";
295 boolean debris = Entities.DEBRIS_FIELD_SHARED.equals(
entity.getCustomEntityType());
297 text1 =
"Your salvage crews find a functional memory bank in the debris. " +
298 "It contains complete preliminary survey data for the " + name +
".";
302 String subject =
"Preliminary Survey of the " + system.getName();
307 Highlights h =
new Highlights();
308 for (PlanetAPI planet : system.getPlanets()) {
309 if (planet.isStar())
continue;
310 if (planet.getMarket() ==
null)
continue;
311 if (!planet.getMarket().isPlanetConditionMarketOnly())
continue;
312 if (planet.getMarket().getSurveyLevel().ordinal() > SurveyLevel.PRELIMINARY.ordinal())
continue;
314 String curr = planet.getName() +
", " + planet.getTypeNameWithWorld().toLowerCase();
315 data +=
" " + curr +
"\n";
316 h.append(curr, planet.getSpec().getIconColor());
320 planet.getMarket().setSurveyLevel(SurveyLevel.PRELIMINARY);
327 if (!data.isEmpty()) {
328 text.setFontSmallInsignia();
329 text.addParagraph(
"Preliminary survey data for:", Misc.getTooltipTitleAndLightHighlightColor());
331 data =
" " + data.trim();
332 text.addParagraph(data);
333 text.setHighlightsInLastPara(h);
334 text.setFontInsignia();
341 BreadcrumbIntel intel =
new BreadcrumbIntel(
entity, system.getCenter());
347 text.addParagraph(
"However, you've already acquired this data through other means.");