mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix token related crash
This commit is contained in:
@@ -6,7 +6,6 @@ import forge.card.CardDb;
|
|||||||
import forge.card.CardRules;
|
import forge.card.CardRules;
|
||||||
import forge.card.CardSplitType;
|
import forge.card.CardSplitType;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.item.PaperToken;
|
|
||||||
|
|
||||||
public class ImageUtil {
|
public class ImageUtil {
|
||||||
public static float getNearestHQSize(float baseSize, float actualSize) {
|
public static float getNearestHQSize(float baseSize, float actualSize) {
|
||||||
@@ -30,28 +29,6 @@ public class ImageUtil {
|
|||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PaperToken getPaperTokenFromImageKey(String key) {
|
|
||||||
if ( key == null ) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
key = key.substring(2);
|
|
||||||
int index = key.lastIndexOf('_');
|
|
||||||
if (index != -1) {
|
|
||||||
String script = key.substring(0, index);
|
|
||||||
String edition = key.substring(index + 1);
|
|
||||||
if (script.startsWith("emblem"))
|
|
||||||
return null;
|
|
||||||
if (null == StaticData.instance().getCardEdition(edition)) {
|
|
||||||
script = key;
|
|
||||||
edition = "???";
|
|
||||||
}
|
|
||||||
script = script.replaceAll("[0-9]*$", "");
|
|
||||||
return StaticData.instance().getAllTokens().getToken(script, edition);
|
|
||||||
}
|
|
||||||
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) {
|
||||||
|
|||||||
@@ -165,8 +165,6 @@ public class ImageCache {
|
|||||||
if (StringUtils.isBlank(imageKey)) {
|
if (StringUtils.isBlank(imageKey)) {
|
||||||
return _defaultImage;
|
return _defaultImage;
|
||||||
}
|
}
|
||||||
} else if (imageKey.startsWith(ImageKeys.TOKEN_PREFIX) && cardView != null && cardView.isToken()) {
|
|
||||||
ipc = ImageUtil.getPaperTokenFromImageKey(imageKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load from file and add to cache if not found in cache initially.
|
// Load from file and add to cache if not found in cache initially.
|
||||||
|
|||||||
Reference in New Issue
Block a user