Node nval = n.getAttributes().getNamedItem("val");
if(nval != null)
{
String val = nval.getNodeValue();
if(val.charAt(0) == '#')
return new LambdaConst(Double.parseDouble(getTableValue(val)));
else if(val.charAt(0) == '$')
{
if(val.equalsIgnoreCase("$player_level"))
return new LambdaStats(LambdaStats.StatsType.PLAYER_LEVEL);
if(val.equalsIgnoreCase("$target_level"))
return new LambdaStats(LambdaStats.StatsType.TARGET_LEVEL);
if(val.equalsIgnoreCase("$player_max_hp"))
return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_HP);
if(val.equalsIgnoreCase("$player_max_mp"))
return new LambdaStats(LambdaStats.StatsType.PLAYER_MAX_MP);
// try to find value out of item fields
StatsSet set = getStatsSet();
String field = set.getString(val.substring(1));
if(field != null)
return new LambdaConst(Double.parseDouble(getValue(field, template)));
// failed
throw new IllegalArgumentException("Unknown value " + val);
}
else
return new LambdaConst(Double.parseDouble(val));
}
LambdaCalc calc = new LambdaCalc();
n = n.getFirstChild();
while(n != null && n.getNodeType() != Node.ELEMENT_NODE)
{