Get variable value from the variable string passed in, this might be an old style variable string (COUNT[EQ and STRLEN) or a new style (JEP formula) @param varString Variable string that we want to calculate value from @param aPC The PC that holds the data that we need to get the info from @return
(String varString, PlayerCharacter aPC)
| 228 | * @return The result |
| 229 | */ |
| 230 | private int getVarValue(String varString, PlayerCharacter aPC) |
| 231 | { |
| 232 | // While COUNT[EQ tokens exist, build up a string |
| 233 | String vString = processCountEquipmentTokens(varString, aPC); |
| 234 | |
| 235 | // While STRLEN[ tokens exist, build up a string |
| 236 | vString = processStringLengthTokens(vString, aPC); |
| 237 | |
| 238 | // If it is the new JEP style variable then deal with that |
| 239 | String valueString = vString; |
| 240 | if (varString.startsWith("${") && varString.endsWith("}")) |
| 241 | { |
| 242 | String jepString = varString.substring(2, varString.length() - 1); |
| 243 | valueString = jepString.replace(';', ','); |
| 244 | } |
| 245 | |
| 246 | return aPC.getVariableValue(valueString, "").intValue(); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Helper method for getting the variable value out of a variable string |
no test coverage detected