public static void teleToLocation(Player player, Location loc, Reflection ref) {
    if (player.isTeleporting() || player.isDeleted()) return;
    player.setIsTeleporting(true);

    player.setTarget(null);
    player.stopMove();

    if (player.isInBoat()) player.setBoat(null);

    player.breakFakeDeath();

    player.sendPacket(new TeleportToLocation(player, loc));

    player.decayMe();

    player.setLoc(loc);

    if (ref == null) player.setReflection(ReflectionManager.DEFAULT);

    // Нужно при телепорте с более высокой точки на более низкую, иначе наносится вред от "падения"
    player.setLastClientPosition(null);
    player.setLastServerPosition(null);

    player.sendPacket(new ExTeleportToLocationActivate(player, loc));
  }
Exemplo n.º 2
0
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    JumpWay way = activeChar.getCurrentJumpWay();
    if (way == null) {
      activeChar.onJumpingBreak();
      return;
    }

    JumpPoint point = way.getJumpPoint(_nextWayId);
    if (point == null) {
      activeChar.onJumpingBreak();
      return;
    }

    Location destLoc = point.getLocation();
    activeChar.broadcastPacketToOthers(new ExFlyMoveBroadcast(activeChar, destLoc));
    activeChar.setLoc(destLoc);

    JumpTrack track = activeChar.getCurrentJumpTrack();
    if (track == null) {
      activeChar.onJumpingBreak();
      return;
    }

    JumpWay nextWay = track.getWay(_nextWayId);
    if (nextWay == null) {
      activeChar.onJumpingBreak();
      return;
    }

    activeChar.sendPacket(
        new ExFlyMove(activeChar.getObjectId(), nextWay.getPoints(), track.getId()));
    activeChar.setCurrentJumpWay(nextWay);
  }