MCPcopy Create free account
hub / github.com/PCGen/pcgen / appendSpellLines

Method appendSpellLines

code/src/java/pcgen/io/PCGVer2Creator.java:2058–2138  ·  view source on GitHub ↗
(StringBuilder buffer)

Source from the content-addressed store, hash-verified

2056 * completely changed due to new Spell API
2057 */
2058 private void appendSpellLines(StringBuilder buffer)
2059 {
2060
2061 for (PCClass pcClass : charDisplay.getClassSet())
2062 {
2063 Collection<? extends CharacterSpell> sp = charDisplay.getCharacterSpells(pcClass);
2064 List<CharacterSpell> classSpells = new ArrayList<>(sp);
2065 // Add in the spells granted by objects
2066 thePC.addBonusKnownSpellsToList(pcClass, classSpells);
2067 Collections.sort(classSpells);
2068
2069 for (CharacterSpell cSpell : classSpells)
2070 {
2071 for (SpellInfo spellInfo : cSpell.getInfoList())
2072 {
2073 CDOMObject owner = cSpell.getOwner();
2074 List<? extends CDOMList<Spell>> lists = charDisplay.getSpellLists(owner);
2075
2076 if (SpellLevel.getFirstLevelForKey(cSpell.getSpell(), lists, thePC) < 0)
2077 {
2078 Logging.errorPrint(
2079 "Ignoring unqualified spell " + cSpell.getSpell() + " in list for class " + pcClass + ".");
2080 continue;
2081 }
2082 if (spellInfo.getBook().equals(Globals.getDefaultSpellBook())
2083 && thePC.getSpellSupport(pcClass).isAutoKnownSpell(cSpell.getSpell(),
2084 SpellLevel.getFirstLevelForKey(cSpell.getSpell(), lists, thePC), false, thePC)
2085 && thePC.getAutoSpells())
2086 {
2087 continue;
2088 }
2089
2090 buffer.append(IOConstants.TAG_SPELLNAME).append(':');
2091 buffer.append(EntityEncoder.encode(cSpell.getSpell().getKeyName()));
2092 buffer.append('|');
2093 buffer.append(IOConstants.TAG_TIMES).append(':');
2094 buffer.append(spellInfo.getTimes());
2095 buffer.append('|');
2096 buffer.append(IOConstants.TAG_CLASS).append(':');
2097 buffer.append(EntityEncoder.encode(pcClass.getKeyName()));
2098 buffer.append('|');
2099 buffer.append(IOConstants.TAG_SPELL_BOOK).append(':');
2100 buffer.append(EntityEncoder.encode(spellInfo.getBook()));
2101 buffer.append('|');
2102 buffer.append(IOConstants.TAG_SPELLLEVEL).append(':');
2103 buffer.append(spellInfo.getActualLevel());
2104 if (spellInfo.getNumPages() > 0)
2105 {
2106 buffer.append('|');
2107 buffer.append(IOConstants.TAG_SPELLNUMPAGES).append(':');
2108 buffer.append(spellInfo.getNumPages());
2109 }
2110
2111 final List<Ability> metaFeats = spellInfo.getFeatList();
2112
2113 if ((metaFeats != null) && (!metaFeats.isEmpty()))
2114 {
2115 buffer.append('|');

Callers 1

createPCGStringMethod · 0.95

Calls 15

getFirstLevelForKeyMethod · 0.95
errorPrintMethod · 0.95
getDefaultSpellBookMethod · 0.95
encodeMethod · 0.95
getStringForMethod · 0.95
getKeyNameMethod · 0.95
getInfoListMethod · 0.80
getBookMethod · 0.80
isAutoKnownSpellMethod · 0.80
getAutoSpellsMethod · 0.80

Tested by

no test coverage detected