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

Method getToken

code/src/java/plugin/exporttokens/SpellMemToken.java:68–428  ·  view source on GitHub ↗
(String tokenSource, PlayerCharacter aPC, ExportHandler eh)

Source from the content-addressed store, hash-verified

66 }
67
68 @Override
69 public String getToken(String tokenSource, PlayerCharacter aPC, ExportHandler eh)
70 {
71 StringBuilder retValue = new StringBuilder();
72
73 // New Token syntax - SPELLMEM.x instead of SPELLMEMx
74 final StringTokenizer aTok = new StringTokenizer(tokenSource, ".");
75
76 aTok.nextToken();
77 final int classNum;
78
79 classNum = Integer.parseInt(aTok.nextToken());
80
81 final int bookNum = Integer.parseInt(aTok.nextToken());
82 final int spellLevel = Integer.parseInt(aTok.nextToken());
83 final int spellNumber = Integer.parseInt(aTok.nextToken());
84 String aLabel = "NAME";
85
86 if (aTok.hasMoreTokens())
87 {
88 aLabel = aTok.nextToken();
89 }
90
91 String altLabel = "";
92
93 if (aTok.hasMoreTokens())
94 {
95 altLabel = aTok.nextToken();
96 }
97
98 final PObject aObject = aPC.getSpellClassAtIndex(classNum);
99
100 if ((aObject == null) && (eh != null) && eh.getExistsOnly() && (classNum != -1))
101 {
102 eh.setNoMoreItems(true);
103 }
104
105 String bookName = Globals.getDefaultSpellBook();
106
107 if (bookNum > 0)
108 {
109 bookName = aPC.getDisplay().getSpellBookNames().get(bookNum);
110 }
111
112 if ((aObject != null) || (classNum == -1))
113 {
114 if (classNum == -1)
115 {
116 bookName = Globals.getDefaultSpellBook();
117 }
118
119 if ((bookName != null) && !bookName.isEmpty())
120 {
121 Spell aSpell = null;
122
123 CharacterSpell selectedCSpell = null;
124 if (classNum == -1)
125 {

Callers 2

testPreparedCasterMethod · 0.95

Calls 15

getDefaultSpellBookMethod · 0.95
getSpellMethod · 0.95
getSpellInfoForMethod · 0.95
getOutputNameMethod · 0.95
getAppliedNameMethod · 0.95
getActualPPCostMethod · 0.95
getTimesMethod · 0.95
getTimeUnitMethod · 0.95
getGameAsPropertyMethod · 0.95
toStringMethod · 0.95
getFormattedStringMethod · 0.95

Tested by 2

testPreparedCasterMethod · 0.76