return false;
}
final List<SkillLearn> list = SkillAcquireHolder.getInstance().getSkillLearnListByItemId(player, item.getItemId());
if (list.isEmpty())
{
player.sendPacket(new SystemMessage2(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(item.getItemId()));
return false;
}
boolean alreadyHas = true;
for (SkillLearn learn : list)
{
if (player.getSkillLevel(learn.getId()) != learn.getLevel())
{
alreadyHas = false;
break;
}
}
if (alreadyHas)
{
player.sendPacket(new SystemMessage2(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(item.getItemId()));
return false;
}
boolean wrongLvl = false;
for (SkillLearn learn : list)
{
if (player.getLevel() < learn.getMinLevel())
{
wrongLvl = true;
}
}
if (wrongLvl)
{
player.sendPacket(new SystemMessage2(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS).addItemName(item.getItemId()));
return false;
}
if (!player.consumeItem(item.getItemId(), 1L))
{
return false;
}
for (SkillLearn skillLearn : list)
{
Skill skill = SkillTable.getInstance().getInfo(skillLearn.getId(), skillLearn.getLevel());
if (skill == null)
{
continue;
}
player.sendPacket(new SystemMessage2(SystemMsg.YOU_HAVE_EARNED_S1_SKILL).addSkillName(skill.getId(), skill.getLevel()));
player.addSkill(skill, true);
}
player.updateStats();
player.sendPacket(new SkillList(player));
player.broadcastPacket(new MagicSkillUse(player, player, 2790, 1, 1, 0));