Package net.sf.l2j.gameserver.model.entity

Examples of net.sf.l2j.gameserver.model.entity.Castle


      int[] castleidarray = {0,0,0,0,0,0,0,1,2,3,4,0,5,7,8,6,0,9};
      int castleIndex= castleidarray[townId] ;

      if ( castleIndex > 0 )
        {
             Castle castle = CastleManager.getInstance().getCastles().get(CastleManager.getInstance().getCastleIndex(castleIndex));
             if (castle != null)
               return castle.getSiege().getIsInProgress();
        }
        return false;
    }
View Full Code Here


        int[] castleidarray = {0,0,0,0,0,1,0,2,3,4,5,0,0,6,8,7,9,0};
        //find an instance of the castle for this town.
        int castleIndex = castleidarray[curtown];
        if ( castleIndex > 0 )
        {
          Castle castle = CastleManager.getInstance().getCastles().get(CastleManager.getInstance().getCastleIndex(castleIndex));
          if (castle != null)
            return castle.getSiege().getIsInProgress();
        }
        return false;
    }
View Full Code Here

            if (targetPlayer != null || targetPet != null)
            {
                boolean condGood = true;

                //check target is not in a active siege zone
                Castle castle = null;

                if (targetPlayer != null)
                  castle = CastleManager.getInstance().getCastle(targetPlayer.getX(), targetPlayer.getY(), targetPlayer.getZ());
                else
                  castle = CastleManager.getInstance().getCastle(targetPet.getX(), targetPet.getY(), targetPet.getZ());

              if (castle != null
                  && castle.getSiege().getIsInProgress())
              {
                    condGood = false;
                    activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_BE_RESURRECTED_DURING_SIEGE));
              }
View Full Code Here

    @Override
  public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {
      if(command.startsWith("open doors")&&target.equals("castle")&&(activeChar.isClanLeader())){
            L2DoorInstance door = (L2DoorInstance) activeChar.getTarget();
            Castle castle = CastleManager.getInstance().getCastleById(activeChar.getClan().getHasCastle());
            if (door == null || castle == null) return false;
            if (castle.checkIfInZone(door.getX(), door.getY(), door.getZ()))
          {
            door.openMe();
          }

      }
      else if(command.startsWith("close doors")&&target.equals("castle")&&(activeChar.isClanLeader())){
            L2DoorInstance door = (L2DoorInstance) activeChar.getTarget();
            Castle castle = CastleManager.getInstance().getCastleById(activeChar.getClan().getHasCastle());
            if (door == null || castle == null) return false;
            if (castle.checkIfInZone(door.getX(), door.getY(), door.getZ()))
          {
            door.closeMe();
          }

      }
View Full Code Here

          {
            npcId = rs.getInt("npcId");
              x = rs.getInt("x");
              y = rs.getInt("y");
              z = rs.getInt("z");
              Castle castle = CastleManager.getInstance().getCastle(x,y,z);
              if(castle != null)
                startindex = 10*(castle.getCastleId()-1);

              // find the FIRST ticket itemId with spawns the saved NPC in the saved location
            for (int i=startindex;i<NPC_IDS.length;i++)
                  if (NPC_IDS[i] == npcId) // Find the index of the item used
                  {
                  // only handle tickets if a siege is not ongoing in this npc's castle

                    if((castle != null) && !(castle.getSiege().getIsInProgress()))
                    {
                      itemId = ITEM_IDS[i];
                    // create the ticket in the gameworld
                  L2ItemInstance dropticket = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
                  dropticket.setLocation(L2ItemInstance.ItemLocation.INVENTORY);
View Full Code Here

      int x = activeChar.getX();
      int y = activeChar.getY();
      int z = activeChar.getZ();
      int heading = activeChar.getHeading();

        Castle castle = CastleManager.getInstance().getCastle(activeChar);
        if (castle == null)    //this should never happen at this point
          return -1;

        //check if this item can be added here
        for (int i = 0; i < ITEM_IDS.length; i++)
        {
            if (ITEM_IDS[i] == itemId) // Find the index of the item used
            {
              spawnMercenary(NPC_IDS[i], x, y, z, 3000, messages, 0);

                // Hire merc for this caslte.  NpcId is at the same index as the item used.
                castle.getSiege().getSiegeGuardManager().hireMerc(x, y, z, heading, NPC_IDS[i]);

                // create the ticket in the gameworld
            L2ItemInstance dropticket = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
            dropticket.setLocation(L2ItemInstance.ItemLocation.INVENTORY);
                dropticket.dropMe(null, x, y, z);
View Full Code Here

            {
              npcId = NPC_IDS[i];
              break;
            }
      // find the castle where this item is
      Castle castle = CastleManager.getInstance().getCastleById(getTicketCastleId(itemId));

      if (npcId > 0 && castle != null)
      {
        (new SiegeGuardManager(castle)).removeMerc(npcId, item.getX(), item.getY(), item.getZ());
      }
View Full Code Here

      {
        // Move current castle treasury to clan warehouse every 2 hour
        ItemContainer warehouse = _clan.getWarehouse();
        if ((warehouse != null) && (_clan.getHasCastle() > 0))
        {
          Castle castle = CastleManager.getInstance().getCastleById(_clan.getHasCastle());
          if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
          {
            if (_runCount % Config.ALT_MANOR_SAVE_PERIOD_RATE == 0)
            {
              castle.saveSeedData();
              castle.saveCropData();
              _log.info("Manor System: all data for " + castle.getName() + " saved");
            }
          }
                    _runCount++;
          CastleUpdater cu = new CastleUpdater(_clan, _runCount);
          ThreadPoolManager.getInstance().scheduleGeneral(cu, 3600000);
View Full Code Here

            // If in Monster Derby Track
            if (player.isInsideZone(L2Character.ZONE_MONSTERTRACK))
                return new Location(12661, 181687, -3560);

            Castle castle = null;
            ClanHall clanhall = null;

            if (player.getClan() != null)
            {
              // If teleport to clan hall
              if (teleportWhere == TeleportWhereType.ClanHall)
                {

                  clanhall = ClanHallManager.getInstance().getClanHallByOwner(player.getClan());
                  if (clanhall != null)
                  {
                    L2ClanHallZone zone = clanhall.getZone();
                      if (zone != null)
                      {
                          return zone.getSpawn();
                      }
                  }
                }

              // If teleport to castle
              if (teleportWhere == TeleportWhereType.Castle) castle = CastleManager.getInstance().getCastleByOwner(player.getClan());

              // Check if player is on castle ground
                if (castle == null) castle = CastleManager.getInstance().getCastle(player);

              if (castle != null && castle.getCastleId() > 0)
                {
                // If Teleporting to castle or
                // If is on caslte with siege and player's clan is defender
                if (teleportWhere == TeleportWhereType.Castle || (teleportWhere == TeleportWhereType.Castle && castle.getSiege().getIsInProgress() && castle.getSiege().getDefenderClan(player.getClan()) != null))
                {
                   coord = castle.getZone().getSpawn();
                  return new Location(coord[0], coord[1], coord[2]);
                }

                if (teleportWhere == TeleportWhereType.SiegeFlag && castle.getSiege().getIsInProgress())
                    {
                        // Check if player's clan is attacker
                        List<L2NpcInstance> flags = castle.getSiege().getFlag(player.getClan());
                        if (flags != null && !flags.isEmpty())
                        {
                            // Spawn to flag - Need more work to get player to the nearest flag
                            L2NpcInstance flag = flags.get(0);
                            return new Location(flag.getX(), flag.getY(), flag.getZ());
View Full Code Here

        writeD(0x01);                                                   // 6d 00 00 00 00 - to nearest village
        if (_clan != null)
        {
            L2SiegeClan siegeClan = null;
            Boolean isInDefense = false;
            Castle castle = CastleManager.getInstance().getCastle(_activeChar);
            if (castle != null && castle.getSiege().getIsInProgress())
            {
              //siege in progress
                siegeClan = castle.getSiege().getAttackerClan(_clan);
                if (siegeClan == null && castle.getSiege().checkIsDefender(_clan)){
                  isInDefense = true;
                }
            }

            writeD(_clan.getHasHideout() > 0 ? 0x01 : 0x00);            // 6d 01 00 00 00 - to hide away
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.entity.Castle

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.