Package lineage2.commons.geometry

Examples of lineage2.commons.geometry.Shape


            }
            zoneDat.set("PKrestart_points", PKrestartPoints);
          }
          else if ((isShape = "rectangle".equalsIgnoreCase(n.getName())) || "banned_rectangle".equalsIgnoreCase(n.getName()))
          {
            Shape shape = parseRectangle(n);
            if (territory == null)
            {
              territory = new Territory();
              zoneDat.set("territory", territory);
            }
            if (isShape)
            {
              territory.add(shape);
            }
            else
            {
              territory.addBanned(shape);
            }
          }
          else if ((isShape = "circle".equalsIgnoreCase(n.getName())) || "banned_cicrcle".equalsIgnoreCase(n.getName()))
          {
            Shape shape = parseCircle(n);
            if (territory == null)
            {
              territory = new Territory();
              zoneDat.set("territory", territory);
            }
            if (isShape)
            {
              territory.add(shape);
            }
            else
            {
              territory.addBanned(shape);
            }
          }
          else if ((isShape = "polygon".equalsIgnoreCase(n.getName())) || "banned_polygon".equalsIgnoreCase(n.getName()))
          {
            Polygon shape = parsePolygon(n);
            if (!shape.validate())
            {
              error("ZoneParser: invalid territory data : " + shape + ", zone: " + zoneDat.getString("name") + "!");
            }
            if (territory == null)
            {
View Full Code Here


   * @return boolean * @see lineage2.commons.geometry.Shape#isInside(int, int)
   */
  @Override
  public boolean isInside(int x, int y)
  {
    Shape shape;
    for (int i = 0; i < include.size(); i++)
    {
      shape = include.get(i);
      if (shape.isInside(x, y))
      {
        return !isExcluded(x, y);
      }
    }
    return false;
View Full Code Here

  {
    if ((x < min.x) || (x > max.x) || (y < min.y) || (y > max.y) || (z < min.z) || (z > max.z))
    {
      return false;
    }
    Shape shape;
    for (int i = 0; i < include.size(); i++)
    {
      shape = include.get(i);
      if (shape.isInside(x, y, z))
      {
        return !isExcluded(x, y, z);
      }
    }
    return false;
View Full Code Here

   * @param y int
   * @return boolean
   */
  public boolean isExcluded(int x, int y)
  {
    Shape shape;
    for (int i = 0; i < exclude.size(); i++)
    {
      shape = exclude.get(i);
      if (shape.isInside(x, y))
      {
        return true;
      }
    }
    return false;
View Full Code Here

   * @param z int
   * @return boolean
   */
  public boolean isExcluded(int x, int y, int z)
  {
    Shape shape;
    for (int i = 0; i < exclude.size(); i++)
    {
      shape = exclude.get(i);
      if (shape.isInside(x, y, z))
      {
        return true;
      }
    }
    return false;
View Full Code Here

    Location pos = new Location();
    List<Shape> territories = territory.getTerritories();
    loop:
    for (int i = 0; i < 100; i++)
    {
      Shape shape = territories.get(Rnd.get(territories.size()));
      pos.x = Rnd.get(shape.getXmin(), shape.getXmax());
      pos.y = Rnd.get(shape.getYmin(), shape.getYmax());
      pos.z = shape.getZmin() + ((shape.getZmax() - shape.getZmin()) / 2);
      if (territory.isInside(pos.x, pos.y))
      {
        int tempz = GeoEngine.getHeight(pos, geoIndex);
        if (shape.getZmin() != shape.getZmax())
        {
          if ((tempz < shape.getZmin()) || (tempz > shape.getZmax()))
          {
            continue;
          }
        }
        else if ((tempz < (shape.getZmin() - 200)) || (tempz > (shape.getZmin() + 200)))
        {
          continue;
        }
        pos.z = tempz;
        int geoX = (pos.x - World.MAP_MIN_X) >> 4;
View Full Code Here

   * @param collision GeoCollision
   * @param geoIndex int
   */
  public static void removeGeoCollision(GeoCollision collision, int geoIndex)
  {
    Shape shape = collision.getShape();
    byte[][] around = collision.getGeoAround();
    if (around == null)
    {
      throw new RuntimeException("Attempt to remove unitialized collision: " + collision);
    }
    int minX = (shape.getXmin() - World.MAP_MIN_X - 16) >> 4;
    int minY = (shape.getYmin() - World.MAP_MIN_Y - 16) >> 4;
    int minZ = shape.getZmin();
    int maxZ = shape.getZmax();
    short height;
    byte old_nswe;
    for (int gX = 0; gX < around.length; gX++)
    {
      for (int gY = 0; gY < around[gX].length; gY++)
View Full Code Here

   * @param collision GeoCollision
   * @param geoIndex int
   */
  public static void applyGeoCollision(GeoCollision collision, int geoIndex)
  {
    Shape shape = collision.getShape();
    if ((shape.getXmax() == shape.getYmax()) && (shape.getXmax() == 0))
    {
      throw new RuntimeException("Attempt to add incorrect collision: " + collision);
    }
    boolean isFirstTime = false;
    int minX = (shape.getXmin() - World.MAP_MIN_X - 16) >> 4;
    int maxX = ((shape.getXmax() - World.MAP_MIN_X) + 16) >> 4;
    int minY = (shape.getYmin() - World.MAP_MIN_Y - 16) >> 4;
    int maxY = ((shape.getYmax() - World.MAP_MIN_Y) + 16) >> 4;
    int minZ = shape.getZmin();
    int maxZ = shape.getZmax();
    byte[][] around = collision.getGeoAround();
    if (around == null)
    {
      isFirstTime = true;
      byte[][] cells = new byte[(maxX - minX) + 1][(maxY - minY) + 1];
      for (int gX = minX; gX <= maxX; gX++)
      {
        for (int gY = minY; gY <= maxY; gY++)
        {
          int x = (gX << 4) + World.MAP_MIN_X;
          int y = (gY << 4) + World.MAP_MIN_Y;
          loop:
          for (int ax = x; ax < (x + 16); ax++)
          {
            for (int ay = y; ay < (y + 16); ay++)
            {
              if (shape.isInside(ax, ay))
              {
                cells[gX - minX][gY - minY] = 1;
                break loop;
              }
            }
View Full Code Here

  public void onEvtDead(Creature killer)
  {
    final NpcInstance actor = getActor();
    super.onEvtDead(killer);
    actor.deleteMe();
    ThreadPoolManager.getInstance().schedule(new RunnableImpl()
    {
      @Override
      public void runImpl()
      {
        final NpcTemplate template = NpcHolder.getInstance().getTemplate(18602);
View Full Code Here

          getZone("[soi_hos_attack_attackup_5]").setActive(false);
          spawnRoom(6);
        }
      }
      else if(self.getNpcId() == Yehan)
        ThreadPoolManager.getInstance().schedule(new RunnableImpl(){
          @Override
          public void runImpl() throws Exception
          {
            spawnRoom(7);
            setReenterTime(System.currentTimeMillis());
View Full Code Here

TOP

Related Classes of lineage2.commons.geometry.Shape

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.