(String tokenSource, PlayerCharacter pc, ExportHandler eh)
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) |
| 55 | { |
| 56 | /* FOLLOWER%.subtag stuff handled in here*/ |
| 57 | |
| 58 | // New token syntax FOLLOWER.x instead of FOLLOWERx |
| 59 | StringTokenizer aTok = new StringTokenizer(tokenSource, "."); |
| 60 | String fString = aTok.nextToken(); // FOLLOWER |
| 61 | final int i; |
| 62 | |
| 63 | if ("FOLLOWER".equals(fString)) |
| 64 | { |
| 65 | i = Integer.parseInt(aTok.nextToken()); |
| 66 | } |
| 67 | else |
| 68 | { |
| 69 | Logging.errorPrint("Old syntax FOLLOWERx will be replaced for FOLLOWER.x"); |
| 70 | |
| 71 | i = Integer.parseInt(tokenSource.substring(8, tokenSource.indexOf('.'))); |
| 72 | } |
| 73 | |
| 74 | StringBuilder restString = new StringBuilder(); |
| 75 | while (aTok.hasMoreTokens()) |
| 76 | { |
| 77 | restString.append(".").append(aTok.nextToken()); |
| 78 | } |
| 79 | if (restString.indexOf(".") == 0) |
| 80 | { |
| 81 | restString = restString.deleteCharAt(0); |
| 82 | } |
| 83 | |
| 84 | String result = ""; |
| 85 | final List<Follower> followers = new ArrayList<>(pc.getDisplay().getFollowerList()); |
| 86 | if (i < followers.size()) |
| 87 | { |
| 88 | result = FollowerToken.getFollowerOutput(eh, restString.toString(), followers.get(i)); |
| 89 | } |
| 90 | |
| 91 | return result; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Process a token for a follower (must already be loaded) and return the output. |
nothing calls this directly
no test coverage detected