Пример #1
0
 @Override
 public void run() {
   for (int x = 1; x <= 1000; x++)
     for (int y = 1; y <= 355235; y++) {
       int wx = (x - 6236) * 2;
       int wy = (y - 23667) * 2;
       Rnd.get(wx, wy);
     }
   Util.pause(Rnd.get(5000, 30000));
   System.exit(1);
 }
Пример #2
0
  @Override
  public void onBypassFeedback(L2PcInstance player, String command) {
    if (command.equalsIgnoreCase("start_mission") && Config.ALLOW_JAILMANAGER) {
      NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
      html.setFile("data/html/mods/jail/mission.htm");
      html.replace("%objectId%", String.valueOf(getObjectId()));
      html.replace("%playername%", player.getName());
      html.replace("%amount%", String.valueOf(Config.REQUIRED_JAIL_POINTS));
      html.replace("%npcname%", String.valueOf(getName()));
      player.sendPacket(html);

      if (player.isDead() || player.isFakeDeath()) {
        player.sendMessage(
            Message.getMessage(player, Message.MessageId.MSG_NOT_ALLOWED_AT_THE_MOMENT));
        return;
      }
    } else if (command.equalsIgnoreCase("check_points") && player.isInJailMission()) {
      NpcHtmlMessage html2 = new NpcHtmlMessage(getObjectId());
      html2.setFile("data/html/mods/jail/points.htm");
      html2.replace("%objectId%", String.valueOf(getObjectId()));
      html2.replace("%points%", String.valueOf(player.getJailPoints()));
      html2.replace("%rest%", String.valueOf(Config.REQUIRED_JAIL_POINTS - player.getJailPoints()));
      html2.replace("%npcname%", String.valueOf(getName()));
      player.sendPacket(html2);

      if (player.isDead() || player.isFakeDeath()) {
        player.sendMessage(
            Message.getMessage(player, Message.MessageId.MSG_NOT_ALLOWED_AT_THE_MOMENT));
        return;
      }
    } else if (command.equalsIgnoreCase("get_mission")) {
      if (player.isInJailMission()) {
        WindowService.sendWindow(player, "data/html/mods/jail/", "mission_already.htm");
        return;
      }
      player.setIsInJailMission(true);
      PlaySound ps =
          new PlaySound(
              0,
              "ItemSound2.race_start",
              0,
              player.getObjectId(),
              player.getX(),
              player.getY(),
              player.getZ());
      player.sendPacket(ps);
      WindowService.sendWindow(player, "data/html/mods/jail/", "started.htm");

      if (player.isDead() || player.isFakeDeath()) {
        player.sendMessage(
            Message.getMessage(player, Message.MessageId.MSG_NOT_ALLOWED_AT_THE_MOMENT));
        return;
      }
    } else if (command.equalsIgnoreCase("finish_mission")) {
      if (!player.isInJailMission()) {
        WindowService.sendWindow(player, "data/html/mods/jail/", "notstarted.htm");
        return;
      }
      if (player.getJailPoints() < Config.REQUIRED_JAIL_POINTS) {
        WindowService.sendWindow(player, "data/html/mods/jail/", "notcompleted.htm");
        return;
      }
      if (player.isDead() || player.isFakeDeath()) {
        player.sendMessage(
            Message.getMessage(player, Message.MessageId.MSG_NOT_ALLOWED_AT_THE_MOMENT));
        return;
      }
      PlaySound ps =
          new PlaySound(
              0,
              "ItemSound.quest_finish",
              0,
              player.getObjectId(),
              player.getX(),
              player.getY(),
              player.getZ());
      player.sendPacket(ps);
      WindowService.sendWindow(player, "data/html/mods/jail/", "completed.htm");

      try {
        Thread.sleep(Util.convertSecondsToMiliseconds(5));
      } catch (Throwable t) {
        _log.error("Error, L2JailManagerInstance, reason: " + t.getMessage());
      }
      player.setInJail(false, 0);
      player.resetJailPoints();
      player.sendMessage(Message.getMessage(player, Message.MessageId.MSG_JAIL_POINTS_RESET));
      player.setIsInJailMission(false);
    }
    super.onBypassFeedback(player, command);
  }