Package lineage2.gameserver.network.serverpackets

Source Code of lineage2.gameserver.network.serverpackets.ExEnchantSkillInfo

package lineage2.gameserver.network.serverpackets;

import lineage2.gameserver.model.base.EnchantSkillLearn;
import lineage2.gameserver.tables.SkillTreeTable;

import java.util.ArrayList;
import java.util.List;

public class ExEnchantSkillInfo extends L2GameServerPacket
{
  private List<Integer> _routes;

  private int _id, _level, _canAdd, canDecrease;

  public ExEnchantSkillInfo(int id, int level)
  {
    _routes = new ArrayList<Integer>();
    _id = id;
    _level = level;

    // 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;
      }
  }

  public void addEnchantSkillDetail(int level)
  {
    _routes.add(level);
  }

  @Override
  protected void writeImpl()
  {
    writeEx(0x2a);

    writeD(_id);
    writeD(_level);
    writeD(_canAdd); // can add enchant
    writeD(canDecrease); // can decrease enchant

    writeD(_routes.size());
    for (Integer route : _routes)
      writeD(route);
  }
}
TOP

Related Classes of lineage2.gameserver.network.serverpackets.ExEnchantSkillInfo

TOP
Copyright © 2018 www.massapi.com. 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.