use of pcgen.facade.util.DefaultListFacade in project pcgen by PCGen.
the class CharacterFacadeImpl method getLanguageChoosers.
@Override
public ListFacade<LanguageChooserFacade> getLanguageChoosers() {
CNAbility cna = theCharacter.getBonusLanguageAbility();
DefaultListFacade<LanguageChooserFacade> chooserList = new DefaultListFacade<>();
chooserList.addElement(new LanguageChooserFacadeImpl(this, LanguageBundle.getString("in_sumLangBonus"), //$NON-NLS-1$
cna));
SkillFacade speakLangSkill = dataSet.getSpeakLanguageSkill();
if (speakLangSkill != null) {
chooserList.addElement(new LanguageChooserFacadeImpl(this, //$NON-NLS-1$
LanguageBundle.getString("in_sumLangSkill"), (Skill) speakLangSkill));
}
return chooserList;
}
use of pcgen.facade.util.DefaultListFacade in project pcgen by PCGen.
the class SourceFileLoader method loadCampaigns.
private void loadCampaigns() throws PersistenceLayerException {
// Unload the existing campaigns and load our selected campaign
Globals.emptyLists();
PersistenceManager pManager = PersistenceManager.getInstance();
List<URI> uris = new ArrayList<>();
for (CampaignFacade campaignFacade : selectedCampaigns) {
uris.add(((Campaign) campaignFacade).getSourceURI());
}
pManager.setChosenCampaignSourcefiles(uris);
sourcesSet.clear();
licenseFiles.clear();
if (selectedCampaigns.isEmpty()) {
throw new PersistenceLayerException("You must select at least one campaign to load.");
}
// -- sage_sam
try {
LoadContext context = Globals.getContext();
loadCampaigns(selectedGame, selectedCampaigns, context);
// Load custom items
loadCustomItems(context);
finishLoad(selectedCampaigns, context);
// Check for valid race types
// checkRaceTypes();
// Verify weapons are melee or ranged
verifyWeaponsMeleeOrRanged(context);
// Auto-gen additional equipment
if (PCGenSettings.OPTIONS_CONTEXT.initBoolean(PCGenSettings.OPTION_AUTOCREATE_MW_MAGIC_EQUIP, false)) {
EquipmentList.autoGenerateEquipment();
}
for (Campaign campaign : selectedCampaigns) {
sourcesSet.add(SourceFormat.getFormattedString(campaign, SourceFormat.MEDIUM, true));
}
context.setLoaded(selectedCampaigns);
/*
* This needs to happen after auto equipment generation and after
* context.setLoaded, not in finishLoad
*/
context.loadCampaignFacets();
dataset = new DataSet(context, selectedGame, new DefaultListFacade<>(selectedCampaigns));
// // Show the licenses
// showLicensesIfNeeded();
// showSponsorsIfNeeded();
} catch (Throwable thr) {
Logging.errorPrint("Exception loading files.", thr);
uiDelegate.showErrorMessage(Constants.APPLICATION_NAME, "Failed to load campaigns, see log for details.");
}
}
use of pcgen.facade.util.DefaultListFacade in project pcgen by PCGen.
the class FacadeFactory method initGameModes.
private static void initGameModes(List<GameMode> modes) {
for (GameMode mode : modes) {
String title = mode.getDefaultSourceTitle();
if (SettingsHandler.getGame().equals(mode) && title == null && !mode.getDefaultDataSetList().isEmpty()) {
title = mode.getName();
}
if (title != null && !"".equals(title)) {
DefaultListFacade<CampaignFacade> qcamps = new DefaultListFacade<>();
List<String> sources = mode.getDefaultDataSetList();
for (String string : sources) {
Campaign camp = Globals.getCampaignKeyed(string);
if (camp != null) {
qcamps.addElement(camp);
} else {
Logging.log(Logging.WARNING, "Unable to find source " + string + " used in default source " + title + " for game mode " + mode + ". " + title + " might not work correctly.");
}
}
if (qcamps.isEmpty()) {
Logging.log(Logging.WARNING, "Unable to load default source '" + title + "'. All of its sources are missing.");
continue;
}
quickSources.addElement(new BasicSourceSelectionFacade(mode.getDefaultSourceTitle(), qcamps, mode));
}
}
}
Aggregations