Package lineage2.gameserver.model.entity.events.objects

Examples of lineage2.gameserver.model.entity.events.objects.SiegeClanObject


    FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
    if (event == null)
    {
      return false;
    }
    SiegeClanObject object = event.getSiegeClan(SiegeEvent.DEFENDERS, attacker.getClan());
    if (object == null)
    {
      return false;
    }
    return true;
View Full Code Here


        {
          for (Serializable o : entry.getValue())
          {
            if (o instanceof SiegeClanObject)
            {
              SiegeClanObject siegeClanObject = (SiegeClanObject) o;
              clans.append("<tr>").append("<td>").append(siegeClanObject.getClan().getName()).append("</td>").append("<td>").append(siegeClanObject.getClan().getLeaderName()).append("</td>").append("<td>").append(siegeClanObject.getType()).append("</td>").append("</tr>");
            }
          }
        }
        msg.replace("%clans%", clans.toString());
        msg.replace("%hour%", String.valueOf(r.getSiegeDate().get(Calendar.HOUR_OF_DAY)));
View Full Code Here

   */
  private static void registerAtCastle(Player player, Castle castle, boolean attacker, boolean join)
  {
    CastleSiegeEvent siegeEvent = castle.getSiegeEvent();
    Clan playerClan = player.getClan();
    SiegeClanObject siegeClan = null;
    if (attacker)
    {
      siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, playerClan);
    }
    else
    {
      siegeClan = siegeEvent.getSiegeClan(SiegeEvent.DEFENDERS, playerClan);
      if (siegeClan == null)
      {
        siegeClan = siegeEvent.getSiegeClan(CastleSiegeEvent.DEFENDERS_WAITING, playerClan);
      }
    }
    if (join)
    {
      Residence registeredCastle = null;
      for (Residence residence : ResidenceHolder.getInstance().getResidenceList(Castle.class))
      {
        SiegeClanObject tempCastle = residence.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, playerClan);
        if (tempCastle == null)
        {
          tempCastle = residence.getSiegeEvent().getSiegeClan(SiegeEvent.DEFENDERS, playerClan);
        }
        if (tempCastle == null)
        {
          tempCastle = residence.getSiegeEvent().getSiegeClan(CastleSiegeEvent.DEFENDERS_WAITING, playerClan);
        }
        if (tempCastle != null)
        {
          registeredCastle = residence;
        }
      }
      if (attacker)
      {
        if (castle.getOwnerId() == playerClan.getClanId())
        {
          player.sendPacket(SystemMsg.CASTLE_OWNING_CLANS_ARE_AUTOMATICALLY_REGISTERED_ON_THE_DEFENDING_SIDE);
          return;
        }
        Alliance alliance = playerClan.getAlliance();
        if (alliance != null)
        {
          for (Clan clan : alliance.getMembers())
          {
            if (clan.getCastle() == castle.getId())
            {
              player.sendPacket(SystemMsg.YOU_CANNOT_REGISTER_AS_AN_ATTACKER_BECAUSE_YOU_ARE_IN_AN_ALLIANCE_WITH_THE_CASTLE_OWNING_CLAN);
              return;
            }
          }
        }
        if (playerClan.getCastle() > 0)
        {
          player.sendPacket(SystemMsg.A_CLAN_THAT_OWNS_A_CASTLE_CANNOT_PARTICIPATE_IN_ANOTHER_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() < 5)
        {
          player.sendPacket(SystemMsg.ONLY_CLANS_OF_LEVEL_5_OR_HIGHER_MAY_REGISTER_FOR_A_CASTLE_SIEGE);
          return;
        }
        if (registeredCastle != null)
        {
          player.sendPacket(SystemMsg.YOU_HAVE_ALREADY_REQUESTED_A_CASTLE_SIEGE);
          return;
        }
        if (siegeEvent.isRegistrationOver())
        {
          player.sendPacket(SystemMsg.YOU_ARE_TOO_LATE_THE_REGISTRATION_PERIOD_IS_OVER);
          return;
        }
        if (castle.getSiegeDate().getTimeInMillis() == 0)
        {
          player.sendPacket(SystemMsg.THIS_IS_NOT_THE_TIME_FOR_SIEGE_REGISTRATION_AND_SO_REGISTRATION_AND_CANCELLATION_CANNOT_BE_DONE);
          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;
        }
        Fortress fortress = player.getFortress();
        if ((fortress != null) && (fortress.getCastleId() == castle.getId()))
        {
          player.sendPacket(SystemMsg.SIEGE_REGISTRATION_IS_NOT_POSSIBLE_DUE_TO_YOUR_CASTLE_CONTRACT);
          return;
        }
        siegeClan = new SiegeClanObject(SiegeEvent.ATTACKERS, playerClan, 0);
        siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
        SiegeClanDAO.getInstance().insert(castle, siegeClan);
        player.sendPacket(new CastleSiegeAttackerList(castle));
      }
      else
      {
        if (castle.getOwnerId() == 0)
        {
          return;
        }
        if (castle.getOwnerId() == playerClan.getClanId())
        {
          player.sendPacket(SystemMsg.CASTLE_OWNING_CLANS_ARE_AUTOMATICALLY_REGISTERED_ON_THE_DEFENDING_SIDE);
          return;
        }
        if (playerClan.getCastle() > 0)
        {
          player.sendPacket(SystemMsg.A_CLAN_THAT_OWNS_A_CASTLE_CANNOT_PARTICIPATE_IN_ANOTHER_SIEGE);
          return;
        }
        if (siegeClan != null)
        {
          player.sendPacket(SystemMsg.YOU_HAVE_ALREADY_REGISTERED_TO_THE_DEFENDER_SIDE_AND_MUST_CANCEL_YOUR_REGISTRATION_BEFORE_SUBMITTING_YOUR_REQUEST);
          return;
        }
        if (playerClan.getLevel() < 5)
        {
          player.sendPacket(SystemMsg.ONLY_CLANS_OF_LEVEL_5_OR_HIGHER_MAY_REGISTER_FOR_A_CASTLE_SIEGE);
          return;
        }
        if (registeredCastle != null)
        {
          player.sendPacket(SystemMsg.YOU_HAVE_ALREADY_REQUESTED_A_CASTLE_SIEGE);
          return;
        }
        if (castle.getSiegeDate().getTimeInMillis() == 0)
        {
          player.sendPacket(SystemMsg.THIS_IS_NOT_THE_TIME_FOR_SIEGE_REGISTRATION_AND_SO_REGISTRATION_AND_CANCELLATION_CANNOT_BE_DONE);
          return;
        }
        if (siegeEvent.isRegistrationOver())
        {
          player.sendPacket(SystemMsg.YOU_ARE_TOO_LATE_THE_REGISTRATION_PERIOD_IS_OVER);
          return;
        }
        siegeClan = new SiegeClanObject(CastleSiegeEvent.DEFENDERS_WAITING, playerClan, 0);
        siegeEvent.addObject(CastleSiegeEvent.DEFENDERS_WAITING, siegeClan);
        SiegeClanDAO.getInstance().insert(castle, siegeClan);
        player.sendPacket(new CastleSiegeDefenderList(castle));
      }
    }
View Full Code Here

   */
  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));
  }
View Full Code Here

    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final int castleId = (param.length > 4) ? Integer.parseInt(param[3]) : 0;
    if (player.getReflection().isDefault())
    {
      final Castle castle = (castleId > 0) ? ResidenceHolder.getInstance().getResidence(Castle.class, castleId) : null;
      if ((castle != null) && castle.getSiegeEvent().isInProgress())
      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
View Full Code Here

    public void onZoneEnter(Zone zone, Creature cha)
    {
      if (zone.getParams() == null || !cha.isPlayer())
        return;

      Castle castle = ResidenceHolder.getInstance().getResidence(zone.getTemplate().getIndex());

      if (castle != null)
      { 
        if(_side.ordinal()==1 || _side.ordinal()==0)
        {
View Full Code Here

   * Method enter_dc.
   */
  public void enter_dc()
  {
    final Player player = getSelf();
    final NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    if (!NpcInstance.canBypassCheck(player, npc))
View Full Code Here

   * Method exit_dc.
   */
  public void exit_dc()
  {
    final Player player = getSelf();
    final NpcInstance npc = getNpc();
    if ((player == null) || (npc == null))
    {
      return;
    }
    if (!NpcInstance.canBypassCheck(player, npc))
View Full Code Here

   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    final NpcInstance actor = getActor();
    if (actor == null)
    {
      return true;
    }
    for (Player player : World.getAroundPlayers(actor, 200, 200))
View Full Code Here

   * @param damage int
   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final NpcInstance actor = getActor();
    if (_firstTimeAttacked)
    {
      _firstTimeAttacked = false;
      if (Rnd.chance(25))
      {
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.entity.events.objects.SiegeClanObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.