* @param clanHall ClanHall
* @param join boolean
*/
private static void registerAtClanHall(Player player, ClanHall clanHall, boolean join)
{
ClanHallSiegeEvent siegeEvent = clanHall.getSiegeEvent();
Clan playerClan = player.getClan();
SiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, playerClan);
if (join)
{
if (playerClan.getHasHideout() > 0)
{
player.sendPacket(SystemMsg.A_CLAN_THAT_OWNS_A_CLAN_HALL_MAY_NOT_PARTICIPATE_IN_A_CLAN_HALL_SIEGE);
return;
}
if (siegeClan != null)
{
player.sendPacket(SystemMsg.YOU_ARE_ALREADY_REGISTERED_TO_THE_ATTACKER_SIDE_AND_MUST_CANCEL_YOUR_REGISTRATION_BEFORE_SUBMITTING_YOUR_REQUEST);
return;
}
if (playerClan.getLevel() < 4)
{
player.sendPacket(SystemMsg.ONLY_CLANS_WHO_ARE_LEVEL_4_OR_ABOVE_CAN_REGISTER_FOR_BATTLE_AT_DEVASTATED_CASTLE_AND_FORTRESS_OF_THE_DEAD);
return;
}
if (siegeEvent.isRegistrationOver())
{
player.sendPacket(SystemMsg.YOU_ARE_TOO_LATE_THE_REGISTRATION_PERIOD_IS_OVER);
return;
}
int allSize = siegeEvent.getObjects(SiegeEvent.ATTACKERS).size();
if (allSize >= CastleSiegeEvent.MAX_SIEGE_CLANS)
{
player.sendPacket(SystemMsg.NO_MORE_REGISTRATIONS_MAY_BE_ACCEPTED_FOR_THE_ATTACKER_SIDE);
return;
}
siegeClan = new SiegeClanObject(SiegeEvent.ATTACKERS, playerClan, 0);
siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
SiegeClanDAO.getInstance().insert(clanHall, siegeClan);
}
else
{
if (siegeClan == null)
{
player.sendPacket(SystemMsg.YOU_ARE_NOT_YET_REGISTERED_FOR_THE_CASTLE_SIEGE);
return;
}
if (siegeEvent.isRegistrationOver())
{
player.sendPacket(SystemMsg.YOU_ARE_TOO_LATE_THE_REGISTRATION_PERIOD_IS_OVER);
return;
}
siegeEvent.removeObject(siegeClan.getType(), siegeClan);
SiegeClanDAO.getInstance().delete(clanHall, siegeClan);
}
player.sendPacket(new CastleSiegeAttackerList(clanHall));
}