예제 #1
0
  public void tele() {
    Player player = getSelf();
    NpcInstance npc = getNpc();

    if (player != null && npc != null)
      if (player.getLevel() < 75) show("teleporter/" + npc.getNpcId() + "-4.htm", player);
      else if (player.getAdena() >= 150000) {
        player.reduceAdena(150000, true);
        player.teleToLocation(-149406, 255247, -80);
      } else show("teleporter/" + npc.getNpcId() + "-2.htm", player);
  }
예제 #2
0
  public void ride(String[] args) {
    Player player = getSelf();
    NpcInstance npc = getNpc();
    if (player == null || npc == null) return;

    boolean ru = player.isLangRus();
    if (args.length != 3) {
      show(ru ? "Некорректные данные" : "Incorrect input", player, npc);
      return;
    }

    if (!NpcInstance.canBypassCheck(player, npc)) return;

    if (player.getActiveWeaponFlagAttachment() != null) {
      player.sendPacket(Msg.YOU_CANNOT_MOUNT_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS);
      return;
    }

    if (player.getTransformation() != 0) {
      show(
          ru
              ? "Вы не можете взять пета в прокат, пока находитесь в режиме трансформации."
              : "Can't ride while in transformation mode.",
          player,
          npc);
      return;
    }

    if (player.getSummonList().size() > 0 || player.isMounted()) {
      player.sendPacket(Msg.YOU_ALREADY_HAVE_A_PET);
      return;
    }

    int npc_id;

    switch (Integer.parseInt(args[0])) {
      case 1:
        npc_id = PetDataTable.WYVERN_ID;
        break;
      case 2:
        npc_id = PetDataTable.STRIDER_WIND_ID;
        break;
      case 3:
        npc_id = PetDataTable.WGREAT_WOLF_ID;
        break;
      case 4:
        npc_id = PetDataTable.WFENRIR_WOLF_ID;
        break;
      default:
        show(ru ? "У меня нет таких питомцев!" : "Unknown pet.", player, npc);
        return;
    }

    if ((npc_id == PetDataTable.WYVERN_ID || npc_id == PetDataTable.STRIDER_WIND_ID)
        && !SiegeUtils.getCanRide()) {
      show(
          ru
              ? "Прокат виверн/страйдеров не работает во время осады."
              : "Can't ride wyvern/strider while Siege in progress.",
          player,
          npc);
      return;
    }

    Integer time = Integer.parseInt(args[1]);
    Long price = Long.parseLong(args[2]);

    if (time > 1800) {
      show(ru ? "Слишком большое время." : "Too long time to ride.", player, npc);
      return;
    }

    if (player.getAdena() < price) {
      player.sendPacket(Msg.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
      return;
    }

    player.reduceAdena(price, true);

    doLimitedRide(player, npc_id, time);
  }