Beispiel #1
0
  @Override
  protected ParseResult parseTokenWithSeparator(
      LoadContext context, KitAbilities kitAbil, String value) {
    StringTokenizer st = new StringTokenizer(value, Constants.PIPE);

    kitAbil.setCategory(AbilityCategory.FEAT);

    ReferenceManufacturer<Ability> rm =
        context.ref.getManufacturer(ABILITY_CLASS, AbilityCategory.FEAT);

    while (st.hasMoreTokens()) {
      String token = st.nextToken();

      if (token.startsWith("CATEGORY=")) {
        return new ParseResult.Fail(
            "Attempting to change the Category of a Feat to '" + token + "'", context);
      }
      CDOMReference<Ability> ref = TokenUtilities.getTypeOrPrimitive(rm, token);
      if (ref == null) {
        return ParseResult.INTERNAL_ERROR;
      }
      kitAbil.addAbility(ref);
    }
    return ParseResult.SUCCESS;
  }
Beispiel #2
0
 public String[] unparse(LoadContext context, KitAbilities kitAbil) {
   Boolean mult = kitAbil.getFree();
   if (mult == null) {
     return null;
   }
   return new String[] {mult.booleanValue() ? "YES" : "NO"};
 }
Beispiel #3
0
 @Override
 public String[] unparse(LoadContext context, KitAbilities KitAbilities) {
   Collection<CDOMReference<Ability>> ref = KitAbilities.getAbilityKeys();
   if (ref == null || ref.isEmpty()) {
     return null;
   }
   return new String[] {ReferenceUtilities.joinLstFormat(ref, Constants.PIPE)};
 }
Beispiel #4
0
 @Override
 protected ParseResult parseNonEmptyToken(
     LoadContext context, KitAbilities kitAbil, String value) {
   Boolean set;
   char firstChar = value.charAt(0);
   if (firstChar == 'y' || firstChar == 'Y') {
     if (value.length() > 1 && !value.equalsIgnoreCase("YES")) {
       return new ParseResult.Fail("You should use 'YES' as the " + getTokenName() + ": " + value);
     }
     set = Boolean.TRUE;
   } else {
     if (firstChar != 'N' && firstChar != 'n') {
       return new ParseResult.Fail(
           "You should use 'YES' or 'NO' as the " + getTokenName() + ": " + value);
     }
     if (value.length() > 1 && !value.equalsIgnoreCase("NO")) {
       return new ParseResult.Fail(
           "You should use 'YES' or 'NO' as the " + getTokenName() + ": " + value);
     }
     set = Boolean.FALSE;
   }
   kitAbil.setFree(set);
   return ParseResult.SUCCESS;
 }