Exemplo n.º 1
0
 private void setPresentationTemplate(
     Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element presentationTemplateElement = generalElement.element(TAG_PRESENTATION_TEMPLATE);
   if (presentationTemplateElement == null) {
     return;
   }
   PresentationPropertiesParser parser =
       new PresentationPropertiesParser(
           registryCollection.getPresentationTemplateRegistry(),
           registryCollection.getCharmPresentationTemplateRegistry());
   GenericPresentationTemplate template = parser.parseTemplate(presentationTemplateElement);
   characterTemplate.setPresentationTemplate(template);
 }
Exemplo n.º 2
0
 private void setTraitCollection(
     Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element traitCollectionElement = generalElement.element(TAG_TRAIT_COLLECTION);
   if (traitCollectionElement == null) {
     return;
   }
   GenericTraitTemplateFactoryParser parser =
       new GenericTraitTemplateFactoryParser(
           registryCollection.getTraitFactoryRegistry(),
           registryCollection.getTraitTemplatePoolRegistry(),
           backgroundRegistry);
   GenericTraitTemplateFactory factory = parser.parseTemplate(traitCollectionElement);
   characterTemplate.setTraitFactory(factory);
 }
Exemplo n.º 3
0
 private void setMagicTemplate(Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element magicTemplateElement = generalElement.element(TAG_MAGIC_TEMPLATE);
   if (magicTemplateElement == null) {
     return;
   }
   GenericMagicTemplateParser parser =
       new GenericMagicTemplateParser(
           registryCollection.getMagicTemplateRegistry(), characterTemplate);
   GenericMagicTemplate template = parser.parseTemplate(magicTemplateElement);
   characterTemplate.setMagicTemplate(template);
 }
Exemplo n.º 4
0
 private void setToughnessControllingTrait(
     Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element healthElement = generalElement.element(TAG_HEALTH_TEMPLATE);
   if (healthElement == null) {
     return;
   }
   HealthTemplateParser parser =
       new HealthTemplateParser(registryCollection.getHealthTemplateRegistry());
   GenericHealthTemplate template = parser.parseTemplate(healthElement);
   characterTemplate.setHealthTemplate(template);
 }
Exemplo n.º 5
0
 private void setEssenceTemplate(
     Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element essenceElement = generalElement.element(TAG_ESSENCE);
   if (essenceElement == null) {
     return;
   }
   EssenceTemplateParser parser =
       new EssenceTemplateParser(registryCollection.getEssenceTemplateRegistry());
   GenericEssenceTemplate essenceTemplate = parser.parseTemplate(essenceElement);
   characterTemplate.setEssenceTemplate(essenceTemplate);
 }
Exemplo n.º 6
0
 public CharacterTemplateParser(
     ICharacterTemplateRegistryCollection registryCollection,
     IRegistry<ICharacterType, ICasteCollection> casteCollectionRegistry,
     ICharmProvider provider,
     IIdentificateRegistry<IBackgroundTemplate> backgroundRegistry,
     IRegistry<String, IAdditionalTemplateParser> additionModelTemplateParser) {
   super(registryCollection.getCharacterTemplateRegistry());
   this.registryCollection = registryCollection;
   this.casteCollectionRegistry = casteCollectionRegistry;
   this.provider = provider;
   this.backgroundRegistry = backgroundRegistry;
   this.additionModelTemplateParserRegistry = additionModelTemplateParser;
 }
Exemplo n.º 7
0
 private void setAbilityGroups(Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element abilityGroupElement = generalElement.element(TAG_ABILITY_GROUPS);
   if (abilityGroupElement == null) {
     return;
   }
   IXmlTemplateRegistry<GenericGroupedTraitTypeProvider> registry =
       registryCollection.getTraitGroupTemplateRegistry();
   TraitTypeGroupTemplateParser parser =
       new TraitTypeGroupTemplateParser(registry, AllAbilityTraitTypeGroup.getInstance());
   GenericGroupedTraitTypeProvider abilityGroups = parser.parseTemplate(abilityGroupElement);
   characterTemplate.setAbilityGroups(abilityGroups.getTraitTypeGroups());
 }
Exemplo n.º 8
0
 private void setAdditionalRules(
     Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element element = generalElement.element(TAG_ADDITIONAL_RULES);
   if (element == null) {
     return;
   }
   AdditionalRulesTemplateParser parser =
       new AdditionalRulesTemplateParser(
           registryCollection.getAdditionalRulesRegistry(),
           provider.getSpecialCharms(
               characterTemplate.getTemplateType().getCharacterType(),
               characterTemplate.getEdition()),
           backgroundRegistry);
   GenericAdditionalRules rules = parser.parseTemplate(element);
   characterTemplate.setAdditionalRules(rules);
 }
Exemplo n.º 9
0
 private void setBonusPoints(GenericCharacterTemplate characterTemplate, Element creationElement)
     throws PersistenceException {
   Element bonusPointsElement = creationElement.element("bonusPointCosts"); // $NON-NLS-1$
   if (bonusPointsElement == null) {
     return;
   }
   BonusPointCostTemplateParser parser =
       new BonusPointCostTemplateParser(
           registryCollection.getBonusPointTemplateRegistry(),
           characterTemplate
               .getMagicTemplate()
               .getCharmTemplate()
               .getMartialArtsRules()
               .getStandardLevel());
   GenericBonusPointCosts bonusPoints = parser.parseTemplate(bonusPointsElement);
   characterTemplate.setBonusPointCosts(bonusPoints);
 }
Exemplo n.º 10
0
 private void setExperiencePoints(
     GenericCharacterTemplate characterTemplate, Element experienceElement)
     throws PersistenceException {
   Element experiencePointsElement = experienceElement.element(TAG_EXPERIENCE_POINT_COST);
   if (experiencePointsElement == null) {
     return;
   }
   ExperienceTemplateParser parser =
       new ExperienceTemplateParser(
           registryCollection.getExperienceTemplateRegistry(),
           characterTemplate
               .getMagicTemplate()
               .getCharmTemplate()
               .getMartialArtsRules()
               .getStandardLevel());
   GenericExperiencePointCosts experienceTemplate = parser.parseTemplate(experiencePointsElement);
   characterTemplate.setExperiencePointCosts(experienceTemplate);
 }
Exemplo n.º 11
0
 private void setYoziGroups(Element generalElement, GenericCharacterTemplate characterTemplate)
     throws PersistenceException {
   Element yoziGroupElement = generalElement.element(TAG_YOZI_GROUPS);
   if (yoziGroupElement == null) {
     GenericGroupedTraitTypeProvider provider =
         new GenericGroupedTraitTypeProvider(AllYoziTraitTypeGroup.getInstance());
     List<String> emptyList = new ArrayList<String>();
     for (YoziType yozi : YoziType.values())
       provider.addGroupedAbilityType(yozi.getId(), yozi.getId(), null, emptyList);
     characterTemplate.setYoziGroups(provider.getTraitTypeGroups());
     return;
   }
   IXmlTemplateRegistry<GenericGroupedTraitTypeProvider> registry =
       registryCollection.getTraitGroupTemplateRegistry();
   TraitTypeGroupTemplateParser parser =
       new TraitTypeGroupTemplateParser(registry, AllYoziTraitTypeGroup.getInstance());
   GenericGroupedTraitTypeProvider yoziGroups = parser.parseTemplate(yoziGroupElement);
   characterTemplate.setYoziGroups(yoziGroups.getTraitTypeGroups());
 }
Exemplo n.º 12
0
 private CreationPointTemplateParser createCreationPointTemplateParser() {
   return new CreationPointTemplateParser(registryCollection.getCreationPointTemplateRegistry());
 }