/*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If
* not, see <http://www.gnu.org/licenses/>.
*/
package silentium.gameserver.network.serverpackets;
import java.util.ArrayList;
import java.util.List;
public final class AcquireSkillList extends L2GameServerPacket
{
public enum SkillType
{
Usual, Fishing, Clan
}
private List<Skill> _skills;
private final SkillType _skillType;
private static class Skill
{
public int id;
public int nextLevel;
public int maxLevel;
public int spCost;
public int requirements;
public Skill(int pId, int pNextLevel, int pMaxLevel, int pSpCost, int pRequirements)
{
id = pId;
nextLevel = pNextLevel;
maxLevel = pMaxLevel;
spCost = pSpCost;
requirements = pRequirements;
}
}
public AcquireSkillList(SkillType type)
{
_skillType = type;
}
public void addSkill(int id, int nextLevel, int maxLevel, int spCost, int requirements)
{
if (_skills == null)
_skills = new ArrayList<>();
_skills.add(new Skill(id, nextLevel, maxLevel, spCost, requirements));
}
@Override
protected final void writeImpl()
{
writeC(0x8a);
writeD(_skillType.ordinal());
writeD(_skills.size());
for (Skill temp : _skills)
{
writeD(temp.id);
writeD(temp.nextLevel);
writeD(temp.maxLevel);
writeD(temp.spCost);
writeD(temp.requirements);
}
}
}