player.sendPacket(new SystemMessage(SystemMessageId.CAPTAIN_OF_ROYAL_GUARD_CANNOT_BE_APPOINTED));
return;
}
L2Clan clan = player.getClan();
SubPledge subPledge = player.getClan().getSubPledge(clanName);
if (null == subPledge)
{
player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_INCORRECT));
return;
}
if (subPledge.getId() == L2Clan.SUBUNIT_ACADEMY)
{
player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_INCORRECT));
return;
}
if (clan.getClanMember(leaderName) == null || (clan.getClanMember(leaderName).getPledgeType() != 0))
{
if (subPledge.getId() >= L2Clan.SUBUNIT_KNIGHT1)
{
player.sendPacket(new SystemMessage(SystemMessageId.CAPTAIN_OF_ORDER_OF_KNIGHTS_CANNOT_BE_APPOINTED));
}
else if (subPledge.getId() >= L2Clan.SUBUNIT_ROYAL1)
{
player.sendPacket(new SystemMessage(SystemMessageId.CAPTAIN_OF_ROYAL_GUARD_CANNOT_BE_APPOINTED));
}
return;
}
subPledge.setLeaderName(leaderName);
clan.updateSubPledgeInDB(subPledge.getId());
L2ClanMember leaderSubPledge = clan.getClanMember(leaderName);
leaderSubPledge.getPlayerInstance().setPledgeClass(leaderSubPledge.calculatePledgeClass(leaderSubPledge.getPlayerInstance()));
leaderSubPledge.getPlayerInstance().sendPacket(new UserInfo(leaderSubPledge.getPlayerInstance()));
clan.broadcastClanStatus();
SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_BEEN_SELECTED_AS_CAPTAIN_OF_S2);