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

Method getToken

code/src/java/plugin/exporttokens/WeaponoToken.java:60–84  ·  view source on GitHub ↗

Get the value of the supplied output token. @param tokenSource The full source of the token @param pc The character to retrieve the value for. @param eh The ExportHandler that is managing the export (may be null for a once off conversion). @return The value of the token.

(String tokenSource, PlayerCharacter pc, ExportHandler eh)

Source from the content-addressed store, hash-verified

58 * @return The value of the token.
59 */
60 @Override
61 public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh)
62 {
63 StringTokenizer aTok = new StringTokenizer(tokenSource, ".", false);
64 //Weapono Token
65 aTok.nextToken();
66
67 final String ind = aTok.nextToken();
68 final int index = Integer.parseInt(ind);
69 Equipment eq = getWeaponEquipment(pc.getDisplay(), index);
70
71 if (eq != null)
72 {
73 return getWeaponToken(pc, eq, aTok, tokenSource);
74 }
75 else if (eh != null && eh.getExistsOnly())
76 {
77 eh.setNoMoreItems(true);
78 if (eh.getCheckBefore())
79 {
80 eh.setCanWrite(false);
81 }
82 }
83 return "";
84 }
85
86 /**
87 * Creates equipment based on the first Secondary Weapon.

Callers

nothing calls this directly

Calls 9

getWeaponEquipmentMethod · 0.95
nextTokenMethod · 0.80
parseIntMethod · 0.80
getWeaponTokenMethod · 0.80
getExistsOnlyMethod · 0.80
setNoMoreItemsMethod · 0.80
getCheckBeforeMethod · 0.80
setCanWriteMethod · 0.80
getDisplayMethod · 0.45

Tested by

no test coverage detected