mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Moved images from cardforge.org to cardforge.link and added missing sets/some product images.
This commit is contained in:
@@ -17,18 +17,8 @@
|
||||
*/
|
||||
package forge.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardRules;
|
||||
import forge.item.IPaperCard;
|
||||
@@ -37,9 +27,15 @@ import forge.model.FModel;
|
||||
import forge.properties.ForgeConstants;
|
||||
import forge.util.FileUtil;
|
||||
import forge.util.ImageUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class ImportSourceAnalyzer {
|
||||
public static enum OpType {
|
||||
|
||||
public enum OpType {
|
||||
CONSTRUCTED_DECK,
|
||||
DRAFT_DECK,
|
||||
PLANAR_DECK,
|
||||
@@ -57,74 +53,75 @@ public class ImportSourceAnalyzer {
|
||||
DB_FILE
|
||||
}
|
||||
|
||||
public static interface AnalysisCallback {
|
||||
public interface AnalysisCallback {
|
||||
boolean checkCancel();
|
||||
void addOp(OpType type, File src, File dest);
|
||||
void addOp(OpType type, File src, File dest);
|
||||
}
|
||||
|
||||
private final File _source;
|
||||
private final AnalysisCallback _cb;
|
||||
private final int _numFilesToAnalyze;
|
||||
private final File source;
|
||||
private final AnalysisCallback cb;
|
||||
private final int numFilesToAnalyze;
|
||||
|
||||
private int _numFilesAnalyzed;
|
||||
private int numFilesAnalyzed;
|
||||
|
||||
public ImportSourceAnalyzer(final String source, final AnalysisCallback cb) {
|
||||
_source = new File(source);
|
||||
_cb = cb;
|
||||
|
||||
_numFilesToAnalyze = _countFiles(_source);
|
||||
this.source = new File(source);
|
||||
this.cb = cb;
|
||||
numFilesToAnalyze = countFiles(this.source);
|
||||
}
|
||||
|
||||
public int getNumFilesToAnalyze() { return _numFilesToAnalyze; }
|
||||
public int getNumFilesAnalyzed() { return _numFilesAnalyzed; }
|
||||
public int getNumFilesToAnalyze() { return numFilesToAnalyze; }
|
||||
public int getNumFilesAnalyzed() { return numFilesAnalyzed; }
|
||||
|
||||
public void doAnalysis() {
|
||||
_identifyAndAnalyze(_source);
|
||||
identifyAndAnalyze(this.source);
|
||||
}
|
||||
|
||||
private void _identifyAndAnalyze(final File root) {
|
||||
private void identifyAndAnalyze(final File root) {
|
||||
// see if we can figure out the likely identity of the source folder and
|
||||
// dispatch to the best analysis subroutine to handle it
|
||||
final String dirname = root.getName();
|
||||
|
||||
if ("res".equalsIgnoreCase(dirname)) { _analyzeOldResDir(root); }
|
||||
else if ("constructed".equalsIgnoreCase(dirname)) { _analyzeConstructedDeckDir(root); }
|
||||
else if ("draft".equalsIgnoreCase(dirname)) { _analyzeDraftDeckDir(root); }
|
||||
else if ("plane".equalsIgnoreCase(dirname) || "planar".equalsIgnoreCase(dirname)) { _analyzePlanarDeckDir(root); }
|
||||
else if ("scheme".equalsIgnoreCase(dirname)) { _analyzeSchemeDeckDir(root); }
|
||||
else if ("sealed".equalsIgnoreCase(dirname)) { _analyzeSealedDeckDir(root); }
|
||||
else if (StringUtils.containsIgnoreCase(dirname, "deck")) { _analyzeDecksDir(root); }
|
||||
else if ("gauntlet".equalsIgnoreCase(dirname)) { _analyzeGauntletDataDir(root); }
|
||||
else if ("layouts".equalsIgnoreCase(dirname)) { _analyzeLayoutsDir(root); }
|
||||
else if ("pics".equalsIgnoreCase(dirname)) { _analyzeCardPicsDir(root); }
|
||||
else if ("pics_product".equalsIgnoreCase(dirname)) { _analyzeProductPicsDir(root); }
|
||||
else if ("preferences".equalsIgnoreCase(dirname)) { _analyzePreferencesDir(root); }
|
||||
else if ("quest".equalsIgnoreCase(dirname)) { _analyzeQuestDir(root); }
|
||||
else if (null != FModel.getMagicDb().getEditions().get(dirname)) { _analyzeCardPicsSetDir(root); }
|
||||
if ("res".equalsIgnoreCase(dirname)) { analyzeOldResDir(root); }
|
||||
else if ("constructed".equalsIgnoreCase(dirname)) { analyzeConstructedDeckDir(root); }
|
||||
else if ("draft".equalsIgnoreCase(dirname)) { analyzeDraftDeckDir(root); }
|
||||
else if ("plane".equalsIgnoreCase(dirname) || "planar".equalsIgnoreCase(dirname)) { analyzePlanarDeckDir(root); }
|
||||
else if ("scheme".equalsIgnoreCase(dirname)) { analyzeSchemeDeckDir(root); }
|
||||
else if ("sealed".equalsIgnoreCase(dirname)) { analyzeSealedDeckDir(root); }
|
||||
else if (StringUtils.containsIgnoreCase(dirname, "deck")) { analyzeDecksDir(root); }
|
||||
else if ("gauntlet".equalsIgnoreCase(dirname)) { analyzeGauntletDataDir(root); }
|
||||
else if ("layouts".equalsIgnoreCase(dirname)) { analyzeLayoutsDir(root); }
|
||||
else if ("pics".equalsIgnoreCase(dirname)) { analyzeCardPicsDir(root); }
|
||||
else if ("pics_product".equalsIgnoreCase(dirname)) { analyzeProductPicsDir(root); }
|
||||
else if ("preferences".equalsIgnoreCase(dirname)) { analyzePreferencesDir(root); }
|
||||
else if ("quest".equalsIgnoreCase(dirname)) { analyzeQuestDir(root); }
|
||||
else if (null != FModel.getMagicDb().getEditions().get(dirname)) { analyzeCardPicsSetDir(root); }
|
||||
else {
|
||||
// look at files in directory and make a semi-educated guess based on file extensions
|
||||
int numUnhandledFiles = 0;
|
||||
for (final File file : root.listFiles()) {
|
||||
if (_cb.checkCancel()) { return; }
|
||||
File[] files = root.listFiles();
|
||||
assert files != null;
|
||||
for (final File file : files) {
|
||||
if (cb.checkCancel()) { return; }
|
||||
|
||||
if (file.isFile()) {
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
|
||||
_analyzeDecksDir(root);
|
||||
analyzeDecksDir(root);
|
||||
numUnhandledFiles = 0;
|
||||
break;
|
||||
} else if (StringUtils.endsWithIgnoreCase(filename, ".jpg")) {
|
||||
_analyzeCardPicsDir(root);
|
||||
analyzeCardPicsDir(root);
|
||||
numUnhandledFiles = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
++numUnhandledFiles;
|
||||
} else if (file.isDirectory()) {
|
||||
_identifyAndAnalyze(file);
|
||||
identifyAndAnalyze(file);
|
||||
}
|
||||
}
|
||||
_numFilesAnalyzed += numUnhandledFiles;
|
||||
numFilesAnalyzed += numUnhandledFiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,24 +129,25 @@ public class ImportSourceAnalyzer {
|
||||
// pre-profile res dir
|
||||
//
|
||||
|
||||
private void _analyzeOldResDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override boolean onDir(final File dir) {
|
||||
private void analyzeOldResDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
final String dirname = dir.getName();
|
||||
if ("decks".equalsIgnoreCase(dirname)) {
|
||||
_analyzeDecksDir(dir);
|
||||
analyzeDecksDir(dir);
|
||||
} else if ("gauntlet".equalsIgnoreCase(dirname)) {
|
||||
_analyzeGauntletDataDir(dir);
|
||||
analyzeGauntletDataDir(dir);
|
||||
} else if ("layouts".equalsIgnoreCase(dirname)) {
|
||||
_analyzeLayoutsDir(dir);
|
||||
analyzeLayoutsDir(dir);
|
||||
} else if ("pics".equalsIgnoreCase(dirname)) {
|
||||
_analyzeCardPicsDir(dir);
|
||||
analyzeCardPicsDir(dir);
|
||||
} else if ("pics_product".equalsIgnoreCase(dirname)) {
|
||||
_analyzeProductPicsDir(dir);
|
||||
analyzeProductPicsDir(dir);
|
||||
} else if ("preferences".equalsIgnoreCase(dirname)) {
|
||||
_analyzePreferencesDir(dir);
|
||||
analyzePreferencesDir(dir);
|
||||
} else if ("quest".equalsIgnoreCase(dirname)) {
|
||||
_analyzeQuestDir(dir);
|
||||
analyzeQuestDir(dir);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -162,74 +160,78 @@ public class ImportSourceAnalyzer {
|
||||
// decks
|
||||
//
|
||||
|
||||
private void _analyzeDecksDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeDecksDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
// we don't really expect any files in here, but if we find a .dck file, add it to the unknown list
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
|
||||
final File targetFile = new File(_lcaseExt(filename));
|
||||
_cb.addOp(OpType.UNKNOWN_DECK, file, targetFile);
|
||||
final File targetFile = new File(lcaseExt(filename));
|
||||
cb.addOp(OpType.UNKNOWN_DECK, file, targetFile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override boolean onDir(final File dir) {
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
final String dirname = dir.getName();
|
||||
if ("constructed".equalsIgnoreCase(dirname)) {
|
||||
_analyzeConstructedDeckDir(dir);
|
||||
analyzeConstructedDeckDir(dir);
|
||||
} else if ("cube".equalsIgnoreCase(dirname)) {
|
||||
return false;
|
||||
} else if ("draft".equalsIgnoreCase(dirname)) {
|
||||
_analyzeDraftDeckDir(dir);
|
||||
analyzeDraftDeckDir(dir);
|
||||
} else if ("plane".equalsIgnoreCase(dirname) || "planar".equalsIgnoreCase(dirname)) {
|
||||
_analyzePlanarDeckDir(dir);
|
||||
analyzePlanarDeckDir(dir);
|
||||
} else if ("scheme".equalsIgnoreCase(dirname)) {
|
||||
_analyzeSchemeDeckDir(dir);
|
||||
analyzeSchemeDeckDir(dir);
|
||||
} else if ("sealed".equalsIgnoreCase(dirname)) {
|
||||
_analyzeSealedDeckDir(dir);
|
||||
analyzeSealedDeckDir(dir);
|
||||
} else {
|
||||
_analyzeKnownDeckDir(dir, null, OpType.UNKNOWN_DECK);
|
||||
analyzeKnownDeckDir(dir, null, OpType.UNKNOWN_DECK);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void _analyzeConstructedDeckDir(final File root) {
|
||||
_analyzeKnownDeckDir(root, ForgeConstants.DECK_CONSTRUCTED_DIR, OpType.CONSTRUCTED_DECK);
|
||||
private void analyzeConstructedDeckDir(final File root) {
|
||||
analyzeKnownDeckDir(root, ForgeConstants.DECK_CONSTRUCTED_DIR, OpType.CONSTRUCTED_DECK);
|
||||
}
|
||||
|
||||
private void _analyzeDraftDeckDir(final File root) {
|
||||
_analyzeKnownDeckDir(root, ForgeConstants.DECK_DRAFT_DIR, OpType.DRAFT_DECK);
|
||||
private void analyzeDraftDeckDir(final File root) {
|
||||
analyzeKnownDeckDir(root, ForgeConstants.DECK_DRAFT_DIR, OpType.DRAFT_DECK);
|
||||
}
|
||||
|
||||
private void _analyzePlanarDeckDir(final File root) {
|
||||
_analyzeKnownDeckDir(root, ForgeConstants.DECK_PLANE_DIR, OpType.PLANAR_DECK);
|
||||
private void analyzePlanarDeckDir(final File root) {
|
||||
analyzeKnownDeckDir(root, ForgeConstants.DECK_PLANE_DIR, OpType.PLANAR_DECK);
|
||||
}
|
||||
|
||||
private void _analyzeSchemeDeckDir(final File root) {
|
||||
_analyzeKnownDeckDir(root, ForgeConstants.DECK_SCHEME_DIR, OpType.SCHEME_DECK);
|
||||
private void analyzeSchemeDeckDir(final File root) {
|
||||
analyzeKnownDeckDir(root, ForgeConstants.DECK_SCHEME_DIR, OpType.SCHEME_DECK);
|
||||
}
|
||||
|
||||
private void _analyzeSealedDeckDir(final File root) {
|
||||
_analyzeKnownDeckDir(root, ForgeConstants.DECK_SEALED_DIR, OpType.SEALED_DECK);
|
||||
private void analyzeSealedDeckDir(final File root) {
|
||||
analyzeKnownDeckDir(root, ForgeConstants.DECK_SEALED_DIR, OpType.SEALED_DECK);
|
||||
}
|
||||
|
||||
private void _analyzeKnownDeckDir(final File root, final String targetDir, final OpType opType) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeKnownDeckDir(final File root, final String targetDir, final OpType opType) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, ".dck")) {
|
||||
final File targetFile = new File(targetDir, _lcaseExt(filename));
|
||||
final File targetFile = new File(targetDir, lcaseExt(filename));
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(opType, file, targetFile);
|
||||
cb.addOp(opType, file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override boolean onDir(final File dir) {
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
// if there's a dir beneath a known directory, assume the same kind of decks are in there
|
||||
_analyzeKnownDeckDir(dir, targetDir, opType);
|
||||
analyzeKnownDeckDir(dir, targetDir, opType);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -239,15 +241,16 @@ public class ImportSourceAnalyzer {
|
||||
// gauntlet
|
||||
//
|
||||
|
||||
private void _analyzeGauntletDataDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeGauntletDataDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
// find *.dat files, but exclude LOCKED_*
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, ".dat") && !filename.startsWith("LOCKED_")) {
|
||||
final File targetFile = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc, _lcaseExt(filename));
|
||||
final File targetFile = new File(ForgeConstants.GAUNTLET_DIR.userPrefLoc, lcaseExt(filename));
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(OpType.GAUNTLET_DATA, file, targetFile);
|
||||
cb.addOp(OpType.GAUNTLET_DATA, file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,15 +261,16 @@ public class ImportSourceAnalyzer {
|
||||
// layouts
|
||||
//
|
||||
|
||||
private void _analyzeLayoutsDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeLayoutsDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
// find *_preferred.xml files
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, "_preferred.xml")) {
|
||||
final File targetFile = new File(ForgeConstants.USER_PREFS_DIR,
|
||||
file.getName().toLowerCase(Locale.ENGLISH).replace("_preferred", ""));
|
||||
_cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
|
||||
cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -276,8 +280,8 @@ public class ImportSourceAnalyzer {
|
||||
// default card pics
|
||||
//
|
||||
|
||||
private static String _oldCleanString(final String in) {
|
||||
final StringBuffer out = new StringBuffer();
|
||||
private static String oldCleanString(final String in) {
|
||||
final StringBuilder out = new StringBuilder();
|
||||
for (int i = 0; i < in.length(); i++) {
|
||||
final char c = in.charAt(i);
|
||||
if ((c == ' ') || (c == '-')) {
|
||||
@@ -292,7 +296,7 @@ public class ImportSourceAnalyzer {
|
||||
return out.toString().toLowerCase();
|
||||
}
|
||||
|
||||
private void _addDefaultPicNames(final PaperCard c, final boolean backFace) {
|
||||
private void addDefaultPicNames(final PaperCard c, final boolean backFace) {
|
||||
final CardRules card = c.getRules();
|
||||
final String urls = card.getPictureUrl(backFace);
|
||||
if (StringUtils.isEmpty(urls)) { return; }
|
||||
@@ -304,59 +308,62 @@ public class ImportSourceAnalyzer {
|
||||
|
||||
final String filenameBase = ImageUtil.getImageKey(c, backFace, false);
|
||||
final String filename = filenameBase + ".jpg";
|
||||
final boolean alreadyHadIt = null != _defaultPicNames.put(filename, filename);
|
||||
final boolean alreadyHadIt = null != defaultPicNames.put(filename, filename);
|
||||
if ( alreadyHadIt ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do you shift artIndex by one here?
|
||||
final String newLastSymbol = 0 == c.getArtIndex() ? "" : String.valueOf(c.getArtIndex() /* + 1 */);
|
||||
final String oldFilename = _oldCleanString(filenameBase.replaceAll("[0-9]?(\\.full)?$", "")) + newLastSymbol + ".jpg";
|
||||
final String oldFilename = oldCleanString(filenameBase.replaceAll("[0-9]?(\\.full)?$", "")) + newLastSymbol + ".jpg";
|
||||
//if ( numPics > 1 )
|
||||
//System.out.printf("Will move %s -> %s%n", oldFilename, filename);
|
||||
_defaultPicOldNameToCurrentName.put(oldFilename, filename);
|
||||
defaultPicOldNameToCurrentName.put(oldFilename, filename);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, String> _defaultPicNames;
|
||||
private Map<String, String> _defaultPicOldNameToCurrentName;
|
||||
private void _analyzeCardPicsDir(final File root) {
|
||||
if (null == _defaultPicNames) {
|
||||
_defaultPicNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
_defaultPicOldNameToCurrentName = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
private Map<String, String> defaultPicNames;
|
||||
private Map<String, String> defaultPicOldNameToCurrentName;
|
||||
private void analyzeCardPicsDir(final File root) {
|
||||
if (null == defaultPicNames) {
|
||||
defaultPicNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
defaultPicOldNameToCurrentName = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
for (final PaperCard c : FModel.getMagicDb().getCommonCards().getAllCards()) {
|
||||
_addDefaultPicNames(c, false);
|
||||
addDefaultPicNames(c, false);
|
||||
if (ImageUtil.hasBackFacePicture(c)) {
|
||||
_addDefaultPicNames(c, true);
|
||||
addDefaultPicNames(c, true);
|
||||
}
|
||||
}
|
||||
|
||||
for (final PaperCard c : FModel.getMagicDb().getVariantCards().getAllCards()) {
|
||||
_addDefaultPicNames(c, false);
|
||||
addDefaultPicNames(c, false);
|
||||
// variants never have backfaces
|
||||
}
|
||||
}
|
||||
|
||||
_analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
|
||||
@Override public String map(final String filename) {
|
||||
if (_defaultPicOldNameToCurrentName.containsKey(filename)) {
|
||||
return _defaultPicOldNameToCurrentName.get(filename);
|
||||
analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new ListedAnalyzer() {
|
||||
@Override
|
||||
public String map(final String filename) {
|
||||
if (defaultPicOldNameToCurrentName.containsKey(filename)) {
|
||||
return defaultPicOldNameToCurrentName.get(filename);
|
||||
}
|
||||
return _defaultPicNames.get(filename);
|
||||
return defaultPicNames.get(filename);
|
||||
}
|
||||
|
||||
@Override public OpType getOpType(final String filename) {
|
||||
@Override
|
||||
public OpType getOpType(final String filename) {
|
||||
return OpType.DEFAULT_CARD_PIC;
|
||||
}
|
||||
|
||||
@Override boolean onDir(final File dir) {
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
if ("icons".equalsIgnoreCase(dir.getName())) {
|
||||
_analyzeIconsPicsDir(dir);
|
||||
analyzeIconsPicsDir(dir);
|
||||
} else if ("tokens".equalsIgnoreCase(dir.getName())) {
|
||||
_analyzeTokenPicsDir(dir);
|
||||
analyzeTokenPicsDir(dir);
|
||||
} else {
|
||||
_analyzeCardPicsSetDir(dir);
|
||||
analyzeCardPicsSetDir(dir);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -367,7 +374,7 @@ public class ImportSourceAnalyzer {
|
||||
// set card pics
|
||||
//
|
||||
|
||||
private static void _addSetCards(final Map<String, String> cardFileNames, final Iterable<PaperCard> library, final Predicate<PaperCard> filter) {
|
||||
private static void addSetCards(final Map<String, String> cardFileNames, final Iterable<PaperCard> library, final Predicate<PaperCard> filter) {
|
||||
for (final PaperCard c : Iterables.filter(library, filter)) {
|
||||
String filename = ImageUtil.getImageKey(c, false, true) + ".jpg";
|
||||
cardFileNames.put(filename, filename);
|
||||
@@ -378,21 +385,21 @@ public class ImportSourceAnalyzer {
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Map<String, String>> _cardFileNamesBySet;
|
||||
Map<String, String> _nameUpdates;
|
||||
private void _analyzeCardPicsSetDir(final File root) {
|
||||
if (null == _cardFileNamesBySet) {
|
||||
_cardFileNamesBySet = new TreeMap<String, Map<String, String>>(String.CASE_INSENSITIVE_ORDER);
|
||||
Map<String, Map<String, String>> cardFileNamesBySet;
|
||||
Map<String, String> nameUpdates;
|
||||
private void analyzeCardPicsSetDir(final File root) {
|
||||
if (null == cardFileNamesBySet) {
|
||||
cardFileNamesBySet = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
for (final CardEdition ce : FModel.getMagicDb().getEditions()) {
|
||||
final Map<String, String> cardFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Map<String, String> cardFileNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Predicate<PaperCard> filter = IPaperCard.Predicates.printedInSet(ce.getCode());
|
||||
_addSetCards(cardFileNames, FModel.getMagicDb().getCommonCards().getAllCards(), filter);
|
||||
_addSetCards(cardFileNames, FModel.getMagicDb().getVariantCards().getAllCards(), filter);
|
||||
_cardFileNamesBySet.put(ce.getCode2(), cardFileNames);
|
||||
addSetCards(cardFileNames, FModel.getMagicDb().getCommonCards().getAllCards(), filter);
|
||||
addSetCards(cardFileNames, FModel.getMagicDb().getVariantCards().getAllCards(), filter);
|
||||
cardFileNamesBySet.put(ce.getCode2(), cardFileNames);
|
||||
}
|
||||
|
||||
// planar cards now don't have the ".full" part in their filenames
|
||||
_nameUpdates = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
nameUpdates = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
final Predicate<PaperCard> predPlanes = new Predicate<PaperCard>() {
|
||||
@Override
|
||||
public boolean apply(final PaperCard arg0) {
|
||||
@@ -402,10 +409,10 @@ public class ImportSourceAnalyzer {
|
||||
|
||||
for (final PaperCard c : Iterables.filter(FModel.getMagicDb().getVariantCards().getAllCards(), predPlanes)) {
|
||||
String baseName = ImageUtil.getImageKey(c,false, true);
|
||||
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
|
||||
nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
|
||||
if (ImageUtil.hasBackFacePicture(c)) {
|
||||
baseName = ImageUtil.getImageKey(c, true, true);
|
||||
_nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
|
||||
nameUpdates.put(baseName + ".full.jpg", baseName + ".jpg");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -415,17 +422,18 @@ public class ImportSourceAnalyzer {
|
||||
final CardEdition edition = editions.get(editionCode);
|
||||
if (null == edition) {
|
||||
// not a valid set name, skip
|
||||
_numFilesAnalyzed += _countFiles(root);
|
||||
numFilesAnalyzed += countFiles(root);
|
||||
return;
|
||||
}
|
||||
|
||||
final String editionCode2 = edition.getCode2();
|
||||
final Map<String, String> validFilenames = _cardFileNamesBySet.get(editionCode2);
|
||||
_analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new _ListedAnalyzer() {
|
||||
@Override public String map(String filename) {
|
||||
final Map<String, String> validFilenames = cardFileNamesBySet.get(editionCode2);
|
||||
analyzeListedDir(root, ForgeConstants.CACHE_CARD_PICS_DIR, new ListedAnalyzer() {
|
||||
@Override
|
||||
public String map(String filename) {
|
||||
filename = editionCode2 + "/" + filename;
|
||||
if (_nameUpdates.containsKey(filename)) {
|
||||
filename = _nameUpdates.get(filename);
|
||||
if (nameUpdates.containsKey(filename)) {
|
||||
filename = nameUpdates.get(filename);
|
||||
}
|
||||
if (validFilenames.containsKey(filename)) {
|
||||
return validFilenames.get(filename);
|
||||
@@ -435,7 +443,9 @@ public class ImportSourceAnalyzer {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override public OpType getOpType(final String filename) {
|
||||
|
||||
@Override
|
||||
public OpType getOpType(final String filename) {
|
||||
return validFilenames.containsKey(filename) ? OpType.SET_CARD_PIC : OpType.POSSIBLE_SET_CARD_PIC;
|
||||
}
|
||||
});
|
||||
@@ -445,65 +455,77 @@ public class ImportSourceAnalyzer {
|
||||
// other image dirs
|
||||
//
|
||||
|
||||
Map<String, String> _iconFileNames;
|
||||
private void _analyzeIconsPicsDir(final File root) {
|
||||
if (null == _iconFileNames) {
|
||||
_iconFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
Map<String, String> iconFileNames;
|
||||
private void analyzeIconsPicsDir(final File root) {
|
||||
if (null == iconFileNames) {
|
||||
iconFileNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_OPPONENT_ICONS_FILE)) {
|
||||
_iconFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
}
|
||||
for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_PET_SHOP_ICONS_FILE)) {
|
||||
_iconFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
iconFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
}
|
||||
}
|
||||
|
||||
_analyzeListedDir(root, ForgeConstants.CACHE_ICON_PICS_DIR, new _ListedAnalyzer() {
|
||||
@Override public String map(final String filename) { return _iconFileNames.containsKey(filename) ? _iconFileNames.get(filename) : null; }
|
||||
@Override public OpType getOpType(final String filename) { return OpType.QUEST_PIC; }
|
||||
analyzeListedDir(root, ForgeConstants.CACHE_ICON_PICS_DIR, new ListedAnalyzer() {
|
||||
@Override
|
||||
public String map(final String filename) {
|
||||
return iconFileNames.containsKey(filename) ? iconFileNames.get(filename) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpType getOpType(final String filename) {
|
||||
return OpType.QUEST_PIC;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Map<String, String> _tokenFileNames;
|
||||
Map<String, String> _questTokenFileNames;
|
||||
private void _analyzeTokenPicsDir(final File root) {
|
||||
if (null == _tokenFileNames) {
|
||||
_tokenFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
_questTokenFileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
Map<String, String> tokenFileNames;
|
||||
Map<String, String> questTokenFileNames;
|
||||
private void analyzeTokenPicsDir(final File root) {
|
||||
if (null == tokenFileNames) {
|
||||
tokenFileNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
questTokenFileNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_TOKENS_FILE)) {
|
||||
_tokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
tokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
}
|
||||
for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(ForgeConstants.IMAGE_LIST_QUEST_TOKENS_FILE)) {
|
||||
_questTokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
questTokenFileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
}
|
||||
}
|
||||
|
||||
_analyzeListedDir(root, ForgeConstants.CACHE_TOKEN_PICS_DIR, new _ListedAnalyzer() {
|
||||
@Override public String map(final String filename) {
|
||||
if (_questTokenFileNames.containsKey(filename)) { return _questTokenFileNames.get(filename); }
|
||||
if (_tokenFileNames.containsKey(filename)) { return _tokenFileNames.get(filename); }
|
||||
analyzeListedDir(root, ForgeConstants.CACHE_TOKEN_PICS_DIR, new ListedAnalyzer() {
|
||||
@Override
|
||||
public String map(final String filename) {
|
||||
if (questTokenFileNames.containsKey(filename)) {
|
||||
return questTokenFileNames.get(filename);
|
||||
}
|
||||
if (tokenFileNames.containsKey(filename)) {
|
||||
return tokenFileNames.get(filename);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override public OpType getOpType(final String filename) {
|
||||
return _questTokenFileNames.containsKey(filename) ? OpType.QUEST_PIC : OpType.TOKEN_PIC;
|
||||
|
||||
@Override
|
||||
public OpType getOpType(final String filename) {
|
||||
return questTokenFileNames.containsKey(filename) ? OpType.QUEST_PIC : OpType.TOKEN_PIC;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void _analyzeProductPicsDir(final File root) {
|
||||
private void analyzeProductPicsDir(final File root) {
|
||||
// we don't care about the files in the root dir -- the new booster files are .png, not the current .jpg ones
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override boolean onDir(final File dir) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
final String dirName = dir.getName();
|
||||
if ("booster".equalsIgnoreCase(dirName)) {
|
||||
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_BOOSTERS_FILE, ForgeConstants.CACHE_BOOSTER_PICS_DIR, OpType.QUEST_PIC);
|
||||
analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_BOOSTERS_FILE, ForgeConstants.CACHE_BOOSTER_PICS_DIR, OpType.QUEST_PIC);
|
||||
} else if ("fatpacks".equalsIgnoreCase(dirName)) {
|
||||
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_FATPACKS_FILE, ForgeConstants.CACHE_FATPACK_PICS_DIR, OpType.QUEST_PIC);
|
||||
analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_FATPACKS_FILE, ForgeConstants.CACHE_FATPACK_PICS_DIR, OpType.QUEST_PIC);
|
||||
} else if ("boosterboxes".equalsIgnoreCase(dirName)) {
|
||||
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_BOOSTERBOXES_FILE, ForgeConstants.CACHE_BOOSTERBOX_PICS_DIR, OpType.QUEST_PIC);
|
||||
analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_BOOSTERBOXES_FILE, ForgeConstants.CACHE_BOOSTERBOX_PICS_DIR, OpType.QUEST_PIC);
|
||||
} else if ("precons".equalsIgnoreCase(dirName)) {
|
||||
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_PRECONS_FILE, ForgeConstants.CACHE_PRECON_PICS_DIR, OpType.QUEST_PIC);
|
||||
analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_PRECONS_FILE, ForgeConstants.CACHE_PRECON_PICS_DIR, OpType.QUEST_PIC);
|
||||
} else if ("tournamentpacks".equalsIgnoreCase(dirName)) {
|
||||
_analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE, ForgeConstants.CACHE_TOURNAMENTPACK_PICS_DIR, OpType.QUEST_PIC);
|
||||
analyzeSimpleListedDir(dir, ForgeConstants.IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE, ForgeConstants.CACHE_TOURNAMENTPACK_PICS_DIR, OpType.QUEST_PIC);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -516,14 +538,15 @@ public class ImportSourceAnalyzer {
|
||||
// preferences
|
||||
//
|
||||
|
||||
private void _analyzePreferencesDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzePreferencesDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
final String filename = file.getName();
|
||||
if ("editor.preferences".equalsIgnoreCase(filename) || "forge.preferences".equalsIgnoreCase(filename)) {
|
||||
final File targetFile = new File(ForgeConstants.USER_PREFS_DIR, filename.toLowerCase(Locale.ENGLISH));
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
|
||||
cb.addOp(OpType.PREFERENCE_FILE, file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -534,20 +557,23 @@ public class ImportSourceAnalyzer {
|
||||
// quest data
|
||||
//
|
||||
|
||||
private void _analyzeQuestDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeQuestDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
final String filename = file.getName();
|
||||
if ("all-prices.txt".equalsIgnoreCase(filename)) {
|
||||
final File targetFile = new File(ForgeConstants.DB_DIR, filename.toLowerCase(Locale.ENGLISH));
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(OpType.DB_FILE, file, targetFile);
|
||||
cb.addOp(OpType.DB_FILE, file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override boolean onDir(final File dir) {
|
||||
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
if ("data".equalsIgnoreCase(dir.getName())) {
|
||||
_analyzeQuestDataDir(dir);
|
||||
analyzeQuestDataDir(dir);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -555,14 +581,15 @@ public class ImportSourceAnalyzer {
|
||||
});
|
||||
}
|
||||
|
||||
private void _analyzeQuestDataDir(final File root) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeQuestDataDir(final File root) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
final String filename = file.getName();
|
||||
if (StringUtils.endsWithIgnoreCase(filename, ".dat")) {
|
||||
final File targetFile = new File(ForgeConstants.QUEST_SAVE_DIR, _lcaseExt(filename));
|
||||
final File targetFile = new File(ForgeConstants.QUEST_SAVE_DIR, lcaseExt(filename));
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(OpType.QUEST_DATA, file, targetFile);
|
||||
cb.addOp(OpType.QUEST_DATA, file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -573,47 +600,56 @@ public class ImportSourceAnalyzer {
|
||||
// utility functions
|
||||
//
|
||||
|
||||
private class _Analyzer {
|
||||
private class Analyzer {
|
||||
void onFile(final File file) { }
|
||||
|
||||
// returns whether the directory has been handled
|
||||
boolean onDir(final File dir) { return false; }
|
||||
}
|
||||
|
||||
private void _analyzeDir(final File root, final _Analyzer analyzer) {
|
||||
for (final File file : root.listFiles()) {
|
||||
if (_cb.checkCancel()) { return; }
|
||||
private void analyzeDir(final File root, final Analyzer analyzer) {
|
||||
File[] files = root.listFiles();
|
||||
assert files != null;
|
||||
for (final File file : files) {
|
||||
if (cb.checkCancel()) { return; }
|
||||
|
||||
if (file.isFile()) {
|
||||
++_numFilesAnalyzed;
|
||||
++numFilesAnalyzed;
|
||||
analyzer.onFile(file);
|
||||
} else if (file.isDirectory()) {
|
||||
if (!analyzer.onDir(file)) {
|
||||
_numFilesAnalyzed += _countFiles(file);
|
||||
numFilesAnalyzed += countFiles(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<String, Map<String, String>> _fileNameDb = new HashMap<String, Map<String, String>>();
|
||||
private void _analyzeSimpleListedDir(final File root, final String listFile, final String targetDir, final OpType opType) {
|
||||
if (!_fileNameDb.containsKey(listFile)) {
|
||||
final Map<String, String> fileNames = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
|
||||
private final Map<String, Map<String, String>> fileNameDb = new HashMap<>();
|
||||
private void analyzeSimpleListedDir(final File root, final String listFile, final String targetDir, final OpType opType) {
|
||||
if (!fileNameDb.containsKey(listFile)) {
|
||||
final Map<String, String> fileNames = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
for (final Pair<String, String> nameurl : FileUtil.readNameUrlFile(listFile)) {
|
||||
// we use a map instead of a set since we need to match case-insensitively but still map to the correct case
|
||||
fileNames.put(nameurl.getLeft(), nameurl.getLeft());
|
||||
}
|
||||
_fileNameDb.put(listFile, fileNames);
|
||||
fileNameDb.put(listFile, fileNames);
|
||||
}
|
||||
|
||||
final Map<String, String> fileDb = _fileNameDb.get(listFile);
|
||||
_analyzeListedDir(root, targetDir, new _ListedAnalyzer() {
|
||||
@Override public String map(final String filename) { return fileDb.containsKey(filename) ? fileDb.get(filename) : null; }
|
||||
@Override public OpType getOpType(final String filename) { return opType; }
|
||||
final Map<String, String> fileDb = fileNameDb.get(listFile);
|
||||
analyzeListedDir(root, targetDir, new ListedAnalyzer() {
|
||||
@Override
|
||||
public String map(final String filename) {
|
||||
return fileDb.containsKey(filename) ? fileDb.get(filename) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpType getOpType(final String filename) {
|
||||
return opType;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private abstract class _ListedAnalyzer {
|
||||
private abstract class ListedAnalyzer {
|
||||
abstract String map(String filename);
|
||||
abstract OpType getOpType(String filename);
|
||||
|
||||
@@ -621,37 +657,43 @@ public class ImportSourceAnalyzer {
|
||||
boolean onDir(final File dir) { return false; }
|
||||
}
|
||||
|
||||
private void _analyzeListedDir(final File root, final String targetDir, final _ListedAnalyzer listedAnalyzer) {
|
||||
_analyzeDir(root, new _Analyzer() {
|
||||
@Override void onFile(final File file) {
|
||||
private void analyzeListedDir(final File root, final String targetDir, final ListedAnalyzer listedAnalyzer) {
|
||||
analyzeDir(root, new Analyzer() {
|
||||
@Override
|
||||
void onFile(final File file) {
|
||||
final String filename = listedAnalyzer.map(file.getName());
|
||||
if (null != filename) {
|
||||
final File targetFile = new File(targetDir, filename);
|
||||
if (!file.equals(targetFile)) {
|
||||
_cb.addOp(listedAnalyzer.getOpType(filename), file, targetFile);
|
||||
cb.addOp(listedAnalyzer.getOpType(filename), file, targetFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override boolean onDir(final File dir) { return listedAnalyzer.onDir(dir); }
|
||||
@Override
|
||||
boolean onDir(final File dir) {
|
||||
return listedAnalyzer.onDir(dir);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int _countFiles(final File root) {
|
||||
private int countFiles(final File root) {
|
||||
int count = 0;
|
||||
for (final File file : root.listFiles()) {
|
||||
if (_cb.checkCancel()) { return 0; }
|
||||
File[] files = root.listFiles();
|
||||
assert files != null;
|
||||
for (final File file : files) {
|
||||
if (cb.checkCancel()) { return 0; }
|
||||
|
||||
if (file.isFile()) {
|
||||
++count;
|
||||
} else if (file.isDirectory()) {
|
||||
count += _countFiles(file);
|
||||
count += countFiles(file);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static String _lcaseExt(final String filename) {
|
||||
private static String lcaseExt(final String filename) {
|
||||
final int lastDotIdx = filename.lastIndexOf('.');
|
||||
if (0 > lastDotIdx) {
|
||||
return filename;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -45,9 +45,9 @@ import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Updates the deck editor UI as necessary draft selection mode.
|
||||
*
|
||||
*
|
||||
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||
*
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: CEditorDraftingProcess.java 24872 2014-02-17 07:35:47Z drdev $
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/**
|
||||
* Show GuiBase.getInterface().
|
||||
*
|
||||
*
|
||||
* @param inBoosterDraft
|
||||
* the in_booster draft
|
||||
*/
|
||||
@@ -110,7 +110,6 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
this.showChoices(this.boosterDraft.nextChoice());
|
||||
}
|
||||
else {
|
||||
this.boosterDraft.finishedDrafting();
|
||||
this.saveDraft();
|
||||
}
|
||||
}
|
||||
@@ -136,9 +135,9 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
* <p>
|
||||
* showChoices.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
* a {@link ItemPool<PaperCard>} object.
|
||||
*/
|
||||
private void showChoices(final ItemPool<PaperCard> list) {
|
||||
int packNumber = ((BoosterDraft) boosterDraft).getCurrentBoosterIndex() + 1;
|
||||
@@ -151,7 +150,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
* <p>
|
||||
* getPlayersDeck.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a {@link forge.deck.Deck} object.
|
||||
*/
|
||||
private Deck getPlayersDeck() {
|
||||
@@ -194,7 +193,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
// Cancel button will be null; OK will return string.
|
||||
// Must check for null value first, then string length.
|
||||
// Recurse, if either null or empty string.
|
||||
if (s == null || s.length() == 0) {
|
||||
if (s == null || s.isEmpty()) {
|
||||
saveDraft();
|
||||
return;
|
||||
}
|
||||
@@ -241,7 +240,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#getController()
|
||||
*/
|
||||
@Override
|
||||
@@ -251,7 +250,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#updateView()
|
||||
*/
|
||||
@Override
|
||||
@@ -260,7 +259,7 @@ public class CEditorDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#show(forge.Command)
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -6,21 +6,18 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.screens.deckeditor.controllers;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.card.MagicColor;
|
||||
import forge.deck.Deck;
|
||||
@@ -48,24 +45,26 @@ import forge.toolbox.FSkin;
|
||||
import forge.util.ItemPool;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* Updates the deck editor UI as necessary draft selection mode.
|
||||
*
|
||||
*
|
||||
* <br><br><i>(C at beginning of class name denotes a control class.)</i>
|
||||
*
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: CEditorDraftingProcess.java 24872 2014-02-17 07:35:47Z drdev $
|
||||
*/
|
||||
public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
|
||||
private CSubmenuQuestDraft draftQuest;
|
||||
private QuestController quest;
|
||||
|
||||
|
||||
public void setDraftQuest(CSubmenuQuestDraft testDraftQuest) {
|
||||
this.draftQuest = testDraftQuest;
|
||||
this.quest = FModel.getQuest();
|
||||
}
|
||||
|
||||
|
||||
private IBoosterDraft boosterDraft;
|
||||
|
||||
private String ccAddLabel = "Add card";
|
||||
@@ -100,7 +99,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
|
||||
/**
|
||||
* Show GuiBase.getInterface().
|
||||
*
|
||||
*
|
||||
* @param inBoosterDraft
|
||||
* the in_booster draft
|
||||
*/
|
||||
@@ -126,7 +125,6 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
this.showChoices(this.boosterDraft.nextChoice());
|
||||
}
|
||||
else {
|
||||
this.boosterDraft.finishedDrafting();
|
||||
this.saveDraft();
|
||||
}
|
||||
}
|
||||
@@ -152,9 +150,9 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
* <p>
|
||||
* showChoices.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
* a {@link ItemPool<PaperCard>} object.
|
||||
*/
|
||||
private void showChoices(final ItemPool<PaperCard> list) {
|
||||
int packNumber = ((BoosterDraft) boosterDraft).getCurrentBoosterIndex() + 1;
|
||||
@@ -167,7 +165,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
* <p>
|
||||
* getPlayersDeck.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a {@link forge.deck.Deck} object.
|
||||
*/
|
||||
public Deck getPlayersDeck() {
|
||||
@@ -217,9 +215,9 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
|
||||
CSubmenuQuestDraft.SINGLETON_INSTANCE.update();
|
||||
FScreen.DRAFTING_PROCESS.close();
|
||||
|
||||
|
||||
draftQuest.setCompletedDraft(finishedDraft);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//========== Overridden from ACEditorBase
|
||||
@@ -231,7 +229,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#getController()
|
||||
*/
|
||||
@Override
|
||||
@@ -241,7 +239,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#updateView()
|
||||
*/
|
||||
@Override
|
||||
@@ -250,7 +248,7 @@ public class CEditorQuestDraftingProcess extends ACEditorBase<PaperCard, DeckGro
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#show(forge.Command)
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -54,6 +54,7 @@ import java.util.Map.Entry;
|
||||
* @author Forge
|
||||
* @version $Id: CEditorDraftingProcess.java 24872 2014-02-17 07:35:47Z drdev $
|
||||
*/
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
private IBoosterDraft boosterDraft;
|
||||
|
||||
@@ -202,7 +203,7 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
// Cancel button will be null; OK will return string.
|
||||
// Must check for null value first, then string length.
|
||||
// Recurse, if either null or empty string.
|
||||
if (s == null || s.length() == 0) {
|
||||
if (s == null || s.isEmpty()) {
|
||||
saveDraft();
|
||||
return;
|
||||
}
|
||||
@@ -251,7 +252,7 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#getController()
|
||||
*/
|
||||
@Override
|
||||
@@ -261,7 +262,7 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#updateView()
|
||||
*/
|
||||
@Override
|
||||
@@ -270,7 +271,7 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see forge.gui.deckeditor.ACEditorBase#show(forge.Command)
|
||||
*/
|
||||
@Override
|
||||
@@ -376,7 +377,6 @@ public class CEditorWinstonProcess extends ACEditorBase<PaperCard, DeckGroup> {
|
||||
}
|
||||
}
|
||||
// If we get here, there's no choices left. Finish the draft and then save it
|
||||
this.boosterDraft.finishedDrafting();
|
||||
this.saveDraft();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
package forge.screens.deckeditor.controllers;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.item.PaperCard;
|
||||
import forge.properties.ForgeConstants;
|
||||
@@ -20,6 +9,13 @@ import freemarker.template.DefaultObjectWrapper;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class DeckHtmlSerializer {
|
||||
public static void writeDeckHtml(final Deck d, final File f) {
|
||||
try {
|
||||
@@ -40,11 +36,9 @@ public class DeckHtmlSerializer {
|
||||
* a {@link forge.deck.Deck} object.
|
||||
* @param out
|
||||
* a {@link java.io.BufferedWriter} object.
|
||||
* @throws java.io.IOException
|
||||
* if any.
|
||||
*/
|
||||
private static void writeDeckHtml(final Deck d, final BufferedWriter out) {
|
||||
Template temp = null;
|
||||
Template temp;
|
||||
final int cardBorder = 0;
|
||||
final int height = 319;
|
||||
final int width = 222;
|
||||
@@ -68,19 +62,19 @@ public class DeckHtmlSerializer {
|
||||
temp = cfg.getTemplate("proxy-template.ftl");
|
||||
|
||||
/* Create a data-model */
|
||||
final Map<String, Object> root = new HashMap<String, Object>();
|
||||
final Map<String, Object> root = new HashMap<>();
|
||||
root.put("title", d.getName());
|
||||
final List<String> list = new ArrayList<String>();
|
||||
final List<String> list = new ArrayList<>();
|
||||
for (final Entry<PaperCard, Integer> card : d.getMain()) {
|
||||
// System.out.println(card.getSets().get(card.getSets().size() - 1).URL);
|
||||
for (int i = card.getValue().intValue(); i > 0; --i ) {
|
||||
for (int i = card.getValue(); i > 0; --i ) {
|
||||
final PaperCard r = card.getKey();
|
||||
final String url = ForgeConstants.URL_PIC_DOWNLOAD + ImageUtil.getDownloadUrl(r, false);
|
||||
list.add(url);
|
||||
}
|
||||
}
|
||||
|
||||
final Map<String, Integer> map = new TreeMap<String, Integer>();
|
||||
final Map<String, Integer> map = new TreeMap<>();
|
||||
for (final Entry<PaperCard, Integer> entry : d.getMain()) {
|
||||
map.put(entry.getKey().getName(), entry.getValue());
|
||||
// System.out.println(entry.getValue() + " " +
|
||||
@@ -97,9 +91,7 @@ public class DeckHtmlSerializer {
|
||||
/* Merge data-model with template */
|
||||
temp.process(root, out);
|
||||
out.flush();
|
||||
} catch (final IOException e) {
|
||||
System.out.println(e.toString());
|
||||
} catch (final TemplateException e) {
|
||||
} catch (final IOException | TemplateException e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
package forge.screens.home.settings;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.UiCommand;
|
||||
import forge.ai.AiProfileUtil;
|
||||
@@ -31,6 +18,16 @@ import forge.toolbox.FComboBox;
|
||||
import forge.toolbox.FComboBoxPanel;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Controls the preferences submenu in the home UI.
|
||||
@@ -46,7 +43,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
private ForgePreferences prefs;
|
||||
private boolean updating;
|
||||
|
||||
private final List<Pair<JCheckBox, FPref>> lstControls = new ArrayList<Pair<JCheckBox,FPref>>();
|
||||
private final List<Pair<JCheckBox, FPref>> lstControls = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
@@ -100,7 +97,6 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
lstControls.add(Pair.of(view.getCbRemoveSmall(), FPref.DECKGEN_NOSMALL));
|
||||
lstControls.add(Pair.of(view.getCbRemoveArtifacts(), FPref.DECKGEN_ARTIFACTS));
|
||||
lstControls.add(Pair.of(view.getCbSingletons(), FPref.DECKGEN_SINGLETONS));
|
||||
lstControls.add(Pair.of(view.getCbUploadDraft(), FPref.UI_UPLOAD_DRAFT));
|
||||
lstControls.add(Pair.of(view.getCbEnableAICheats(), FPref.UI_ENABLE_AI_CHEATS));
|
||||
lstControls.add(Pair.of(view.getCbDisplayFoil(), FPref.UI_OVERLAY_FOIL_EFFECT));
|
||||
lstControls.add(Pair.of(view.getCbRandomFoil(), FPref.UI_RANDOM_FOIL));
|
||||
@@ -285,7 +281,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
|
||||
private void initializeCloseActionComboBox() {
|
||||
final FComboBoxPanel<CloseAction> panel = this.view.getCloseActionComboBoxPanel();
|
||||
final FComboBox<CloseAction> comboBox = new FComboBox<CloseAction>(CloseAction.values());
|
||||
final FComboBox<CloseAction> comboBox = new FComboBox<>(CloseAction.values());
|
||||
comboBox.addItemListener(new ItemListener() {
|
||||
@Override public void itemStateChanged(final ItemEvent e) {
|
||||
Singletons.getControl().setCloseAction(comboBox.getSelectedItem());
|
||||
@@ -303,7 +299,7 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
}
|
||||
|
||||
private <E> FComboBox<E> createComboBox(final E[] items, final ForgePreferences.FPref setting) {
|
||||
final FComboBox<E> comboBox = new FComboBox<E>(items);
|
||||
final FComboBox<E> comboBox = new FComboBox<>(items);
|
||||
addComboBoxListener(comboBox, setting);
|
||||
return comboBox;
|
||||
}
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
package forge.screens.home.settings;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.control.FControl.CloseAction;
|
||||
import forge.control.KeyboardShortcuts;
|
||||
import forge.control.KeyboardShortcuts.Shortcut;
|
||||
@@ -34,13 +12,20 @@ import forge.properties.ForgePreferences.FPref;
|
||||
import forge.screens.home.EMenuGroup;
|
||||
import forge.screens.home.IVSubmenu;
|
||||
import forge.screens.home.VHomeUI;
|
||||
import forge.toolbox.FCheckBox;
|
||||
import forge.toolbox.FComboBoxPanel;
|
||||
import forge.toolbox.FLabel;
|
||||
import forge.toolbox.FScrollPane;
|
||||
import forge.toolbox.FSkin;
|
||||
import forge.toolbox.*;
|
||||
import forge.toolbox.FSkin.SkinnedLabel;
|
||||
import forge.toolbox.FSkin.SkinnedTextField;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Assembles Swing components of preferences submenu singleton.
|
||||
@@ -73,7 +58,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbRemoveArtifacts = new OptionsCheckBox("Remove Artifacts");
|
||||
private final JCheckBox cbAnte = new OptionsCheckBox("Play for Ante");
|
||||
private final JCheckBox cbAnteMatchRarity = new OptionsCheckBox("Match Ante Rarity");
|
||||
private final JCheckBox cbUploadDraft = new OptionsCheckBox("Upload Draft Picks");
|
||||
private final JCheckBox cbEnableAICheats = new OptionsCheckBox("Allow AI Cheating");
|
||||
private final JCheckBox cbManaBurn = new OptionsCheckBox("Mana Burn");
|
||||
private final JCheckBox cbManaLostPrompt = new OptionsCheckBox("Prompt Mana Pool Emptying");
|
||||
@@ -99,17 +83,17 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbTokensInSeparateRow = new OptionsCheckBox("Display Tokens in a Separate Row");
|
||||
private final JCheckBox cbStackCreatures = new OptionsCheckBox("Stack Creatures");
|
||||
|
||||
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<FPref, KeyboardShortcutField>();
|
||||
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<>();
|
||||
|
||||
// ComboBox items are added in CSubmenuPreferences since this is just the View.
|
||||
private final FComboBoxPanel<GameLogEntryType> cbpGameLogEntryType = new FComboBoxPanel<GameLogEntryType>("Game Log Verbosity:");
|
||||
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<CloseAction>("Close Action:");
|
||||
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<String>("AI Personality:");
|
||||
private final FComboBoxPanel<GameLogEntryType> cbpGameLogEntryType = new FComboBoxPanel<>("Game Log Verbosity:");
|
||||
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<>("Close Action:");
|
||||
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>("AI Personality:");
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
private VSubmenuPreferences() {
|
||||
VSubmenuPreferences() {
|
||||
|
||||
pnlPrefs.setOpaque(false);
|
||||
pnlPrefs.setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||
@@ -153,9 +137,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbAnteMatchRarity, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Attempts to make antes the same rarity for all players."), regularConstraints);
|
||||
|
||||
pnlPrefs.add(cbUploadDraft, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Sends draft picks to Forge servers for analysis, to improve draft AI."), regularConstraints);
|
||||
|
||||
pnlPrefs.add(cbEnableAICheats, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Allow the AI to cheat to gain advantage (for personalities that have cheat shuffling options set)."), regularConstraints);
|
||||
|
||||
@@ -317,8 +298,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
/** Consolidates checkbox styling in one place. */
|
||||
@SuppressWarnings("serial")
|
||||
private class OptionsCheckBox extends FCheckBox {
|
||||
public OptionsCheckBox(final String txt0) {
|
||||
private final class OptionsCheckBox extends FCheckBox {
|
||||
private OptionsCheckBox(final String txt0) {
|
||||
super(txt0);
|
||||
this.setFont(FSkin.getBoldFont(12));
|
||||
}
|
||||
@@ -326,8 +307,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
/** Consolidates section title label styling in one place. */
|
||||
@SuppressWarnings("serial")
|
||||
private class SectionLabel extends SkinnedLabel {
|
||||
public SectionLabel(final String txt0) {
|
||||
private final class SectionLabel extends SkinnedLabel {
|
||||
private SectionLabel(final String txt0) {
|
||||
super(txt0);
|
||||
this.setBorder(new FSkin.MatteSkinBorder(0, 0, 1, 0, FSkin.getColor(FSkin.Colors.CLR_BORDERS)));
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
@@ -338,8 +319,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
/** Consolidates notation label styling in one place. */
|
||||
@SuppressWarnings("serial")
|
||||
private class NoteLabel extends SkinnedLabel {
|
||||
public NoteLabel(final String txt0) {
|
||||
private final class NoteLabel extends SkinnedLabel {
|
||||
private NoteLabel(final String txt0) {
|
||||
super(txt0);
|
||||
this.setFont(FSkin.getItalicFont(12));
|
||||
this.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||
@@ -359,7 +340,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
* A JTextField plus a "codeString" property, that stores keycodes for
|
||||
* the shortcut. Also, an action listener that handles translation of
|
||||
* keycodes into characters and (dis)assembly of keycode stack.
|
||||
*
|
||||
*
|
||||
* @param shortcut0   Shortcut object
|
||||
*/
|
||||
public KeyboardShortcutField(final Shortcut shortcut0) {
|
||||
@@ -398,7 +379,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
/**
|
||||
* Gets the code string.
|
||||
*
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public final String getCodeString() {
|
||||
@@ -407,7 +388,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
/**
|
||||
* Sets the code string.
|
||||
*
|
||||
*
|
||||
* @param str0
|
||||
*   The new code string (space delimited)
|
||||
*/
|
||||
@@ -418,8 +399,8 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
this.codeString = str0.trim();
|
||||
|
||||
final List<String> codes = new ArrayList<String>(Arrays.asList(this.codeString.split(" ")));
|
||||
final List<String> displayText = new ArrayList<String>();
|
||||
final List<String> codes = new ArrayList<>(Arrays.asList(this.codeString.split(" ")));
|
||||
final List<String> displayText = new ArrayList<>();
|
||||
|
||||
for (final String s : codes) {
|
||||
if (!s.isEmpty()) {
|
||||
@@ -451,11 +432,6 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbRemoveArtifacts;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbUploadDraft() {
|
||||
return cbUploadDraft;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbEnableAICheats() {
|
||||
return cbEnableAICheats;
|
||||
@@ -475,7 +451,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
public JCheckBox getCbAnte() {
|
||||
return cbAnte;
|
||||
}
|
||||
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbAnteMatchRarity() {
|
||||
return cbAnteMatchRarity;
|
||||
@@ -579,7 +555,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
public final JCheckBox getCbStackCreatures() {
|
||||
return cbStackCreatures;
|
||||
}
|
||||
|
||||
|
||||
public final JCheckBox getCbManaLostPrompt() {
|
||||
return cbManaLostPrompt;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
* <p>
|
||||
* BoosterDraftTest class.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: BoosterDraftTest.java 24769 2014-02-09 13:56:04Z Hellfish $
|
||||
*/
|
||||
@@ -31,7 +31,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* <p>
|
||||
* getDecks.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return an array of {@link forge.deck.Deck} objects.
|
||||
*/
|
||||
@Override
|
||||
@@ -44,7 +44,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* <p>
|
||||
* nextChoice.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* <p>
|
||||
* hasNextChoice.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
@Override
|
||||
@@ -78,7 +78,7 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* <p>
|
||||
* getChosenCards.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public List<Card> getChosenCards() {
|
||||
@@ -89,23 +89,13 @@ public class BoosterDraftTest implements IBoosterDraft {
|
||||
* <p>
|
||||
* getUnchosenCards.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public List<Card> getUnchosenCards() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see forge.game.limited.IBoosterDraft#finishedDrafting()
|
||||
*/
|
||||
@Override
|
||||
public void finishedDrafting() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPileDraft() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user