use of pcgen.core.Campaign in project pcgen by PCGen.
the class VisibleTokenTest method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class FunctionTokenTest method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class PreCampaignTester method countCampaignByBookType.
/**
* Count the number of campaign currently loaded or selected that
* are of the book type.
*
* @param bookType the book type
* @param includeSubCampaigns Should we count included sub campaigns that match
*
* @return the number of matching campaigns
*/
private int countCampaignByBookType(String bookType, boolean includeSubCampaigns) {
Set<Campaign> matchingCampaigns = new HashSet<>();
PersistenceManager pMan = PersistenceManager.getInstance();
List<URI> selCampaigns = pMan.getChosenCampaignSourcefiles();
for (URI element : selCampaigns) {
final Campaign aCampaign = Globals.getCampaignByURI(element, false);
List<Campaign> fullCampList;
if (includeSubCampaigns) {
fullCampList = getFullCampaignList(aCampaign);
} else {
fullCampList = new ArrayList<>();
fullCampList.add(aCampaign);
}
for (Campaign camp : fullCampList) {
for (String listType : camp.getBookTypeList()) {
if (bookType.equalsIgnoreCase(listType)) {
matchingCampaigns.add(camp);
break;
}
}
}
}
return matchingCampaigns.size();
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class AbstractPCClassLevelTokenTestCase method classSetUp.
@BeforeClass
public static void classSetUp() throws URISyntaxException {
testCampaign = new CampaignSourceEntry(new Campaign(), new URI("file:/Test%20Case"));
classSetUpFired = true;
}
use of pcgen.core.Campaign in project pcgen by PCGen.
the class DataLoadTest method getBasicSources.
private static List<SourceSelectionFacade> getBasicSources() {
List<SourceSelectionFacade> basicSources = new ArrayList<>();
for (Campaign campaign : Globals.getCampaignList()) {
if (campaign.showInMenu()) {
SourceSelectionFacade sourceSelection = FacadeFactory.createSourceSelection(campaign.getGameModes().getElementAt(0), Collections.singletonList(campaign), campaign.getName());
basicSources.add(sourceSelection);
}
}
for (GameMode mode : SystemCollections.getUnmodifiableGameModeList()) {
String title = mode.getDefaultSourceTitle();
if (title == null && !mode.getDefaultDataSetList().isEmpty()) {
title = mode.getName();
}
if (!mode.getDefaultDataSetList().isEmpty()) {
List<CampaignFacade> qcamps = new ArrayList<>();
List<String> sources = mode.getDefaultDataSetList();
for (String string : sources) {
Campaign camp = Globals.getCampaignKeyed(string);
assertNotNull("Cannot find source " + string + " for game mode " + mode, camp);
qcamps.add(camp);
}
basicSources.add(FacadeFactory.createSourceSelection(mode, qcamps, mode.getDefaultSourceTitle()));
}
}
return basicSources;
}
Aggregations