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

Method dataAdded

code/src/java/pcgen/cdom/facet/AddLevelFacet.java:61–77  ·  view source on GitHub ↗

Drives the necessary results of an ADDLEVEL: token to apply the results to a Player Character. Triggered when one of the Facets to which AddLevelFacet listens fires a DataFacetChangeEvent to indicate a CDOMObject was added to a Player Character. @param dfce The DataFacetChangeEvent cont

(DataFacetChangeEvent<CharID, PCTemplate> dfce)

Source from the content-addressed store, hash-verified

59 * change
60 */
61 @Override
62 public void dataAdded(DataFacetChangeEvent<CharID, PCTemplate> dfce)
63 {
64 PCTemplate template = dfce.getCDOMObject();
65 CharID id = dfce.getCharID();
66 PlayerCharacter pc = trackingFacet.getPC(id);
67
68 // If we are importing these levels will have been saved with the
69 // character so don't apply them again.
70 if (!pc.isImporting())
71 {
72 for (LevelCommandFactory lcf : template.getSafeListFor(ListKey.ADD_LEVEL))
73 {
74 add(lcf.getLevelCount(), lcf.getPCClass(), pc);
75 }
76 }
77 }
78
79 /**
80 * Drives the necessary removal of the results of an ADDLEVEL: token to

Callers

nothing calls this directly

Calls 8

isImportingMethod · 0.95
addMethod · 0.95
getLevelCountMethod · 0.80
getCDOMObjectMethod · 0.65
getCharIDMethod · 0.65
getSafeListForMethod · 0.65
getPCMethod · 0.45
getPCClassMethod · 0.45

Tested by

no test coverage detected