Moved formats into separate folder so that additional custom format files can be added - added Pauper and Kaladesh_Standard as examples

This commit is contained in:
austinio7116
2018-03-30 07:49:54 +01:00
committed by maustin
parent 3ea9f7d218
commit 9082a89c59
6 changed files with 20 additions and 4 deletions

View File

@@ -0,0 +1,4 @@
[Pauper]
Rarities:L, C
[Kaladesh_Standard]
Sets:KLD, AER, EMN, SOI, BFZ, OGW

View File

@@ -166,8 +166,19 @@ public final class FModel {
ForgePreferences.DEV_MODE = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED); ForgePreferences.DEV_MODE = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED);
ForgePreferences.UPLOAD_DRAFT = ForgePreferences.NET_CONN; ForgePreferences.UPLOAD_DRAFT = ForgePreferences.NET_CONN;
formats = new GameFormat.Collection(new GameFormat.Reader(new File(ForgeConstants.BLOCK_DATA_DIR + "formats.txt")));
//add user custom formats if file present final File[] files = new File(ForgeConstants.FORMATS_DATA_DIR).listFiles();
for (final File file : files) {
if(formats == null){
formats = new GameFormat.Collection(new GameFormat.Reader(file));
}else{
GameFormat.Collection additionalformats = new GameFormat.Collection(new GameFormat.Reader(file));
for (GameFormat format:additionalformats) {
formats.add(format);
}
}
}
//still support old user custom formats if file present
GameFormat.Collection customFormats = new GameFormat.Collection(new GameFormat.Reader(new File(ForgeConstants.USER_PREFS_DIR + "customformats.txt"))); GameFormat.Collection customFormats = new GameFormat.Collection(new GameFormat.Reader(new File(ForgeConstants.USER_PREFS_DIR + "customformats.txt")));
for (GameFormat format:customFormats){ for (GameFormat format:customFormats){
formats.add(format); formats.add(format);

View File

@@ -61,6 +61,7 @@ public final class ForgeConstants {
public static final String TOKEN_DATA_DIR = RES_DIR + "tokenscripts" + PATH_SEPARATOR; public static final String TOKEN_DATA_DIR = RES_DIR + "tokenscripts" + PATH_SEPARATOR;
public static final String EDITIONS_DIR = RES_DIR + "editions" + PATH_SEPARATOR; public static final String EDITIONS_DIR = RES_DIR + "editions" + PATH_SEPARATOR;
public static final String BLOCK_DATA_DIR = RES_DIR + "blockdata" + PATH_SEPARATOR; public static final String BLOCK_DATA_DIR = RES_DIR + "blockdata" + PATH_SEPARATOR;
public static final String FORMATS_DATA_DIR = RES_DIR + "formats" + PATH_SEPARATOR;
public static final String DECK_CUBE_DIR = RES_DIR + "cube" + PATH_SEPARATOR; public static final String DECK_CUBE_DIR = RES_DIR + "cube" + PATH_SEPARATOR;
public static final String AI_PROFILE_DIR = RES_DIR + "ai" + PATH_SEPARATOR; public static final String AI_PROFILE_DIR = RES_DIR + "ai" + PATH_SEPARATOR;
public static final String SOUND_DIR = RES_DIR + "sound" + PATH_SEPARATOR; public static final String SOUND_DIR = RES_DIR + "sound" + PATH_SEPARATOR;

View File

@@ -110,7 +110,7 @@ def initializeForgeCards():
def initializeFormats(): def initializeFormats():
formats = {} formats = {}
formatLocation = os.path.join(resDir, 'blockdata', 'formats.txt') formatLocation = os.path.join(resDir, 'formats', 'coreformats.txt')
print "Looking for formats in ", formatLocation print "Looking for formats in ", formatLocation
with open(formatLocation) as formatFile: with open(formatLocation) as formatFile:
while formatFile: while formatFile:

View File

@@ -15,7 +15,7 @@ pathToMtgData = os.path.join(toolsDir, "mtg-data.txt")
def initializeFormats(): def initializeFormats():
formats = {} formats = {}
formatLocation = os.path.join(resDir, 'blockdata', 'formats.txt') formatLocation = os.path.join(resDir, 'formats', 'coreformats.txt')
print "Looking for formats in ", formatLocation print "Looking for formats in ", formatLocation
with open(formatLocation) as formatFile: with open(formatLocation) as formatFile:
while formatFile: while formatFile: