Package l2p.gameserver.model.entity.residence

Examples of l2p.gameserver.model.entity.residence.Residence$AutoTaskForFunctions


    if(activeChar.getTarget() == null || !activeChar.getTarget().isDoor() || activeChar.getClan() == null)
    {
      return false;
    }
    L2DoorInstance door = (L2DoorInstance) activeChar.getTarget();
    Residence castle = CastleManager.getInstance().getCastleByIndex(activeChar.getClan().getHasCastle());
    if(door == null || castle == null)
    {
      return false;
    }
    if(target.equals("doors") && activeChar.isClanLeader() && castle.checkIfInZone(door.getX(), door.getY()))
    {
      if(command.startsWith("open"))
      {
        door.openMe();
      }
View Full Code Here


      TerritorySiege.getClans().clear();
      TerritorySiegeDatabase.saveSiegeMembers();
      showTerritorySiegePage(activeChar);
      return true;
    }
    Residence siegeUnit = null;
    int siegeUnitId = 0;
    if(st.hasMoreTokens())
    {
      siegeUnitId = Integer.parseInt(st.nextToken());
    }
    if(siegeUnitId != 0)
    {
      siegeUnit = CastleManager.getInstance().getCastleByIndex(siegeUnitId);
      if(siegeUnit == null)
      {
        siegeUnit = FortressManager.getInstance().getFortressByIndex(siegeUnitId);
      }
      if(siegeUnit == null)
      {
        siegeUnit = ClanHallManager.getInstance().getClanHall(siegeUnitId);
      }
    }
    if(siegeUnit == null || siegeUnit.getId() < 0 || siegeUnit.getSiege() == null)
    {
      showSiegeUnitSelectPage(activeChar);
    }
    else
    {
      if(fullString.equalsIgnoreCase("admin_add_attacker"))
      {
        siegeUnit.getSiege().registerAttacker(player, true);
      }
      else if(fullString.equalsIgnoreCase("admin_add_defender"))
      {
        siegeUnit.getSiege().registerDefender(player, true);
      }
      else if(fullString.equalsIgnoreCase("admin_add_guard"))
      {
        // Get value
        String val = "";
        if(st.hasMoreTokens())
        {
          val = st.nextToken();
        }
        if(!val.equals(""))
        {
          try
          {
            int npcId = Integer.parseInt(val);
            siegeUnit.getSiege().getSiegeGuardManager().addSiegeGuard(activeChar, npcId);
          }
          catch(Exception e)
          {
            activeChar.sendMessage("Value entered for Npc Id wasn't an integer");
          }
        }
        else
        {
          activeChar.sendMessage("Missing Npc Id");
        }
      }
      else if(fullString.equalsIgnoreCase("admin_clear_siege_list"))
      {
        siegeUnit.getSiege().getDatabase().clearSiegeClan();
      }
      else if(fullString.equalsIgnoreCase("admin_endsiege"))
      {
        siegeUnit.getSiege().endSiege();
      }
      else if(fullString.equalsIgnoreCase("admin_list_siege_clans"))
      {
        siegeUnit.getSiege().listRegisterClan(activeChar);
        return true;
      }
      else if(fullString.equalsIgnoreCase("admin_move_defenders"))
      {
        activeChar.sendPacket(Msg.NOT_WORKING_PLEASE_TRY_AGAIN_LATER);
      }
      else if(fullString.equalsIgnoreCase("admin_setcastle"))
      {
        if(player.getClan() == null)
        {
          activeChar.sendPacket(Msg.THAT_IS_THE_INCORRECT_TARGET);
        }
        else
        {
          siegeUnit.changeOwner(player.getClan());
          _log.fine(siegeUnit.getName() + " owned by clan " + player.getClan().getName());
        }
      }
      else if(fullString.equalsIgnoreCase("admin_castledel"))
      {
        siegeUnit.changeOwner(null);
      }
      else if(fullString.equalsIgnoreCase("admin_spawn_doors"))
      {
        siegeUnit.spawnDoor();
      }
      else if(fullString.equalsIgnoreCase("admin_startsiege"))
      {
        siegeUnit.getSiege().startSiege();
      }
      showSiegePage(activeChar, siegeUnit);
    }
    return true;
  }
View Full Code Here

  {
    if(player.isGM())
    {
      return Cond_Owner;
    }
    Residence castle = getCastle();
    if(castle != null && castle.getId() > 0)
    {
      if(player.getClan() != null)
      {
        if(castle.getSiege().isInProgress() || TerritorySiege.isInProgress())
        {
          return Cond_Busy_Because_Of_Siege; // Busy because of siege
        }
        else if(castle.getOwnerId() == player.getClanId())
        {
          if(player.isClanLeader()) // Leader of clan
          {
            return Cond_Owner;
          }
View Full Code Here

    player.sendActionFailed();
  }

  private boolean validateCondition(L2Player player)
  {
    Residence residence = getCastle();
    if(residence != null && residence.getId() > 0)
    {
      if(player.getClan() != null)
      {
        if(residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
        {
          return true;
        }
      }
    } // Owner
    residence = getFortress();
    if(residence != null && residence.getId() > 0)
    {
      if(player.getClan() != null)
      {
        if(residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
        {
          return true;
        }
      }
    } // Owner
    residence = getClanHall();
    if(residence != null && residence.getId() > 0)
    {
      if(player.getClan() != null)
      {
        if(residence.getOwnerId() == player.getClanId() && player.isClanLeader()) // Leader of clan
        {
          return true;
        }
      }
    } // Owner
View Full Code Here

    if((activeChar.getClanPrivileges() & L2Clan.CP_CS_MANAGE_SIEGE) != L2Clan.CP_CS_MANAGE_SIEGE)
    {
      activeChar.sendPacket(Msg.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
      return;
    }
    Residence siegeUnit = CastleManager.getInstance().getCastleByIndex(_id);
    if(siegeUnit == null)
    {
      siegeUnit = FortressManager.getInstance().getFortressByIndex(_id);
    }
    if(siegeUnit == null)
    {
      siegeUnit = ClanHallManager.getInstance().getClanHall(_id);
    }
    if(siegeUnit == null || siegeUnit.getSiege() == null)
    {
      return;
    }
    if(_isJoining)
    {
      switch(siegeUnit.getType())
      {
        case Castle:
        case Clanhall:
          for(Castle temp : CastleManager.getInstance().getCastles().values())
          {
            if(temp.getSiege().checkIsClanRegistered(activeChar.getClan()) && siegeUnit.getSiegeDayOfWeek() == temp.getSiegeDayOfWeek() && siegeUnit.getSiegeHourOfDay() == temp.getSiegeHourOfDay())
            {
              activeChar.sendMessage(new CustomMessage("l2p.gameserver.clientpackets.RequestJoinSiege.AlreadyRegistered", activeChar).addString(temp.getName()));
              return;
            }
          }
          break;
        case Fortress:
          for(Fortress fort : FortressManager.getInstance().getFortresses().values())
          {
            if(fort.getSiege().checkIsClanRegistered(activeChar.getClan()))
            {
              activeChar.sendMessage(new CustomMessage("l2p.gameserver.clientpackets.RequestJoinSiege.AlreadyRegistered", activeChar).addString(fort.getName()));
              return;
            }
          }
          break;
      }
      if(_isAttacker)
      {
        siegeUnit.getSiege().registerAttacker(activeChar);
      }
      else
      {
        siegeUnit.getSiege().registerDefender(activeChar);
      }
    }
    else if(siegeUnit.getType() == ResidenceType.Fortress)
    {
      activeChar.sendMessage(new CustomMessage("l2p.gameserver.clientpackets.RequestJoinSiege.CantUnregister", activeChar));
    }
    else
    {
      siegeUnit.getSiege().clearSiegeClan(activeChar.getClan(), false);
    }
    siegeUnit.getSiege().listRegisterClan(activeChar);
  }
View Full Code Here

    {
      return;
    }
    L2Player player = (L2Player) playable;
    int itemId = item.getItemId();
    Residence castle = CastleManager.getInstance().getCastleByObject(player);
    if(castle == null)
    {
      return;
    }
    int castleId = castle.getId();
    // add check that certain tickets can only be placed in certain castles
    if(MercTicketManager.getInstance().getTicketCastleId(itemId) != castleId)
    {
      switch(castleId)
      {
        case 1:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Gludio"));
          return;
        case 2:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Dion"));
          return;
        case 3:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Giran"));
          return;
        case 4:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Oren"));
          return;
        case 5:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Aden"));
          return;
        case 6:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Innadril"));
          return;
        case 7:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Goddard"));
          return;
        case 8:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Rune"));
          return;
        case 9:
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnlyIn", player).addString("Schuttgart"));
          return;
        default:
          // player is not in a castle
          player.sendMessage(new CustomMessage("scripts.items.MercTicket.TicketOnly", player));
          return;
      }
    }
    if((player.getClanPrivileges() & L2Clan.CP_CS_MERCENARIES) != L2Clan.CP_CS_MERCENARIES)
    {
      player.sendMessage("You don't have rights to do this.");
      return;
    }
    if(castle.getSiege().isInProgress() || TerritorySiege.isInProgress())
    {
      player.sendMessage(new CustomMessage("scripts.items.MercTicket.SiegeInProgress", player));
      return;
    }
    if(MercTicketManager.getInstance().isAtCasleLimit(item.getItemId()))
View Full Code Here

   * Если координаты принадлежат зоне какого-либо замка, возвращает индекс этого замка.
   * Иначе возвращает -1.
   */
  public int getCastleIndexByCoord(int x, int y)
  {
    Residence castle;
    for(int i = 1; i <= getCastles().size(); i++)
    {
      castle = getCastles().get(i);
      if(castle != null && castle.checkIfInZone(x, y))
      {
        return i;
      }
    }
    return -1;
View Full Code Here

   * Находит замок по имени, без учета регистра.
   * Если не найден - возвращает -1.
   */
  public int getCastleIndexByName(String name)
  {
    Residence castle;
    for(int i = 1; i <= getCastles().size(); i++)
    {
      castle = getCastles().get(i);
      if(castle != null && castle.getName().equalsIgnoreCase(name.trim()))
      {
        return i;
      }
    }
    return -1;
View Full Code Here

    {
      castleId = 1; // gludio manor dy default
    }
    else
    {
      Residence castle = CastleManager.getInstance().getCastleByIndex(castleId);
      if(castle != null)
      {
        castleId = castle.getId();
      }
    }
    //System.out.println(CastleManager.getInstance().findNearestCastleIndex(activeChar) + " " +castleId + " " + L2Manor.getInstance().getSeedManorId(_seedId));
    // Несовпадение зоны
    if(L2Manor.getInstance().getCastleIdForSeed(seedId) != castleId)
View Full Code Here

  }

  @Override
  public void runImpl()
  {
    Residence unit = CastleManager.getInstance().getCastleByIndex(_unitId);
    if(unit == null)
    {
      unit = FortressManager.getInstance().getFortressByIndex(_unitId);
    }
    if(unit == null)
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.entity.residence.Residence$AutoTaskForFunctions

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.