Package l2p.gameserver.model.entity.residence

Examples of l2p.gameserver.model.entity.residence.Castle


      {
        refundlist.poll();
      }
    }
    double taxRate = 0;
    Castle castle;
    if(npc != null)
    {
      castle = npc.getCastle(activeChar);
      if(castle != null)
      {
        taxRate = castle.getTaxRate();
      }
    }
    activeChar.sendPacket(new ExBuySellList(TradeController.getInstance().getBuyList(_listId), activeChar, taxRate).done());
    activeChar.updateStats();
  }
View Full Code Here


          if((clan == null || clan.getHasCastle() == 0) && !isInDefense)
          {
            sendPacket(Msg.ActionFail, new Die(activeChar));
            return;
          }
          Castle castle = activeChar.getCastle();
          loc = MapRegion.getTeleToCastle(activeChar);
          if(castle.getFunction(ResidenceFunction.RESTORE_EXP) != null)
          {
            activeChar.restoreExp(castle.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
          }
          break;
        case TO_FORTRESS:
          isInDefense = false;
          if(siege != null && siege.checkIsDefender(clan))
View Full Code Here

  private GArray<CastleFlagsInfo> _cfi = new GArray<CastleFlagsInfo>();

  public ExShowDominionRegistry(L2Player activeChar, int terrId)
  {
    _territoryId = terrId;
    Castle castle = CastleManager.getInstance().getCastleByIndex(terrId);
    if(castle == null)
    {
      System.out.println("Cant find castle with ID " + terrId);
      return;
    }
    L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId());
    _territoryOwnerClanName = clan == null ? "No Clan" : clan.getName();
    _territoryOwnerLeaderName = clan == null ? "No Owner" : clan.getLeaderName();
    _territoryOwnerAllyName = clan == null || clan.getAlliance() == null ? "No Ally" : clan.getAlliance().getAllyName();
    _warTime = (int) (TerritorySiege.getSiegeDate().getTimeInMillis() / 1000);
    _currentTime = (int) (System.currentTimeMillis() / 1000);
View Full Code Here

      if(count < 0)
      {
        sendPacket(Msg.INCORRECT_ITEM_COUNT);
        return;
      }
      Castle castle = manor.getCastle();
      if(castle == null)
      {
        return;
      }
      CropProcure crop = castle.getCrop(itemId, CastleManorManager.PERIOD_CURRENT);
      if(crop == null)
      {
        return;
      }
      int rewardId = L2Manor.getInstance().getRewardItem(itemId, crop.getReward());
View Full Code Here

    return null;
  }

  private boolean check(L2Player player)
  {
    Castle castle = CastleManager.getInstance().getCastleByObject(player);
    if(castle == null)
    {
      return false;
    }
    L2Clan clan = player.getClan();
    if(clan == null)
    {
      return false;
    }
    if(clan.getClanId() != castle.getOwnerId())
    {
      return false;
    }
    return true;
  }
View Full Code Here

    return true;
  }

  private String enterPrison(L2Player player)
  {
    Castle castle = CastleManager.getInstance().getCastleByObject(player);
    if(castle == null || castle.getOwner() != player.getClan())
    {
      return "gludio_prison_keeper_q0512_01a.htm";
    }
    InstancedZoneManager ilm = InstancedZoneManager.getInstance();
    FastMap<Integer, InstancedZone> ils = ilm.getById(201);
    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return null;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return null;
    }
    if(player.isInParty())
    {
      if(player.getParty().isInReflection())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          return null;
        }
      }
      if(!player.getParty().isLeader(player))
      {
        player.sendPacket(Msg.ONLY_A_PARTY_LEADER_CAN_TRY_TO_ENTER);
        return null;
      }
      if(player.getParty().getMemberCount() > maxParty)
      {
        player.sendPacket(Msg.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
        return null;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(member.getLevel() < min_level || member.getLevel() > max_level)
        {
          SystemMessage sm = new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member);
          member.sendPacket(sm);
          player.sendPacket(sm);
          return null;
        }
        if(member.getClan() != player.getClan())
        {
          return "gludio_prison_keeper_q0512_01a.htm";
        }
        if(!player.isInRange(member, 500))
        {
          member.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
          player.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
          return null;
        }
      }
    }
    Prison prison = null;
    if(!_prisons.isEmpty())
    {
      prison = _prisons.get(castle.getId());
      if(prison != null && prison.isLocked())
      {
        // TODO правильное сообщение
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
    }
    prison = new Prison(castle.getId(), ils);
    _prisons.put(prison.getCastleId(), prison);
    Reflection r = ReflectionTable.getInstance().get(prison.getReflectionId());
    r.setReturnLoc(player.getLoc());
    for(L2Player member : player.getParty().getPartyMembers())
    {
View Full Code Here

  private long[] _seedData; // data to send, size:_count*12

  public ExShowSeedSetting(int manorId)
  {
    _manorId = manorId;
    Castle c = CastleManager.getInstance().getCastleByIndex(_manorId);
    GArray<Integer> seeds = L2Manor.getInstance().getSeedsForCastle(_manorId);
    _count = seeds.size();
    _seedData = new long[_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();
      }
View Full Code Here

      }
    }
    int castleIndex = clan.getHasCastle();
    if(castleIndex != 0)
    {
      Castle castle = CastleManager.getInstance().getCastleByIndex(castleIndex);
      if(castle != null && castle.checkIfInZone(getX(), getY()))
      {
        setInResidence(ResidenceType.Castle);
        return;
      }
    }
View Full Code Here

  private long[] _cropData; // data to send, size:_count*14

  public ExShowCropSetting(int manorId)
  {
    _manorId = manorId;
    Castle c = CastleManager.getInstance().getCastleByIndex(_manorId);
    GArray<Integer> crops = L2Manor.getInstance().getCropsForCastle(_manorId);
    _count = crops.size();
    _cropData = new long[_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();
View Full Code Here

  {
    if(player.isGM())
    {
      return Cond_Castle_Owner;
    }
    Castle castle;
    if(player.getClan() != null && (castle = getCastle()) != null)
    {
      if(castle.getOwnerId() == player.getClanId()) // Clan owns castle
      {
        return Cond_Castle_Owner; // Owner
      }
      else if(castle.getSiege().isInProgress() && castle.getSiege().checkIsAttacker(player.getClan()))
      {
        return Cond_Castle_Attacker; // Attacker
      }
      else if(castle.getSiege().isInProgress() && castle.getSiege().checkIsDefender(player.getClan()))
      {
        return Cond_Castle_Defender;
      }
    } // Defender
    return Cond_All_False;
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.entity.residence.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.