diff --git a/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuestCardShop.java b/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuestCardShop.java index 0a9b75f403b..61332f8641e 100644 --- a/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuestCardShop.java +++ b/forge-gui/src/main/java/forge/gui/deckeditor/controllers/CEditorQuestCardShop.java @@ -149,7 +149,8 @@ public final class CEditorQuestCardShop extends ACEditorBase itemEntry : items) { final InventoryItem item = itemEntry.getKey(); + final String displayType = getItemDisplayType(item); + if (displayType == null) { continue; } //don't remove item from Catalog if unsupported type + final int qty = itemEntry.getValue(); final int value = this.getCardValue(item); + final int totalCost = qty * value; + final String title = "Buy " + displayType; + final String promptSuffix = " credits to purchase " + (qty == 1 ? "'" : qty + " copies of '") + item.getName() + "'"; - if (value > this.questData.getAssets().getCredits()) { - FOptionPane.showMessageDialog("Not enough credits to purchase " + (qty == 1 ? "" : qty + " copies of ") + item.getName() + "."); + if (totalCost > this.questData.getAssets().getCredits()) { + FOptionPane.showMessageDialog("Not enough" + promptSuffix + ".", title); + continue; + } + + if (!FOptionPane.showConfirmDialog("Pay " + totalCost + promptSuffix + "?", title, "Buy", "Cancel")) { continue; } @@ -373,8 +403,7 @@ public final class CEditorQuestCardShop extends ACEditorBase> items, boolean toAlternate) { if (showingFullCatalog || toAlternate) { return; } - this.getCatalogManager().addItems(items); - this.getDeckManager().removeItems(items); + List> itemsToRemove = new ArrayList>(); for (Entry itemEntry : items) { final InventoryItem item = itemEntry.getKey(); @@ -382,10 +411,24 @@ public final class CEditorQuestCardShop extends ACEditorBase