Starsector API
Loading...
Searching...
No Matches
GADetectHyperspaceOddity.java
Go to the documentation of this file.
1package com.fs.starfarer.api.impl.campaign.missions.academy;
2
3import java.awt.Color;
4
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.campaign.SectorEntityToken;
7import com.fs.starfarer.api.campaign.StarSystemAPI;
8import com.fs.starfarer.api.campaign.econ.MarketAPI;
9import com.fs.starfarer.api.characters.PersonAPI;
10import com.fs.starfarer.api.impl.campaign.ids.Factions;
11import com.fs.starfarer.api.impl.campaign.ids.FleetTypes;
12import com.fs.starfarer.api.impl.campaign.ids.People;
13import com.fs.starfarer.api.impl.campaign.world.NamelessRock;
14import com.fs.starfarer.api.ui.TooltipMakerAPI;
15import com.fs.starfarer.api.util.Misc;
16
18
19 public static enum Stage {
20 VISIT_ELEK,
21 GO_TO_ARRAY,
22 GO_TO_LOCATION,
23 INVESTIGATE_SHIP,
24 RETURN_TO_ELEK,
25 COMPLETED,
26 FAILED,
27 ARRAY_THEN_ELEK,
28 ARRAY_THEN_ABYSS,
29 ABYSS_NO_ELEK,
30 }
31
36 protected PersonAPI elek;
37 protected int rewardAmount;
38
39 @Override
40 protected boolean create(MarketAPI createdAt, boolean barEvent) {
41
42 // if this mission was already accepted by the player, abort
43 if (!setGlobalReference("$gaDHO_ref", "$gaDHO_inProgress")) return false;
44
46 if (elek == null) return false;
47
49 if (array == null) return false;
50
52 if (oneslaughtSystem == null) return false;
53
54
56 if(entity.getMemoryWithoutUpdate().contains("$onslaughtMkI")) {
57 oneslaught = entity;
58 break;
59 }
60 }
61 if(oneslaught == null) return false;
62
64 if(arraySystem == null) return false;
65
66 setStartingStage(Stage.VISIT_ELEK);
67 addSuccessStages(Stage.COMPLETED);
68 addFailureStages(Stage.FAILED);
69
70 setStageOnGlobalFlag(Stage.FAILED, "$gaDHO_declinedTwice");
71
72 setStageOnGlobalFlag(Stage.GO_TO_ARRAY, "$gaDHO_gotScanPackage");
73 setStageOnGlobalFlag(Stage.GO_TO_LOCATION, "$gaDHO_gotCoordinates");
74 setStageOnGlobalFlag(Stage.INVESTIGATE_SHIP, "$gaDHO_foundRock");
75 setStageOnGlobalFlag(Stage.RETURN_TO_ELEK, "$gaDHO_foundOneslaught");
76 setStageOnGlobalFlag(Stage.COMPLETED, "$gaDHO_completed");
77
78 setStageOnGlobalFlag(Stage.ARRAY_THEN_ELEK, "$gaDHO_arrayFirstThenElek");
79 setStageOnGlobalFlag(Stage.ARRAY_THEN_ABYSS, "$gaDHO_arrayFirstThenAbyss");
80 setStageOnGlobalFlag(Stage.ABYSS_NO_ELEK, "$gaDHO_playerMadeElekMad");
81
82 makeImportant(elek, "$gaDHO_answerInvite", Stage.VISIT_ELEK);
83 makeImportant(array, "$gaDHO_object", Stage.GO_TO_ARRAY);
84
85 makeImportant(oneslaughtSystem.getEntityById("nameless_rock"), null, Stage.GO_TO_LOCATION);
86 makeImportant(oneslaughtSystem.getEntityById("nameless_rock"), null, Stage.ARRAY_THEN_ABYSS);
87 makeImportant(oneslaughtSystem.getEntityById("nameless_rock"), null, Stage.ABYSS_NO_ELEK);
88
89 //SectorEntityToken node2 = spawnMissionNode(new LocData(oneslaughtSystem.getEntityById("nameless_rock")));
90 //makeImportant(node2, null, Stage.GO_TO_ARRAY);
91
92 makeImportant(elek, "$gaDHO_elekReturn", Stage.RETURN_TO_ELEK);
93 makeImportant(elek, "$gaDHO_elekReturn", Stage.ARRAY_THEN_ELEK);
94
95 makeImportant(oneslaught, null, Stage.INVESTIGATE_SHIP);
96
99
100 setStartingStage(Stage.VISIT_ELEK);
101 addSuccessStages(Stage.COMPLETED);
102
103 // spawn a spicy pirate fleet if player found the array first.
104 beginStageTrigger(Stage.VISIT_ELEK);
105 triggerCreateFleet(FleetSize.MEDIUM, FleetQuality.HIGHER, Factions.PIRATES, FleetTypes.PATROL_MEDIUM, array.getStarSystem());
107 triggerSpawnFleetAtPickedLocation("$gaDHO_arrayFleet", null);
109 //triggerOrderFleetInterceptPlayer();
110 endTrigger();
111
112
113 beginStageTrigger(Stage.COMPLETED);
114 triggerSetGlobalMemoryValue("$gaDHO_missionCompleted", true);
115 //triggerMakeNonStoryCritical(kazeron, chicomoztoc, epiphany, siyavong.getMarket(), kanta.getMarket());
116 endTrigger();
117
118 return true;
119 }
120
121 protected void updateInteractionDataImpl() {
122 set("$gaDHO_stage", getCurrentStage());
123 set("$gaDHO_starName", arraySystem.getNameWithNoType());
124 set("$gaDHO_systemName", arraySystem.getNameWithLowercaseTypeShort());
125 set("$gaDHO_dist", getDistanceLY(array));
126 set("$gaDHO_reward", Misc.getWithDGS(rewardAmount));
127 }
128
129 @Override
130 public void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height) {
131 float opad = 10f;
132 Color h = Misc.getHighlightColor();
133 //if(Global.getSector().getMemoryWithoutUpdate().contains("$gaDHO_foundArrayFirst")) {
134
135 if (currentStage == Stage.VISIT_ELEK) {
136 if(Global.getSector().getMemoryWithoutUpdate().contains("$gaDHO_foundArrayFirst")) {
137 info.addPara("Talk to Academician " + elek.getNameString() + " about the sensor array data.", opad);
138 info.addPara("Or go directly to the coordinates held in the array's data.", opad);
139 info.addImage(elek.getPortraitSprite(), width, 128, opad);
140 }
141 else {
142 info.addPara("Talk to Academician " + elek.getNameString() + " about the services he requires. "
143 + "He is at the Galatia Academy, which orbits Pontus in the Galatia system.", opad);
144 info.addImage(elek.getPortraitSprite(), width, 128, opad);
145 }
146 }
147 else if (currentStage == Stage.GO_TO_ARRAY) {
148 info.addPara("Install the modification package on the Sensor Array located in the " +
150 info.addImage(Global.getSettings().getSpriteName("illustrations", "sensor_array"), width, opad);
151 }
152 else if (currentStage == Stage.GO_TO_LOCATION) {
153 info.addPara("Go to the location deep in the Abyss to find what Academician Elek's patron was looking for.", opad);
154 }
155 else if (currentStage == Stage.ARRAY_THEN_ABYSS) {
156 info.addPara("Go to the location deep in the Abyss to find out what the sensor array detected.", opad);
157 }
158 else if (currentStage == Stage.ABYSS_NO_ELEK) {
159 info.addPara("Go to the location deep in the Abyss to find out what the sensor array detected.", opad);
160 }
161 else if (currentStage == Stage.ARRAY_THEN_ELEK) {
162 info.addPara("Talk to Academician " + elek.getNameString() + " about what his sensor array modifications were looking for. "
163 + "He is at the Galatia Academy, which orbits Pontus in the Galatia system.", opad);
164 info.addImage(elek.getPortraitSprite(), width, 128, opad);
165 }
166 else if (currentStage == Stage.INVESTIGATE_SHIP) {
167 info.addPara("Investigate the strange ship orbiting Nameless Rock.", opad);
168 }
169 else if (currentStage == Stage.RETURN_TO_ELEK) {
170 if(Global.getSector().getMemoryWithoutUpdate().contains("$gaDHO_arrayFirstThenAbyss")) {
171 info.addPara("Talk to Academician " + elek.getNameString() + " about what he thought he was looking for.", opad);
172 info.addPara("And maybe some kind of reward.", opad);
173 }
174 else {
175 info.addPara("Talk to Academician " + elek.getNameString() + " about a reward. And about his 'patron'.", opad);
176 }
177
178 info.addImage(elek.getPortraitSprite(), width, 128, opad);
179 }
180 }
181
182 @Override
183 public boolean addNextStepText(TooltipMakerAPI info, Color tc, float pad) {
184 Color h = Misc.getHighlightColor();
185 //
186 if (currentStage == Stage.VISIT_ELEK) {
187 if(Global.getSector().getMemoryWithoutUpdate().contains("$gaDHO_foundArrayFirst")) {
188 info.addPara("Talk to Academician " + elek.getNameString() + " at the Galatia Academy about the sensor array data.", tc, pad);
189 info.addPara("Or go directly to the coordinates extracted from the array's data", tc, pad);
190 }
191 else {
192 info.addPara("Talk to Academician " + elek.getNameString() + " at the Galatia Academy, which orbits Pontus in the Galatia system.", tc, pad);
193 }
194 return true;
195 }
196 else if (currentStage == Stage.GO_TO_ARRAY) {
197 info.addPara("Go to the Sensor Array located in the " +
199 return true;
200 }
201 else if (currentStage == Stage.GO_TO_LOCATION) {
202 info.addPara("Go to the location deep in the Abyss and discover what the Sensor Array found.", tc, pad);
203 return true;
204 }
205 else if (currentStage == Stage.ARRAY_THEN_ABYSS) {
206 info.addPara("Go to the location deep in the Abyss and discover what the Sensor Array found.", tc, pad);
207 return true;
208 }
209 else if (currentStage == Stage.ABYSS_NO_ELEK) {
210 info.addPara("Go to the location deep in the Abyss and discover what the Sensor Array found.", tc, pad);
211 return true;
212 }
213 else if (currentStage == Stage.ARRAY_THEN_ELEK) {
214 info.addPara("Talk to Academician " + elek.getNameString() + " at the Galatia Academy.", tc, pad);
215 return true;
216 }
217 else if (currentStage == Stage.RETURN_TO_ELEK) {
218 info.addPara("Talk to Academician " + elek.getNameString() +
219 " at the Galatia Academy.", tc, pad);
220 return true;
221 }
222 else if (currentStage == Stage.GO_TO_LOCATION) {
223 info.addPara("Go to the location deep in the Abyss and discover what the Sensor Array found.", tc, pad);
224 return true;
225 }
226 else if (currentStage == Stage.INVESTIGATE_SHIP) {
227 info.addPara("Investigate the strange ship orbiting Nameless Rock.", tc, pad);
228 return true;
229 }
230 else if (currentStage == Stage.RETURN_TO_ELEK) {
231 // return to elek *after finding the Oneslaught* to finish the mission.
232 info.addPara("Talk to Academician " + elek.getNameString() + " at the Galatia Academy.", tc, pad);
233 return true;
234 }
235
236 return false;
237 }
238
239 /*
240 @Override
241 protected boolean callAction(String action, String ruleId, InteractionDialogAPI dialog, List<Token> params, Map<String, MemoryAPI> memoryMap) {
242 if ("discoveredArrayOutOfSequence".equals(action)) {
243
244
245 return true;
246 }
247 return false;
248 }*/
249
250 @Override
251 public String getBaseName() {
252 //return "Detect Hyperspace Oddity";
253 return "Abyssal Space Oddity";
254 }
255
256}
257
258
static SettingsAPI getSettings()
Definition Global.java:57
static SectorAPI getSector()
Definition Global.java:65
void addDescriptionForNonEndStage(TooltipMakerAPI info, float width, float height)
void makeImportant(PersonAPI person, String flag, Enum ... stages)
void triggerCreateFleet(FleetSize size, FleetQuality quality, String factionId, String type, StarSystemAPI roughlyWhere)
static String getWithDGS(float num)
Definition Misc.java:1381
static Color getHighlightColor()
Definition Misc.java:792
String getSpriteName(String category, String id)
List< SectorEntityToken > getAllEntities()
SectorEntityToken getEntityById(String id)
Map< String, Object > getPersistentData()
StarSystemAPI getStarSystem(String name)
void addImage(String spriteName, float pad)
LabelAPI addPara(String format, float pad, Color hl, String... highlights)