mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Won't show errors if a card has no setinfo.
This commit is contained in:
@@ -39,8 +39,6 @@ public final class CardDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static List<String> skippedCards = new ArrayList<String>();
|
|
||||||
public static List<String> getSkippedCards() { return skippedCards; }
|
|
||||||
|
|
||||||
// Here oracle cards
|
// Here oracle cards
|
||||||
private final Map<String, CardRules> cards = new Hashtable<String, CardRules>();
|
private final Map<String, CardRules> cards = new Hashtable<String, CardRules>();
|
||||||
@@ -63,17 +61,13 @@ public final class CardDb {
|
|||||||
|
|
||||||
private CardDb(final Iterator<CardRules> parser) {
|
private CardDb(final Iterator<CardRules> parser) {
|
||||||
while (parser.hasNext()) {
|
while (parser.hasNext()) {
|
||||||
CardRules nextCard = parser.next();
|
addNewCard(parser.next());
|
||||||
boolean wasAdded = addNewCard(nextCard);
|
|
||||||
if (!wasAdded) {
|
|
||||||
skippedCards.add(nextCard.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TODO: consider using Collections.unmodifiableList wherever possible
|
// TODO: consider using Collections.unmodifiableList wherever possible
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addNewCard(final CardRules card) {
|
public void addNewCard(final CardRules card) {
|
||||||
if (null == card) { return true; } // consider that a success
|
if (null == card) { return; } // consider that a success
|
||||||
//System.out.println(card.getName());
|
//System.out.println(card.getName());
|
||||||
String cardName = card.getName().toLowerCase();
|
String cardName = card.getName().toLowerCase();
|
||||||
|
|
||||||
@@ -101,12 +95,7 @@ public final class CardDb {
|
|||||||
cardCopies[i] = lastAdded;
|
cardCopies[i] = lastAdded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != lastAdded) {
|
|
||||||
uniqueCards.put(cardName, lastAdded);
|
uniqueCards.put(cardName, lastAdded);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Single fetch
|
// Single fetch
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ public enum CardRarity {
|
|||||||
Uncommon("U"),
|
Uncommon("U"),
|
||||||
Rare("R"),
|
Rare("R"),
|
||||||
MythicRare("M"),
|
MythicRare("M"),
|
||||||
Special("S"); // Timeshifted
|
Special("S"), // Timeshifted
|
||||||
|
Unknown("?"); // In development
|
||||||
|
|
||||||
private final String strValue;
|
private final String strValue;
|
||||||
private CardRarity(final String sValue) {
|
private CardRarity(final String sValue) {
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ public final class CardRules {
|
|||||||
} else if (cardType.isPlaneswalker()) {
|
} else if (cardType.isPlaneswalker()) {
|
||||||
this.loyalty = ptLine;
|
this.loyalty = ptLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setsData.isEmpty()) {
|
||||||
|
setsData.put("???", new CardInSet(CardRarity.Unknown, 1));
|
||||||
|
}
|
||||||
setsPrinted = setsData;
|
setsPrinted = setsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,11 +82,6 @@ public class PreloadingCardFactory extends AbstractCardFactory {
|
|||||||
read.run();
|
read.run();
|
||||||
CardDb.setup(listCardRules.iterator());
|
CardDb.setup(listCardRules.iterator());
|
||||||
|
|
||||||
List<String> skipped = CardDb.getSkippedCards();
|
|
||||||
if (!skipped.isEmpty()) {
|
|
||||||
String message = String.format("The following cards are lacking of correct SetInfo: %s", StringUtils.join(skipped, ", "));
|
|
||||||
ErrorViewer.showError(message);
|
|
||||||
}
|
|
||||||
} // readCard()
|
} // readCard()
|
||||||
|
|
||||||
} //end class PreloadingCardFactory
|
} //end class PreloadingCardFactory
|
||||||
|
|||||||
Reference in New Issue
Block a user