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

Method getToken

code/src/java/plugin/exporttokens/AttackToken.java:66–94  ·  view source on GitHub ↗
(String tokenSource, PlayerCharacter pc, ExportHandler eh)

Source from the content-addressed store, hash-verified

64 }
65
66 @Override
67 public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh)
68 {
69 String retString = "";
70 StringTokenizer aTok = new StringTokenizer(tokenSource, ".");
71 aTok.nextToken();
72
73 if (aTok.hasMoreTokens())
74 {
75 String attackTypeString = aTok.nextToken();
76 String modifier = aTok.hasMoreTokens() ? aTok.nextToken() : "";
77 String format = aTok.hasMoreTokens() ? aTok.nextToken() : "";
78
79 AttackType attackType = AttackType.valueOf(attackTypeString);
80 retString = AttackInfo.getAttackInfo(pc, attackType, modifier);
81
82 // SHORT means we only return the first attack bonus
83 if ("SHORT".equalsIgnoreCase(format))
84 {
85 int sepPos = retString.indexOf('/');
86 if (sepPos >= 0)
87 {
88 retString = retString.substring(0, sepPos);
89 }
90 }
91 }
92
93 return retString;
94 }
95}

Callers

nothing calls this directly

Calls 6

getAttackInfoMethod · 0.95
nextTokenMethod · 0.80
hasMoreTokensMethod · 0.80
equalsIgnoreCaseMethod · 0.80
indexOfMethod · 0.65
valueOfMethod · 0.45

Tested by

no test coverage detected