mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Custom content fixes
Method to get token data was not good, it failed with tokens with image keys different to the script name. Current method just checks for the token's edition instead. Removed a few now unused bits of code.
This commit is contained in:
@@ -227,9 +227,6 @@ public class StaticData {
|
|||||||
public void attemptToLoadCard(String cardName, String setCode) {
|
public void attemptToLoadCard(String cardName, String setCode) {
|
||||||
CardRules rules = cardReader.attemptToLoadCard(cardName);
|
CardRules rules = cardReader.attemptToLoadCard(cardName);
|
||||||
CardRules customRules = null;
|
CardRules customRules = null;
|
||||||
if (customCardReader != null) {
|
|
||||||
customRules = customCardReader.attemptToLoadCard(cardName);
|
|
||||||
}
|
|
||||||
if (rules != null) {
|
if (rules != null) {
|
||||||
if (rules.isVariant()) {
|
if (rules.isVariant()) {
|
||||||
variantCards.loadCard(cardName, setCode, rules);
|
variantCards.loadCard(cardName, setCode, rules);
|
||||||
@@ -237,13 +234,6 @@ public class StaticData {
|
|||||||
commonCards.loadCard(cardName, setCode, rules);
|
commonCards.loadCard(cardName, setCode, rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (customRules != null) {
|
|
||||||
if (customRules.isVariant()) {
|
|
||||||
variantCards.loadCard(cardName, setCode, customRules);
|
|
||||||
} else {
|
|
||||||
commonCards.loadCard(cardName, setCode, customRules);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,15 +27,6 @@ public class ImageUtil {
|
|||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PaperToken getPaperTokenFromImageKey(String key) {
|
|
||||||
if (key == null) return null;
|
|
||||||
String[] data = key.split("[_](?=[^_]*$)");
|
|
||||||
if (data.length == 2) {
|
|
||||||
return StaticData.instance().getAllTokens().getToken(data[0], data[1].toUpperCase());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getImageRelativePath(PaperCard cp, boolean backFace, boolean includeSet, boolean isDownloadUrl) {
|
public static String getImageRelativePath(PaperCard cp, boolean backFace, boolean includeSet, boolean isDownloadUrl) {
|
||||||
final String nameToUse = cp == null ? null : getNameToUse(cp, backFace);
|
final String nameToUse = cp == null ? null : getNameToUse(cp, backFace);
|
||||||
if (nameToUse == null) {
|
if (nameToUse == null) {
|
||||||
|
|||||||
@@ -115,8 +115,11 @@ public abstract class ImageFetcher {
|
|||||||
final String filename = imageKey.substring(2) + ".jpg";
|
final String filename = imageKey.substring(2) + ".jpg";
|
||||||
String tokenUrl = tokenImages.get(filename);
|
String tokenUrl = tokenImages.get(filename);
|
||||||
if (tokenUrl == null) {
|
if (tokenUrl == null) {
|
||||||
PaperToken T = ImageUtil.getPaperTokenFromImageKey(imageKey.substring(2));
|
String[] tempdata = imageKey.split("[_](?=[^_]*$)"); //We want to check the edition first.
|
||||||
if (T.getRules().isCustom()) return; //Custom token, do not fetch image.
|
if(tempdata.length == 2){
|
||||||
|
CardEdition E = StaticData.instance().getEditions().get(tempdata[1]);
|
||||||
|
if (E.getType() == CardEdition.Type.CUSTOM_SET) return; //Custom set token, skip fetching.
|
||||||
|
}
|
||||||
System.err
|
System.err
|
||||||
.println("No specified file for '" + filename + "'.. Attempting to download from default Url");
|
.println("No specified file for '" + filename + "'.. Attempting to download from default Url");
|
||||||
tokenUrl = String.format("%s%s", ForgeConstants.URL_TOKEN_DOWNLOAD, filename);
|
tokenUrl = String.format("%s%s", ForgeConstants.URL_TOKEN_DOWNLOAD, filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user