Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class CardDownloadData {
private String set;
private final String collectorId;
private final Integer imageNumber;
private boolean isCommon;
private boolean isToken;
private boolean isSecondSide;
private boolean isFlippedSide;
Expand All @@ -39,6 +40,7 @@ public CardDownloadData(final CardDownloadData card) {
this.isFlippedSide = card.isFlippedSide;
this.isSplitCard = card.isSplitCard;
this.isUsesVariousArt = card.isUsesVariousArt;
this.isCommon = card.isCommon;
}

@Override
Expand Down Expand Up @@ -170,4 +172,12 @@ public boolean isFlippedSide() {
public void setFlippedSide(boolean flippedSide) {
this.isFlippedSide = flippedSide;
}

public boolean isCommon() {
return isCommon;
}

public void setCommon(boolean common) {
this.isCommon = common;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import mage.client.util.CardLanguage;
import mage.client.util.GUISizeHelper;
import mage.client.util.sets.ConstructedFormats;
import mage.constants.Rarity;
import mage.util.ThreadUtils;
import mage.util.XmageThreadFactory;
import net.java.truevfs.access.TFile;
Expand Down Expand Up @@ -59,6 +60,7 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
private static final String ALL_IMAGES = "- ALL images from selected source (can be slow)";
private static final String ALL_MODERN_IMAGES = "- MODERN images (can be slow)";
private static final String ALL_STANDARD_IMAGES = "- STANDARD images";
private static final String ALL_PAUPER_IMAGES = "- PAUPER images (can be slow)";
private static final String ALL_TOKENS = "- TOKEN images";
private static final String ALL_BASICS = "- BASIC LAND images";

Expand Down Expand Up @@ -329,6 +331,7 @@ private Object[] getSetsForCurrentImageSource() {
setNames.add(ALL_IMAGES);
setNames.add(ALL_MODERN_IMAGES);
setNames.add(ALL_STANDARD_IMAGES);
setNames.add(ALL_PAUPER_IMAGES);
setNames.add(ALL_BASICS);
}
if (selectedSource.isTokenSource()) {
Expand Down Expand Up @@ -356,6 +359,7 @@ private void reloadCardsToDownload(String selectedItem) {
selectedSets.clear();
boolean onlyTokens = false;
boolean onlyBasics = false;
boolean onlyCommons = false;
List<String> formatSets;
List<String> sourceSets = selectedSource.getSupportedSets();
switch (selectedItem) {
Expand Down Expand Up @@ -388,6 +392,11 @@ private void reloadCardsToDownload(String selectedItem) {
onlyTokens = true;
break;

case ALL_PAUPER_IMAGES:
selectedSets.addAll(selectedSource.getSupportedSets());
onlyCommons = true;
break;

default:
// selects one set
ExpansionSet selectedExp = findSetByNameWithYear(selectedItem);
Expand All @@ -402,6 +411,16 @@ private void reloadCardsToDownload(String selectedItem) {
int numberTokenImagesAvailable = 0;
int numberCardImagesAvailable = 0;
for (CardDownloadData data : cardsMissing) {
if(onlyCommons) {
if(data.isCommon()
&& selectedSource.isCardSource()
&& selectedSource.isCardImageProvided(data.getSet(), data.getName())
&& selectedSets.contains(data.getSet())) {
numberTokenImagesAvailable++;
cardsDownloadQueue.add(data);
}
continue;
}
if (data.isToken()) {
if (!onlyBasics
&& selectedSource.isTokenSource()
Expand Down Expand Up @@ -498,6 +517,7 @@ private static List<CardDownloadData> prepareMissingCards(List<CardInfo> allCard
}

url.setSplitCard(card.isSplitCard());
url.setCommon(card.getRarity() == Rarity.COMMON);
allCardsUrls.add(url);
}
// second side
Expand Down