52 int refund = Misc.computeTotalShutdownRefund(market);
53 int credits = (int)
Global.
getSector().getPlayerFleet().getCargo().getCredits().get();
55 Color h = Misc.getHighlightColor();
58 String costStr =
"cost";
63 if (cost - refund > credits) {
64 cc = Misc.getNegativeHighlightColor();
70 FactionAPI faction = market.getFaction();
73 LabelAPI label = prompt.addPara(
"Abandoning %s, a size %s colony, requires %s in evacuation expenses. " +
74 "Shutting down all operations will generate %s credits, for a net " + costStr +
" of %s.",
78 "" + market.getSize(),
79 Misc.getDGSCredits(cost),
80 Misc.getDGSCredits(refund),
81 Misc.getDGSCredits(Math.abs(cost - refund))
83 label.setHighlightColors(faction.getBaseUIColor(), h, h, h, cc);
86 prompt.addPara(
"You have %s credits.", opad, h, Misc.getDGSCredits(credits));
88 prompt.addPara(
"This action can not be undone. All items in storage and in use by industries will be lost.", opad);
105 int refund = Misc.computeTotalShutdownRefund(market);
107 int diff = cost - refund;
109 Global.
getSector().getPlayerFleet().getCargo().getCredits().subtract(diff);
113 String.format(
"Spent %s", Misc.getDGSCredits(diff)),
114 Misc.getTooltipTitleAndLightHighlightColor(), Misc.getDGSCredits(diff), Misc.getHighlightColor());
115 }
else if (diff < 0) {
117 String.format(
"Received %s", Misc.getDGSCredits(-diff)),
118 Misc.getTooltipTitleAndLightHighlightColor(), Misc.getDGSCredits(-diff), Misc.getHighlightColor());
121 DecivTracker.removeColony(market,
false);
123 ListenerUtil.reportPlayerAbandonedColony(market);
125 InteractionDialogAPI dialog =
Global.
getSector().getCampaignUI().getCurrentInteractionDialog();
126 if (dialog !=
null && dialog.getPlugin() instanceof RuleBasedDialog) {
129 RuleBasedDialog rbd = ((RuleBasedDialog) dialog.getPlugin());
131 market.getMemoryWithoutUpdate().unset(
"$tradeMode");
132 if (market.getPrimaryEntity() !=
null) {
133 market.getPrimaryEntity().getMemoryWithoutUpdate().unset(
"$tradeMode");
137 new ShowDefaultVisual().execute(
null, dialog, Misc.tokenize(
""), rbd.getMemoryMap());
140 dialog.getInteractionTarget().getMemoryWithoutUpdate().set(
"$menuState",
"main", 0);
141 dialog.getInteractionTarget().getMemoryWithoutUpdate().set(
"$tradeMode",
"NONE", 0);
142 dialog.getInteractionTarget().getMemoryWithoutUpdate().unset(
"$hasMarket");
145 dialog.getVisualPanel().closeCoreUI();
148 FireAll.fire(
null, dialog, rbd.getMemoryMap(),
"OpenInteractionDialog");
151 Global.
getSector().getCampaignUI().showCoreUITab(CoreUITabId.OUTPOSTS);