Search in sources :

Example 31 with ClassSource

use of pcgen.cdom.helper.ClassSource in project pcgen by PCGen.

the class PCGVer2Parser method getDomainSource.

/**
	 * Set the source of the domain. See getDomainSource() for details.
	 * This method should NOT be called outside of file i/o routines!
	 * @param aSource the source to be set
	 **/
public ClassSource getDomainSource(String aSource) {
    final StringTokenizer aTok = new StringTokenizer(aSource, "|", false);
    if (aTok.countTokens() < 2) {
        Logging.errorPrint("Invalid Domain Source:" + aSource);
        return null;
    }
    //Throw away "PCClass"
    aTok.nextToken();
    String classString = aTok.nextToken();
    PCClass cl = thePC.getClassKeyed(classString);
    if (cl == null) {
        Logging.errorPrint("Invalid Class in Domain Source:" + aSource);
        return null;
    }
    ClassSource cs;
    if (aTok.hasMoreTokens()) {
        int level = Integer.parseInt(aTok.nextToken());
        cs = new ClassSource(cl, level);
    } else {
        cs = new ClassSource(cl);
    }
    return cs;
}
Also used : StringTokenizer(java.util.StringTokenizer) PCClass(pcgen.core.PCClass) ClassSource(pcgen.cdom.helper.ClassSource)

Aggregations

ClassSource (pcgen.cdom.helper.ClassSource)31 PCClass (pcgen.core.PCClass)19 Domain (pcgen.core.Domain)18 Test (org.junit.Test)9 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)6 ParseResult (pcgen.rules.persistence.token.ParseResult)5 PlayerCharacter (pcgen.core.PlayerCharacter)4 CNAbility (pcgen.cdom.content.CNAbility)3 Ability (pcgen.core.Ability)3 CharacterSpell (pcgen.core.character.CharacterSpell)3 Spell (pcgen.core.spell.Spell)3 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)3 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)2 CDOMReference (pcgen.cdom.base.CDOMReference)2 Type (pcgen.cdom.enumeration.Type)2 SpellSchool (pcgen.cdom.identifier.SpellSchool)2 DomainSpellList (pcgen.cdom.list.DomainSpellList)2 PCLevelInfo (pcgen.core.pclevelinfo.PCLevelInfo)2 MessageType (pcgen.core.utils.MessageType)2 AttackType (pcgen.util.enumeration.AttackType)2