use of pcgen.cdom.enumeration.FactKey in project pcgen by PCGen.
the class DeityToken method getToken.
/**
* @see pcgen.io.exporttoken.Token#getToken(java.lang.String, pcgen.core.PlayerCharacter, pcgen.io.ExportHandler)
*/
@Override
public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) {
String retString = "";
CharacterDisplay display = pc.getDisplay();
Deity deity = display.getDeity();
if (deity != null) {
StringTokenizer aTok = new StringTokenizer(tokenSource, ".", false);
String subTag = "OUTPUTNAME";
if (aTok.countTokens() > 1) {
aTok.nextToken();
subTag = aTok.nextToken();
}
if ("NAME".equals(subTag)) {
if (!display.getSuppressBioField(BiographyField.DEITY)) {
retString = deity.getDisplayName();
}
} else if ("OUTPUTNAME".equals(subTag)) {
if (!display.getSuppressBioField(BiographyField.DEITY)) {
retString = OutputNameFormatting.getOutputName(deity);
}
} else if ("DOMAINLIST".equals(subTag)) {
retString = getDomainListToken(deity);
} else if ("FOLLOWERALIGNMENT".equals(subTag)) {
Logging.errorPrint("Output Sheet uses DEITY.FOLLOWERALIGN: " + "Function has been removed from PCGen");
} else if ("ALIGNMENT".equals(subTag)) {
CDOMSingleRef<PCAlignment> al = deity.get(ObjectKey.ALIGNMENT);
retString = al == null ? "" : al.get().getKeyName();
} else if ("APPEARANCE".equals(subTag)) {
FactKey<String> fk = FactKey.valueOf("Appearance");
String str = deity.getResolved(fk);
retString = (str == null) ? "" : str;
} else if ("DESCRIPTION".equals(subTag)) {
retString = pc.getDescription(deity);
} else if ("HOLYITEM".equals(subTag)) {
FactKey<String> fk = FactKey.valueOf("Symbol");
String str = deity.getResolved(fk);
retString = (str == null) ? "" : str;
} else if ("FAVOREDWEAPON".equals(subTag)) {
List<CDOMReference<WeaponProf>> dwp = deity.getSafeListFor(ListKey.DEITYWEAPON);
retString = ReferenceUtilities.joinLstFormat(dwp, Constants.PIPE, true);
} else if ("PANTHEONLIST".equals(subTag)) {
FactSetKey<String> fk = FactSetKey.valueOf("Pantheon");
Set<String> pset = new TreeSet<>();
for (Indirect<String> indirect : deity.getSafeSetFor(fk)) {
pset.add(indirect.get());
}
retString = StringUtil.join(pset, ", ");
} else if ("SOURCE".equals(subTag)) {
retString = SourceFormat.getFormattedString(deity, Globals.getSourceDisplay(), true);
} else if ("SA".equals(subTag)) {
retString = getSAToken(deity, display);
} else if ("TITLE".equals(subTag)) {
FactKey<String> fk = FactKey.valueOf("Title");
String str = deity.getResolved(fk);
retString = (str == null) ? "" : str;
} else if ("WORSHIPPERS".equals(subTag)) {
FactKey<String> fk = FactKey.valueOf("Worshippers");
String str = deity.getResolved(fk);
retString = (str == null) ? "" : str;
}
}
return retString;
}
Aggregations