Package lineage2.gameserver.model.base

Examples of lineage2.gameserver.model.base.EnchantSkillLearn


  private void init()
  {
    _zoneListener = new ZoneListener();
    for (String s : zones)
    {
      Zone zone = ReflectionUtils.getZone(s);
      zone.addListener(_zoneListener);
    }
  }
View Full Code Here


   * Method init.
   */
  private void init()
  {
    _zoneListener = new ZoneListener();
    Zone zone = ReflectionUtils.getZone(ZONE_NAME);
    if (zone != null)
    {
      zone.addListener(_zoneListener);
    }
  }
View Full Code Here

        int cool = getInt(args[5]);
        int reuse = getInt(args[6]);
        boolean is_magic = (getInt(args[7]) == 1) || (getInt(args[7]) == 2);
        if (lvl > 100)
        {
          EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(id, lvl);
          if (sl == null)
          {
            for (int i = 1; i < 8; i++)
            {
              int l = lvl - (i * 100);
              if (l < 100)
              {
                continue;
              }
              sl = SkillTreeTable.getSkillEnchant(id, l);
              if (sl != null)
              {
                lvl = l;
                break;
              }
            }
            if (sl == null)
            {
              continue loop;
            }
          }
          lvl = SkillTreeTable.convertEnchantLevel(sl.getBaseLevel(), lvl, sl.getMaxLevel());
        }
        Skill s = getInfo(id, lvl);
        if (s != null)
        {
          if (reuse > 0)
View Full Code Here

    if ((activeChar.getLevel() < 76) || (activeChar.getClassLevel() < 4))
    {
      activeChar.sendMessage("You must have 3rd class change quest completed.");
      return;
    }
    EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl);
    if (sl == null)
    {
      return;
    }
    int slevel = activeChar.getSkillLevel(_skillId);
    if (slevel == -1)
    {
      return;
    }
    int enchantLevel = SkillTreeTable.convertEnchantLevel(sl.getBaseLevel(), _skillLvl, sl.getMaxLevel());
    if (slevel >= enchantLevel)
    {
      return;
    }
    if (slevel == sl.getBaseLevel() ? (_skillLvl % 100) != 1 : slevel != (enchantLevel - 1))
    {
      activeChar.sendMessage("Incorrect enchant level.");
      return;
    }
    Skill skill = SkillTable.getInstance().getInfo(_skillId, enchantLevel);
    if (skill == null)
    {
      activeChar.sendMessage("Internal error: not found skill level");
      return;
    }
    int[] cost = sl.getCost();
    int requiredSp = cost[1] * SkillTreeTable.NORMAL_ENCHANT_COST_MULTIPLIER * sl.getCostMult();
    int requiredAdena = cost[0] * SkillTreeTable.NORMAL_ENCHANT_COST_MULTIPLIER * sl.getCostMult();
    int rate = sl.getRate(activeChar);
    if (activeChar.getSp() < requiredSp)
    {
      sendPacket(Msg.SP_REQUIRED_FOR_SKILL_ENCHANT_IS_INSUFFICIENT);
      return;
    }
    if (activeChar.getAdena() < requiredAdena)
    {
      sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return;
    }
    if ((_skillId < 10000) && ((_skillLvl % 100) == 1))
    {
      if (Functions.getItemCount(activeChar, SkillTreeTable.NORMAL_ENCHANT_BOOK) == 0)
      {
        activeChar.sendPacket(Msg.ITEMS_REQUIRED_FOR_SKILL_ENCHANT_ARE_INSUFFICIENT);
        return;
      }
      Functions.removeItem(activeChar, SkillTreeTable.NORMAL_ENCHANT_BOOK, 1);
    }
    else if ((_skillId >= 10000) && ((_skillLvl % 100) == 1))
    {
      if (Functions.getItemCount(activeChar, SkillTreeTable.NEW_ENCHANT_BOOK) == 0)
      {
        activeChar.sendPacket(Msg.ITEMS_REQUIRED_FOR_SKILL_ENCHANT_ARE_INSUFFICIENT);
        return;
      }
      Functions.removeItem(activeChar, SkillTreeTable.NEW_ENCHANT_BOOK, 1);
    }
    if (Rnd.chance(rate))
    {
      activeChar.addExpAndSp(0, -1 * requiredSp);
      Functions.removeItem(activeChar, 57, requiredAdena);
      activeChar.sendPacket(new SystemMessage(SystemMessage.SP_HAS_DECREASED_BY_S1).addNumber(requiredSp), new SystemMessage(SystemMessage.SUCCEEDED_IN_ENCHANTING_SKILL_S1).addSkillName(_skillId, _skillLvl), new ExEnchantSkillResult(1));
      Log.add(activeChar.getName() + "|Successfully enchanted|" + _skillId + "|to+" + _skillLvl + "|" + rate, "enchant_skills");
    }
    else
    {
      skill = SkillTable.getInstance().getInfo(_skillId, sl.getBaseLevel());
      activeChar.sendPacket(new SystemMessage(SystemMessage.FAILED_IN_ENCHANTING_SKILL_S1).addSkillName(_skillId, _skillLvl), new ExEnchantSkillResult(0));
      Log.add(activeChar.getName() + "|Failed to enchant|" + _skillId + "|to+" + _skillLvl + "|" + rate, "enchant_skills");
    }
    activeChar.addSkill(skill, true);
    activeChar.sendSkillList();
View Full Code Here

    // skill already enchanted?
    if (_level > 100)
    {
      canDecrease = 1;
      // get detail for next level
      EnchantSkillLearn esd = SkillTreeTable.getSkillEnchant(_id, _level + 1);

      // if it exists add it
      if (esd != null)
      {
        addEnchantSkillDetail(esd.getLevel());
        _canAdd = 1;
      }

      for (EnchantSkillLearn el : SkillTreeTable.getEnchantsForChange(_id, _level))
        addEnchantSkillDetail(el.getLevel());
    }
    else
      // not already enchanted
      for (EnchantSkillLearn esd : SkillTreeTable.getFirstEnchantsForSkill(_id))
      {
        addEnchantSkillDetail(esd.getLevel());
        _canAdd = 1;
      }
  }
View Full Code Here

    {
      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
View Full Code Here

          else
          {
            level = lastLvl + (eLevels * count) + r;
            levelskilllearn = (100 * (count + 1)) + r;
          }
          EnchantSkillLearn e = new EnchantSkillLearn(skillId, levelskilllearn, skillName, "+" + r + " " + ename, r == 1 ? lastLvl : levelskilllearn - 1, lastLvl, eLevels);
          List<EnchantSkillLearn> t = SkillTreeTable._enchant.get(skillId);
          if (t == null)
          {
            t = new ArrayList<>();
          }
View Full Code Here

    if ((activeChar.getLevel() < 76) || (activeChar.getClassLevel() < 4))
    {
      activeChar.sendMessage("You must have 3rd class change quest completed.");
      return;
    }
    EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl);
    if (sl == null)
    {
      return;
    }
    int slevel = activeChar.getSkillLevel(_skillId);
    if (slevel == -1)
    {
      return;
    }
    int enchantLevel = SkillTreeTable.convertEnchantLevel(sl.getBaseLevel(), _skillLvl, sl.getMaxLevel());
    if (slevel >= enchantLevel)
    {
      return;
    }
    if (slevel == sl.getBaseLevel() ? (_skillLvl % 100) != 1 : slevel != (enchantLevel - 1))
    {
      activeChar.sendMessage("Incorrect enchant level.");
      return;
    }
    Skill skill = SkillTable.getInstance().getInfo(_skillId, enchantLevel);
    if (skill == null)
    {
      return;
    }
    int[] cost = sl.getCost();
    int requiredSp = cost[1] * SkillTreeTable.SAFE_ENCHANT_COST_MULTIPLIER * sl.getCostMult();
    int requiredAdena = cost[0] * SkillTreeTable.SAFE_ENCHANT_COST_MULTIPLIER * sl.getCostMult();
    int rate = sl.getRate(activeChar);
    if (activeChar.getSp() < requiredSp)
    {
      sendPacket(Msg.SP_REQUIRED_FOR_SKILL_ENCHANT_IS_INSUFFICIENT);
      return;
    }
View Full Code Here

    }
    int bookId = 0;
    int sp = 0;
    int adenaCount = 0;
    double spMult = SkillTreeTable.NORMAL_ENCHANT_COST_MULTIPLIER;
    EnchantSkillLearn esd = null;
    switch (_type)
    {
      case TYPE_NORMAL_ENCHANT:
        if ((_skillId < 10000) & ((_skillLvl % 100) == 1))
        {
          bookId = SkillTreeTable.NORMAL_ENCHANT_BOOK;
        }
        else if (_skillId >= 10000)
        {
          bookId = SkillTreeTable.NEW_ENCHANT_BOOK;
        }
        esd = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl);
        break;
      case TYPE_SAFE_ENCHANT:
        if (_skillId < 10000)
        {
          bookId = SkillTreeTable.SAFE_ENCHANT_BOOK;
        }
        else
        {
          bookId = SkillTreeTable.NEW_SAFE_ENCHANT_BOOK;
        }
        esd = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl);
        spMult = SkillTreeTable.SAFE_ENCHANT_COST_MULTIPLIER;
        break;
      case TYPE_UNTRAIN_ENCHANT:
        if (_skillId < 10000)
        {
          bookId = SkillTreeTable.UNTRAIN_ENCHANT_BOOK;
        }
        else
        {
          bookId = SkillTreeTable.UNTRAIN_NEW_ENCHANT_BOOK;
        }
        esd = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl + 1);
        break;
      case TYPE_CHANGE_ENCHANT:
        if (_skillId < 10000)
        {
          bookId = SkillTreeTable.CHANGE_ENCHANT_BOOK;
        }
        else
        {
          bookId = SkillTreeTable.NEW_CHANGE_ENCHANT_BOOK;
        }
        esd = SkillTreeTable.getEnchantsForChange(_skillId, _skillLvl).get(0);
        spMult = 1f / SkillTreeTable.SAFE_ENCHANT_COST_MULTIPLIER;
        break;
    }
    if (esd == null)
    {
      return;
    }
    spMult *= esd.getCostMult();
    int[] cost = esd.getCost();
    sp = (int) (cost[1] * spMult);
    if (_type != TYPE_UNTRAIN_ENCHANT)
    {
      adenaCount = (int) (cost[0] * spMult);
    }
    activeChar.sendPacket(new ExEnchantSkillInfoDetail(_skillId, _skillLvl, sp, esd.getRate(activeChar), bookId, adenaCount));
  }
View Full Code Here

    {
      return;
    }
    if (_skillLvl > 100)
    {
      EnchantSkillLearn sl = SkillTreeTable.getSkillEnchant(_skillId, _skillLvl);
      if (sl == null)
      {
        activeChar.sendMessage("Not found enchant info for this skill");
        return;
      }
      Skill skill = SkillTable.getInstance().getInfo(_skillId, SkillTreeTable.convertEnchantLevel(sl.getBaseLevel(), _skillLvl, sl.getMaxLevel()));
      if ((skill == null) || (skill.getId() != _skillId))
      {
        activeChar.sendMessage("This skill doesn't yet have enchant info in Datapack");
        return;
      }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.base.EnchantSkillLearn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.