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

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


        L2PcInstance player = (L2PcInstance)activeChar;

        if (!activeChar.isRiding()) return;
        if (!(player.getTarget() instanceof L2DoorInstance)) return;

        Castle castle = CastleManager.getInstance().getCastle(player);
        if (castle == null || !checkIfOkToUseStriderSiegeAssault(player, castle, true)) return;

        try
        {
            L2ItemInstance itemToTake = player.getInventory().getItemByItemId(skill.getItemConsumeId());
View Full Code Here


  public void runImpl() {
  }

  public ExShowCropSetting(int manorId) {
    _manorId = manorId;
    Castle c = CastleManager.getInstance().getCastleById(_manorId);
    FastList<Integer> crops = L2Manor.getInstance().getCropsForCastle(_manorId);
    _count = crops.size();
    _cropData = new int[_count * 14];
    int i=0;
    for (int cr : crops) {
      _cropData[i*14 + 0] = cr;
      _cropData[i*14 + 1] = L2Manor.getInstance().getSeedLevelByCrop(cr);
      _cropData[i*14 + 2] = L2Manor.getInstance().getRewardItem(cr, 1);
      _cropData[i*14 + 3] = L2Manor.getInstance().getRewardItem(cr, 2);
      _cropData[i*14 + 4] = L2Manor.getInstance().getCropPuchaseLimit(cr);
      _cropData[i*14 + 5] = 0; // Looks like not used
      _cropData[i*14 + 6] = L2Manor.getInstance().getCropBasicPrice(cr) * 60 / 100;
      _cropData[i*14 + 7] = L2Manor.getInstance().getCropBasicPrice(cr) * 10;
      CropProcure cropPr = c.getCrop(cr, CastleManorManager.PERIOD_CURRENT);
      if (cropPr != null) {
        _cropData[i*14 + 8] = cropPr.getStartAmount();
        _cropData[i*14 + 9] = cropPr.getPrice();
        _cropData[i*14 + 10] = cropPr.getReward();
      } else {
        _cropData[i*14 + 8] = 0;
        _cropData[i*14 + 9] = 0;
        _cropData[i*14 + 10] = 0;
      }
      cropPr = c.getCrop(cr, CastleManorManager.PERIOD_NEXT);
      if (cropPr != null) {
        _cropData[i*14 + 11] = cropPr.getStartAmount();
        _cropData[i*14 + 12] = cropPr.getPrice();
        _cropData[i*14 + 13] = cropPr.getReward();
      } else {
View Full Code Here

    }

    @Override
  protected void runImpl()
    {
        Castle castle = CastleManager.getInstance().getCastleById(_castleId);
        if (castle == null) return;
        SiegeDefenderList sdl = new SiegeDefenderList(castle);
        sendPacket(sdl);
    }
View Full Code Here

  public void runImpl() {
  }

  public ExShowSeedSetting(int manorId) {
    _manorId = manorId;
    Castle c = CastleManager.getInstance().getCastleById(_manorId);
    FastList<Integer> seeds = L2Manor.getInstance().getSeedsForCastle(_manorId);
    _count = seeds.size();
    _seedData = new int[_count * 12];
    int i=0;
    for (int s : seeds) {
      _seedData[i*12 + 0] = s;
      _seedData[i*12 + 1] = L2Manor.getInstance().getSeedLevel(s);
      _seedData[i*12 + 2] = L2Manor.getInstance().getRewardItemBySeed(s, 1);
      _seedData[i*12 + 3] = L2Manor.getInstance().getRewardItemBySeed(s, 2);
      _seedData[i*12 + 4] = L2Manor.getInstance().getSeedSaleLimit(s);
      _seedData[i*12 + 5] = L2Manor.getInstance().getSeedBuyPrice(s);
      _seedData[i*12 + 6] = L2Manor.getInstance().getSeedBasicPrice(s) * 60 / 100;
      _seedData[i*12 + 7] = L2Manor.getInstance().getSeedBasicPrice(s) * 10;
      SeedProduction seedPr = c.getSeed(s, CastleManorManager.PERIOD_CURRENT);
      if (seedPr != null) {
        _seedData[i*12 + 8] = seedPr.getStartProduce();
        _seedData[i*12 + 9] = seedPr.getPrice();
      } else {
        _seedData[i*12 + 8] = 0;
        _seedData[i*12 + 9] = 0;
      }
      seedPr = c.getSeed(s, CastleManorManager.PERIOD_NEXT);
      if (seedPr != null) {
        _seedData[i*12 + 10] = seedPr.getStartProduce();
        _seedData[i*12 + 11] = seedPr.getPrice();
      } else {
        _seedData[i*12 + 10] = 0;
View Full Code Here

        int index = getCastleIndex(obj);
        if (index < 0)
        {
            double closestDistance = 99999999;
            double distance;
            Castle castle;
            for (int i = 0; i < getCastles().size(); i++)
            {
                castle = getCastles().get(i);
                if (castle == null) continue;
                distance = castle.getDistance(obj);
                if (closestDistance > distance)
                {
                    closestDistance = distance;
                    index = i;
                }
View Full Code Here

            statement = con.prepareStatement("Select id from castle order by id");
            rs = statement.executeQuery();

            while (rs.next())
            {
                getCastles().add(new Castle(rs.getInt("id")));
            }

            statement.close();

            System.out.println("Loaded: " + getCastles().size() + " castles");
View Full Code Here

    public final Castle getCastle(L2Object activeObject) { return getCastle(activeObject.getX(), activeObject.getY(), activeObject.getZ()); }

    public final int getCastleIndex(int castleId)
    {
        Castle castle;
        for (int i = 0; i < getCastles().size(); i++)
        {
            castle = getCastles().get(i);
            if (castle != null && castle.getCastleId() == castleId) return i;
        }
        return -1;
    }
View Full Code Here

      return getCastleIndex(activeObject.getX(), activeObject.getY(), activeObject.getZ());
    }

    public final int getCastleIndex(int x, int y, int z)
    {
        Castle castle;
        for (int i = 0; i < getCastles().size(); i++)
        {
            castle = getCastles().get(i);
            if (castle != null && castle.checkIfInZone(x, y, z)) return i;
        }
        return -1;
    }
View Full Code Here

    {
        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

    @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

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.