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

Method writeAbilityToBuffer

code/src/java/pcgen/io/PCGVer2Creator.java:1381–1428  ·  view source on GitHub ↗
(StringBuilder buffer, CNAbility cna)

Source from the content-addressed store, hash-verified

1379 }
1380
1381 private void writeAbilityToBuffer(StringBuilder buffer, CNAbility cna)
1382 {
1383 Category<Ability> cat = cna.getAbilityCategory();
1384 Nature nature = cna.getNature();
1385 Ability ability = cna.getAbility();
1386 buffer.append(IOConstants.TAG_ABILITY).append(IOConstants.TAG_END);
1387 buffer.append(EntityEncoder.encode(cat.getKeyName())).append(IOConstants.TAG_SEPARATOR);
1388 buffer.append(IOConstants.TAG_TYPE).append(IOConstants.TAG_END);
1389 buffer.append(EntityEncoder.encode(nature.toString())).append(IOConstants.TAG_SEPARATOR);
1390 buffer.append(IOConstants.TAG_CATEGORY).append(IOConstants.TAG_END);
1391 buffer.append(EntityEncoder.encode(ability.getCategory())).append(IOConstants.TAG_SEPARATOR);
1392 buffer.append(IOConstants.TAG_MAPKEY).append(IOConstants.TAG_END);
1393 buffer.append(EntityEncoder.encode(ability.getKeyName())).append(IOConstants.TAG_SEPARATOR);
1394 if (ability.getSafe(ObjectKey.MULTIPLE_ALLOWED))
1395 {
1396 buffer.append(IOConstants.TAG_APPLIEDTO).append(IOConstants.TAG_END);
1397 List<String> assocList = thePC.getAssociationList(cna);
1398 boolean first = true;
1399 for (String assoc : assocList)
1400 {
1401 if (!first)
1402 {
1403 buffer.append(Constants.COMMA);
1404 }
1405 first = false;
1406 buffer.append(EntityEncoder.encode(assoc));
1407 }
1408 buffer.append(IOConstants.TAG_SEPARATOR);
1409 }
1410 buffer.append(IOConstants.TAG_TYPE).append(IOConstants.TAG_END);
1411 buffer.append(EntityEncoder.encode(ability.getType()));
1412
1413 for (final BonusObj save : thePC.getSaveableBonusList(ability))
1414 {
1415 buffer.append('|');
1416 buffer.append(IOConstants.TAG_SAVE).append(':');
1417 buffer.append(EntityEncoder.encode("BONUS|" + save));
1418 }
1419
1420 for (final Description desc : ability.getSafeListFor(ListKey.DESCRIPTION))
1421 {
1422 buffer.append(Constants.PIPE);
1423 buffer.append(IOConstants.TAG_DESC).append(':');
1424 buffer.append(EntityEncoder.encode(desc.getPCCText()));
1425 }
1426
1427 buffer.append(IOConstants.LINE_SEP);
1428 }
1429
1430 /*
1431 * ###############################################################

Callers 1

appendAbilityLinesMethod · 0.95

Calls 14

encodeMethod · 0.95
getCategoryMethod · 0.95
getSafeMethod · 0.80
getSaveableBonusListMethod · 0.80
getKeyNameMethod · 0.65
toStringMethod · 0.65
getTypeMethod · 0.65
getSafeListForMethod · 0.65
getAbilityCategoryMethod · 0.45
getNatureMethod · 0.45
getAbilityMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected