Examples of Castle


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

    {
        if (activeChar == null || !(activeChar instanceof L2PcInstance)) return false;

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
        L2PcInstance player = (L2PcInstance)activeChar;
        Castle castle = CastleManager.getInstance().getCastle(player);

        if (castle == null || castle.getCastleId() <= 0)
            sm.addString("You must be on castle ground to summon this");
        else if (!castle.getSiege().getIsInProgress())
            sm.addString("You can only summon this during a siege.");
        else if (player.getClanId() != 0 && castle.getSiege().getAttackerClan(player.getClanId()) == null)
            sm.addString("You can only summon this as a registered attacker.");
        else
            return true;

        if (!isCheckOnly) {player.sendPacket(sm);}
View Full Code Here

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

    @Override
  public void useItem(L2PlayableInstance playable, L2ItemInstance item)
    {
      int itemId = item.getItemId();
      L2PcInstance activeChar = (L2PcInstance)playable;
      Castle castle = CastleManager.getInstance().getCastle(activeChar);
      int castleId = -1;
      if (castle != null) castleId = castle.getCastleId();

      //add check that certain tickets can only be placed in certain castles
      if (MercTicketManager.getInstance().getTicketCastleId(itemId) != castleId)
      {
        switch (castleId)
        {
        case 1:activeChar.sendMessage("This Mercenary Ticket can only be used in Gludio.");return;
        case 2:activeChar.sendMessage("This Mercenary Ticket can only be used in Dion.");return;
        case 3:activeChar.sendMessage("This Mercenary Ticket can only be used in Giran.");return;
        case 4:activeChar.sendMessage("This Mercenary Ticket can only be used in Oren.");return;
        case 5:activeChar.sendMessage("This Mercenary Ticket can only be used in Aden.");return;
        case 6:activeChar.sendMessage("This Mercenary Ticket can only be used in Heine.");return;
        case 7:activeChar.sendMessage("This Mercenary Ticket can only be used in Goddard.");return;
        case 8:activeChar.sendMessage("This Mercenary Ticket can only be used in Rune.");return;
        case 9:activeChar.sendMessage("This Mercenary Ticket can only be used in Schuttgart.");return;
        // player is not in a castle
        default: activeChar.sendMessage("Mercenary Tickets can only be used in a castle.");return;
        }
      }

        if (!activeChar.isCastleLord(castleId))
        {
          activeChar.sendMessage("You are not the lord of this castle!");
            return;
        }

        if (castle.getSiege().getIsInProgress())
        {
            activeChar.sendMessage("You cannot hire mercenary while siege is in progress!");
            return;
        }
View Full Code Here

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

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

        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

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

            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

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

    @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

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

          {
            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

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

      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

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

            {
              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

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

      {
        // 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
TOP
Copyright © 2018 www.massapi.com. 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.