1package com.fs.starfarer.api.impl.campaign.intel.bar.events;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.CampaignFleetAPI;
10import com.fs.starfarer.api.campaign.CargoAPI;
11import com.fs.starfarer.api.campaign.FactionAPI;
12import com.fs.starfarer.api.campaign.InteractionDialogAPI;
13import com.fs.starfarer.api.campaign.PlanetAPI;
14import com.fs.starfarer.api.campaign.SectorEntityToken;
15import com.fs.starfarer.api.campaign.econ.MarketAPI;
16import com.fs.starfarer.api.campaign.rules.MemoryAPI;
17import com.fs.starfarer.api.characters.PersonAPI;
18import com.fs.starfarer.api.impl.campaign.ids.Tags;
19import com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin;
20import com.fs.starfarer.api.impl.campaign.rulecmd.AddRemoveCommodity;
21import com.fs.starfarer.api.ui.SectorMapAPI;
22import com.fs.starfarer.api.ui.TooltipMakerAPI;
23import com.fs.starfarer.api.util.Misc;
24import com.fs.starfarer.api.util.Misc.Token;
28 public static enum PSIStage {
49 Misc.makeImportant(pilot,
"psi");
50 MarketAPI market =
event.getPilotMarket();
51 market.addPerson(pilot);
52 market.getCommDirectory().addPerson(pilot);
56 pilot.getMemoryWithoutUpdate().set(
"$psi_isPilot",
true);
57 pilot.getMemoryWithoutUpdate().set(
"$psi_eventRef",
this);
58 pilot.getMemoryWithoutUpdate().set(
"$psi_credits", Misc.getDGSCredits(
pilotCredits));
64 stage = PSIStage.TALK_TO_PILOT;
72 PersonAPI pilot =
event.getPilot();
73 MarketAPI market =
event.getPilotMarket();
74 market.removePerson(pilot);
75 market.getCommDirectory().removePerson(pilot);
76 Misc.makeUnimportant(
planet,
"psi");
82 public boolean callEvent(String ruleId, InteractionDialogAPI dialog,
83 List<Token> params, Map<String, MemoryAPI> memoryMap) {
84 String action = params.get(0).getString(memoryMap);
87 CargoAPI cargo = playerFleet.getCargo();
90 PersonAPI pilot =
event.getPilot();
91 MarketAPI market =
event.getPilotMarket();
93 if (action.equals(
"prepare")) {
94 pilot.getMemoryWithoutUpdate().set(
"$psi_credits", Misc.getDGSCredits(
pilotCredits), 0);
95 pilot.getMemoryWithoutUpdate().set(
"$psi_playerCredits", Misc.getDGSCredits(cargo.getCredits().get()), 0);
96 }
else if (action.equals(
"canPay")) {
98 }
else if (action.equals(
"payPilot")) {
99 market.removePerson(pilot);
100 market.getCommDirectory().removePerson(pilot);
103 AddRemoveCommodity.addCreditsLossText(
pilotCredits, dialog.getTextPanel());
106 Misc.makeImportant(
planet,
"psi");
107 stage = PSIStage.GO_TO_PLANET;
108 sendUpdate(PSIStage.GO_TO_PLANET, dialog.getTextPanel());
116 stage = PSIStage.DONE;
117 Misc.makeUnimportant(
planet,
"psi");
118 super.endAfterDelay();
123 super.notifyEnding();
129 Color h = Misc.getHighlightColor();
130 Color g = Misc.getGrayColor();
135 if (mode == ListInfoMode.IN_DESC) initPad = opad;
142 MarketAPI market =
event.getPilotMarket();
144 if (
stage == PSIStage.TALK_TO_PILOT) {
145 info.addPara(
"Talk to the pilot at %s", initPad, tc, market.getFaction().getBaseUIColor(), market.getName());
146 }
else if (
stage == PSIStage.GO_TO_PLANET) {
147 info.addPara(
"Explore the planet", tc, initPad);
159 info.setParaSmallInsignia();
160 info.addPara(
getName(), c, 0f);
161 info.setParaFontDefault();
168 Color h = Misc.getHighlightColor();
169 Color g = Misc.getGrayColor();
170 Color tc = Misc.getTextColor();
174 if (
stage == PSIStage.TALK_TO_PILOT) {
175 info.addPara(
"An old spacer told you a tale about a mysterious red planet. " +
176 "The pilot - the only other survivor of the salvage expedition - may know the planet's location.", opad);
177 }
else if (
stage == PSIStage.GO_TO_PLANET) {
178 info.addPara(
"You've talked to the old spacer's pilot comrade and convinced " +
179 "them to divulge the location of the planet.", opad);
181 info.addPara(
"You've found the planet and uncovered its secret.", opad);
195 Set<String> tags = super.getIntelTags(map);
196 tags.add(Tags.INTEL_STORY);
197 tags.add(Tags.INTEL_EXPLORATION);
198 tags.add(Tags.INTEL_ACCEPTED);
199 tags.add(Tags.INTEL_MISSIONS);
205 return IntelSortTier.TIER_2;
214 return "Red Planet - Completed";
221 return super.getFactionForUIColors();
230 if (
stage == PSIStage.TALK_TO_PILOT) {
231 return event.getPilotMarket().getPrimaryEntity();
238 return super.shouldRemoveIntel();
static SettingsAPI getSettings()
static SectorAPI getSector()
void sendUpdate(Object listInfoParam, TextPanelAPI textPanel)
void unindent(TooltipMakerAPI info)
Object getListInfoParam()
Color getBulletColorForMode(ListInfoMode mode)
void bullet(TooltipMakerAPI info)
static String getSoundMajorPosting()
Color getTitleColor(ListInfoMode mode)
IntelSortTier getSortTier()
String getCommMessageSound()
PlanetaryShieldBarEvent event
void createIntelInfo(TooltipMakerAPI info, ListInfoMode mode)
boolean callEvent(String ruleId, InteractionDialogAPI dialog, List< Token > params, Map< String, MemoryAPI > memoryMap)
String getSmallDescriptionTitle()
SectorEntityToken getMapLocation(SectorMapAPI map)
boolean shouldRemoveIntel()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
FactionAPI getFactionForUIColors()
Set< String > getIntelTags(SectorMapAPI map)
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
PlanetaryShieldIntel(PlanetAPI planet, PlanetaryShieldBarEvent event)
String getSpriteName(String category, String id)