Package lineage2.gameserver.model.entity.events.impl

Examples of lineage2.gameserver.model.entity.events.impl.FortressSiegeEvent


   */
  @Override
  public void pickUp(Player player)
  {
    player.getInventory().equipItem(_item);
    FortressSiegeEvent event = player.getEvent(FortressSiegeEvent.class);
    event.broadcastTo(new SystemMessage2(SystemMsg.C1_HAS_ACQUIRED_THE_FLAG).addName(player), SiegeEvent.ATTACKERS, SiegeEvent.DEFENDERS);
  }
View Full Code Here


        {
          Fortress fortress = getFortress();
          fortress.setFortState(state, castleId);
          fortress.setJdbcState(JdbcEntityState.UPDATED);
          fortress.update();
          FortressSiegeEvent event = fortress.getSiegeEvent();
          event.despawnEnvoy();
        }
        player.sendPacket(new NpcHtmlMessage(player, this, fileName, 0));
        break;
      case COND_FAIL:
        player.sendPacket(new NpcHtmlMessage(player, this, _failDialog, 0));
View Full Code Here

  public ExShowFortressMapInfo(Fortress fortress)
  {
    _fortressId = fortress.getId();
    _fortressStatus = fortress.getSiegeEvent().isInProgress();

    FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
    _commanders = siegeEvent.getBarrackStatus();
  }
View Full Code Here

    {
      return;
    }
   
    Fortress fortress = getFortress();
    FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
   
    if (command.equalsIgnoreCase("register"))
    {
      Clan clan = player.getClan();
      if (clan == null)
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery002.htm");
        return;
      }
     
      if (clan.getHasFortress() == fortress.getId())
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery014.htm", "%clan_name%", clan.getName());
        return;
      }
     
      if (!player.hasPrivilege(Privilege.CS_FS_SIEGE_WAR))
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery012.htm");
        return;
      }
     
      if (clan.getCastle() > 0)
      {
        Castle relatedCastle = null;
        for (Castle castle : fortress.getRelatedCastles())
        {
          if (castle.getId() == clan.getCastle())
          {
            relatedCastle = castle;
          }
        }
       
        if (relatedCastle != null)
        {
          if (fortress.getContractState() == Fortress.CONTRACT_WITH_CASTLE)
          {
            showChatWindow(player, "residence2/fortress/fortress_ordery022.htm");
            return;
          }
         
          if (relatedCastle.getSiegeEvent().isRegistrationOver())
          {
            showChatWindow(player, "residence2/fortress/fortress_ordery022.htm");
            return;
          }
        }
        else
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery021.htm");
          return;
        }
      }
     
      int attackersSize = siegeEvent.getObjects(SiegeEvent.ATTACKERS).size();
     
      if (attackersSize == 0)
      {
        if (!player.consumeItem(ItemTemplate.ITEM_ID_ADENA, 250000L))
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery003.htm");
          return;
        }
      }
     
      SiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
      if (siegeClan != null)
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery007.htm");
        return;
      }
     
      for (Fortress $ : ResidenceHolder.getInstance().getResidenceList(Fortress.class))
      {
        if ($.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, clan) != null)
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery006.htm");
          return;
        }
      }
     
      if ((clan.getHasFortress() > 0) && (fortress.getSiegeDate().getTimeInMillis() > 0))
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery006.htm");
        return;
      }
     
      siegeClan = new SiegeClanObject(SiegeEvent.ATTACKERS, clan, 0);
      siegeEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
      SiegeClanDAO.getInstance().insert(fortress, siegeClan);
     
      siegeEvent.reCalcNextTime(false);
     
      player.sendPacket(new SystemMessage2(SystemMsg.YOUR_CLAN_HAS_BEEN_REGISTERED_TO_S1S_FORTRESS_BATTLE).addResidenceName(fortress));
      showChatWindow(player, "residence2/fortress/fortress_ordery005.htm");
    }
    else if (command.equalsIgnoreCase("cancel"))
    {
      Clan clan = player.getClan();
      if ((clan == null) || !player.hasPrivilege(Privilege.CS_FS_SIEGE_WAR))
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery010.htm");
        return;
      }
     
      SiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
      if (siegeClan != null)
      {
        siegeEvent.removeObject(SiegeEvent.ATTACKERS, siegeClan);
        SiegeClanDAO.getInstance().delete(fortress, siegeClan);
       
        siegeEvent.reCalcNextTime(false);
       
        showChatWindow(player, "residence2/fortress/fortress_ordery009.htm");
      }
      else
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery011.htm");
      }
    }
    else if (command.equalsIgnoreCase("state"))
    {
      int attackersSize = siegeEvent.getObjects(SiegeEvent.ATTACKERS).size();
      if (attackersSize == 0)
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery019.htm");
      }
      else
View Full Code Here

  public ExShowFortressSiegeInfo(Fortress fortress)
  {
    _fortressId = fortress.getId();

    FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
    _commandersMax = siegeEvent.getBarrackStatus().length;
    if (fortress.getSiegeEvent().isInProgress())
      for (int i = 0; i < _commandersMax; i++)
        if (siegeEvent.getBarrackStatus()[i])
          _commandersCurrent++;
  }
View Full Code Here

  @Override
  public void onSpawn()
  {
    super.onSpawn();
    Fortress f = getFortress();
    FortressSiegeEvent event = f.getSiegeEvent();
    List<DoorObject> objects = event.getObjects(FortressSiegeEvent.ENTER_DOORS);
    for (DoorObject d : objects)
    {
      d.getDoor().addListener(_doorDeathListener);
    }
  }
View Full Code Here

   * @return boolean
   */
  @Override
  public boolean isAutoAttackable(Creature attacker)
  {
    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

  @Override
  public void onDecay()
  {
    super.onDecay();
    Fortress f = getFortress();
    FortressSiegeEvent event = f.getSiegeEvent();
    List<DoorObject> objects = event.getObjects(FortressSiegeEvent.ENTER_DOORS);
    for (DoorObject d : objects)
    {
      d.getDoor().removeListener(_doorDeathListener);
    }
  }
View Full Code Here

    {
      if (isDead())
      {
        return;
      }
      FortressSiegeEvent event = door.getEvent(FortressSiegeEvent.class);
      if (event == null)
      {
        return;
      }
      Functions.npcShout(MercenaryCaptionInstance.this, NpcString.WE_HAVE_BROKEN_THROUGH_THE_GATE_DESTROY_THE_ENCAMPMENT_AND_MOVE_TO_THE_COMMAND_POST);
      List<DoorObject> objects = event.getObjects(FortressSiegeEvent.ENTER_DOORS);
      for (DoorObject d : objects)
      {
        d.open(event);
      }
      ((MercenaryCaption) getAI()).startMove(true);
View Full Code Here

   */
  @Override
  public void onSpawn()
  {
    super.onSpawn();
    FortressSiegeEvent siegeEvent = getEvent(FortressSiegeEvent.class);
    if (siegeEvent == null)
    {
      return;
    }
    siegeEvent.barrackAction(3, false);
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.entity.events.impl.FortressSiegeEvent

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.