Package com.l2jfrozen.gameserver.model.entity.siege

Examples of com.l2jfrozen.gameserver.model.entity.siege.Castle


    };
    //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


  @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 == null) || castle.getSiege().getIsInProgress())
    {
      activeChar.sendMessage("You cannot hire mercenary while siege is in progress!");
      return;
    }
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.VOID);
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

   
    L2PcInstance player = (L2PcInstance) activeChar;
    if (player.getClan() == null || player.getClan().getLeaderId() != player.getObjectId())
      return;
   
    Castle castle = CastleManager.getInstance().getCastle(player);
    Fort fort = FortManager.getInstance().getFort(player);
    if ((castle == null) && (fort == null))
      return;
   
    if (castle != null)
    {
      if (!checkIfOkToPlaceFlag(player, castle, true))
        return;
    }
    else
    {
      if (!checkIfOkToPlaceFlag(player, fort, true))
        return;
    }
   
    try
    {
      // Spawn a new flag
      L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, IdFactory.getInstance().getNextId(), NpcTable.getInstance().getTemplate(35062));
     
      if (skill.is_advancedFlag())
      {
        flag.set_advanceFlag(true);
        flag.set_advanceMultiplier(skill.get_advancedMultiplier());
      }
     
      flag.setTitle(player.getClan().getName());
      flag.setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
      flag.setHeading(player.getHeading());
      flag.spawnMe(player.getX(), player.getY(), player.getZ() + 50);
     
      if (castle != null)
        castle.getSiege().getFlag(player.getClan()).add(flag);
      else
        fort.getSiege().getFlag(player.getClan()).add(flag);
     
      flag = null;
    }
View Full Code Here

   * @param isCheckOnly if false, it will send a notification to the player telling him why it failed
   * @return
   */
  public static boolean checkIfOkToPlaceFlag(L2Character activeChar, boolean isCheckOnly)
  {
    Castle castle = CastleManager.getInstance().getCastle(activeChar);
    Fort fort = FortManager.getInstance().getFort(activeChar);
    if ((castle == null) && (fort == null))
      return false;
   
    if (castle != null)
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();
            String text = "Manor System: all data for " + castle.getName() + " saved";
            Log.add(text, "Manor_system");
          }
        }

        _runCount++;
View Full Code Here

    L2PcInstance player = (L2PcInstance) activeChar;

    if(player.getClan() == null || player.getClan().getLeaderId() != player.getObjectId())
      return;

    Castle castle = CastleManager.getInstance().getCastle(player);
    Fort fort = FortManager.getInstance().getFort(player);

    if(castle != null && fort == null){
      if(!checkIfOkToCastSealOfRule(player, castle, true))
        return;
   
    }else if(fort != null && castle == null){
      if(!checkIfOkToCastFlagDisplay(player, fort, true))
        return;
    }
   
    if(castle == null && fort == null)
      return;

    try
    {
      if((castle != null) && (targets[0] instanceof L2ArtefactInstance))
        castle.Engrave(player.getClan(), targets[0].getObjectId());
      else if(fort != null)
        fort.EndOfSiege(player.getClan());
    }
    catch(Exception e)
    {
View Full Code Here

   * @param isCheckOnly
   * @return
   */
  public static boolean checkIfOkToCastSealOfRule(L2Character activeChar, boolean isCheckOnly)
  {
    Castle castle = CastleManager.getInstance().getCastle(activeChar);
    Fort fort = FortManager.getInstance().getFort(activeChar);

    if(fort != null && castle == null)
    {
      return checkIfOkToCastFlagDisplay(activeChar, fort, isCheckOnly);
View Full Code Here

TOP

Related Classes of com.l2jfrozen.gameserver.model.entity.siege.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.