mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
refactor some vars, and save to deck file
todo validate
This commit is contained in:
@@ -42,6 +42,7 @@ import java.util.stream.Collectors;
|
|||||||
public final class CardDb implements ICardDatabase, IDeckGenPool {
|
public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||||
public final static String foilSuffix = "+";
|
public final static String foilSuffix = "+";
|
||||||
public final static char NameSetSeparator = '|';
|
public final static char NameSetSeparator = '|';
|
||||||
|
public final static String colorIDPrefix = "#";
|
||||||
private final String exlcudedCardName = "Concentrate";
|
private final String exlcudedCardName = "Concentrate";
|
||||||
private final String exlcudedCardSet = "DS0";
|
private final String exlcudedCardSet = "DS0";
|
||||||
|
|
||||||
@@ -90,13 +91,19 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
public int artIndex;
|
public int artIndex;
|
||||||
public boolean isFoil;
|
public boolean isFoil;
|
||||||
public String collectorNumber;
|
public String collectorNumber;
|
||||||
|
public List<String> colorID;
|
||||||
|
|
||||||
private CardRequest(String name, String edition, int artIndex, boolean isFoil, String collectorNumber) {
|
private CardRequest(String name, String edition, int artIndex, boolean isFoil, String collectorNumber) {
|
||||||
|
this(name, edition, artIndex, isFoil, collectorNumber, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CardRequest(String name, String edition, int artIndex, boolean isFoil, String collectorNumber, List<String> colorID) {
|
||||||
cardName = name;
|
cardName = name;
|
||||||
this.edition = edition;
|
this.edition = edition;
|
||||||
this.artIndex = artIndex;
|
this.artIndex = artIndex;
|
||||||
this.isFoil = isFoil;
|
this.isFoil = isFoil;
|
||||||
this.collectorNumber = collectorNumber;
|
this.collectorNumber = collectorNumber;
|
||||||
|
this.colorID = colorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFoilCardName(final String cardName){
|
public static boolean isFoilCardName(final String cardName){
|
||||||
@@ -125,6 +132,14 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
return requestInfo + NameSetSeparator + artIndex;
|
return requestInfo + NameSetSeparator + artIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String compose(String cardName, String setCode, int artIndex, List<String> colorID) {
|
||||||
|
String requestInfo = compose(cardName, setCode);
|
||||||
|
artIndex = Math.max(artIndex, IPaperCard.DEFAULT_ART_INDEX);
|
||||||
|
String cid = colorID == null ? "" : NameSetSeparator +
|
||||||
|
colorID.toString().replace("[", colorIDPrefix).replace(", ", colorIDPrefix).replace("]", "");
|
||||||
|
return requestInfo + NameSetSeparator + artIndex + cid;
|
||||||
|
}
|
||||||
|
|
||||||
public static String compose(String cardName, String setCode, String collectorNumber) {
|
public static String compose(String cardName, String setCode, String collectorNumber) {
|
||||||
String requestInfo = compose(cardName, setCode);
|
String requestInfo = compose(cardName, setCode);
|
||||||
// CollectorNumber will be wrapped in square brackets
|
// CollectorNumber will be wrapped in square brackets
|
||||||
@@ -154,6 +169,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
return s.startsWith("[") && s.endsWith("]");
|
return s.startsWith("[") && s.endsWith("]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isColorIDString(String s) {
|
||||||
|
return s.startsWith(colorIDPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isArtIndex(String s) {
|
private static boolean isArtIndex(String s) {
|
||||||
return StringUtils.isNumeric(s) && s.length() <= 2 ; // only artIndex between 1-99
|
return StringUtils.isNumeric(s) && s.length() <= 2 ; // only artIndex between 1-99
|
||||||
}
|
}
|
||||||
@@ -171,7 +190,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
String cardName = info[0];
|
String cardName = info[0];
|
||||||
String setCode = info[1];
|
String setCode = info[1];
|
||||||
int artIndex = Integer.parseInt(info[2]);
|
int artIndex = Integer.parseInt(info[2]);
|
||||||
return new CardRequest(cardName, setCode, artIndex, isFoil, IPaperCard.NO_COLLECTOR_NUMBER);
|
return new CardRequest(cardName, setCode, artIndex, isFoil, IPaperCard.NO_COLLECTOR_NUMBER, null);
|
||||||
} catch (NumberFormatException ex){ return null; }
|
} catch (NumberFormatException ex){ return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,22 +202,29 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
int setPos;
|
int setPos;
|
||||||
int artPos;
|
int artPos;
|
||||||
int cNrPos;
|
int cNrPos;
|
||||||
|
int clrPos;
|
||||||
if (info.length >= 4) { // name|set|artIndex|[collNr]
|
if (info.length >= 4) { // name|set|artIndex|[collNr]
|
||||||
setPos = isSetCode(info[1]) ? 1 : -1;
|
setPos = isSetCode(info[1]) ? 1 : -1;
|
||||||
artPos = isArtIndex(info[2]) ? 2 : -1;
|
artPos = isArtIndex(info[2]) ? 2 : -1;
|
||||||
cNrPos = isCollectorNumber(info[3]) ? 3 : -1;
|
cNrPos = isCollectorNumber(info[3]) ? 3 : -1;
|
||||||
|
int pos = cNrPos > 0 ? 4 : 3;
|
||||||
|
clrPos = isColorIDString(info[pos]) ? pos : -1;
|
||||||
} else if (info.length == 3) { // name|set|artIndex (or CollNr)
|
} else if (info.length == 3) { // name|set|artIndex (or CollNr)
|
||||||
setPos = isSetCode(info[1]) ? 1 : -1;
|
setPos = isSetCode(info[1]) ? 1 : -1;
|
||||||
artPos = isArtIndex(info[2]) ? 2 : -1;
|
artPos = isArtIndex(info[2]) ? 2 : -1;
|
||||||
cNrPos = isCollectorNumber(info[2]) ? 2 : -1;
|
cNrPos = isCollectorNumber(info[2]) ? 2 : -1;
|
||||||
|
int pos = cNrPos > 0 ? 3 : 2;
|
||||||
|
clrPos = isColorIDString(info[pos]) ? pos : -1;
|
||||||
} else if (info.length == 2) { // name|set (or artIndex, even if not possible via compose)
|
} else if (info.length == 2) { // name|set (or artIndex, even if not possible via compose)
|
||||||
setPos = isSetCode(info[1]) ? 1 : -1;
|
setPos = isSetCode(info[1]) ? 1 : -1;
|
||||||
artPos = isArtIndex(info[1]) ? 1 : -1;
|
artPos = isArtIndex(info[1]) ? 1 : -1;
|
||||||
cNrPos = -1;
|
cNrPos = -1;
|
||||||
|
clrPos = -1;
|
||||||
} else {
|
} else {
|
||||||
setPos = -1;
|
setPos = -1;
|
||||||
artPos = -1;
|
artPos = -1;
|
||||||
cNrPos = -1;
|
cNrPos = -1;
|
||||||
|
clrPos = -1;
|
||||||
}
|
}
|
||||||
String cardName = info[0];
|
String cardName = info[0];
|
||||||
boolean isFoil = false;
|
boolean isFoil = false;
|
||||||
@@ -209,6 +235,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
int artIndex = artPos > 0 ? Integer.parseInt(info[artPos]) : IPaperCard.NO_ART_INDEX; // default: no art index
|
int artIndex = artPos > 0 ? Integer.parseInt(info[artPos]) : IPaperCard.NO_ART_INDEX; // default: no art index
|
||||||
String collectorNumber = cNrPos > 0 ? info[cNrPos].substring(1, info[cNrPos].length() - 1) : IPaperCard.NO_COLLECTOR_NUMBER;
|
String collectorNumber = cNrPos > 0 ? info[cNrPos].substring(1, info[cNrPos].length() - 1) : IPaperCard.NO_COLLECTOR_NUMBER;
|
||||||
String setCode = setPos > 0 ? info[setPos] : null;
|
String setCode = setPos > 0 ? info[setPos] : null;
|
||||||
|
List<String> colorID = clrPos > 0 ? Arrays.stream(info[clrPos].substring(1).split(colorIDPrefix)).collect(Collectors.toList()) : null;
|
||||||
if (setCode != null && setCode.equals(CardEdition.UNKNOWN.getCode())) { // ???
|
if (setCode != null && setCode.equals(CardEdition.UNKNOWN.getCode())) { // ???
|
||||||
setCode = null;
|
setCode = null;
|
||||||
}
|
}
|
||||||
@@ -224,7 +251,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
// finally, check whether any between artIndex and CollectorNumber has been set
|
// finally, check whether any between artIndex and CollectorNumber has been set
|
||||||
if (collectorNumber.equals(IPaperCard.NO_COLLECTOR_NUMBER) && artIndex == IPaperCard.NO_ART_INDEX)
|
if (collectorNumber.equals(IPaperCard.NO_COLLECTOR_NUMBER) && artIndex == IPaperCard.NO_ART_INDEX)
|
||||||
artIndex = IPaperCard.DEFAULT_ART_INDEX;
|
artIndex = IPaperCard.DEFAULT_ART_INDEX;
|
||||||
return new CardRequest(cardName, setCode, artIndex, isFoil, collectorNumber);
|
return new CardRequest(cardName, setCode, artIndex, isFoil, collectorNumber, colorID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,6 +596,13 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
return tryGetCard(request);
|
return tryGetCard(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PaperCard getCard(final String cardName, String setCode, int artIndex, List<String> colorID) {
|
||||||
|
String reqInfo = CardRequest.compose(cardName, setCode, artIndex, colorID);
|
||||||
|
CardRequest request = CardRequest.fromString(reqInfo);
|
||||||
|
return tryGetCard(request);
|
||||||
|
}
|
||||||
|
|
||||||
private PaperCard tryGetCard(CardRequest request) {
|
private PaperCard tryGetCard(CardRequest request) {
|
||||||
// Before doing anything, check that a non-null request has been provided
|
// Before doing anything, check that a non-null request has been provided
|
||||||
if (request == null)
|
if (request == null)
|
||||||
@@ -1128,6 +1162,11 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
if (artCount >= IPaperCard.DEFAULT_ART_INDEX) {
|
if (artCount >= IPaperCard.DEFAULT_ART_INDEX) {
|
||||||
sb.append(CardDb.NameSetSeparator).append(card.getArtIndex()); // indexes start at 1 to match image file name conventions
|
sb.append(CardDb.NameSetSeparator).append(card.getArtIndex()); // indexes start at 1 to match image file name conventions
|
||||||
}
|
}
|
||||||
|
if (card.getColorID() != null) {
|
||||||
|
sb.append(CardDb.NameSetSeparator);
|
||||||
|
for (String color : card.getColorID())
|
||||||
|
sb.append(CardDb.colorIDPrefix).append(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb;
|
return sb;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public interface ICardDatabase extends Iterable<PaperCard> {
|
|||||||
// [NEW Methods] Including the card CollectorNumber as criterion for DB lookup
|
// [NEW Methods] Including the card CollectorNumber as criterion for DB lookup
|
||||||
PaperCard getCard(String cardName, String edition, String collectorNumber);
|
PaperCard getCard(String cardName, String edition, String collectorNumber);
|
||||||
PaperCard getCard(String cardName, String edition, int artIndex, String collectorNumber);
|
PaperCard getCard(String cardName, String edition, int artIndex, String collectorNumber);
|
||||||
|
PaperCard getCard(String cardName, String edition, int artIndex, List<String> colorID);
|
||||||
|
|
||||||
// 2. Card Lookup from a single Expansion Set
|
// 2. Card Lookup from a single Expansion Set
|
||||||
PaperCard getCardFromSet(String cardName, CardEdition edition, boolean isFoil); // NOT yet used, included for API symmetry
|
PaperCard getCardFromSet(String cardName, CardEdition edition, boolean isFoil); // NOT yet used, included for API symmetry
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class CardPool extends ItemPool<PaperCard> {
|
|||||||
|
|
||||||
public void add(final String cardRequest, final int amount) {
|
public void add(final String cardRequest, final int amount) {
|
||||||
CardDb.CardRequest request = CardDb.CardRequest.fromString(cardRequest);
|
CardDb.CardRequest request = CardDb.CardRequest.fromString(cardRequest);
|
||||||
this.add(CardDb.CardRequest.compose(request.cardName, request.isFoil), request.edition, request.artIndex, amount);
|
this.add(CardDb.CardRequest.compose(request.cardName, request.isFoil), request.edition, request.artIndex, amount, false, request.colorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(final String cardName, final String setCode) {
|
public void add(final String cardName, final String setCode) {
|
||||||
@@ -65,14 +65,14 @@ public class CardPool extends ItemPool<PaperCard> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void add(final String cardName, final String setCode, final int amount, boolean addAny) {
|
public void add(final String cardName, final String setCode, final int amount, boolean addAny) {
|
||||||
this.add(cardName, setCode, IPaperCard.NO_ART_INDEX, amount, addAny);
|
this.add(cardName, setCode, IPaperCard.NO_ART_INDEX, amount, addAny, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: ART indices are "1" -based
|
// NOTE: ART indices are "1" -based
|
||||||
public void add(String cardName, String setCode, int artIndex, final int amount) {
|
public void add(String cardName, String setCode, int artIndex, final int amount) {
|
||||||
this.add(cardName, setCode, artIndex, amount, false);
|
this.add(cardName, setCode, artIndex, amount, false, null);
|
||||||
}
|
}
|
||||||
public void add(String cardName, String setCode, int artIndex, final int amount, boolean addAny) {
|
public void add(String cardName, String setCode, int artIndex, final int amount, boolean addAny, List<String> colorID) {
|
||||||
Map<String, CardDb> dbs = StaticData.instance().getAvailableDatabases();
|
Map<String, CardDb> dbs = StaticData.instance().getAvailableDatabases();
|
||||||
PaperCard paperCard = null;
|
PaperCard paperCard = null;
|
||||||
String selectedDbName = "";
|
String selectedDbName = "";
|
||||||
@@ -82,7 +82,7 @@ public class CardPool extends ItemPool<PaperCard> {
|
|||||||
for (Map.Entry<String, CardDb> entry: dbs.entrySet()){
|
for (Map.Entry<String, CardDb> entry: dbs.entrySet()){
|
||||||
String dbName = entry.getKey();
|
String dbName = entry.getKey();
|
||||||
CardDb db = entry.getValue();
|
CardDb db = entry.getValue();
|
||||||
paperCard = db.getCard(cardName, setCode, artIndex);
|
paperCard = db.getCard(cardName, setCode, artIndex, colorID);
|
||||||
if (paperCard != null) {
|
if (paperCard != null) {
|
||||||
selectedDbName = dbName;
|
selectedDbName = dbName;
|
||||||
break;
|
break;
|
||||||
@@ -124,7 +124,7 @@ public class CardPool extends ItemPool<PaperCard> {
|
|||||||
int cnt = artGroups[i - 1];
|
int cnt = artGroups[i - 1];
|
||||||
if (cnt <= 0)
|
if (cnt <= 0)
|
||||||
continue;
|
continue;
|
||||||
PaperCard randomCard = cardDb.getCard(cardName, setCode, i);
|
PaperCard randomCard = cardDb.getCard(cardName, setCode, i, colorID);
|
||||||
this.add(randomCard, cnt);
|
this.add(randomCard, cnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -337,7 +337,7 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
int amount = entry.getValue();
|
int amount = entry.getValue();
|
||||||
String poolCardRequest = CardDb.CardRequest.compose(
|
String poolCardRequest = CardDb.CardRequest.compose(
|
||||||
card.isFoil() ? CardDb.CardRequest.compose(card.getName(), true) : card.getName(),
|
card.isFoil() ? CardDb.CardRequest.compose(card.getName(), true) : card.getName(),
|
||||||
card.getEdition(), card.getArtIndex());
|
card.getEdition(), card.getArtIndex(), card.getColorID());
|
||||||
String originalRequestCandidate = null;
|
String originalRequestCandidate = null;
|
||||||
for (Pair<String, Integer> originalRequest : originalCardRequests){
|
for (Pair<String, Integer> originalRequest : originalCardRequests){
|
||||||
String cardRequest = originalRequest.getLeft();
|
String cardRequest = originalRequest.getLeft();
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ public interface IPaperCard extends InventoryItem, Serializable {
|
|||||||
String getEdition();
|
String getEdition();
|
||||||
String getCollectorNumber();
|
String getCollectorNumber();
|
||||||
String getFunctionalVariant();
|
String getFunctionalVariant();
|
||||||
List<String> getSpireColors();
|
List<String> getColorID();
|
||||||
int getArtIndex();
|
int getArtIndex();
|
||||||
boolean isFoil();
|
boolean isFoil();
|
||||||
boolean isToken();
|
boolean isToken();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
private final boolean foil;
|
private final boolean foil;
|
||||||
private Boolean hasImage;
|
private Boolean hasImage;
|
||||||
private final boolean noSell;
|
private final boolean noSell;
|
||||||
private List<String> spireColors;
|
private List<String> colorID;
|
||||||
private String sortableName;
|
private String sortableName;
|
||||||
private final String functionalVariant;
|
private final String functionalVariant;
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getSpireColors() {
|
public List<String> getColorID() {
|
||||||
return spireColors;
|
return colorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -222,7 +222,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
sortableName = TextUtil.toSortableName(CardTranslation.getTranslatedName(rules0.getName()));
|
sortableName = TextUtil.toSortableName(CardTranslation.getTranslatedName(rules0.getName()));
|
||||||
this.functionalVariant = functionalVariant != null ? functionalVariant : IPaperCard.NO_FUNCTIONAL_VARIANT;
|
this.functionalVariant = functionalVariant != null ? functionalVariant : IPaperCard.NO_FUNCTIONAL_VARIANT;
|
||||||
noSell = noSell0;
|
noSell = noSell0;
|
||||||
spireColors = spires;
|
colorID = spires;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PaperCard FAKE_CARD = new PaperCard(CardRules.getUnsupportedCardNamed("Fake Card"), "Fake Edition", CardRarity.Common);
|
public static PaperCard FAKE_CARD = new PaperCard(CardRules.getUnsupportedCardNamed("Fake Card"), "Fake Edition", CardRarity.Common);
|
||||||
@@ -261,7 +261,7 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int code = (name.hashCode() * 11) + (edition.hashCode() * 59) +
|
final int code = (name.hashCode() * 11) + (edition.hashCode() * 59) +
|
||||||
(artIndex * 2) + (getCollectorNumber().hashCode() * 383);
|
(artIndex * 2) + (getCollectorNumber().hashCode() * 383);
|
||||||
final int id = spireColors == null ? 0 : spireColors.hashCode();
|
final int id = colorID == null ? 0 : colorID.hashCode();
|
||||||
if (foil) {
|
if (foil) {
|
||||||
return code + id + 1;
|
return code + id + 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class PaperToken implements InventoryItemFromSet, IPaperCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getSpireColors() {
|
public List<String> getColorID() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
|||||||
view.updateClassLevel(this);
|
view.updateClassLevel(this);
|
||||||
view.updateDraftAction(this);
|
view.updateDraftAction(this);
|
||||||
if (paperCard != null)
|
if (paperCard != null)
|
||||||
setChosenColorID(paperCard.getSpireColors());
|
setChosenColorID(paperCard.getColorID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean changeToState(final CardStateName state) {
|
public boolean changeToState(final CardStateName state) {
|
||||||
|
|||||||
@@ -1846,7 +1846,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
menu.addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblColorIdentity"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, e -> {
|
menu.addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblColorIdentity"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, e -> {
|
||||||
//sort options so current option is on top and selected by default
|
//sort options so current option is on top and selected by default
|
||||||
List<String> colorChoices = new ArrayList<>(MagicColor.Constant.ONLY_COLORS);
|
List<String> colorChoices = new ArrayList<>(MagicColor.Constant.ONLY_COLORS);
|
||||||
GuiChoose.getChoices(Forge.getLocalizer().getMessage("lblChooseNColors", Lang.getNumeral(2)), 2, 2, colorChoices, new Callback<>() {
|
GuiChoose.getChoices(Forge.getLocalizer().getMessage("lblChooseAColor", Lang.getNumeral(2)), 2, 2, colorChoices, new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(List<String> result) {
|
public void run(List<String> result) {
|
||||||
addCard(card.getSpireVersion(result));
|
addCard(card.getSpireVersion(result));
|
||||||
@@ -1898,7 +1898,7 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
|
|||||||
menu.addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblColorIdentity"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, e -> {
|
menu.addItem(new FMenuItem(Forge.getLocalizer().getMessage("lblColorIdentity"), Forge.hdbuttons ? FSkinImage.HDPREFERENCE : FSkinImage.SETTINGS, e -> {
|
||||||
//sort options so current option is on top and selected by default
|
//sort options so current option is on top and selected by default
|
||||||
List<String> colorChoices = new ArrayList<>(MagicColor.Constant.ONLY_COLORS);
|
List<String> colorChoices = new ArrayList<>(MagicColor.Constant.ONLY_COLORS);
|
||||||
GuiChoose.getChoices(Forge.getLocalizer().getMessage("lblChooseNColors", Lang.getNumeral(2)), 2, 2, colorChoices, new Callback<>() {
|
GuiChoose.getChoices(Forge.getLocalizer().getMessage("lblChooseAColor", Lang.getNumeral(2)), 2, 2, colorChoices, new Callback<>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(List<String> result) {
|
public void run(List<String> result) {
|
||||||
addCard(card.getSpireVersion(result));
|
addCard(card.getSpireVersion(result));
|
||||||
|
|||||||
@@ -1057,8 +1057,8 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
draftRankImage = FSkinImage.DRAFTRANK_C;
|
draftRankImage = FSkinImage.DRAFTRANK_C;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((PaperCard) item).getSpireColors() != null) {
|
if (((PaperCard) item).getColorID() != null) {
|
||||||
for (String s : ((PaperCard) item).getSpireColors()) {
|
for (String s : ((PaperCard) item).getColorID()) {
|
||||||
if ("white".equalsIgnoreCase(s))
|
if ("white".equalsIgnoreCase(s))
|
||||||
colorID.append("{W}");
|
colorID.append("{W}");
|
||||||
if ("green".equalsIgnoreCase(s))
|
if ("green".equalsIgnoreCase(s))
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public enum ColumnDef {
|
|||||||
NAME("lblName", "lblName", 180, false, SortState.ASC,
|
NAME("lblName", "lblName", 180, false, SortState.ASC,
|
||||||
from -> {
|
from -> {
|
||||||
if (from.getKey() instanceof PaperCard) {
|
if (from.getKey() instanceof PaperCard) {
|
||||||
String spire = ((PaperCard) from.getKey()).getSpireColors() == null ? "" : ((PaperCard) from.getKey()).getSpireColors().toString();
|
String spire = ((PaperCard) from.getKey()).getColorID() == null ? "" : ((PaperCard) from.getKey()).getColorID().toString();
|
||||||
String sortableName = ((PaperCard)from.getKey()).getSortableName();
|
String sortableName = ((PaperCard)from.getKey()).getSortableName();
|
||||||
return sortableName == null ? TextUtil.toSortableName(from.getKey().getName() + spire) : sortableName + spire;
|
return sortableName == null ? TextUtil.toSortableName(from.getKey().getName() + spire) : sortableName + spire;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user