06-27-2015, 07:13 PM
RedonZC Написал:У тебя есть опкод очен надо IOЭто пакеты под эртею, 603. Делал для себя когда-то.
AcquireSkillList
Код:
public class AcquireSkillList extends L2GameServerPacket
{
private Collection<SkillLearn> _learn;
private Player _player;
private List<Require> _items = new ArrayList<Require>(2);
public AcquireSkillList(Player player)
{
_player = player;
_learn = SkillAcquireHolder.getInstance().getAvailableSkills(player, AcquireType.NORMAL, true);
for(SkillLearn sk : _learn)
{
if (sk.getItemId() != 0)
{
_items.add(new Require(sk.getItemId(), sk.getItemCount()));
}
}
}
@Override
protected final void writeImpl()
{
writeC(0x90);
writeH(_learn.size());
for(SkillLearn skill : _learn)
{
writeD(skill.getId());
writeH(skill.getLevel());
writeQ(skill.getCost());
writeC(skill.getMinLevel());
writeC(skill.getDualMinLevel());
writeC(_items.size());
for (Require temp : _items)
{
writeD(temp.itemId);
writeQ(temp.count);
}
writeC(skill.getRemovedSkillsForPlayer(_player).size());
for (Skill skills : skill.getRemovedSkillsForPlayer(_player))
{
writeD(skills.getId());
writeH(skills.getLevel());
}
}
}
private static class Require
{
public int itemId;
public long count;
public Require(int pItemId, long pCount)
{
itemId = pItemId;
count = pCount;
}
}
}
ExAcquirableSkillListByClass
Код:
public class ExAcquirableSkillListByClass extends L2GameServerPacket
{
private AcquireType _type;
private final List<Skill> _skills;
class Skill
{
public int id;
public int nextLevel;
public int maxLevel;
public int cost;
public int requirements;
public int subUnit;
Skill(int id, int nextLevel, int maxLevel, int cost, int requirements, int subUnit)
{
this.id = id;
this.nextLevel = nextLevel;
this.maxLevel = maxLevel;
this.cost = cost;
this.requirements = requirements;
this.subUnit = subUnit;
}
}
public ExAcquirableSkillListByClass(AcquireType type, int size)
{
_skills = new ArrayList<>(size);
_type = type;
}
public void addSkill(int id, int nextLevel, int maxLevel, int Cost, int requirements, int subUnit)
{
_skills.add(new Skill(id, nextLevel, maxLevel, Cost, requirements, subUnit));
}
public void addSkill(int id, int nextLevel, int maxLevel, int Cost, int requirements)
{
_skills.add(new Skill(id, nextLevel, maxLevel, Cost, requirements, 0));
}
@Override
protected final void writeImpl()
{
writeEx(0xFA);
writeH(_type.ordinal());
writeH(_skills.size());
for (Skill temp : _skills)
{
writeD(temp.id);
writeH(temp.nextLevel);
writeH(temp.nextLevel);
writeC(temp.maxLevel);
writeQ(temp.cost);
writeC(temp.requirements);
if (_type == AcquireType.SUB_UNIT)
{
writeH(temp.subUnit);
}
}
}
}
ExAcquireSkillInfo
Код:
public class ExAcquireSkillInfo extends L2GameServerPacket
{
private List<Require> _reqs = new ArrayList<Require>(2);
private Player _player;
private SkillLearn _skillLearn;
public ExAcquireSkillInfo(Player player, SkillLearn skillLearn)
{
_player = player;
_skillLearn = skillLearn;
if (_skillLearn.getItemId() != 0)
{
_reqs.add(new Require(_skillLearn.getItemId(), _skillLearn.getItemCount()));
}
}
@Override
protected void writeImpl()
{
writeEx(0xFC);
writeD(_skillLearn.getId());
writeD(_skillLearn.getLevel());
writeQ(_skillLearn.getCost());
writeH(_skillLearn.getMinLevel());
writeH(_skillLearn.getDualMinLevel());
writeD(_reqs.size());
for (Require temp : _reqs)
{
writeD(temp.itemId);
writeQ(temp.count);
}
writeD(_skillLearn.getRemovedSkillsForPlayer(_player).size());
for (Skill skill : _skillLearn.getRemovedSkillsForPlayer(_player))
{
writeD(skill.getId());
writeD(skill.getLevel());
}
}
private static class Require
{
public int itemId;
public long count;
public Require(int pItemId, long pCount)
{
itemId = pItemId;
count = pCount;
}
}
}