Starsector API
Loading...
Searching...
No Matches
RemoteSurveyDataForPlanetIntel.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.intel.misc;
2
3import java.util.Random;
4import java.util.Set;
5
6import java.awt.Color;
7
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.PlanetAPI;
10import com.fs.starfarer.api.campaign.SectorEntityToken;
11import com.fs.starfarer.api.impl.campaign.ids.Commodities;
12import com.fs.starfarer.api.impl.campaign.ids.Tags;
13import com.fs.starfarer.api.plugins.SurveyPlugin;
14import com.fs.starfarer.api.ui.SectorMapAPI;
15import com.fs.starfarer.api.ui.TooltipMakerAPI;
16import com.fs.starfarer.api.ui.TooltipMakerAPI.PlanetInfoParams;
17import com.fs.starfarer.api.util.Misc;
18
20
21 protected PlanetAPI planet;
22 protected String minClass;
23
25 this.planet = planet;
26
27 setSound("ui_discovered_entity");
28 setIconId("remote_survey_data");
29
32
34
36 Global.getSector().getIntelManager().addIntel(this, false, null);
37 setListInfoParam(null);
38 }
39
40 public String pickMinClass() {
42 String type = plugin.getSurveyDataType(planet);
43 int typeNum = 0;
44 if (Commodities.SURVEY_DATA_1.equals(type)) {
45 typeNum = 1;
46 } else if (Commodities.SURVEY_DATA_2.equals(type)) {
47 typeNum = 2;
48 } else if (Commodities.SURVEY_DATA_3.equals(type)) {
49 typeNum = 3;
50 } else if (Commodities.SURVEY_DATA_4.equals(type)) {
51 typeNum = 4;
52 } else if (Commodities.SURVEY_DATA_5.equals(type)) {
53 typeNum = 5;
54 }
55
56 Random random = Misc.getRandom(Misc.getSalvageSeed(planet, true), 0);
57 if (random.nextBoolean()) {
58 typeNum--;
59 }
60 if (typeNum < 1) typeNum = 1;
61
62 switch (typeNum) {
63 case 1: return "Class I";
64 case 2: return "Class II";
65 case 3: return "Class III";
66 case 4: return "Class IV";
67 }
68 return "Class V";
69 }
70
71 @Override
72 protected String getName() {
73 String name = "Remote Survey: " + minClass + "+ " + planet.getTypeNameWithWorld();
74 return name;
75 }
76
77
78 @Override
79 public void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode) {
80 Color c = getTitleColor(mode);
81 info.addPara(getName(), c, 0f);
82 addBulletPoints(info, mode);
83 }
84
85 protected void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode) {
86 Color h = Misc.getHighlightColor();
87 Color g = Misc.getGrayColor();
88 float pad = 3f;
89 float opad = 10f;
90
91 float initPad = pad;
92 if (mode == ListInfoMode.IN_DESC) initPad = opad;
93
94 Color tc = getBulletColorForMode(mode);
95 //boolean isUpdate = getListInfoParam() != null;
96
97 bullet(info);
98 //info.addPara(str, tc, initPad);
99 initPad = 0f;
100 unindent(info);
101 }
102
103 @Override
104 public void createSmallDescription(TooltipMakerAPI info, float width, float height) {
105 Color h = Misc.getHighlightColor();
106 Color g = Misc.getGrayColor();
107 Color tc = Misc.getTextColor();
108 float pad = 3f;
109 float opad = 10f;
110
111 PlanetInfoParams params = new PlanetInfoParams();
112 params.showConditions = true;
113 params.showName = true;
114 params.withClass = true;
115 params.classStrOverride = minClass + "+";
116 params.scaleEvenWhenShowingName = true;
117 params.conditionsYOffset = 32f;
118 params.showHazardRating = true;
119 info.showPlanetInfo(planet, width, width / 1.62f, params, opad + params.conditionsYOffset);
120 info.addPara("A remote survey has indicated that " + planet.getName() + " is " + minClass + " or higher "
121 + "and is likely the most promising candidate "
122 + "for a full survey operation in the " + planet.getStarSystem().getNameWithLowercaseTypeShort() + ".", opad + 18f,
123 h, minClass + " or higher", "most promising candidate");
124
125 addBulletPoints(info, ListInfoMode.IN_DESC);
126
127 addLogTimestamp(info, tc, opad);
128 addDeleteButton(info, width);
129 }
130
131 @Override
132 public Set<String> getIntelTags(SectorMapAPI map) {
133 Set<String> tags = super.getIntelTags(map);
134 tags.remove(Tags.INTEL_FLEET_LOG);
135 tags.add(Tags.INTEL_EXPLORATION);
136 return tags;
137 }
138
139 @Override
141 return planet;
142 }
143
144
145
146}
147
148
149
150
static SettingsAPI getSettings()
Definition Global.java:57
static SectorAPI getSector()
Definition Global.java:65
void addLogTimestamp(TooltipMakerAPI info, Color tc, float opad)
void addDeleteButton(TooltipMakerAPI info, float width)
static Color getTextColor()
Definition Misc.java:839
static Random getRandom(long seed, int level)
Definition Misc.java:2973
static Color getGrayColor()
Definition Misc.java:826
static long getSalvageSeed(SectorEntityToken entity)
Definition Misc.java:4129
static Color getHighlightColor()
Definition Misc.java:792
Object getNewPluginInstance(String id)
String getSurveyDataType(PlanetAPI planet)
LabelAPI addPara(String format, float pad, Color hl, String... highlights)
void showPlanetInfo(PlanetAPI planet, float pad)