Clan clan = player.getClan();
if (clan == null)
{
return;
}
SubUnit sub = clan.getSubUnit(id);
if (sub == null)
{
return;
}
if ((player.getClanPrivileges() & Clan.CP_CL_TROOPS_FAME) != Clan.CP_CL_TROOPS_FAME)
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
return;
}
int lvl = sub.getSkillLevel(skillLearn.getId(), 0);
if (lvl >= skillLearn.getLevel())
{
player.sendPacket(SystemMsg.THIS_SQUAD_SKILL_HAS_ALREADY_BEEN_ACQUIRED);
return;
}
if (lvl != (skillLearn.getLevel() - 1))
{
player.sendPacket(SystemMsg.THE_PREVIOUS_LEVEL_SKILL_HAS_NOT_BEEN_LEARNED);
return;
}
if (clan.getReputationScore() < skillLearn.getCost())
{
player.sendPacket(SystemMsg.THE_CLAN_REPUTATION_SCORE_IS_TOO_LOW);
return;
}
if (skillLearn.getItemId() > 0)
{
if (!player.consumeItem(skillLearn.getItemId(), skillLearn.getItemCount()))
{
return;
}
}
clan.incReputation(-skillLearn.getCost(), false, "AquireSkill2: " + skillLearn.getId() + ", lvl " + skillLearn.getLevel());
sub.addSkill(skill, true);
player.sendPacket(new SystemMessage2(SystemMsg.THE_CLAN_SKILL_S1_HAS_BEEN_ADDED).addSkillName(skill));
if (trainer != null)
{
NpcInstance.showSubUnitSkillList(player);
}