Search in sources :

Example 61 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class SourceFileLoader method getOtherLicenses.

/**
	 * @return a list of licenses read from the campaign license files
	 */
public Iterable<String> getOtherLicenses() {
    Collection<String> licenses = new ArrayList<>();
    for (CampaignSourceEntry licenseFile : licenseFiles) {
        try {
            StringBuilder dataBuffer = LstFileLoader.readFromURI(licenseFile.getURI());
            licenses.add(dataBuffer.toString());
        } catch (PersistenceLayerException e) {
            Logging.errorPrint("Could not read license at " + licenseFile, e);
        }
    }
    return licenses;
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) ArrayList(java.util.ArrayList)

Example 62 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class SourceFileLoader method addDefaultEquipmentMods.

private void addDefaultEquipmentMods(LoadContext context) throws PersistenceLayerException {
    URI uri = URI.create("file:/" + eqModLoader.getClass().getName() + ".java");
    context.setSourceURI(uri);
    SourceEntry source = new CampaignSourceEntry(new Campaign(), uri);
    LoadContext subContext = context.dropIntoContext("EQUIPMENT");
    String aLine;
    aLine = "Add Type\tKEY:ADDTYPE\tTYPE:ALL\tCOST:0\tNAMEOPT:NONAME\tSOURCELONG:PCGen Internal\tCHOOSE:EQBUILDER.EQTYPE|COUNT=ALL|TITLE=desired TYPE(s)";
    eqModLoader.parseLine(subContext, null, aLine, source);
    //
    // Add internal equipment modifier for adding weapon/armor types to
    // equipment
    //
    aLine = Constants.INTERNAL_EQMOD_WEAPON + "\tTYPE:Weapon\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME";
    eqModLoader.parseLine(subContext, null, aLine, source);
    aLine = Constants.INTERNAL_EQMOD_ARMOR + "\tTYPE:Armor\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME";
    eqModLoader.parseLine(subContext, null, aLine, source);
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) LoadContext(pcgen.rules.context.LoadContext) CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) SourceEntry(pcgen.persistence.lst.SourceEntry) URI(java.net.URI)

Example 63 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class SourceFileLoader method addDefaultDataControlIfNeeded.

/**
	 * Add default data control files to the supplied list, but only if it is empty.
	 * 
	 * @param dataDefFileList The list of data control files.
	 */
public static List<CampaignSourceEntry> addDefaultDataControlIfNeeded(List<CampaignSourceEntry> dataDefFileList) {
    if (dataDefFileList == null) {
        dataDefFileList = new ArrayList<>();
    }
    if (dataDefFileList.isEmpty()) {
        File gameModeDir = new File(ConfigurationSettings.getSystemsDir(), "gameModes");
        File defaultGameModeDir = new File(gameModeDir, "default");
        File df = new File(defaultGameModeDir, "compatibilityDataControl.lst");
        Campaign c = new Campaign();
        c.setName("Default Data Control File");
        CampaignSourceEntry cse = new CampaignSourceEntry(c, df.toURI());
        dataDefFileList.add(cse);
    }
    return dataDefFileList;
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) PCGFile(pcgen.io.PCGFile) File(java.io.File)

Example 64 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class AbstractGlobalTokenTestCase method classSetUp.

@BeforeClass
public static void classSetUp() throws URISyntaxException {
    Locale.setDefault(Locale.US);
    testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
    classSetUpFired = true;
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) URI(java.net.URI) BeforeClass(org.junit.BeforeClass)

Example 65 with CampaignSourceEntry

use of pcgen.persistence.lst.CampaignSourceEntry in project pcgen by PCGen.

the class AbstractTokenTestCase method classSetUp.

@BeforeClass
public static void classSetUp() throws URISyntaxException {
    testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
    classSetUpFired = true;
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) URI(java.net.URI) BeforeClass(org.junit.BeforeClass)

Aggregations

CampaignSourceEntry (pcgen.persistence.lst.CampaignSourceEntry)95 URI (java.net.URI)54 Campaign (pcgen.core.Campaign)44 URISyntaxException (java.net.URISyntaxException)27 LoadContext (pcgen.rules.context.LoadContext)25 UnreachableError (pcgen.base.lang.UnreachableError)19 BeforeClass (org.junit.BeforeClass)16 PCClassLoader (pcgen.persistence.lst.PCClassLoader)15 TreeSet (java.util.TreeSet)12 PlayerCharacter (pcgen.core.PlayerCharacter)11 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)11 ArrayList (java.util.ArrayList)9 PCClass (pcgen.core.PCClass)9 File (java.io.File)8 GenericLoader (pcgen.persistence.lst.GenericLoader)8 CDOMReference (pcgen.cdom.base.CDOMReference)7 SourceEntry (pcgen.persistence.lst.SourceEntry)7 Ability (pcgen.core.Ability)6 FeatLoader (pcgen.persistence.lst.FeatLoader)6 AbilityList (pcgen.cdom.list.AbilityList)5