Merge branch 'historicformats' of https://git.cardforge.org/core-developers/forge into historicformats

# Conflicts:
#	forge-gui/res/formats/Historic/prototypes/release-dates.txt
This commit is contained in:
schnautzr
2018-05-15 19:09:58 -05:00
6 changed files with 32 additions and 2 deletions

View File

@@ -286,13 +286,27 @@ public class GameFormat implements Comparable<GameFormat> {
public static class Reader extends StorageReaderRecursiveFolderWithUserFolder<GameFormat> {
List<GameFormat> naturallyOrdered = new ArrayList<GameFormat>();
boolean includeHistoric;
private List<String> coreFormats = new ArrayList<>();
{
coreFormats.add("Standard.txt");
coreFormats.add("Modern.txt");
coreFormats.add("Legacy.txt");
coreFormats.add("Vintage.txt");
coreFormats.add("Commander.txt");
public Reader(File forgeFormats, File customFormats) {
}
public Reader(File forgeFormats, File customFormats, boolean includeHistoric) {
super(forgeFormats, customFormats, GameFormat.FN_GET_NAME);
this.includeHistoric=includeHistoric;
}
@Override
protected GameFormat read(File file) {
if(!includeHistoric && !coreFormats.contains(file.getName())){
return null;
}
final Map<String, List<String>> contents = FileSection.parseSections(FileUtil.readFile(file));
List<String> sets = null; // default: all sets allowed
List<String> bannedCards = null; // default: nothing banned

View File

@@ -134,6 +134,9 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbLoadCardsLazily(), FPref.LOAD_CARD_SCRIPTS_LAZILY));
lstControls.add(Pair.of(view.getCbLoadHistoricFormats(), FPref.LOAD_HISTORIC_FORMATS));
for(final Pair<JCheckBox, FPref> kv : lstControls) {
kv.getKey().addItemListener(new ItemListener() {
@Override

View File

@@ -65,6 +65,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbManaLostPrompt = new OptionsCheckBox("Prompt Mana Pool Emptying");
private final JCheckBox cbDevMode = new OptionsCheckBox("Developer Mode");
private final JCheckBox cbLoadCardsLazily = new OptionsCheckBox("Load Card Scripts Lazily");
private final JCheckBox cbLoadHistoricFormats = new OptionsCheckBox("Load Historic Formats");
private final JCheckBox cbWorkshopSyntax = new OptionsCheckBox("Workshop Syntax Checker");
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbImageFetcher = new OptionsCheckBox("Automatically Download Missing Card Art");
@@ -239,6 +240,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbLoadCardsLazily, titleConstraints);
pnlPrefs.add(new NoteLabel("If turned on, Forge will load card scripts as they're needed instead of at start up. (Warning: Experimental)"), descriptionConstraints);
pnlPrefs.add(cbLoadHistoricFormats, titleConstraints);
pnlPrefs.add(new NoteLabel("If turned on, Forge will load all historic format definitions, this may take slightly longer to load at startup."), descriptionConstraints);
// Graphic Options
pnlPrefs.add(new SectionLabel("Graphic Options"), sectionConstraints + ", gaptop 2%");
@@ -586,6 +590,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbLoadCardsLazily;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbLoadHistoricFormats() {
return cbLoadHistoricFormats;
}
public JCheckBox getCbWorkshopSyntax() {
return cbWorkshopSyntax;
}

View File

@@ -187,6 +187,9 @@ public class SettingsPage extends TabPage<SettingsScreen> {
lstSettings.addItem(new BooleanSetting(FPref.LOAD_CARD_SCRIPTS_LAZILY,
"Load Card Scripts Lazily",
"If turned on, Forge will load card scripts as they're needed instead of at start up. (Warning: Experimental)"), 3);
lstSettings.addItem(new BooleanSetting(FPref.LOAD_HISTORIC_FORMATS,
"Load Historic Formats",
"If turned on, Forge will load all historic format definitions, this may take slightly longer to load at startup."), 3);
//Graphic Options
lstSettings.addItem(new BooleanSetting(FPref.UI_OVERLAY_FOIL_EFFECT,

View File

@@ -165,7 +165,7 @@ public final class FModel {
ForgePreferences.UPLOAD_DRAFT = ForgePreferences.NET_CONN;
formats = new GameFormat.Collection(new GameFormat.Reader( new File(ForgeConstants.FORMATS_DATA_DIR),
new File(ForgeConstants.USER_FORMATS_DIR)));
new File(ForgeConstants.USER_FORMATS_DIR), preferences.getPrefBoolean(FPref.LOAD_HISTORIC_FORMATS)));
magicDb.setStandardPredicate(formats.getStandard().getFilterRules());
magicDb.setModernPredicate(formats.getModern().getFilterRules());

View File

@@ -159,6 +159,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
DEV_LOG_ENTRY_TYPE (GameLogEntryType.DAMAGE.toString()),
LOAD_CARD_SCRIPTS_LAZILY ("false"),
LOAD_HISTORIC_FORMATS ("false"),
DECK_DEFAULT_CARD_LIMIT ("4"),
DECKGEN_SINGLETONS ("false"),