Package lineage2.gameserver.model.entity.residence

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


    if (!canBypassCheck(player, this))
    {
      return;
    }
   
    Fortress fortress = getFortress();
    FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
   
    if (command.equalsIgnoreCase("register"))
    {
      Clan clan = player.getClan();
      if (clan == null)
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery002.htm");
        return;
      }
     
      if (clan.getHasFortress() == fortress.getId())
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery014.htm", "%clan_name%", clan.getName());
        return;
      }
     
      if (!player.hasPrivilege(Privilege.CS_FS_SIEGE_WAR))
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery012.htm");
        return;
      }
     
      if (clan.getCastle() > 0)
      {
        Castle relatedCastle = null;
        for (Castle castle : fortress.getRelatedCastles())
        {
          if (castle.getId() == clan.getCastle())
          {
            relatedCastle = castle;
          }
        }
       
        if (relatedCastle != null)
        {
          if (fortress.getContractState() == Fortress.CONTRACT_WITH_CASTLE)
          {
            showChatWindow(player, "residence2/fortress/fortress_ordery022.htm");
            return;
          }
         
          if (relatedCastle.getSiegeEvent().isRegistrationOver())
          {
            showChatWindow(player, "residence2/fortress/fortress_ordery022.htm");
            return;
          }
        }
        else
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery021.htm");
          return;
        }
      }
     
      int attackersSize = siegeEvent.getObjects(SiegeEvent.ATTACKERS).size();
     
      if (attackersSize == 0)
      {
        if (!player.consumeItem(ItemTemplate.ITEM_ID_ADENA, 250000L))
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery003.htm");
          return;
        }
      }
     
      SiegeClanObject siegeClan = siegeEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
      if (siegeClan != null)
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery007.htm");
        return;
      }
     
      for (Fortress $ : ResidenceHolder.getInstance().getResidenceList(Fortress.class))
      {
        if ($.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, clan) != null)
        {
          showChatWindow(player, "residence2/fortress/fortress_ordery006.htm");
          return;
        }
      }
     
      if ((clan.getHasFortress() > 0) && (fortress.getSiegeDate().getTimeInMillis() > 0))
      {
        showChatWindow(player, "residence2/fortress/fortress_ordery006.htm");
        return;
      }
     
View Full Code Here


   */
  @Override
  public void showChatWindow(Player player, int val, Object... arg)
  {
    NpcHtmlMessage html = new NpcHtmlMessage(player, this);
    Fortress fortress = getFortress();
    if (fortress.getOwner() != null)
    {
      html.setFile("residence2/fortress/fortress_ordery001a.htm");
      html.replace("%clan_name%", fortress.getOwner().getName());
    }
    else
    {
      html.setFile("residence2/fortress/fortress_ordery001.htm");
    }
View Full Code Here

  {
    if (!canBypassCheck(player, this))
    {
      return;
    }
    Fortress fortress = getFortress();
    if (command.equalsIgnoreCase("defenceInfo"))
    {
      if ((player.getClanPrivileges() & Clan.CP_CS_MANAGE_SIEGE) != Clan.CP_CS_MANAGE_SIEGE)
      {
        showChatWindow(player, "residence2/fortress/fortress_not_authorized.htm");
        return;
      }
      if (fortress.getContractState() != Fortress.CONTRACT_WITH_CASTLE)
      {
        showChatWindow(player, "residence2/fortress/fortress_supply_officer005.htm");
        return;
      }
      showChatWindow(player, "residence2/fortress/fortress_garrison002.htm", "%facility_0%", fortress.getFacilityLevel(Fortress.REINFORCE), "%facility_2%", fortress.getFacilityLevel(Fortress.DOOR_UPGRADE), "%facility_3%", fortress.getFacilityLevel(Fortress.DWARVENS), "%facility_4%", fortress.getFacilityLevel(Fortress.SCOUT));
    }
    else if (command.equalsIgnoreCase("defenceUp1") || command.equalsIgnoreCase("defenceUp2"))
    {
      buyFacility(player, Fortress.REINFORCE, Integer.parseInt(command.substring(9, 10)), 100000);
    }
    else if (command.equalsIgnoreCase("deployScouts"))
    {
      buyFacility(player, Fortress.SCOUT, 1, 150000);
    }
    else if (command.equalsIgnoreCase("doorUpgrade"))
    {
      boolean buy = buyFacility(player, Fortress.DOOR_UPGRADE, 1, 200000);
      if (buy)
      {
        List<DoorObject> doorObjects = fortress.getSiegeEvent().getObjects(FortressSiegeEvent.UPGRADEABLE_DOORS);
        for (DoorObject d : doorObjects)
        {
          d.setUpgradeValue(fortress.<SiegeEvent<?, ?>> getSiegeEvent(), d.getDoor().getMaxHp() * fortress.getFacilityLevel(Fortress.DOOR_UPGRADE));
        }
      }
    }
    else if (command.equalsIgnoreCase("hireDwarves"))
    {
View Full Code Here

    return true;
  }
 
  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;
    }
    if (fort.getContractState() != 1)
    {
      return false;
    }
    return true;
  }
View Full Code Here

        }
        break;
      case TO_FORTRESS:
        if ((clan != null) && (clan.getHasFortress() != 0))
        {
          Fortress fort = activeChar.getFortress();
          loc = TeleportUtils.getRestartLocation(activeChar, RestartType.TO_FORTRESS);
          if (fort.getFunction(ResidenceFunction.RESTORE_EXP) != null)
          {
            activeChar.restoreExp(fort.getFunction(ResidenceFunction.RESTORE_EXP).getLevel());
          }
        }
        break;
      case TO_VILLAGE:
      default:
View Full Code Here

   */
  @Override
  public void onSpawn()
  {
    super.onSpawn();
    Fortress f = getFortress();
    FortressSiegeEvent event = f.getSiegeEvent();
    List<DoorObject> objects = event.getObjects(FortressSiegeEvent.ENTER_DOORS);
    for (DoorObject d : objects)
    {
      d.getDoor().addListener(_doorDeathListener);
    }
View Full Code Here

   */
  @Override
  public void onDecay()
  {
    super.onDecay();
    Fortress f = getFortress();
    FortressSiegeEvent event = f.getSiegeEvent();
    List<DoorObject> objects = event.getObjects(FortressSiegeEvent.ENTER_DOORS);
    for (DoorObject d : objects)
    {
      d.getDoor().removeListener(_doorDeathListener);
    }
View Full Code Here

      case admin_fortress_spawn_flags:
        if (wordList.length != 2)
        {
          return false;
        }
        final Fortress fortress = ResidenceHolder.getInstance().getResidence(Fortress.class, Integer.parseInt(wordList[1]));
        if (fortress == null)
        {
          return false;
        }
        final FortressSiegeEvent siegeEvent = fortress.getSiegeEvent();
        if (!siegeEvent.isInProgress())
        {
          return false;
        }
        final boolean[] f = siegeEvent.getBarrackStatus();
View Full Code Here

    Player player = getClient().getActiveChar();
    if (player == null)
    {
      return;
    }
    Fortress fortress = ResidenceHolder.getInstance().getResidence(Fortress.class, _fortressId);
    if (fortress != null)
    {
      sendPacket(new ExShowFortressMapInfo(fortress));
    }
  }
View Full Code Here

        if (allSize >= CastleSiegeEvent.MAX_SIEGE_CLANS)
        {
          player.sendPacket(SystemMsg.NO_MORE_REGISTRATIONS_MAY_BE_ACCEPTED_FOR_THE_ATTACKER_SIDE);
          return;
        }
        Fortress fortress = player.getFortress();
        if ((fortress != null) && (fortress.getCastleId() == castle.getId()))
        {
          player.sendPacket(SystemMsg.SIEGE_REGISTRATION_IS_NOT_POSSIBLE_DUE_TO_YOUR_CASTLE_CONTRACT);
          return;
        }
        siegeClan = new SiegeClanObject(SiegeEvent.ATTACKERS, playerClan, 0);
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.