[AFR] added dungeon support in image/card view, images download, Card Viewer, verify tests;

This commit is contained in:
Oleg Agafonov 2021-08-21 20:29:33 +04:00
parent 654ee7791c
commit 2b2a2d085a
8 changed files with 107 additions and 25 deletions

View file

@ -318,6 +318,33 @@ public class MageBook extends JComponent {
}
}
// dungeons
List<CardDownloadData> allDungeons = getTokenCardUrls();
for (CardDownloadData dungeon : allDungeons) {
if (dungeon.getSet().equals(currentSet)) {
try {
String className = dungeon.getName();
if (dungeon.getTokenClassName() != null && dungeon.getTokenClassName().length() > 0) {
if (dungeon.getTokenClassName().toLowerCase(Locale.ENGLISH).matches(".*dungeon.*")) {
className = dungeon.getTokenClassName();
className = "mage.game.command.dungeons." + className;
}
} else {
continue;
}
Class<?> c = Class.forName(className);
Constructor<?> cons = c.getConstructor();
Object newDungeon = cons.newInstance();
if (newDungeon instanceof Dungeon) {
((Dungeon) newDungeon).setExpansionSetCodeForImage(currentSet);
res.add(newDungeon);
}
} catch (ClassNotFoundException | InvocationTargetException | IllegalArgumentException | IllegalAccessException | InstantiationException | SecurityException | NoSuchMethodException ex) {
// Swallow exception
}
}
}
return res;
}

View file

@ -550,7 +550,6 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true);
card.setTokenClassName(tokenClassName);
list.add(card);
// logger.debug("Token: " + set + "/" + card.getName() + " type: " + type);
} else if (params[1].toLowerCase(Locale.ENGLISH).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);
@ -571,6 +570,11 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
CardDownloadData card = new CardDownloadData(params[3], set, "0", false, type, "", "", true, fileName);
card.setTokenClassName(tokenClassName);
list.add(card);
} else if (params[1].toLowerCase(Locale.ENGLISH).equals("generate") && params[2].startsWith("DUNGEON:")) {
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 {
logger.error("wrong line format in tokens file: " + line);
}