Package lineage2.gameserver.model.entity.residence

Examples of lineage2.gameserver.model.entity.residence.Fortress


    {
      return;
    }
    if (command.equalsIgnoreCase("request_nightzaken"))
    {
      Reflection r = player.getActiveReflection();
      if (r != null)
      {
        if (player.canReenterInstance(nightZakenIzId))
        {
          player.teleToLocation(r.getTeleportLoc(), r);
        }
      }
      else if (player.canEnterInstance(nightZakenIzId))
      {
        ReflectionUtils.enterReflection(player, new ZakenNight(), nightZakenIzId);
      }
    }
    else if (command.equalsIgnoreCase("request_dayzaken"))
    {
      Reflection r = player.getActiveReflection();
      if (r != null)
      {
        if (player.canReenterInstance(dayZakenIzId))
        {
          player.teleToLocation(r.getTeleportLoc(), r);
        }
      }
      else if (player.canEnterInstance(dayZakenIzId))
      {
        ReflectionUtils.enterReflection(player, new ZakenDay(), dayZakenIzId);
      }
    }
    else if (command.equalsIgnoreCase("request_ultrazaken"))
    {
      Reflection r = player.getActiveReflection();
      if (r != null)
      {
        if (player.canReenterInstance(ultraZakenIzId))
        {
          player.teleToLocation(r.getTeleportLoc(), r);
        }
      }
      else if (player.canEnterInstance(ultraZakenIzId))
      {
        ReflectionUtils.enterReflection(player, new ZakenDay83(), ultraZakenIzId);
View Full Code Here


    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final int castleId = (param.length > 4) ? Integer.parseInt(param[3]) : 0;
    if (player.getReflection().isDefault())
    {
      final Castle castle = (castleId > 0) ? ResidenceHolder.getInstance().getResidence(Castle.class, castleId) : null;
      if ((castle != null) && castle.getSiegeEvent().isInProgress())
      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
View Full Code Here

    public void onZoneEnter(Zone zone, Creature cha)
    {
      if (zone.getParams() == null || !cha.isPlayer())
        return;

      Castle castle = ResidenceHolder.getInstance().getResidence(zone.getTemplate().getIndex());

      if (castle != null)
      { 
        if(_side.ordinal()==1 || _side.ordinal()==0)
        {
View Full Code Here

  @Override
  public void onEvtSpawn()
  {
    super.onEvtSpawn();
    final NpcInstance actor = getActor();
    final Fortress f = actor.getFortress();
    final FortressSiegeEvent event = f.getSiegeEvent();
    _points = event.getObjects(FortressSiegeEvent.MERCENARY_POINTS);
  }
View Full Code Here

    return null;
  }
 
  private boolean check(Player player)
  {
    Fortress fort = ResidenceHolder.getInstance().getResidenceByObject(Fortress.class, player);
    if (fort == null)
    {
      return false;
    }
    Clan clan = player.getClan();
    if (clan == null)
    {
      return false;
    }
    if (clan.getClanId() != fort.getOwnerId())
    {
      return false;
    }
    return true;
  }
View Full Code Here

    return true;
  }
 
  private String enterPrison(Player player)
  {
    Fortress fort = ResidenceHolder.getInstance().getResidenceByObject(Fortress.class, player);
    if ((fort == null) || (fort.getOwner() != player.getClan()))
    {
      return "gludio_fort_a_campkeeper_q0511_01a.htm";
    }
    if (fort.getContractState() != 1)
    {
      return "gludio_fort_a_campkeeper_q0511_13.htm";
    }
    if (!areMembersSameClan(player))
    {
      return "gludio_fort_a_campkeeper_q0511_01a.htm";
    }
    if (player.canEnterInstance(INSTANCE_ZONE_ID))
    {
      InstantZone iz = InstantZoneHolder.getInstance().getInstantZone(INSTANCE_ZONE_ID);
      Prison prison = null;
      if (!_prisons.isEmpty())
      {
        prison = _prisons.get(fort.getId());
        if ((prison != null) && prison.isLocked())
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
          return null;
        }
      }
      prison = new Prison(fort.getId(), iz);
      _prisons.put(prison.getFortId(), prison);
      Reflection r = ReflectionManager.getInstance().get(prison.getReflectionId());
      r.setReturnLoc(player.getLoc());
      for (Player member : player.getParty().getPartyMembers())
      {
View Full Code Here

    }
    if (command.equalsIgnoreCase("receive_report"))
    {
      int ownedTime = (int) ((System.currentTimeMillis() - getFortress().getOwnDate().getTimeInMillis()) / 60000L);
      NpcHtmlMessage html = new NpcHtmlMessage(player, this);
      Fortress fortress = getFortress();
      if (fortress.getContractState() == Fortress.CONTRACT_WITH_CASTLE)
      {
        html.setFile("residence2/fortress/fortress_steward022.htm");
        html.replace("%castle_name%", HtmlUtils.htmlResidenceName(getFortress().getCastleId()));
        html.replaceNpcString("%contract%", NpcString.CONTRACT_STATE);
        long leftTime = (REWARD_CYCLE - (3600 - fortress.getCycleDelay()) - (fortress.getPaidCycle() * 3600)) / 60;
        html.replace("%rent_cost%", String.valueOf(Fortress.CASTLE_FEE));
        html.replace("%next_hour%", String.valueOf(leftTime / 60));
        html.replace("%next_min%", String.valueOf(leftTime % 60));
      }
      else
View Full Code Here

   * @param price long
   * @return boolean
   */
  protected boolean buyFacility(Player player, int type, int lvl, long price)
  {
    Fortress fortress = getFortress();
    if ((player.getClanPrivileges() & Clan.CP_CS_MANAGE_SIEGE) != Clan.CP_CS_MANAGE_SIEGE)
    {
      showChatWindow(player, "residence2/fortress/fortress_not_authorized.htm");
      return false;
    }
    if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
    {
      showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
      return false;
    }
    if (fortress.getFacilityLevel(type) >= lvl)
    {
      showChatWindow(player, "residence2/fortress/fortress_already_upgraded.htm");
      return false;
    }
    if (player.consumeItem(ItemTemplate.ITEM_ID_ADENA, price))
    {
      fortress.setFacilityLevel(type, lvl);
      fortress.setJdbcState(JdbcEntityState.UPDATED);
      fortress.update();
      showChatWindow(player, "residence2/fortress/fortress_supply_officer006.htm");
      return true;
    }
    showChatWindow(player, "residence2/fortress/fortress_not_enough_money.htm");
    return false;
View Full Code Here

  {
    if (!canBypassCheck(player, this))
    {
      return;
    }
    Fortress fortress = getFortress();
    if (!player.isClanLeader() || (fortress.getOwnerId() != player.getClanId()))
    {
      showChatWindow(player, "residence2/fortress/fortress_not_authorized.htm");
      return;
    }
    if (command.equalsIgnoreCase("guardInfo"))
    {
      if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
      {
        showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
        return;
      }
      showChatWindow(player, "residence2/fortress/fortress_supply_officer002.htm", "%guard_buff_level%", fortress.getFacilityLevel(Fortress.GUARD_BUFF));
    }
    else if (command.equalsIgnoreCase("supplyInfo"))
    {
      if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
      {
        showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
        return;
      }
      showChatWindow(player, "residence2/fortress/fortress_supply_officer009.htm", "%supply_count%", fortress.getSupplyCount());
    }
    else if (command.equalsIgnoreCase("rewardInfo"))
    {
      showChatWindow(player, "residence2/fortress/fortress_supply_officer010.htm", "%blood_oaths%", fortress.getRewardCount());
    }
    else if (command.equalsIgnoreCase("receiveSupply"))
    {
      String filename;
      if (fortress.getSupplyCount() > 0)
      {
        filename = "residence2/fortress/fortress_supply_officer016.htm";
        NpcInstance npc = NpcHolder.getInstance().getTemplate(SUPPLY_NPC[fortress.getSupplyCount() - 1]).getNewInstance();
        npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
        npc.spawnMe(new Location(getX() - 23, getY() + 41, getZ()));
      }
      else
      {
        filename = "residence2/fortress/fortress_supply_officer017.htm";
      }
      NpcHtmlMessage html = new NpcHtmlMessage(player, this);
      html.setFile(filename);
      player.sendPacket(html);
    }
    else if (command.equalsIgnoreCase("receiveRewards"))
    {
      String filename;
      int count = fortress.getRewardCount();
      if (count > 0)
      {
        filename = "residence2/fortress/fortress_supply_officer013.htm";
        fortress.setRewardCount(0);
        fortress.setJdbcState(JdbcEntityState.UPDATED);
        fortress.update();
        Functions.addItem(player, ITEM_ID, count);
      }
      else
      {
        filename = "residence2/fortress/fortress_supply_officer014.htm";
View Full Code Here

          state = Fortress.INDEPENDENT;
          fileName = _successIndependentDialog;
        }
        if (state != Fortress.NOT_DECIDED)
        {
          Fortress fortress = getFortress();
          fortress.setFortState(state, castleId);
          fortress.setJdbcState(JdbcEntityState.UPDATED);
          fortress.update();
          FortressSiegeEvent event = fortress.getSiegeEvent();
          event.despawnEnvoy();
        }
        player.sendPacket(new NpcHtmlMessage(player, this, fileName, 0));
        break;
      case COND_FAIL:
View Full Code Here

TOP

Related Classes of lineage2.gameserver.model.entity.residence.Fortress

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.