1package com.fs.starfarer.api.impl.campaign.intel;
6import org.lwjgl.input.Keyboard;
8import com.fs.starfarer.api.Global;
9import com.fs.starfarer.api.campaign.FactionAPI;
10import com.fs.starfarer.api.campaign.InteractionDialogAPI;
11import com.fs.starfarer.api.campaign.SectorEntityToken;
12import com.fs.starfarer.api.campaign.TextPanelAPI;
13import com.fs.starfarer.api.campaign.econ.CommodityOnMarketAPI;
14import com.fs.starfarer.api.campaign.econ.MonthlyReport;
15import com.fs.starfarer.api.campaign.econ.MonthlyReport.FDNode;
16import com.fs.starfarer.api.campaign.listeners.EconomyTickListener;
17import com.fs.starfarer.api.impl.campaign.ids.Factions;
18import com.fs.starfarer.api.impl.campaign.ids.Tags;
19import com.fs.starfarer.api.impl.campaign.intel.events.SindrianDiktatHostileActivityFactor;
20import com.fs.starfarer.api.impl.campaign.rulecmd.HA_CMD;
21import com.fs.starfarer.api.impl.campaign.shared.SharedData;
22import com.fs.starfarer.api.ui.ButtonAPI;
23import com.fs.starfarer.api.ui.IntelUIAPI;
24import com.fs.starfarer.api.ui.LabelAPI;
25import com.fs.starfarer.api.ui.SectorMapAPI;
26import com.fs.starfarer.api.ui.TooltipMakerAPI;
27import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator;
28import com.fs.starfarer.api.util.Misc;
32 public static enum AgreementEndingType {
38 public static String
KEY =
"$sindrianDiktatDeal_ref";
48 protected AgreementEndingType
endType =
null;
54 SindrianDiktatHostileActivityFactor.setMadeDeal(
true);
56 TextPanelAPI text =
null;
57 if (dialog !=
null) text = dialog.getTextPanel();
66 HA_CMD.avertOrEndDiktatAttackAsNecessary();
73 SindrianDiktatHostileActivityFactor.setMadeDeal(
false);
88 return "Sindrian Diktat Fuel Accord";
125 Color h = Misc.getHighlightColor();
126 Color g = Misc.getGrayColor();
131 if (mode == ListInfoMode.IN_DESC) initPad = opad;
149 Color h = Misc.getHighlightColor();
150 Color g = Misc.getGrayColor();
151 Color tc = Misc.getTextColor();
155 info.addImage(
getFaction().getLogo(), width, 128, opad);
158 info.addPara(
"You are no longer abiding by your agreement with the Sindrian Diktat.", opad);
164 LabelAPI label = info.addPara(
"You've made an agreement with the Sindrian Diktat, paying a sizeable "
165 +
"fee, %s of your gross fuel exports, in exchange for them not bombarding "
166 +
"your fuel production facilities from orbit.",
167 opad, h,
"" + (
int) Math.round(feeFraction * 100f) +
"%");
168 label.setHighlight(
"Sindrian Diktat",
"" + (
int) Math.round(feeFraction * 100f) +
"%");
169 label.setHighlightColors(
faction.getBaseUIColor(), h);
171 info.addPara(
"You can end this agreement, but there "
172 +
"would be no possibility of re-negotiating a similar one in the future.", opad);
174 ButtonAPI button = info.addButton(
"End the agreement",
BUTTON_END,
176 (
int)(width), 20f, opad * 1f);
177 button.setShortcut(Keyboard.KEY_U,
true);
187 Set<String> tags = super.getIntelTags(map);
188 tags.add(Tags.INTEL_AGREEMENTS);
208 public void endAgreement(AgreementEndingType type, InteractionDialogAPI dialog) {
214 if (dialog !=
null) {
215 sendUpdate(
new Object(), dialog.getTextPanel());
218 if (type == AgreementEndingType.BROKEN) {
219 SindrianDiktatHostileActivityFactor.setBrokeDeal(
true);
223 TextPanelAPI text = dialog ==
null ? null : dialog.getTextPanel();
235 super.buttonPressConfirmed(buttonId, ui);
242 prompt.addPara(
"The terms of the agreement are so onerous that your reputation at large "
243 +
"would not suffer for unilaterally breaking it, "
244 +
"though your standing with the Sindrian Diktat specifically "
245 +
"would of course be affected.", 0f,
256 return super.doesButtonHaveConfirmDialog(buttonId);
265 if (iterIndex != numIter - 1)
return;
269 MonthlyReport report = SharedData.getData().getCurrentReport();
270 FDNode marketsNode = report.getNode(MonthlyReport.OUTPOSTS);
271 if (marketsNode ==
null)
return;
274 int credits = (int) (exportIncome * feeFraction);
276 if (credits <= 0)
return;
279 node.upkeep += credits;
284 if (curr.custom instanceof CommodityOnMarketAPI) {
285 CommodityOnMarketAPI com = (CommodityOnMarketAPI) curr.custom;
287 total += curr.income;
290 for (FDNode child : curr.getChildren().values()) {
298 MonthlyReport report = SharedData.getData().getCurrentReport();
299 FDNode marketsNode = report.getNode(MonthlyReport.OUTPOSTS);
300 if (marketsNode.name ==
null) {
301 marketsNode.name =
"Colonies";
302 marketsNode.custom = MonthlyReport.OUTPOSTS;
303 marketsNode.tooltipCreator = report.getMonthlyReportTooltip();
306 FDNode paymentNode = report.getNode(marketsNode,
"diktat_fuel_fees");
307 paymentNode.name =
"Sindrian Diktat fuel accord fees";
308 paymentNode.icon =
faction.getCrest();
310 if (paymentNode.tooltipCreator ==
null) {
311 paymentNode.tooltipCreator =
new TooltipCreator() {
312 public boolean isTooltipExpandable(Object tooltipParam) {
315 public float getTooltipWidth(Object tooltipParam) {
318 public void createTooltip(TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
319 tooltip.addPara(
"Fees paid to the Sindrian Diktat in exchange for their refraining "
320 +
"from interfering in your fuel production business. From orbit.", 0f);
static SettingsAPI getSettings()
static SectorAPI getSector()
boolean isSendingUpdate()
void sendUpdate(Object listInfoParam, TextPanelAPI textPanel)
void unindent(TooltipMakerAPI info)
Object getListInfoParam()
Color getBulletColorForMode(ListInfoMode mode)
void setImportant(Boolean important)
void bullet(TooltipMakerAPI info)
FDNode getMonthlyReportNode()
void createSmallDescription(TooltipMakerAPI info, float width, float height)
void createConfirmationPrompt(Object buttonId, TooltipMakerAPI prompt)
boolean doesButtonHaveConfirmDialog(Object buttonId)
void reportEconomyTick(int iterIndex)
void reportEconomyMonthEnd()
float computeFuelExportIncome(FDNode curr)
String getImportantIcon()
String getSmallDescriptionTitle()
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
String getAcceptedPostfix()
SectorEntityToken getMapLocation(SectorMapAPI map)
AgreementEndingType endType
static String UPDATE_PARAM_ACCEPTED
String getBrokenPostfix()
FactionAPI getFactionForUIColors()
static float REP_FOR_BREAKING_DEAL
void buttonPressConfirmed(Object buttonId, IntelUIAPI ui)
Set< String > getIntelTags(SectorMapAPI map)
SindrianDiktatFuelDeal(InteractionDialogAPI dialog)
void endAgreement(AgreementEndingType type, InteractionDialogAPI dialog)
String getSpriteName(String category, String id)
float getFloat(String key)