예제 #1
0
  public void onTransferOnlyRemoveSkills(Player player, int toFinalClass, int baseKeepSkills) {
    boolean delete = false;

    if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) {
      delete = true;
    }

    List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId();
    List<Integer> skillsToMantain =
        SkillAcquireHolder.getInstance().getMaintainSkillOnAwake(baseKeepSkills, toFinalClass);

    for (Skill skl : player.getAllSkills()) {
      if (allSkillsId.contains(skl.getId())) {
        player.removeSkill(skl, delete);
      }
    }

    for (int skillId : skillsToMantain) {
      int skillLv = SkillTable.getInstance().getBaseLevel(skillId);
      Skill newSkill = SkillTable.getInstance().getInfo(skillId, skillLv);
      player.addSkill(newSkill, true);
    }

    for (int alterSkill : ALTER_SKILLS.get(toFinalClass)) {
      int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill);
      Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv);
      player.addSkill(newSkillAlter, true);
    }

    player.sendSkillList();
  }
예제 #2
0
  public void checkAwakenPlayerSkills(Player player) // For check on subclass change and logon
      {
    int classId = player.getActiveClassId();
    boolean delete = false;

    if (Config.ALT_DELETE_AWAKEN_SKILL_FROM_DB) {
      delete = true;
    }

    List<Integer> SkillsCheck = new ArrayList<>();
    List<Integer> SkillsToRemove = new ArrayList<>();
    List<Integer> allSkillsId = SkillAcquireHolder.getInstance().getAllClassSkillId();
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenGeneralKeepSkillList());
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAwakenClassSkillForCheck(classId));
    SkillsCheck.addAll(SkillAcquireHolder.getInstance().getAllAwakenSkillsByClass(classId));

    if (player.getTransformation()
        == 0) // if the character log on with a transformation, do not remove any skill
    {
      for (Skill skl : player.getAllSkills()) {
        if (!SkillsCheck.contains(skl.getId()) && allSkillsId.contains(skl.getId())) {
          SkillsToRemove.add(skl.getId());
        }
      }
    } else {
      for (Skill skl : player.getAllSkills()) {
        if (!SkillsCheck.contains(skl.getId()) && SkillsCheck.contains(skl.getId())) {
          SkillsToRemove.add(skl.getId());
        }
      }
    }

    player.removeSkills(SkillsToRemove, delete);

    for (int alterSkill : ALTER_SKILLS.get(classId)) {
      int skillLv = SkillTable.getInstance().getBaseLevel(alterSkill);
      Skill newSkillAlter = SkillTable.getInstance().getInfo(alterSkill, skillLv);
      player.addSkill(newSkillAlter, true);
    }

    player.sendSkillList();
  }
예제 #3
0
  /**
   * Method giveGiantEssences.
   *
   * @param player Player
   * @param onlyCalculateCount boolean
   * @return int
   */
  public int giveGiantEssences(Player player, boolean onlyCalculateCount) {
    List<Integer> enchantedSkills = new FastList<>();
    int count = 0;

    for (Skill skill : player.getAllSkills()) {
      if ((SkillTreeTable.isEnchantable(skill) != 0)
          && (player.getSkillDisplayLevel(skill.getId()) > 99)) {
        int skillLvl = skill.getDisplayLevel();
        int elevel = skillLvl % 100;
        EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(skill.getId(), skillLvl);

        if (sl != null) {
          if (sl.getMaxLevel() == 15) {
            elevel = Math.min(count15T.length, elevel);
            count += count15T[elevel];
          } else {
            elevel = Math.min(count30T.length, elevel);
            count += count30T[elevel];
          }
        }
      }

      enchantedSkills.add(Integer.valueOf(skill.getId()));
    }

    if (!onlyCalculateCount) {
      if (count > 0) {
        for (int i = 0; i < enchantedSkills.size(); i++) {
          player.removeSkillById(enchantedSkills.get(i));
          player.addSkill(
              SkillTable.getInstance()
                  .getInfo(
                      enchantedSkills.get(i),
                      SkillTable.getInstance().getBaseLevel(enchantedSkills.get(i))),
              true);
        }

        ItemFunctions.addItem(player, ESSENCE_OF_THE_LESSER_GIANTS, count, true);
      }
    }

    return count;
  }
예제 #4
0
 public SkillList(Player p, int learnedSkill) {
   _skills = new ArrayList<Skill>(p.getAllSkills());
   canEnchant = p.getTransformation() == 0;
   activeChar = p;
   _learnedSkill = learnedSkill;
 }