Exemple #1
0
  @Override
  public boolean onActionTime() {
    if (_skill == null) return true;

    int mpConsume = _skill.getMpConsume();
    if (mpConsume > getEffector().getCurrentMp()) {
      getEffector()
          .sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
      return false;
    }
    getEffector().reduceCurrentMp(mpConsume);

    List<L2Character> targets = new ArrayList<>();
    for (L2Character cha :
        _actor
            .getKnownList()
            .getKnownTypeInRadius(L2Character.class, getSkill().getSkillRadius())) {
      if (_skill.isOffensive()
          && !L2Skill.checkForAreaOffensiveSkills(getEffector(), cha, _skill, _srcInArena))
        continue;

      // there doesn't seem to be a visible effect with MagicSkillLaunched packet...
      _actor.broadcastPacket(
          new MagicSkillUse(_actor, cha, _skill.getId(), _skill.getLevel(), 0, 0));
      targets.add(cha);
    }

    if (!targets.isEmpty())
      getEffector().callSkill(_skill, targets.toArray(new L2Character[targets.size()]));

    return true;
  }
Exemple #2
0
  private void load() {
    final File dir = new File("./data/xml/skills");

    for (File file : dir.listFiles()) {
      DocumentSkill doc = new DocumentSkill(file);
      doc.parse();

      for (L2Skill skill : doc.getSkills()) _skills.put(getSkillHashCode(skill), skill);
    }

    _log.info("SkillTable: Loaded " + _skills.size() + " skills.");

    // Stores max level of skills in a map for future uses.
    for (final L2Skill skill : _skills.values()) {
      // Only non-enchanted skills
      final int skillLvl = skill.getLevel();
      if (skillLvl < 99) {
        final int skillId = skill.getId();
        final int maxLvl = getMaxLevel(skillId);

        if (skillLvl > maxLvl) _skillMaxLevel.put(skillId, skillLvl);
      }
    }

    // Loading FrequentSkill enumeration values
    for (FrequentSkill sk : FrequentSkill.values()) sk._skill = getInfo(sk._id, sk._level);

    for (int i = 0; i < _heroSkillsId.length; i++) _heroSkills[i] = getInfo(_heroSkillsId[i], 1);

    for (int i = 0; i < _nobleSkills.length; i++) _nobleSkills[i] = getInfo(_nobleSkillsId[i], 1);
  }
Exemple #3
0
 public ConfirmDlg addSkillName(L2Skill skill) {
   return addSkillName(skill.getId(), skill.getLevel());
 }
Exemple #4
0
 /**
  * Provides the skill hash
  *
  * @param skill The L2Skill to be hashed
  * @return SkillTable.getSkillHashCode(skill.getId(), skill.getLevel())
  */
 public static int getSkillHashCode(L2Skill skill) {
   return getSkillHashCode(skill.getId(), skill.getLevel());
 }