Package lineage2.gameserver.templates.spawn

Examples of lineage2.gameserver.templates.spawn.WalkerRouteTemplate$Route


   * @return boolean
   */
  @Override
  protected boolean thinkActive()
  {
    WalkerRouteTemplate routeTemplate = getActor().getWalkerRouteTemplate();
    if (routeTemplate == null)
    {
      return false;
    }
    boolean LINEAR = (routeTemplate.getRouteType() == RouteType.LINEAR);
    boolean CYCLE = (routeTemplate.getRouteType() == RouteType.CYCLE);
    boolean TELEPORT = (routeTemplate.getRouteType() == RouteType.TELEPORT);
    boolean RANDOM = (routeTemplate.getRouteType() == RouteType.RANDOM);
    if (routeTemplate.getIsRunning())
    {
      getActor().setRunning();
    }
    int pointsCount = routeTemplate.getPointsCount();
    if (pointsCount <= 0)
    {
      return false;
    }
    Route point = null;
    int oldIndex = _routeIndex;
    if (((_routeIndex + _direction) >= pointsCount) || ((_routeIndex + _direction) < 0))
    {
      if (LINEAR)
      {
        _direction *= -1;
        _routeIndex += _direction;
        point = routeTemplate.getPoints().get(_routeIndex);
      }
      else if (CYCLE)
      {
        _direction = 1;
        _routeIndex = 0;
        point = routeTemplate.getPoints().get(_routeIndex);
      }
      else if (TELEPORT)
      {
        _direction = 1;
        _routeIndex = 0;
        point = routeTemplate.getPoints().get(_routeIndex);
      }
      else if (RANDOM)
      {
        randomWalk();
      }
    }
    else
    {
      _routeIndex += _direction;
      point = routeTemplate.getPoints().get(_routeIndex);
    }
    Location nextLoc = point.getLoc();
    long delay = (point.getDelay() <= 0) ? routeTemplate.getDelay() : point.getDelay();
    if (_lastMove == 0)
    {
      _lastMove = System.currentTimeMillis() + delay;
      _routeIndex = oldIndex;
      return false;
View Full Code Here


   * @return boolean
   */
  @Override
  protected boolean randomWalk()
  {
    WalkerRouteTemplate routeTemplate = getActor().getWalkerRouteTemplate();
    int AI_WALK_RANGE = routeTemplate.getWalkRange();
    if ((AI_WALK_RANGE == 0) | (routeTemplate.getRouteType() == RouteType.RANDOM))
    {
      return false;
    }
    NpcInstance actor = getActor();
    if (actor == null)
View Full Code Here

        int npcId = Integer.parseInt(routeElement.attributeValue("npcId"));
        RouteType type = RouteType.valueOf(routeElement.attributeValue("type"));
        long baseDelay = Long.parseLong(routeElement.attributeValue("delay"));
        boolean isRunning = Boolean.parseBoolean(routeElement.attributeValue("isRunning"));
        int walkRange = Integer.parseInt(routeElement.attributeValue("walkRange"));
        WalkerRouteTemplate template = new WalkerRouteTemplate(npcId, baseDelay, type, isRunning, walkRange);
        for (Iterator<Element> subIterator = routeElement.elementIterator(); subIterator.hasNext();)
        {
          Element subElement = subIterator.next();
          if (subElement.getName().equalsIgnoreCase("point"))
          {
            int x = Integer.parseInt(subElement.attributeValue("x"));
            int y = Integer.parseInt(subElement.attributeValue("y"));
            int z = Integer.parseInt(subElement.attributeValue("z"));
            int h = subElement.attributeValue("h") == null ? -1 : Integer.parseInt(subElement.attributeValue("h"));
            long delay = subElement.attributeValue("delay") == null ? 0 : Long.parseLong(subElement.attributeValue("delay"));
            boolean end = (subElement.attributeValue("endPoint") != null) && Boolean.parseBoolean(routeElement.attributeValue("endPoint"));
            template.setRoute(x, y, z, h, delay, end);
          }
        }
        getHolder().addSpawn(template);
      }
    }
View Full Code Here

      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
    final Location pos = Location.findPointToStay(x, y, z, 50, 100, player.getGeoIndex());
    if (price > 0)
    {
      player.reduceAdena(price, true);
    }
    player.teleToLocation(pos);
View Full Code Here

      player.sendPacket(SystemMessage2.removeItems(item, count));
    }
    final int x = Integer.parseInt(param[0]);
    final int y = Integer.parseInt(param[1]);
    final int z = Integer.parseInt(param[2]);
    final Location pos = Location.findPointToStay(x, y, z, 20, 70, player.getGeoIndex());
    player.teleToLocation(pos);
  }
View Full Code Here

      return;
    }
    final String var = player.getVar("DCBackCoords");
    if ((var == null) || var.isEmpty())
    {
      player.teleToLocation(new Location(43768, -48232, -800), 0);
      return;
    }
    player.teleToLocation(Location.parseLoc(var), 0);
    player.unsetVar("DCBackCoords");
  }
View Full Code Here

    }
    for (Player player : World.getAroundPlayers(actor, 200, 200))
    {
      if (player != null)
      {
        player.teleToLocation(new Location(207559, 86429, -1000));
      }
    }
    return true;
  }
View Full Code Here

        }
        return new NmnRoute(this, Route, route.getName(), positions);
    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<NmnRoute> context) throws Exception {
        Route route = unmarshal(source);
        context.appendRoute(process(route));
    }
View Full Code Here

        throw new UnsupportedOperationException();
    }

    private Route createNmn(NmnRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        Route result = objectFactory.createRoute();
        result.setName(asRouteName(route.getName()));
        for (int i = startIndex; i < endIndex; i++) {
            NmnPosition position = route.getPosition(i);
            Route.Point point = objectFactory.createRoutePoint();
            point.setX(formatBigDecimal(position.getLongitude(), 7));
            point.setY(formatBigDecimal(position.getLatitude(), 7));
            point.setName(position.getDescription());
            result.getPoint().add(point);
        }
        return result;
    }
View Full Code Here

        }
        return marshaller;
    }

    public static Route unmarshal(InputStream in) throws JAXBException {
        Route result = null;
        try {
            result = (Route) newUnmarshaller().unmarshal(in);
        } catch (ClassCastException e) {
            throw new JAXBException("Parse error: " + e, e);
        }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.templates.spawn.WalkerRouteTemplate$Route

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.