|
@@ -222,65 +222,46 @@ public abstract class DocumentBase
|
|
|
}
|
|
|
for (; n != null; n = n.getNextSibling())
|
|
|
{
|
|
|
- switch (n.getNodeName().toLowerCase())
|
|
|
+ final String name = n.getNodeName().toLowerCase();
|
|
|
+
|
|
|
+ if (name.equalsIgnoreCase("effect"))
|
|
|
{
|
|
|
- case "add":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Add", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "sub":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Sub", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "mul":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Mul", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "div":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Div", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "set":
|
|
|
+ if (template instanceof AbstractEffect)
|
|
|
{
|
|
|
- attachFunc(n, template, "Set", condition);
|
|
|
- break;
|
|
|
+ throw new RuntimeException("Nested effects");
|
|
|
}
|
|
|
- case "share":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Share", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "enchant":
|
|
|
- {
|
|
|
- attachFunc(n, template, "Enchant", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "enchanthp":
|
|
|
- {
|
|
|
- attachFunc(n, template, "EnchantHp", condition);
|
|
|
- break;
|
|
|
- }
|
|
|
- case "effect":
|
|
|
- {
|
|
|
- if (template instanceof AbstractEffect)
|
|
|
+ attachEffect(n, template, condition, effectScope);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ switch (name)
|
|
|
+ {
|
|
|
+ case "add":
|
|
|
+ case "sub":
|
|
|
+ case "mul":
|
|
|
+ case "div":
|
|
|
+ case "set":
|
|
|
+ case "share":
|
|
|
+ case "enchant":
|
|
|
+ case "enchanthp":
|
|
|
{
|
|
|
- throw new RuntimeException("Nested effects");
|
|
|
+ attachFunc(n, template, name, condition);
|
|
|
}
|
|
|
- attachEffect(n, template, condition, effectScope);
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected void attachFunc(Node n, Object template, String name, Condition attachCond)
|
|
|
+ protected void attachFunc(Node n, Object template, String functionName, Condition attachCond)
|
|
|
{
|
|
|
Stats stat = Stats.valueOfXml(n.getAttributes().getNamedItem("stat").getNodeValue());
|
|
|
- String order = n.getAttributes().getNamedItem("order").getNodeValue();
|
|
|
+ int order = -1;
|
|
|
+ final Node orderNode = n.getAttributes().getNamedItem("order");
|
|
|
+ if (orderNode != null)
|
|
|
+ {
|
|
|
+ order = Integer.parseInt(orderNode.getNodeValue());
|
|
|
+ }
|
|
|
+
|
|
|
String valueString = n.getAttributes().getNamedItem("val").getNodeValue();
|
|
|
double value;
|
|
|
if (valueString.charAt(0) == '#')
|
|
@@ -292,9 +273,8 @@ public abstract class DocumentBase
|
|
|
value = Double.parseDouble(valueString);
|
|
|
}
|
|
|
|
|
|
- final int ord = Integer.decode(getValue(order, template));
|
|
|
final Condition applayCond = parseCondition(n.getFirstChild(), template);
|
|
|
- final FuncTemplate ft = new FuncTemplate(attachCond, applayCond, name, stat, ord, value);
|
|
|
+ final FuncTemplate ft = new FuncTemplate(attachCond, applayCond, functionName, order, stat, value);
|
|
|
if (template instanceof L2Item)
|
|
|
{
|
|
|
((L2Item) template).attach(ft);
|