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.RepLevel;
12import com.fs.starfarer.api.campaign.SectorEntityToken;
13import com.fs.starfarer.api.campaign.TextPanelAPI;
14import com.fs.starfarer.api.campaign.econ.MarketAPI;
15import com.fs.starfarer.api.campaign.econ.MonthlyReport;
16import com.fs.starfarer.api.campaign.econ.MonthlyReport.FDNode;
17import com.fs.starfarer.api.campaign.listeners.CommissionEndedListener;
18import com.fs.starfarer.api.campaign.listeners.EconomyTickListener;
19import com.fs.starfarer.api.characters.PersonAPI;
20import com.fs.starfarer.api.impl.campaign.ids.Factions;
21import com.fs.starfarer.api.impl.campaign.ids.People;
22import com.fs.starfarer.api.impl.campaign.ids.Tags;
23import com.fs.starfarer.api.impl.campaign.intel.contacts.ContactIntel;
24import com.fs.starfarer.api.impl.campaign.rulecmd.HA_CMD;
25import com.fs.starfarer.api.impl.campaign.shared.SharedData;
26import com.fs.starfarer.api.ui.ButtonAPI;
27import com.fs.starfarer.api.ui.IntelUIAPI;
28import com.fs.starfarer.api.ui.LabelAPI;
29import com.fs.starfarer.api.ui.SectorMapAPI;
30import com.fs.starfarer.api.ui.TooltipMakerAPI;
31import com.fs.starfarer.api.ui.TooltipMakerAPI.TooltipCreator;
32import com.fs.starfarer.api.util.Misc;
36 public static enum AgreementEndingType {
108 public static String
KEY =
"$plMembership_ref";
129 Global.
getSector().getPlayerFaction().setSecondaryColorSegmentsOverride(8);
131 TextPanelAPI text =
null;
132 if (dialog !=
null) text = dialog.getTextPanel();
139 RepLevel level =
faction.getRelToPlayer().getLevel();
140 if (!level.isAtWorst(RepLevel.NEUTRAL)) {
141 Misc.adjustRep(Factions.PERSEAN, 2f, RepLevel.NEUTRAL, text);
149 super.notifyEnding();
171 return "Persean League Membership";
221 Color h = Misc.getHighlightColor();
222 Color g = Misc.getGrayColor();
227 if (mode == ListInfoMode.IN_DESC) initPad = opad;
240 Color c = perMonth > 0 ? h : Misc.getNegativeHighlightColor();
241 info.addPara(
"%s per month", initPad, tc, c, Misc.getDGSCredits(perMonth));
261 Color h = Misc.getHighlightColor();
262 Color g = Misc.getGrayColor();
263 Color tc = Misc.getTextColor();
267 Color c =
faction.getBaseUIColor();
269 info.addImage(
getFaction().getLogo(), width, 128, opad);
272 info.addPara(
"Your agreement with the League is no longer in force.", opad, c,
"League");
277 info.addPara(
"You've negotiated a good membership deal from a position of strength. "
278 +
"The League will support you politically, which "
279 +
"for example makes it untenable for the Hegemony to insist on AI inspections "
280 +
"in your space.", opad, c,
"League");
283 info.addPara(
"Part of your arrangement involves unofficial payments directly to the accounts "
284 +
"of House Hannan, as payment for facilitating this agreement.", opad);
288 (
int)(width), 20f, opad * 1f);
289 button.setShortcut(Keyboard.KEY_G,
true);
290 info.addSpacer(opad);
293 info.addPara(
"You've joined the Persean League, though it's whispered that you only did so to avoid "
294 +
"harassment, and your membership dues are nothing more than protection payments. "
295 +
"However, the League still supports you politically, which "
296 +
"for example makes it untenable for the Hegemony to insist on AI inspections "
297 +
"in your space.", opad, c,
"Persean League");
300 info.addPara(
"Your League membership is contingent on maintaining an active Persean League commission. If "
301 +
"you resign it, or if it is annulled for any reason, your membership will end as well.", opad);
304 info.addPara(
"You are paying membership dues to the League.", opad);
309 ButtonAPI button = info.addButton(
"End League membership",
BUTTON_END,
311 (
int)(width), 20f, opad * 1f);
312 button.setShortcut(Keyboard.KEY_U,
true);
322 Set<String> tags = super.getIntelTags(map);
323 tags.add(Tags.INTEL_AGREEMENTS);
350 node.income += credits;
351 }
else if (credits < 0) {
352 node.upkeep -= credits;
358 MonthlyReport report = SharedData.getData().getCurrentReport();
359 FDNode marketsNode = report.getNode(MonthlyReport.OUTPOSTS);
360 if (marketsNode.name ==
null) {
361 marketsNode.name =
"Colonies";
362 marketsNode.custom = MonthlyReport.OUTPOSTS;
363 marketsNode.tooltipCreator = report.getMonthlyReportTooltip();
366 FDNode paymentNode = report.getNode(marketsNode,
"persean_league_membership");
367 paymentNode.name =
"Persean League membership dues";
370 paymentNode.icon =
faction.getCrest();
372 if (paymentNode.tooltipCreator ==
null) {
373 paymentNode.tooltipCreator =
new TooltipCreator() {
374 public boolean isTooltipExpandable(Object tooltipParam) {
377 public float getTooltipWidth(Object tooltipParam) {
380 public void createTooltip(TooltipMakerAPI tooltip,
boolean expanded, Object tooltipParam) {
381 tooltip.addPara(
"Monthly dues for keeping your Persean League membership in good standing.", 0f);
392 return (
int) (perTick * numIter);
397 float f = 1f / numIter;
408 for (MarketAPI market : Misc.getPlayerMarkets(
false)) {
409 payment += (int) (market.getGrossIncome() * f) * feeFraction;
419 public void endMembership(AgreementEndingType type, InteractionDialogAPI dialog) {
431 Global.
getSector().getPlayerFaction().setSecondaryColorSegmentsOverride(0);
433 if (dialog !=
null) {
434 sendUpdate(
new Object(), dialog.getTextPanel());
437 if (baseMembership) {
438 HA_CMD.sendPerseanLeaguePunitiveExpedition(dialog);
447 TextPanelAPI text =
null;
448 if (dialog !=
null) text = dialog.getTextPanel();
449 PersonAPI reynard = People.getPerson(People.REYNARD_HANNAN);
450 if (reynard !=
null) {
451 Misc.adjustRep(reynard, -0.5f, text);
452 ContactIntel.removeContact(reynard, dialog);
458 Misc.incrUntrustwortyCount();
470 super.buttonPressConfirmed(buttonId, ui);
481 LabelAPI label = prompt.addPara(
"You've negotiated a good membership deal from a position of strength. If "
482 +
"you leave, you will not be allowed to rejoin, but the " +
483 faction.getDisplayNameWithArticle() +
" will likely refrain "
484 +
"from harassing your interests." + extra, 0f,
485 Misc.getTextColor(),
faction.getBaseUIColor(),
486 faction.getDisplayNameWithArticleWithoutArticle());
487 label.setHighlightColors(Misc.getNegativeHighlightColor(),
faction.getBaseUIColor());
488 label.setHighlight(
"will not be allowed to rejoin",
faction.getDisplayNameWithArticleWithoutArticle());
490 prompt.addPara(
"However, Gens Hannan will not be pleased with their payments being stopped.",
491 10f, Misc.getNegativeHighlightColor(),
"Gens Hannan will not be pleased");
496 float rejoinPad = 10f;
497 if (HA_CMD.canSendPerseanLeaguePunitiveExpedition()) {
498 LabelAPI label = prompt.addPara(
499 "If you leave, " +
faction.getDisplayNameWithArticle() +
" will likely take"
500 +
" drastic action against your colonies." + extra, 0f);
501 label.setHighlightColors(
faction.getBaseUIColor(), Misc.getNegativeHighlightColor());
502 label.setHighlight(
faction.getDisplayNameWithArticleWithoutArticle(),
"drastic action");
505 prompt.addPara(
"If you leave, " +
faction.getDisplayNameWithArticle() +
" will likely start "
506 +
" harassing your interests in the near future.", 0f,
507 Misc.getTextColor(),
faction.getBaseUIColor(),
508 faction.getDisplayNameWithArticleWithoutArticle());
514 prompt.addPara(
"Given your history, it is likely that you would not be allowed "
515 +
"to rejoin the League at any point in the future.",
516 rejoinPad, Misc.getNegativeHighlightColor(),
517 "would not be allowed to rejoin");
521 prompt.addPara(
"Gens Hannan will not be pleased. While they are unlikely to be unable to obtain your outright "
522 +
"explulsion from the League, their influence is significant and will likely be used "
523 +
"to continually undermine your standing. ", 0f,
524 Misc.getNegativeHighlightColor(),
525 "continually undermine your standing");
527 prompt.addPara(
"You will also lose Reynard Hannan as a contact.", 10f,
528 Misc.getNegativeHighlightColor(),
529 "lose Reynard Hannan");
539 return super.doesButtonHaveConfirmDialog(buttonId);
544 if (intel.
getFaction().getId().equals(Factions.PERSEAN)) {
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)
static final String PL_MEMBERSHIP_GOOD_DEAL
static boolean isLeagueMember()
AgreementEndingType endType
static final String LEFT_LEAGUE_WHEN_GOOD_DEAL
String getAcceptedPostfix()
static final String PAYING_HOUSE_HANNAN
void reportEconomyTick(int iterIndex)
void createConfirmationPrompt(Object buttonId, TooltipMakerAPI prompt)
static void setDefeatedPunEx(boolean value)
void reportCommissionEnded(FactionCommissionIntel intel)
Set< String > getIntelTags(SectorMapAPI map)
static int getNumTimesLeftLeague()
void addBulletPoints(TooltipMakerAPI info, ListInfoMode mode)
String getBrokenPostfix()
static int computeCreditsPerTick()
static final String DEFEATED_PUN_EX
SectorEntityToken getMapLocation(SectorMapAPI map)
static final String DEFEATED_BLOCKADE
void createSmallDescription(TooltipMakerAPI info, float width, float height)
static String BUTTON_RENEGE_HANNAN
static final String NUM_TIMES_LEFT_LEAGUE
static int TIMES_LEFT_LEAGUE_FOR_NO_REJOIN
void reportEconomyMonthEnd()
static final String IS_LEAGUE_MEMBER
boolean doesButtonHaveConfirmDialog(Object buttonId)
static void setLeagueMember(boolean member)
static void stopPayingHouseHannan(boolean trustBroken, InteractionDialogAPI dialog)
void buttonPressConfirmed(Object buttonId, IntelUIAPI ui)
PerseanLeagueMembership(InteractionDialogAPI dialog)
void endMembership(AgreementEndingType type, InteractionDialogAPI dialog)
static boolean isDefeatedBlockadeOrPunEx()
static void setLeftLeagueWhenGoodDeal(boolean value)
FactionAPI getFactionForUIColors()
static void incrLeftLeagueCount()
static boolean isLeftLeagueWhenGoodDeal()
String getExpiredPostfix()
FDNode getMonthlyReportNode()
String getSmallDescriptionTitle()
static boolean isGoodDeal()
static boolean isPayingHouseHannan()
static String UPDATE_PARAM_ACCEPTED
static void setPayingHouseHannan(boolean value)
String getImportantIcon()
static void setDefeatedBlockade(boolean value)
int computeCreditsPerMonth()
String getSpriteName(String category, String id)
float getFloat(String key)