Exemplo n.º 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();
  }
Exemplo n.º 2
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;
  }
Exemplo n.º 3
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();
  }
Exemplo n.º 4
0
  /**
   * Method getRaceSkill.
   *
   * @param player Player
   * @return null
   */
  public Skill getRaceSkill(Player player) {
    int race = player.getRace().ordinal();
    Skill skill = null;

    if (player.getClassId().isOfLevel(ClassLevel.Fourth)) {
      switch (race) {
        case 0:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
          break;

        case 1:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
          break;

        case 2:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
          break;

        case 3:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
          break;

        case 4:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
          break;

        case 5:
          skill = SkillTable.getInstance().getInfo(248, 6);
          player.addSkill(skill);
      }
    } else {
      player.sendActionFailed();
    }

    player.updateStats();
    return null;
  }