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

Method parseTempBonusLine

code/src/java/pcgen/io/PCGVer2Parser.java:5046–5252  ·  view source on GitHub ↗

############################################################### Temporary Bonuses ############################################################### @param line

(final String line)

Source from the content-addressed store, hash-verified

5044 * @param line
5045 **/
5046 private void parseTempBonusLine(final String line)
5047 {
5048 PCGTokenizer tokens;
5049
5050 try
5051 {
5052 tokens = new PCGTokenizer(line);
5053 }
5054 catch (PCGParseException pcgpex)
5055 {
5056 final String message = "Illegal TempBonus line ignored: " + line + Constants.LINE_SEPARATOR + "Error: "
5057 + pcgpex.getMessage();
5058 warnings.add(message);
5059
5060 return;
5061 }
5062
5063 String cTag = null;
5064 String tName = null;
5065 boolean active = true;
5066
5067 for (PCGElement element : tokens.getElements())
5068 {
5069 final String tag = element.getName();
5070
5071 if (IOConstants.TAG_TEMPBONUS.equals(tag))
5072 {
5073 cTag = EntityEncoder.decode(element.getText());
5074 }
5075 else if (IOConstants.TAG_TEMPBONUSTARGET.equals(tag))
5076 {
5077 tName = EntityEncoder.decode(element.getText());
5078 }
5079 else if (IOConstants.TAG_TEMPBONUSACTIVE.equals(tag))
5080 {
5081 active = element.getText().endsWith(IOConstants.VALUE_Y);
5082 }
5083 }
5084
5085 if ((cTag == null) || (tName == null))
5086 {
5087 warnings.add("Illegal TempBonus line ignored: " + line);
5088
5089 return;
5090 }
5091
5092 final StringTokenizer aTok = new StringTokenizer(cTag, "=", false); //$NON-NLS-1$
5093
5094 if (aTok.countTokens() < 2)
5095 {
5096 return;
5097 }
5098
5099 final String cType = aTok.nextToken();
5100 final String cKey = aTok.nextToken();
5101
5102 Equipment aEq = null;
5103

Callers 1

parseCachedLinesMethod · 0.95

Calls 15

getElementsMethod · 0.95
decodeMethod · 0.95
cloneMethod · 0.95
resetTempBonusListMethod · 0.95
getContextMethod · 0.95
getGameAsPropertyMethod · 0.95
getReferenceContextMethod · 0.95
newBonusMethod · 0.95
addTempBonusMethod · 0.95
getBonusDisplayNameMethod · 0.95
setAppliedNameMethod · 0.95
nextTokenMethod · 0.80

Tested by

no test coverage detected