1package com.fs.starfarer.api.impl.campaign.intel.inspection;
6import org.lwjgl.input.Keyboard;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.CampaignFleetAPI;
10import com.fs.starfarer.api.campaign.InteractionDialogAPI;
11import com.fs.starfarer.api.campaign.InteractionDialogPlugin;
12import com.fs.starfarer.api.campaign.OptionPanelAPI;
13import com.fs.starfarer.api.campaign.TextPanelAPI;
14import com.fs.starfarer.api.campaign.VisualPanelAPI;
15import com.fs.starfarer.api.campaign.rules.MemoryAPI;
16import com.fs.starfarer.api.combat.EngagementResultAPI;
17import com.fs.starfarer.api.impl.campaign.ids.Sounds;
18import com.fs.starfarer.api.impl.campaign.intel.events.HegemonyHostileActivityFactor;
19import com.fs.starfarer.api.impl.campaign.intel.inspection.HegemonyInspectionIntel.AntiInspectionOrders;
20import com.fs.starfarer.api.impl.campaign.rulecmd.AddRemoveCommodity;
21import com.fs.starfarer.api.impl.campaign.rulecmd.SetStoryOption;
22import com.fs.starfarer.api.ui.IntelUIAPI;
23import com.fs.starfarer.api.util.Misc;
31 private static enum OptionId {
44 protected InteractionDialogAPI
dialog;
52 protected IntelUIAPI
ui;
67 visual.setVisualFade(0.25f, 0.25f);
71 dialog.setOptionOnEscape(
"Leave", OptionId.LEAVE);
90 int bribe = (int) (Math.pow(1.5f, HegemonyHostileActivityFactor.getInspectionAttempts()) *
BRIBE_MULT);
106 textPanel.addPara(
"Sufficient funding allocated to proper official and unofficial actors should " +
107 "ensure that the inspection reaches a satisfactory outcome.");
110 textPanel.addPara(
"Once this order is given and the funds and agents dispatched, it can not be " +
113 int credits = (int)
playerFleet.getCargo().getCredits().get();
114 Color costColor = Misc.getHighlightColor();
115 if (bribe > credits) costColor = Misc.getNegativeHighlightColor();
121 textPanel.addPara(
"A total of %s should be enough to get the job done. " +
122 "and guarantees that your standing with the Hegemony will not suffer.", costColor,
123 Misc.getDGSCredits(bribe));
125 textPanel.addPara(
"You have %s available.", Misc.getHighlightColor(),
126 Misc.getDGSCredits(credits));
128 textPanel.addPara(
"You've allocated %s to the task and have otherwise committed to this course of action.",
129 Misc.getHighlightColor(), Misc.getDGSCredits(bribe));
135 textPanel.addPara(
"The local authorities will comply with the inspection. This will result " +
136 "in all AI cores being found and confiscated, and will cause your standing with the Hegemony " +
137 "to fall based on the nuber of AI cores found.");
138 textPanel.addPara(
"If AI cores currently in use are removed or moved off-planet, this activity will " +
139 "surely leave traces for inspectors to find, inspiring them to much greater zeal.");
142 textPanel.addPara(
"All space and ground forces available will resist the inspection.");
143 textPanel.addPara(
"If the inspection reaches the surface, " +
144 "the ground defense strength will determine whether " +
145 "they're able to confiscate any AI cores.");
146 textPanel.addPara(
"The Hegemony will become aware of this - and hostile - when the inspection task force " +
147 "enters the star system.");
156 if (curr != AntiInspectionOrders.BRIBE) {
157 options.addOption(
"Order the local authorities to comply with the inspection", OptionId.COMPLY,
null);
158 options.addOption(
"Allocate sufficient funds to bribe or otherwise handle the inspectors", OptionId.BRIBE,
null);
159 options.addOption(
"Order your local forces to resist the inspection", OptionId.RESIST,
null);
161 dialog.setOptionColor(OptionId.BRIBE, Misc.getStoryOptionColor());
164 options.addOption(
"Dismiss", OptionId.LEAVE,
null);
165 options.setShortcut(OptionId.LEAVE, Keyboard.KEY_ESCAPE,
false,
false,
false,
true);
167 if (curr == AntiInspectionOrders.COMPLY) {
168 options.setEnabled(OptionId.COMPLY,
false);
170 if (curr == AntiInspectionOrders.BRIBE) {
171 options.setEnabled(OptionId.BRIBE,
false);
173 if (curr == AntiInspectionOrders.RESIST) {
174 options.setEnabled(OptionId.RESIST,
false);
186 options.addOption(
"Confirm your orders", OptionId.CONFIRM,
null);
187 options.addOption(
"Never mind", OptionId.CANCEL,
null);
188 options.setShortcut(OptionId.CANCEL, Keyboard.KEY_ESCAPE,
false,
false,
false,
true);
192 if (bribe >
playerFleet.getCargo().getCredits().get()) {
193 options.setEnabled(OptionId.CONFIRM,
false);
194 options.setTooltip(OptionId.CONFIRM,
"Not enough credits.");
197 SetStoryOption.set(
dialog, 1, OptionId.CONFIRM,
"bribeAICoreInspection", Sounds.STORY_POINT_SPEND_TECHNOLOGY,
198 "Issued bribe to prevent " +
intel.getFaction().getDisplayName() +
" AI core inspection");
217 if (optionData ==
null)
return;
219 OptionId option = (OptionId) optionData;
223 dialog.addOptionSelectedText(option);
246 AddRemoveCommodity.addCreditsGainText(invested,
textPanel);
255 AddRemoveCommodity.addCreditsLossText(bribe,
textPanel);
256 playerFleet.getCargo().getCredits().subtract(bribe);
275 if (
ui !=
null)
ui.updateUIForItem(
intel);
static SectorAPI getSector()
AntiInspectionOrders beingConfirmed
HIOrdersInteractionDialogPluginImpl(HegemonyInspectionIntel intel, IntelUIAPI ui)
void advance(float amount)
HegemonyInspectionIntel intel
CampaignFleetAPI playerFleet
void backFromEngagement(EngagementResultAPI result)
InteractionDialogAPI dialog
void printOptionDesc(AntiInspectionOrders orders, boolean inConfirm)
void optionSelected(String text, Object optionData)
void init(InteractionDialogAPI dialog)
void optionMousedOver(String optionText, Object optionData)
Map< String, MemoryAPI > getMemoryMap()
AntiInspectionOrders getOrders()
void setOrders(AntiInspectionOrders orders)
void setInvestedCredits(int investedCredits)