forked from External/mage
[CardRepository] replaced Sets.findCard(setCode, cardNum)
This commit is contained in:
parent
8d83251428
commit
271aaab5fd
2 changed files with 5 additions and 20 deletions
|
|
@ -28,7 +28,9 @@
|
||||||
|
|
||||||
package mage.client.util;
|
package mage.client.util;
|
||||||
|
|
||||||
import mage.sets.Sets;
|
import mage.cards.Card;
|
||||||
|
import mage.cards.repository.CardInfo;
|
||||||
|
import mage.cards.repository.CardRepository;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
import mage.view.SimpleCardView;
|
import mage.view.SimpleCardView;
|
||||||
|
|
@ -44,9 +46,9 @@ public class CardsViewUtil {
|
||||||
CardsView cards = new CardsView();
|
CardsView cards = new CardsView();
|
||||||
|
|
||||||
for (SimpleCardView simple: view.values()) {
|
for (SimpleCardView simple: view.values()) {
|
||||||
mage.cards.Card card = Sets.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
CardInfo cardInfo = CardRepository.instance.findCard(simple.getExpansionSetCode(), simple.getCardNumber());
|
||||||
|
Card card = cardInfo != null ? cardInfo.getCard() : null;
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
|
||||||
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
cards.put(simple.getId(), new CardView(card, simple.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -305,23 +305,6 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Card findCard(String expansionsetCode, int cardNum) {
|
|
||||||
if (cardMap.containsKey(expansionsetCode + Integer.toString(cardNum))) {
|
|
||||||
return cardMap.get(expansionsetCode + Integer.toString(cardNum));
|
|
||||||
}
|
|
||||||
if (fINSTANCE.containsKey(expansionsetCode)) {
|
|
||||||
ExpansionSet set = fINSTANCE.get(expansionsetCode);
|
|
||||||
Card card = set.findCard(cardNum);
|
|
||||||
if (card != null) {
|
|
||||||
cardMap.put(expansionsetCode + Integer.toString(cardNum), card);
|
|
||||||
return card;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.warn("Could not find card: set=" + expansionsetCode + "cardNum=" + Integer.toString(cardNum));
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Card createCard(Class clazz) {
|
public static Card createCard(Class clazz) {
|
||||||
try {
|
try {
|
||||||
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
|
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue