forked from External/mage
[AFR] added dungeon support in image/card view, images download, Card Viewer, verify tests;
This commit is contained in:
parent
654ee7791c
commit
2b2a2d085a
8 changed files with 107 additions and 25 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue