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

Method getToken

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

Source from the content-addressed store, hash-verified

45 }
46
47 @Override
48 public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh)
49 {
50 String retString = "";
51 StringTokenizer aTok = new StringTokenizer(tokenSource, ".");
52 aTok.nextToken();
53
54 int level = 1;
55
56 if (aTok.hasMoreTokens())
57 {
58 level = Integer.parseInt(aTok.nextToken());
59 }
60
61 if (level < 1 || level > pc.getDisplay().getLevelInfoSize())
62 {
63 //TODO Error?
64 return "";
65 }
66 PCLevelInfo pcl = pc.getDisplay().getLevelInfo(level - 1);
67
68 if (aTok.hasMoreTokens())
69 {
70 String tokName = aTok.nextToken();
71 if (tokName.equals("CLASSNAME"))
72 {
73 retString = pcl.getClassKeyName();
74 }
75 if (tokName.equals("CLASSLEVEL"))
76 {
77 retString = Integer.toString(pcl.getClassLevel());
78 }
79 if (tokName.equals("FEATLIST"))
80 {
81 //TODO This is likely a bug...
82 retString = "";
83 }
84 if (tokName.equals("HP"))
85 {
86 retString = getLevelHP(pc, pcl);
87 }
88 if (tokName.equals("SKILLPOINTS"))
89 {
90 retString = Integer.toString(pcl.getSkillPointsGained(pc));
91 }
92 }
93 return retString;
94 }
95
96 /**
97 * Get the HP for the level

Callers

nothing calls this directly

Calls 12

getClassKeyNameMethod · 0.95
getClassLevelMethod · 0.95
getLevelHPMethod · 0.95
getSkillPointsGainedMethod · 0.95
nextTokenMethod · 0.80
hasMoreTokensMethod · 0.80
parseIntMethod · 0.80
equalsMethod · 0.65
toStringMethod · 0.65
getLevelInfoSizeMethod · 0.45
getDisplayMethod · 0.45
getLevelInfoMethod · 0.45

Tested by

no test coverage detected