1package com.fs.starfarer.api.impl.campaign.submarkets;
5import com.fs.starfarer.api.Global;
6import com.fs.starfarer.api.Script;
7import com.fs.starfarer.api.campaign.CampaignFleetAPI;
8import com.fs.starfarer.api.campaign.CargoStackAPI;
9import com.fs.starfarer.api.campaign.CoreUIAPI;
10import com.fs.starfarer.api.campaign.econ.SubmarketAPI;
11import com.fs.starfarer.api.fleet.FleetMemberAPI;
12import com.fs.starfarer.api.impl.campaign.ids.Strings;
13import com.fs.starfarer.api.ui.TooltipMakerAPI;
14import com.fs.starfarer.api.util.Highlights;
15import com.fs.starfarer.api.util.Misc;
19 private boolean playerPaidToUnlock =
false;
32 return super.isIllegalOnSubmarket(stack, action);
38 return super.isIllegalOnSubmarket(commodityId, action);
45 return super.isIllegalOnSubmarket(member, action);
72 return "Illegal to put into storage here";
91 this.playerPaidToUnlock = playerPaidToUnlock;
95 if (playerPaidToUnlock)
return OnClickAction.OPEN_SUBMARKET;
96 return OnClickAction.SHOW_TEXT_DIALOG;
99 private int getUnlockCost() {
103 private boolean canPlayerAffordUnlock() {
106 return credits >= getUnlockCost();
110 if (canPlayerAffordUnlock()) {
111 return "Gaining access to storage at this colony requires a one-time fee of " + getUnlockCost() +
" credits.";
113 return "Gaining access to storage at this colony requires a one-time fee of " + getUnlockCost() +
" credits, which you can't afford.";
118 h.
setText(
"" + getUnlockCost());
119 if (canPlayerAffordUnlock()) {
127 if (canPlayerAffordUnlock()) {
128 return new DialogOption [] {
129 new DialogOption(
"Pay",
new Script() {
133 playerPaidToUnlock =
true;
136 new DialogOption(
"Never mind",
null)
139 return new DialogOption [] {
140 new DialogOption(
"Never mind",
null)
179 int percent = (int) (f * 100f);
183 if (!playerPaidToUnlock) {
184 tooltip.
addPara(
"Requires a one-time access fee of %s, and a monthly fee equal to %s of the " +
185 "base value of the items in storage.", opad, h,
186 "" + getUnlockCost() +
Strings.
C,
"" + percent +
"%");
193 if (cargoCost + shipCost > 0) {
195 tooltip.
addPara(
"Monthly fees and expenses (%s of base value of stored items):", opad, h,
"" + percent +
"%");
202 tooltip.
addPara(
"Monthly fees and expenses are equal to %s of base value of the stored items.", opad, h,
"" + percent +
"%");
static SectorAPI getSector()
Highlights getTooltipAppendixHighlights(CoreUIAPI ui)
DialogOption[] getDialogOptions(CoreUIAPI ui)
void createTooltipAfterDescription(TooltipMakerAPI tooltip, boolean expanded)
void updateCargoPrePlayerInteraction()
boolean isIllegalOnSubmarket(FleetMemberAPI member, TransferAction action)
String getDialogText(CoreUIAPI ui)
Highlights getDialogTextHighlights(CoreUIAPI ui)
boolean isEnabled(CoreUIAPI ui)
void init(SubmarketAPI submarket)
void setPlayerPaidToUnlock(boolean playerPaidToUnlock)
boolean isIllegalOnSubmarket(CargoStackAPI stack, TransferAction action)
boolean isParticipatesInEconomy()
OnClickAction getOnClickAction(CoreUIAPI ui)
String getTooltipAppendix(CoreUIAPI ui)
String getIllegalTransferText(CargoStackAPI stack, TransferAction action)
boolean isIllegalOnSubmarket(String commodityId, TransferAction action)
void setText(String ... text)
void setColors(Color ... colors)
static String getDGSCredits(float num)
static float getStorageShipValue(MarketAPI market)
static float getStorageFeeFraction()
static Color getNegativeHighlightColor()
static float getStorageCargoValue(MarketAPI market)
static String getTokenReplaced(String in, SectorEntityToken entity)
static Color getHighlightColor()
MutableValue getCredits()
boolean isNeutralFaction()
CampaignFleetAPI getPlayerFleet()
SectorEntityToken getPrimaryEntity()