mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
LQ setless images will be appended a number (1) if they exist in multiple prints in any set.
This commit is contained in:
@@ -196,24 +196,26 @@ public class ImageCache {
|
|||||||
s.append(ImageCache.toMWSFilename(nameToUse));
|
s.append(ImageCache.toMWSFilename(nameToUse));
|
||||||
|
|
||||||
final int cntPictures;
|
final int cntPictures;
|
||||||
|
final boolean hasManyPictures;
|
||||||
if (includeSet) {
|
if (includeSet) {
|
||||||
cntPictures = card.getEditionInfo(edition).getCopiesCount();
|
cntPictures = card.getEditionInfo(edition).getCopiesCount();
|
||||||
|
hasManyPictures = cntPictures > 1;
|
||||||
} else {
|
} else {
|
||||||
// without set number of pictures equals number of urls provided in Svar:Picture
|
// without set number of pictures equals number of urls provided in Svar:Picture
|
||||||
String urls = backFace ? card.getPictureOtherSideUrl() : card.getPictureUrl();
|
String urls = backFace ? card.getPictureOtherSideUrl() : card.getPictureUrl();
|
||||||
cntPictures = StringUtils.countMatches(urls, "\\\\") + 1;
|
cntPictures = StringUtils.countMatches(urls, "\\\\") + 1;
|
||||||
|
|
||||||
// // raise the art index limit to the maximum of the sets this card was printed in
|
// raise the art index limit to the maximum of the sets this card was printed in
|
||||||
// int maxCntPictures = 1;
|
int maxCntPictures = 1;
|
||||||
// for (String set : card.getSets()) {
|
for (String set : card.getSets()) {
|
||||||
// maxCntPictures = Math.max(maxCntPictures, card.getEditionInfo(set).getCopiesCount());
|
maxCntPictures = Math.max(maxCntPictures, card.getEditionInfo(set).getCopiesCount());
|
||||||
// }
|
}
|
||||||
// cntPictures = maxCntPictures;
|
hasManyPictures = maxCntPictures > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int artIdx = cp.getArtIndex();
|
int artIdx = cp.getArtIndex();
|
||||||
if (cntPictures > 1 ) {
|
if (hasManyPictures) {
|
||||||
if ( cntPictures <= artIdx )
|
if ( cntPictures <= artIdx ) // prevent overflow
|
||||||
artIdx = cntPictures == 1 ? 0 : artIdx % cntPictures;
|
artIdx = cntPictures == 1 ? 0 : artIdx % cntPictures;
|
||||||
s.append(artIdx + 1);
|
s.append(artIdx + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,12 +64,12 @@ final class ImageLoader extends CacheLoader<String, BufferedImage> {
|
|||||||
if (null == ret && filename.contains("/")) {
|
if (null == ret && filename.contains("/")) {
|
||||||
setlessFilename = filename.substring(filename.indexOf('/') + 1);
|
setlessFilename = filename.substring(filename.indexOf('/') + 1);
|
||||||
ret = _findFile(key, path, setlessFilename);
|
ret = _findFile(key, path, setlessFilename);
|
||||||
}
|
|
||||||
|
|
||||||
// try lowering the art index to the minimum for regular cards
|
// try lowering the art index to the minimum for regular cards
|
||||||
if (null == ret && null != setlessFilename && setlessFilename.contains(".full")) {
|
if (null == ret && setlessFilename.contains(".full")) {
|
||||||
ret = _findFile(key, path, setlessFilename.replaceAll("[0-9]*[.]full", "1.full"));
|
ret = _findFile(key, path, setlessFilename.replaceAll("[0-9]*[.]full", "1.full"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (null == ret) {
|
if (null == ret) {
|
||||||
System.out.println("File not found, no image created: " + key);
|
System.out.println("File not found, no image created: " + key);
|
||||||
|
|||||||
Reference in New Issue
Block a user