Esempio n. 1
0
  final void attachEffect(Node n, Object template) {
    if (!(template instanceof L2Skill))
      throw new IllegalStateException("Attaching an effect to a non-L2Skill template");

    final L2Skill skill = (L2Skill) template;
    final NamedNodeMap attrs = n.getAttributes();

    final ValidatingStatsSet set =
        new ValidatingStatsSet().setDescription(skill.toString() + "'s effect");

    for (int i = 0; i < attrs.getLength(); i++) {
      final Node node = attrs.item(i);

      set.set(node.getNodeName(), getValue(node.getNodeValue(), template));
    }

    final EffectTemplate effectTemplate = new EffectTemplate(set, skill);

    parseTemplate(n, effectTemplate);

    if (set.getInteger("self", 0) == 0) skill.attach(effectTemplate);
    else skill.attachSelf(effectTemplate);

    set.clear();
  }
Esempio n. 2
0
  @Override
  void parseDefaultNode(Node n) {
    try {
      parseSkill(n);

      _skillsInFile.addAll(_skills);
    } catch (Exception e) {
      _log.warn(
          "Error while parsing skill id " + _currentSkillId + ", level " + (_currentSkillLevel + 1),
          e);
    } finally {
      _currentSkillId = 0;
      _currentSkillLevel = 0;
      _currentSkillName = null;

      _tables.clear();

      clear(_sets);
      clear(_enchsets1);
      clear(_enchsets2);
      clear(_enchsets3);
      clear(_enchsets4);
      clear(_enchsets5);
      clear(_enchsets6);
      clear(_enchsets7);
      clear(_enchsets8);

      _skills.clear();
    }
  }
Esempio n. 3
0
 @Override
 protected void reset(ValidatingStatsSet set) {
   set.clear();
 }