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

Method appendClassLines

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

Source from the content-addressed store, hash-verified

765 * ###############################################################
766 */
767 private void appendClassLines(StringBuilder buffer)
768 {
769 Cache specials = new Cache();
770
771 for (PCClass pcClass : charDisplay.getClassSet())
772 {
773 int classLevel = charDisplay.getLevel(pcClass);
774
775 buffer.append(IOConstants.TAG_CLASS).append(':');
776 buffer.append(EntityEncoder.encode(pcClass.getKeyName()));
777
778 final String subClassKey = charDisplay.getSubClassName(pcClass);
779
780 if (subClassKey != null && !Constants.EMPTY_STRING.equals(subClassKey))
781 {
782 buffer.append('|');
783 buffer.append(IOConstants.TAG_SUBCLASS).append(':');
784 buffer.append(EntityEncoder.encode(subClassKey));
785 }
786
787 buffer.append('|');
788 buffer.append(IOConstants.TAG_LEVEL).append(':');
789 buffer.append(classLevel);
790 buffer.append('|');
791 buffer.append(IOConstants.TAG_SKILLPOOL).append(':');
792 Integer currentPool = thePC.getSkillPool(pcClass);
793 buffer.append(currentPool == null ? 0 : currentPool);
794
795 // determine if this class can cast spells
796 boolean isCaster = false;
797
798 if (!thePC.getSpellSupport(pcClass).canCastSpells(thePC))
799 {
800 isCaster = true;
801 }
802
803 boolean isPsionic = thePC.getSpellSupport(pcClass).hasKnownList() && !isCaster;
804
805 if (isCaster || isPsionic)
806 {
807 buffer.append('|');
808 buffer.append(IOConstants.TAG_SPELLBASE).append(':');
809 buffer.append(EntityEncoder.encode(pcClass.getSpellBaseStat()));
810 buffer.append('|');
811 buffer.append(IOConstants.TAG_CANCASTPERDAY).append(':');
812 buffer.append(StringUtil.join(thePC.getSpellSupport(pcClass).getCastListForLevel(classLevel), ","));
813 }
814
815 Collection<? extends SpellProhibitor> prohib = charDisplay.getProhibitedSchools(pcClass);
816 if (prohib != null)
817 {
818 Set<String> set = new TreeSet<>();
819 for (SpellProhibitor sp : prohib)
820 {
821 set.addAll(sp.getValueList());
822 }
823 if (!set.isEmpty())
824 {

Callers 1

createPCGStringMethod · 0.95

Calls 15

encodeMethod · 0.95
getSpellBaseStatMethod · 0.95
joinMethod · 0.95
appendAddTokenInfoMethod · 0.95
putMethod · 0.95
getContextMethod · 0.95
appendSpecialsMethod · 0.95
getMethod · 0.95
canCastSpellsMethod · 0.80
hasKnownListMethod · 0.80
getCastListForLevelMethod · 0.80
getValueListMethod · 0.80

Tested by

no test coverage detected