forked from External/mage
Token refactor
This commit is contained in:
parent
a532368b84
commit
e73e7d8600
20 changed files with 1449 additions and 744 deletions
|
|
@ -79,7 +79,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
protected UUID gameId;
|
||||
private TransferData data = new TransferData();
|
||||
|
||||
private final boolean isPermanent;
|
||||
private boolean isPermanent;
|
||||
private boolean hasSickness;
|
||||
private String zone;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
this.gameId = gameId;
|
||||
|
||||
// Gather info about the card
|
||||
this.isPermanent = this.gameCard instanceof PermanentView;
|
||||
this.isPermanent = this.gameCard instanceof PermanentView && !this.gameCard.inViewerOnly();
|
||||
if (isPermanent) {
|
||||
this.hasSickness = ((PermanentView) this.gameCard).hasSummoningSickness();
|
||||
}
|
||||
|
|
@ -202,6 +202,10 @@ public abstract class CardPanel extends MagePermanent implements MouseListener,
|
|||
updateArtImage();
|
||||
}
|
||||
}
|
||||
|
||||
public void setIsPermanent(boolean isPermanent) {
|
||||
this.isPermanent = isPermanent;
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
if (dayNightButton != null) {
|
||||
|
|
|
|||
|
|
@ -23,22 +23,27 @@ public class CardDownloadData {
|
|||
private boolean flippedSide;
|
||||
private boolean splitCard;
|
||||
private final boolean usesVariousArt;
|
||||
private String tokenClassName;
|
||||
private boolean isType2;
|
||||
|
||||
public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor) {
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, false);
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, false, "");
|
||||
}
|
||||
|
||||
public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token) {
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false);
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false, "");
|
||||
}
|
||||
|
||||
public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token, String fileName) {
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false);
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false, "");
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token, boolean twoFacedCard, boolean secondSide) {
|
||||
this(name, set, collectorId, usesVariousArt, type, tokenSetCode, tokenDescriptor, token, false, false, "");
|
||||
}
|
||||
|
||||
public CardDownloadData(String name, String set, String collectorId, boolean usesVariousArt, Integer type, String tokenSetCode, String tokenDescriptor, boolean token, boolean twoFacedCard, boolean secondSide, String tokenClassName) {
|
||||
this.name = name;
|
||||
this.set = set;
|
||||
this.collectorId = collectorId;
|
||||
|
|
@ -49,6 +54,7 @@ public class CardDownloadData {
|
|||
this.secondSide = secondSide;
|
||||
this.tokenSetCode = tokenSetCode;
|
||||
this.tokenDescriptor = tokenDescriptor;
|
||||
this.tokenClassName = tokenClassName;
|
||||
|
||||
if (this.tokenDescriptor == null || this.tokenDescriptor.equalsIgnoreCase("")) {
|
||||
this.tokenDescriptor = lastDitchTokenDescriptor();
|
||||
|
|
@ -66,6 +72,7 @@ public class CardDownloadData {
|
|||
this.usesVariousArt = card.usesVariousArt;
|
||||
this.tokenSetCode = card.tokenSetCode;
|
||||
this.tokenDescriptor = card.tokenDescriptor;
|
||||
this.tokenClassName = tokenClassName;
|
||||
this.fileName = card.fileName;
|
||||
|
||||
}
|
||||
|
|
@ -156,6 +163,14 @@ public class CardDownloadData {
|
|||
public String getTokenDescriptor() {
|
||||
return tokenDescriptor;
|
||||
}
|
||||
|
||||
public void setTokenClassName(String tokenClassName) {
|
||||
this.tokenClassName = tokenClassName;
|
||||
}
|
||||
|
||||
public String getTokenClassName() {
|
||||
return tokenClassName;
|
||||
}
|
||||
|
||||
public void setTokenDescriptor(String tokenDescriptor) {
|
||||
this.tokenDescriptor = tokenDescriptor;
|
||||
|
|
|
|||
|
|
@ -362,22 +362,30 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
|
|||
if (params.length > 5 && params[5] != null && !params[5].isEmpty()) {
|
||||
fileName = params[5].trim();
|
||||
}
|
||||
String tokenClassName = "";
|
||||
if (params.length > 7 && params[6] != null && !params[6].isEmpty()) {
|
||||
tokenClassName = params[6].trim();
|
||||
}
|
||||
|
||||
if (params[1].toLowerCase().equals("generate") && params[2].startsWith("TOK:")) {
|
||||
String set = params[2].substring(4);
|
||||
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true);
|
||||
card.setTokenClassName(tokenClassName);
|
||||
list.add(card);
|
||||
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM:")) {
|
||||
String set = params[2].substring(7);
|
||||
CardDownloadData card = new CardDownloadData("Emblem " + params[3], set, "0", false, type, "", "", true, fileName);
|
||||
card.setTokenClassName(tokenClassName);
|
||||
list.add(card);
|
||||
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM-:")) {
|
||||
String set = params[2].substring(8);
|
||||
CardDownloadData card = new CardDownloadData(params[3] + " Emblem", set, "0", false, type, "", "", true, fileName);
|
||||
card.setTokenClassName(tokenClassName);
|
||||
list.add(card);
|
||||
} else if (params[1].toLowerCase().equals("generate") && params[2].startsWith("EMBLEM!:")) {
|
||||
String set = params[2].substring(8);
|
||||
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true, fileName);
|
||||
card.setTokenClassName(tokenClassName);
|
||||
list.add(card);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -27,10 +27,12 @@ public final class CardImageUtils {
|
|||
*/
|
||||
public static String generateTokenImagePath(CardDownloadData card) {
|
||||
if (card.isToken()) {
|
||||
if (pathCache.containsKey(card)) {
|
||||
return pathCache.get(card);
|
||||
}
|
||||
String filePath = getTokenImagePath(card);
|
||||
if (pathCache.containsKey(card)) {
|
||||
if (filePath.equals(pathCache.get(card))) {
|
||||
return pathCache.get(card);
|
||||
}
|
||||
}
|
||||
TFile file = new TFile(filePath);
|
||||
|
||||
if (!file.exists() && card.getTokenSetCode() != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue