(String tokenSource, PlayerCharacter pc, ExportHandler eh)
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public String getToken(String tokenSource, PlayerCharacter pc, ExportHandler eh) |
| 49 | { |
| 50 | boolean isMin = tokenSource.lastIndexOf(".MINVAL") >= 0; |
| 51 | boolean isInt = tokenSource.lastIndexOf(".INTVAL") >= 0; |
| 52 | boolean isSign = (tokenSource.lastIndexOf(".SIGN") >= 0); |
| 53 | if (tokenSource.lastIndexOf(".NOSIGN") >= 0) |
| 54 | { |
| 55 | isSign = false; |
| 56 | Logging.errorPrint(".NOSIGN in output token " + tokenSource + " is deprecated. " |
| 57 | + "The default output format is unsigned."); |
| 58 | } |
| 59 | |
| 60 | String workingSource = tokenSource; |
| 61 | // clear out the gunk |
| 62 | if (isMin) |
| 63 | { |
| 64 | workingSource = workingSource.replaceAll(".MINVAL", ""); |
| 65 | } |
| 66 | if (isInt) |
| 67 | { |
| 68 | workingSource = workingSource.replaceAll(".INTVAL", ""); |
| 69 | } |
| 70 | workingSource = workingSource.replaceAll(".NOSIGN", ""); |
| 71 | workingSource = workingSource.replaceAll(".SIGN", ""); |
| 72 | |
| 73 | StringTokenizer aTok = new StringTokenizer(workingSource, "."); |
| 74 | aTok.nextToken(); //this should be VAR |
| 75 | |
| 76 | StringBuilder varName = new StringBuilder(); |
| 77 | |
| 78 | if (aTok.hasMoreElements()) |
| 79 | { |
| 80 | varName.append(aTok.nextToken()); |
| 81 | } |
| 82 | while (aTok.hasMoreElements()) |
| 83 | { |
| 84 | varName.append('.').append(aTok.nextToken()); |
| 85 | } |
| 86 | |
| 87 | if (isInt) |
| 88 | { |
| 89 | if (isSign) |
| 90 | { |
| 91 | return Delta.toString(pc.getVariable(varName.toString(), !isMin).intValue()); |
| 92 | } |
| 93 | return String.valueOf(pc.getVariable(varName.toString(), !isMin).intValue()); |
| 94 | } |
| 95 | if (isSign) |
| 96 | { |
| 97 | return Delta.toString((float) pc.getVariable(varName.toString(), !isMin)); |
| 98 | } |
| 99 | return String.valueOf(pc.getVariable(varName.toString(), !isMin)); |
| 100 | } |
| 101 | } |
nothing calls this directly
no test coverage detected