mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
add the correct number of packs/decks when multiple are purchased at once
This commit is contained in:
@@ -317,7 +317,7 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
|
|
||||||
} else if (item instanceof OpenablePack) {
|
} else if (item instanceof OpenablePack) {
|
||||||
this.getTableCatalog().removeCard(item, qty);
|
this.getTableCatalog().removeCard(item, qty);
|
||||||
|
for (int i = 0; qty > i; ++i) {
|
||||||
OpenablePack booster = null;
|
OpenablePack booster = null;
|
||||||
if (item instanceof BoosterPack) {
|
if (item instanceof BoosterPack) {
|
||||||
booster = (BoosterPack) ((BoosterPack) item).clone();
|
booster = (BoosterPack) ((BoosterPack) item).clone();
|
||||||
@@ -333,16 +333,21 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
|
|||||||
final CardListViewer c = new CardListViewer(booster.getName(),
|
final CardListViewer c = new CardListViewer(booster.getName(),
|
||||||
"You have found the following cards inside:", newCards);
|
"You have found the following cards inside:", newCards);
|
||||||
c.show();
|
c.show();
|
||||||
|
}
|
||||||
} else if (item instanceof PreconDeck) {
|
} else if (item instanceof PreconDeck) {
|
||||||
this.getTableCatalog().removeCard(item, qty);
|
this.getTableCatalog().removeCard(item, qty);
|
||||||
final PreconDeck deck = (PreconDeck) item;
|
final PreconDeck deck = (PreconDeck) item;
|
||||||
this.questData.getCards().buyPreconDeck(deck, value);
|
this.questData.getCards().buyPreconDeck(deck, value);
|
||||||
final ItemPool<InventoryItem> newInventory =
|
final ItemPool<InventoryItem> newInventory =
|
||||||
ItemPool.createFrom(deck.getDeck().getMain(), InventoryItem.class);
|
ItemPool.createFrom(deck.getDeck().getMain(), InventoryItem.class);
|
||||||
|
for (int i = 0; qty > i; ++i) {
|
||||||
getTableDeck().addCards(newInventory);
|
getTableDeck().addCards(newInventory);
|
||||||
|
}
|
||||||
JOptionPane.showMessageDialog(null, String.format(
|
JOptionPane.showMessageDialog(null, String.format(
|
||||||
"Deck '%s' was added to your decklist.%n%nCards from it were also added to your pool.",
|
"%s '%s' %s added to your decklist.%n%nCards from it were also added to your pool.",
|
||||||
deck.getName()), "Thanks for purchasing!", JOptionPane.INFORMATION_MESSAGE);
|
1 == qty ? "Deck" : String.format("%d copies of deck", qty),
|
||||||
|
deck.getName(), 1 == qty ? "was" : "were"),
|
||||||
|
"Thanks for purchasing!", JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.creditsLabel.setText("Credits: " + this.questData.getAssets().getCredits());
|
this.creditsLabel.setText("Credits: " + this.questData.getAssets().getCredits());
|
||||||
|
|||||||
@@ -92,9 +92,6 @@ public class ReadPriceList {
|
|||||||
final String name = s[0].trim();
|
final String name = s[0].trim();
|
||||||
final String price = s[1].trim();
|
final String price = s[1].trim();
|
||||||
|
|
||||||
// System.out.println("Name: " + name + ", Price: " +
|
|
||||||
// price);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int val = Integer.parseInt(price.trim());
|
int val = Integer.parseInt(price.trim());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user