private static final void renameSubPledge( L2PcInstance player, int pledgeType, String pledgeName) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT)); return; } final L2Clan clan = player.getClan(); final SubPledge subPledge = player.getClan().getSubPledge(pledgeType); if (subPledge == null) { player.sendMessage("Pledge don't exists."); return; } if (!Util.isAlphaNumeric(pledgeName) || 2 > pledgeName.length()) { player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_INCORRECT)); return; } if (pledgeName.length() > 16) { player.sendPacket(new SystemMessage(SystemMessageId.CLAN_NAME_TOO_LONG)); return; } subPledge.setName(pledgeName); clan.updateSubPledgeInDB(subPledge.getId()); clan.broadcastClanStatus(); player.sendMessage("Pledge name changed."); }
@Override protected void runImpl() { final L2PcInstance activeChar = getClient().getActiveChar(); if (activeChar == null) { return; } final L2Clan clan = activeChar.getClan(); if (clan == null) { return; } if (!activeChar.hasClanPrivilege(ClanPrivilege.CL_MANAGE_RANKS)) { return; } final L2ClanMember member = clan.getClanMember(_member); if (member == null) { return; } if (member.getObjectId() == clan.getLeaderId()) { return; } if (member.getPledgeType() == L2Clan.SUBUNIT_ACADEMY) { // also checked from client side activeChar.sendMessage("You cannot change academy member grade"); return; } member.setPowerGrade(_powerGrade); clan.broadcastClanStatus(); }
private static final void assignSubPledgeLeader( L2PcInstance player, String clanName, String leaderName) { if (!player.isClanLeader()) { player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT)); return; } if (leaderName.length() > 16) { player.sendPacket(new SystemMessage(SystemMessageId.NAMING_CHARNAME_UP_TO_16CHARS)); return; } if (player.getName().equals(leaderName)) { player.sendPacket( new SystemMessage(SystemMessageId.CAPTAIN_OF_ROYAL_GUARD_CANNOT_BE_APPOINTED)); return; } final L2Clan clan = player.getClan(); final SubPledge subPledge = player.getClan().getSubPledge(clanName); if (null == subPledge || 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.setLeaderId(clan.getClanMember(leaderName).getObjectId()); clan.updateSubPledgeInDB(subPledge.getId()); final L2ClanMember leaderSubPledge = clan.getClanMember(leaderName); final L2PcInstance leaderPlayer = leaderSubPledge.getPlayerInstance(); if (leaderPlayer != null) { leaderPlayer.setPledgeClass(leaderSubPledge.calculatePledgeClass(leaderPlayer)); leaderPlayer.sendPacket(new UserInfo(leaderPlayer)); leaderPlayer.sendPacket(new ExBrExtraUserInfo(leaderPlayer)); } clan.broadcastClanStatus(); SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_BEEN_SELECTED_AS_CAPTAIN_OF_S2); sm.addString(leaderName); sm.addString(clanName); clan.broadcastToOnlineMembers(sm); sm = null; }