mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Return false instead of throw if an illegal draft choice is made
This commit is contained in:
@@ -907,8 +907,7 @@ public class AdventurePlayer implements Serializable, SaveFileContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sellCard(PaperCard card, Integer result) {
|
public void sellCard(PaperCard card, Integer result) {
|
||||||
float price = CardUtil.getCardPrice(card) * result;
|
float price = cardSellPrice(card) * result;
|
||||||
price *= difficultyData.sellFactor;
|
|
||||||
cards.remove(card, result);
|
cards.remove(card, result);
|
||||||
addGold((int) price);
|
addGold((int) price);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,7 @@ import forge.assets.FSkinFont;
|
|||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.CardZoom;
|
import forge.card.CardZoom;
|
||||||
import forge.deck.AddBasicLandsDialog;
|
import forge.deck.*;
|
||||||
import forge.deck.CardPool;
|
|
||||||
import forge.deck.Deck;
|
|
||||||
import forge.deck.DeckFormat;
|
|
||||||
import forge.deck.DeckSection;
|
|
||||||
import forge.deck.FDeckViewer;
|
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.gamemodes.limited.BoosterDraft;
|
import forge.gamemodes.limited.BoosterDraft;
|
||||||
import forge.item.InventoryItem;
|
import forge.item.InventoryItem;
|
||||||
@@ -37,11 +32,7 @@ import forge.menu.FPopupMenu;
|
|||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.screens.FScreen;
|
import forge.screens.FScreen;
|
||||||
import forge.screens.TabPageScreen;
|
import forge.screens.TabPageScreen;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.*;
|
||||||
import forge.toolbox.FEvent;
|
|
||||||
import forge.toolbox.FLabel;
|
|
||||||
import forge.toolbox.FOptionPane;
|
|
||||||
import forge.toolbox.GuiChoose;
|
|
||||||
import forge.util.Callback;
|
import forge.util.Callback;
|
||||||
import forge.util.ItemPool;
|
import forge.util.ItemPool;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
@@ -568,6 +559,32 @@ public class AdventureDeckEditor extends TabPageScreen<AdventureDeckEditor> {
|
|||||||
if (!catalogPage.showNoSellCards || !catalogPage.showAutoSellCards || !catalogPage.showCollectionCards) {
|
if (!catalogPage.showNoSellCards || !catalogPage.showAutoSellCards || !catalogPage.showCollectionCards) {
|
||||||
addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblShowAll"), Forge.hdbuttons ? FSkinImage.HDPLUS : FSkinImage.PLUS, e1 -> catalogPage.showAllCards()));
|
addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblShowAll"), Forge.hdbuttons ? FSkinImage.HDPLUS : FSkinImage.PLUS, e1 -> catalogPage.showAllCards()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add bulk sell menu option. This will sell all cards in the current filter.
|
||||||
|
int count = 0;
|
||||||
|
int value = 0;
|
||||||
|
|
||||||
|
for (Map.Entry<PaperCard, Integer> entry : catalogPage.cardManager.getFilteredItems()) {
|
||||||
|
value += AdventurePlayer.current().cardSellPrice(entry.getKey()) * entry.getValue();
|
||||||
|
count += entry.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
final int finalCount = count;
|
||||||
|
final int finalValue = value;
|
||||||
|
addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblSellCurrentFilters"), FSkinImage.QUEST_COINSTACK, e1 -> {
|
||||||
|
FOptionPane.showConfirmDialog(Forge.getLocalizer().getMessage("lblSellAllConfirm", finalCount, finalValue), Forge.getLocalizer().getMessage("lblSellCurrentFilters"), Forge.getLocalizer().getMessage("lblSell"), Forge.getLocalizer().getMessage("lblCancel"), false, new Callback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void run(Boolean result) {
|
||||||
|
if (result) {
|
||||||
|
for (Map.Entry<PaperCard, Integer> entry : catalogPage.cardManager.getFilteredItems()) {
|
||||||
|
AdventurePlayer.current().sellCard(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
catalogPage.refresh();
|
||||||
|
lblGold.setText(String.valueOf(AdventurePlayer.current().getGold()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
((DeckEditorPage) getSelectedPage()).buildDeckMenu(this);
|
((DeckEditorPage) getSelectedPage()).buildDeckMenu(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3436,6 +3436,8 @@ lblShowNoSell=No-Sell Anzeigen
|
|||||||
lblShowAll=Alle Anzeigen
|
lblShowAll=Alle Anzeigen
|
||||||
lblHideCollection=Sammlung Ausblenden
|
lblHideCollection=Sammlung Ausblenden
|
||||||
lblShowCollection=Sammlung Anzeigen
|
lblShowCollection=Sammlung Anzeigen
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=Geknackt!
|
lblCracked=Geknackt!
|
||||||
lblTake=Nehmen
|
lblTake=Nehmen
|
||||||
lblRefund=Erstattung
|
lblRefund=Erstattung
|
||||||
|
|||||||
@@ -3169,6 +3169,8 @@ lblShowNoSell=Show No-Sell
|
|||||||
lblShowAll=Show All
|
lblShowAll=Show All
|
||||||
lblHideCollection=Hide Collection
|
lblHideCollection=Hide Collection
|
||||||
lblShowCollection=Show Collection
|
lblShowCollection=Show Collection
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=Cracked!
|
lblCracked=Cracked!
|
||||||
lblTake=Take
|
lblTake=Take
|
||||||
lblRefund=Refund
|
lblRefund=Refund
|
||||||
|
|||||||
@@ -3450,6 +3450,8 @@ lblShowNoSell=Mostrar No Vender
|
|||||||
lblShowAll=Mostrar Todo
|
lblShowAll=Mostrar Todo
|
||||||
lblHideCollection=Ocultar Colección
|
lblHideCollection=Ocultar Colección
|
||||||
lblShowCollection=Mostrar Colección
|
lblShowCollection=Mostrar Colección
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=¡Agrietado!
|
lblCracked=¡Agrietado!
|
||||||
lblTake=Llevar
|
lblTake=Llevar
|
||||||
lblRefund=Reembolso
|
lblRefund=Reembolso
|
||||||
|
|||||||
@@ -3444,6 +3444,8 @@ lblShowNoSell=Afficher Non-Vente
|
|||||||
lblShowAll=Afficher Tout
|
lblShowAll=Afficher Tout
|
||||||
lblHideCollection=Masquer la Collection
|
lblHideCollection=Masquer la Collection
|
||||||
lblShowCollection=Afficher la Collection
|
lblShowCollection=Afficher la Collection
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=Fissuré!
|
lblCracked=Fissuré!
|
||||||
lblTake=Prendre
|
lblTake=Prendre
|
||||||
lblRefund=Remboursement
|
lblRefund=Remboursement
|
||||||
|
|||||||
@@ -3442,6 +3442,8 @@ lblShowNoSell=Mostra Non Vendita
|
|||||||
lblShowAll=Mostra Tutto
|
lblShowAll=Mostra Tutto
|
||||||
lblHideCollection=Nascondi Collezione
|
lblHideCollection=Nascondi Collezione
|
||||||
lblShowCollection=Mostra Collezione
|
lblShowCollection=Mostra Collezione
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=Incrinato!
|
lblCracked=Incrinato!
|
||||||
lblTake=Prendere
|
lblTake=Prendere
|
||||||
lblRefund=Rimborso
|
lblRefund=Rimborso
|
||||||
|
|||||||
@@ -3438,6 +3438,8 @@ lblShowNoSell=ノーセールを表示
|
|||||||
lblShowAll=すべて表示
|
lblShowAll=すべて表示
|
||||||
lblHideCollection=コレクションを非表示にする
|
lblHideCollection=コレクションを非表示にする
|
||||||
lblShowCollection=ショーコレクション
|
lblShowCollection=ショーコレクション
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=ひび割れた!
|
lblCracked=ひび割れた!
|
||||||
lblTake=取る
|
lblTake=取る
|
||||||
lblRefund=返金
|
lblRefund=返金
|
||||||
|
|||||||
@@ -3528,6 +3528,8 @@ lblShowNoSell=Mostrar Não-Venda
|
|||||||
lblShowAll=Mostrar Tudo
|
lblShowAll=Mostrar Tudo
|
||||||
lblHideCollection=Ocultar Coleção
|
lblHideCollection=Ocultar Coleção
|
||||||
lblShowCollection=Mostrar Coleção
|
lblShowCollection=Mostrar Coleção
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=Rachado!
|
lblCracked=Rachado!
|
||||||
lblTake=Pegar
|
lblTake=Pegar
|
||||||
lblRefund=Reembolso
|
lblRefund=Reembolso
|
||||||
|
|||||||
@@ -3429,6 +3429,8 @@ lblShowNoSell=显示不卖
|
|||||||
lblShowAll=显示全部
|
lblShowAll=显示全部
|
||||||
lblHideCollection=隐藏收藏
|
lblHideCollection=隐藏收藏
|
||||||
lblShowCollection=展会系列
|
lblShowCollection=展会系列
|
||||||
|
lblSellCurrentFilters=Sell Displayed Cards
|
||||||
|
lblSellAllConfirm=You are attempting to sell {0} cards for {1} gold. Selling cards is irreversible. Are you sure you want to proceed?
|
||||||
lblCracked=破裂了!
|
lblCracked=破裂了!
|
||||||
lblTake=拿
|
lblTake=拿
|
||||||
lblRefund=退款
|
lblRefund=退款
|
||||||
|
|||||||
Reference in New Issue
Block a user