Search in sources :

Example 61 with Campaign

use of pcgen.core.Campaign 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 62 with Campaign

use of pcgen.core.Campaign 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)

Example 63 with Campaign

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

the class AbstractPCClassLevelTokenTestCase method classSetUp.

@BeforeClass
public static final 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)

Example 64 with Campaign

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

the class Gui2CampaignInfoFactory method appendCampaignInfo.

private void appendCampaignInfo(Campaign aCamp, final HtmlInfoBuilder infoText) {
    infoText.appendLineBreak();
    if (aCamp.getSizeOfListFor(ListKey.FILE_COVER) > 0) {
        CampaignSourceEntry image = aCamp.getSafeListFor(ListKey.FILE_COVER).get(0);
        infoText.appendIconElement(image.getURI().toString());
    }
    if (aCamp.getSizeOfListFor(ListKey.FILE_LOGO) > 0) {
        CampaignSourceEntry image = aCamp.getSafeListFor(ListKey.FILE_LOGO).get(0);
        infoText.appendIconElement(image.getURI().toString());
    }
    if (aCamp.getSizeOfListFor(ListKey.FILE_COVER) > 0 || aCamp.getSizeOfListFor(ListKey.FILE_LOGO) > 0) {
        infoText.appendLineBreak();
    }
    String bString = SourceFormat.getFormattedString(aCamp, SourceFormat.MEDIUM, true);
    if (StringUtils.isEmpty(bString)) {
        bString = SourceFormat.getFormattedString(aCamp, SourceFormat.LONG, true);
    }
    //$NON-NLS-1$
    infoText.appendI18nElement("in_sumSource", bString);
    //$NON-NLS-1$
    infoText.appendI18nFormattedElement(//$NON-NLS-1$
    "in_infByPub", aCamp.getSafe(StringKey.PUB_NAME_LONG));
    infoText.appendLineBreak();
    // Add the data set release status
    Status status = aCamp.getSafe(ObjectKey.STATUS);
    //$NON-NLS-1$
    infoText.appendI18nElement(//$NON-NLS-1$
    "in_infStatus", //$NON-NLS-1$ //$NON-NLS-2$
    "<font color=\"#" + Integer.toHexString(status.getColor()) + "\">" + status + //$NON-NLS-1$
    "</font>");
    infoText.appendLineBreak();
    String descr = aCamp.get(StringKey.DESCRIPTION);
    if (descr != null) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_infDesc", descr);
        infoText.appendLineBreak();
    }
    // Add the website URLs
    List<CampaignURL> webURLs = getUrlListForKind(aCamp, URLKind.WEBSITE);
    if (!webURLs.isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_infWebsite", buildURLListString(webURLs));
        infoText.appendLineBreak();
    }
    if (!aCamp.getType().isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_infType", aCamp.getType());
        infoText.appendSpacer();
    }
    infoText.appendI18nElement("in_infRank", String.valueOf(//$NON-NLS-1$
    aCamp.getSafe(IntegerKey.CAMPAIGN_RANK)));
    if (!StringUtil.join(aCamp.getSafeListFor(ListKey.GAME_MODE), ", ").isEmpty()) {
        infoText.appendSpacer();
        //$NON-NLS-1$
        infoText.appendI18nElement(//$NON-NLS-1$
        "in_infGame", StringUtil.join(aCamp.getSafeListFor(ListKey.GAME_MODE), ", "));
    }
    infoText.appendLineBreak();
    // Add the purchase URLs
    List<CampaignURL> purchaseURLs = getUrlListForKind(aCamp, URLKind.PURCHASE);
    if (!purchaseURLs.isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_infPurchase", buildURLListString(purchaseURLs));
        infoText.appendLineBreak();
    }
    // Add the survey URLs
    List<CampaignURL> surveyURLs = getUrlListForKind(aCamp, URLKind.SURVEY);
    if (!surveyURLs.isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_infSurvey", buildURLListString(surveyURLs));
        infoText.appendLineBreak();
    }
    String preString = PrerequisiteUtilities.preReqHTMLStringsForList(null, null, aCamp.getPrerequisiteList(), false);
    if (!preString.isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nFormattedElement("in_InfoRequirements", preString);
    }
    boolean infoDisplayed = false;
    List<String> info = aCamp.getListFor(ListKey.INFO_TEXT);
    if (info != null) {
        if (!infoDisplayed) {
            infoText.appendLineBreak();
        }
        //$NON-NLS-1$
        infoText.appendSmallTitleElement(LanguageBundle.getString("in_infInf"));
        infoText.appendLineBreak();
        for (String infotext : info) {
            infoText.append(infotext);
            infoText.appendLineBreak();
        }
        infoDisplayed = true;
    }
    List<String> copyright = aCamp.getListFor(ListKey.SECTION_15);
    if (copyright != null) {
        if (!infoDisplayed) {
            infoText.appendLineBreak();
        }
        //$NON-NLS-1$
        infoText.appendSmallTitleElement(LanguageBundle.getString("in_infCopyright"));
        infoText.appendLineBreak();
        for (String license : copyright) {
            infoText.append(license);
            infoText.appendLineBreak();
        }
    }
    List<Campaign> subCampaigns = aCamp.getSubCampaigns();
    List<CampaignSourceEntry> notFoundSubCampaigns = aCamp.getNotFoundSubCampaigns();
    if (subCampaigns != null && notFoundSubCampaigns != null && (!subCampaigns.isEmpty() || !notFoundSubCampaigns.isEmpty())) {
        infoText.appendLineBreak();
        infoText.appendSmallTitleElement(LanguageBundle.getString(//$NON-NLS-1$
        "in_infIncludedCampaigns"));
        infoText.appendLineBreak();
        for (Campaign subCamp : subCampaigns) {
            infoText.append(subCamp.getDisplayName());
            infoText.appendLineBreak();
        }
        for (CampaignSourceEntry subCse : notFoundSubCampaigns) {
            infoText.append(LanguageBundle.getFormattedString("in_infMissingCampaign", subCse.getURI()));
            infoText.appendLineBreak();
        }
    }
    infoText.appendLineBreak();
    infoText.appendI18nElement("in_infPccPath", aCamp.getSourceURI().getPath());
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Status(pcgen.cdom.enumeration.Status) CampaignURL(pcgen.cdom.content.CampaignURL) Campaign(pcgen.core.Campaign)

Example 65 with Campaign

use of pcgen.core.Campaign 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));
        }
    }
}
Also used : GameMode(pcgen.core.GameMode) Campaign(pcgen.core.Campaign) CampaignFacade(pcgen.facade.core.CampaignFacade) DefaultListFacade(pcgen.facade.util.DefaultListFacade)

Aggregations

Campaign (pcgen.core.Campaign)84 URI (java.net.URI)49 CampaignSourceEntry (pcgen.persistence.lst.CampaignSourceEntry)44 URISyntaxException (java.net.URISyntaxException)17 BeforeClass (org.junit.BeforeClass)16 LoadContext (pcgen.rules.context.LoadContext)16 ArrayList (java.util.ArrayList)14 PlayerCharacter (pcgen.core.PlayerCharacter)11 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)11 File (java.io.File)10 PCClass (pcgen.core.PCClass)10 PCClassLoader (pcgen.persistence.lst.PCClassLoader)10 UnreachableError (pcgen.base.lang.UnreachableError)9 Ability (pcgen.core.Ability)9 GameMode (pcgen.core.GameMode)7 SourceEntry (pcgen.persistence.lst.SourceEntry)7 Test (org.junit.Test)6 HashSet (java.util.HashSet)5 CampaignFacade (pcgen.facade.core.CampaignFacade)5 PCGFile (pcgen.io.PCGFile)5