Search in sources :

Example 1 with PointBuyCost

use of pcgen.core.PointBuyCost in project pcgen by PCGen.

the class GameModeFileLoader method loadGameModes.

private void loadGameModes(String[] gameFiles) {
    SystemCollections.clearGameModeList();
    File gameModeDir = new File(ConfigurationSettings.getSystemsDir(), "gameModes");
    int progress = 0;
    for (final String gameFile : gameFiles) {
        File specGameModeDir = new File(gameModeDir, gameFile);
        File miscInfoFile = new File(specGameModeDir, "miscinfo.lst");
        final GameMode gm = GameModeFileLoader.loadGameModeMiscInfo(gameFile, miscInfoFile.toURI());
        if (gm != null) {
            String gmName = gm.getName();
            //SettingsHandler.setGame(gmName);
            LoadContext context = gm.getModeContext();
            loadGameModeInfoFile(gm, new File(specGameModeDir, "level.lst").toURI(), "level");
            loadGameModeInfoFile(gm, new File(specGameModeDir, "rules.lst").toURI(), "rules");
            // Load equipmentslot.lst
            GameModeFileLoader.loadGameModeLstFile(context, eqSlotLoader, gmName, gameFile, "equipmentslots.lst");
            // Load paperInfo.lst
            GameModeFileLoader.loadGameModeLstFile(context, paperLoader, gmName, gameFile, "paperInfo.lst");
            // Load bio files
            GameModeFileLoader.loadGameModeLstFile(context, traitLoader, gmName, gameFile, "bio" + File.separator + "traits.lst");
            GameModeFileLoader.loadGameModeLstFile(context, locationLoader, gmName, gameFile, "bio" + File.separator + "locations.lst");
            // Load load.lst and check for completeness
            GameModeFileLoader.loadGameModeLstFile(context, loadInfoLoader, gmName, gameFile, "load.lst");
            // Load sizeAdjustment.lst
            GameModeFileLoader.loadGameModeLstFile(context, sizeLoader, gmName, gameFile, "sizeAdjustment.lst");
            // Load statsandchecks.lst
            GameModeFileLoader.loadGameModeLstFile(context, statCheckLoader, gmName, gameFile, "statsandchecks.lst");
            // Load equipIcons.lst
            GameModeFileLoader.loadGameModeLstFile(context, equipIconLoader, gmName, gameFile, "equipIcons.lst");
            GameModeFileLoader.loadGameModeLstFile(context, codeControlLoader, gmName, gameFile, "codeControl.lst");
            // Load pointbuymethods.lst
            loadPointBuyFile(context, gameFile, gmName);
            for (final PointBuyCost pbc : context.getReferenceContext().getConstructedCDOMObjects(PointBuyCost.class)) {
                gm.addPointBuyStatCost(pbc);
            }
            // Load migration.lst
            GameModeFileLoader.loadGameModeLstFile(context, migrationLoader, gmName, gameFile, "migration.lst");
            GameModeFileLoader.loadGameModeLstFile(context, bioLoader, gmName, gameFile, "bio" + File.separator + "biosettings.lst");
        }
        try {
            GameModeFileLoader.addDefaultWieldCategories(gm.getModeContext());
        } catch (final PersistenceLayerException ple) {
            Logging.errorPrint("Error Initializing PreParserFactory");
            Logging.errorPrint("  " + ple.getMessage(), ple);
            throw new UnreachableError();
        }
        progress++;
        setProgress(progress);
    }
    SystemCollections.sortGameModeList();
}
Also used : GameMode(pcgen.core.GameMode) LoadContext(pcgen.rules.context.LoadContext) PointBuyCost(pcgen.core.PointBuyCost) UnreachableError(pcgen.base.lang.UnreachableError) File(java.io.File)

Aggregations

File (java.io.File)1 UnreachableError (pcgen.base.lang.UnreachableError)1 GameMode (pcgen.core.GameMode)1 PointBuyCost (pcgen.core.PointBuyCost)1 LoadContext (pcgen.rules.context.LoadContext)1