Sell lands down to 50 when selling all extras in the card shop

This commit is contained in:
myk
2013-02-05 10:36:35 +00:00
parent e63d914b47
commit 0e65ad2ebf
2 changed files with 6 additions and 5 deletions

View File

@@ -431,15 +431,16 @@ public final class CEditorQuestCardShop extends ACEditorBase<InventoryItem, Deck
this.getTableCatalog().setDeck(cardsForSale);
this.getTableDeck().setDeck(ownedItems);
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setText("Sell excess cards");
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setToolTipText("Sell extra non-basic land cards of which you have more than four copies");
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setText("Sell all extras");
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setToolTipText("Sell unneeded extra copies of all cards");
VCurrentDeck.SINGLETON_INSTANCE.getBtnRemove4().setCommand(new Command() {
@Override
public void execute() {
List<Map.Entry<InventoryItem, Integer>> cardsToRemove = new LinkedList<Map.Entry<InventoryItem,Integer>>();
for (Map.Entry<InventoryItem, Integer> item : getTableDeck().getCards()) {
if (4 < item.getValue() && CardRarity.BasicLand != ((CardPrinted)item.getKey()).getRarity()) {
cardsToRemove.add(Pair.of(item.getKey(), item.getValue() - 4));
int numToKeep = CardRarity.BasicLand == ((CardPrinted)item.getKey()).getRarity() ? 50 : 4;
if (numToKeep < item.getValue()) {
cardsToRemove.add(Pair.of(item.getKey(), item.getValue() - numToKeep));
}
}
removeCards(cardsToRemove);

View File

@@ -86,7 +86,7 @@ public enum VCurrentDeck implements IVDoc<CCurrentDeck>, ITableContainer {
private final FLabel btnRemove = new FLabel.Builder()
.fontSize(14)
.text("Remove card")
.tooltip("Remove selected card to current deck (or double click the row)")
.tooltip("Remove selected card from current deck (or double click the row or hit the spacebar)")
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_MINUS))
.iconScaleAuto(false).hoverable(true).build();