Example #1
0
  private void showTeleportWindow(Player activeChar) {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    StringBuilder replyMSG = new StringBuilder("<html><title>Teleport Menu</title>");
    replyMSG.append("<body>");

    replyMSG.append("<br>");
    replyMSG.append("<center><table>");

    replyMSG.append(
        "<tr><td><button value=\"  \" action=\"bypass -h admin_tele\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"North\" action=\"bypass -h admin_gonorth\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"Up\" action=\"bypass -h admin_goup\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td></tr>");
    replyMSG.append(
        "<tr><td><button value=\"West\" action=\"bypass -h admin_gowest\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"  \" action=\"bypass -h admin_tele\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"East\" action=\"bypass -h admin_goeast\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td></tr>");
    replyMSG.append(
        "<tr><td><button value=\"  \" action=\"bypass -h admin_tele\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"South\" action=\"bypass -h admin_gosouth\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>");
    replyMSG.append(
        "<td><button value=\"Down\" action=\"bypass -h admin_godown\" width=70 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td></tr>");

    replyMSG.append("</table></center>");
    replyMSG.append("</body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    UndergroundColiseumEvent coliseumEvent =
        EventHolder.getInstance().getEvent(EventType.MAIN_EVENT, _coliseumId);

    if (command.equals("register")) {
      Party party = player.getParty();
      if (party == null) showChatWindow(player, "events/kerthang_manager008.htm");
      else if (party.getPartyLeader() != player)
        showChatWindow(player, "events/kerthang_manager004.htm");
      else
        for (Player $player : party)
          if ($player.getLevel() < coliseumEvent.getMinLevel()
              || $player.getLevel() > coliseumEvent.getMaxLevel()) {
            showChatWindow(player, "events/kerthang_manager011.htm", "%name%", $player.getName());
            return;
          }
    } else if (command.equals("viewTeams")) {

      List<Player> reg = coliseumEvent.getRegisteredPlayers();

      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("events/kerthang_manager003.htm");
      for (int i = 0; i < 5; i++) {
        Player $player = CollectionUtils.safeGet(reg, i);

        msg.replace("%team" + i + "%", $player == null ? StringUtils.EMPTY : $player.getName());
      }

      player.sendPacket(msg);
    } else super.onBypassFeedback(player, command);
  }
Example #3
0
  private static boolean ShowQuestState(QuestState qs, Player activeChar) {
    Map<String, String> vars = qs.getVars();
    int id = qs.getQuest().getQuestIntId();
    String char_name = qs.getPlayer().getName();

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    StringBuilder replyMSG = new StringBuilder("<html><body>");
    replyMSG.append(fmtHEAD.sprintf(new Object[] {qs.getQuest().getClass().getSimpleName(), id}));
    replyMSG.append("<table width=260>");
    replyMSG.append(fmtRow.sprintf(new Object[] {"PLAYER: ", char_name, ""}));
    replyMSG.append(
        fmtRow.sprintf(
            new Object[] {
              "STATE: ",
              qs.getStateName(),
              fmtSetButton.sprintf(new Object[] {id, "STATE", "$new_val", char_name, ""})
            }));
    for (String key : vars.keySet())
      if (!key.equalsIgnoreCase("<state>"))
        replyMSG.append(
            fmtRow.sprintf(
                new Object[] {
                  key + ": ",
                  vars.get(key),
                  fmtSetButton.sprintf(new Object[] {id, "VAR", key, "$new_val", char_name})
                }));
    replyMSG.append(
        fmtRow.sprintf(
            new Object[] {
              "<edit var=\"new_name\" width=50 height=12>",
              "~new var~",
              fmtSetButton.sprintf(new Object[] {id, "VAR", "$new_name", "$new_val", char_name})
            }));
    replyMSG.append("</table>");
    replyMSG.append(fmtFOOT.sprintf(new Object[] {id, char_name, char_name}));
    replyMSG.append("</body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);
    vars.clear();
    return true;
  }
Example #4
0
  private static boolean ShowQuestList(Player targetChar, Player activeChar) {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    StringBuilder replyMSG = new StringBuilder("<html><body><table width=260>");
    for (QuestState qs : targetChar.getAllQuestsStates())
      if (qs != null && qs.getQuest().getQuestIntId() != 255)
        replyMSG.append(
            fmtListRow.sprintf(
                new Object[] {
                  qs.getQuest().getQuestIntId(),
                  targetChar.getName(),
                  qs.getQuest().getName(),
                  qs.getStateName()
                }));
    replyMSG.append(fmtListNew.sprintf(new Object[] {targetChar.getName()}));
    replyMSG.append("</table></body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);

    return true;
  }
Example #5
0
  @Override
  public boolean useUserCommand(int id, Player player) {
    if (!player.isClanLeader()) {
      player.sendPacket(SystemMsg.ONLY_THE_CLAN_LEADER_MAY_ISSUE_COMMANDS);
      return false;
    }

    Castle castle = player.getCastle();
    if (castle == null) return false;

    if (castle.getSiegeEvent().isInProgress())
      if (!player.isNoble()) {
        player.sendPacket(
            SystemMsg
                .ONLY_A_CLAN_LEADER_THAT_IS_A_NOBLESSE_CAN_VIEW_THE_SIEGE_WAR_STATUS_WINDOW_DURING_A_SIEGE_WAR);
        return false;
      }

    NpcHtmlMessage msg = new NpcHtmlMessage(5);
    msg.setFile("siege_status.htm");
    msg.replace("%name%", player.getName());
    msg.replace("%kills%", String.valueOf(0));
    msg.replace("%deaths%", String.valueOf(0));
    msg.replace("%type%", String.valueOf(0));

    player.sendPacket(msg);
    return true;
  }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    if (player.getEnchantScroll() != null) {
      Log.add(
          "Player "
              + player.getName()
              + " trying to use enchant exploit[Warehouse], ban this player!",
          "illegal-actions");
      player.setEnchantScroll(null);
      return;
    }

    if (command.startsWith("WithdrawP")) {
      int val = Integer.parseInt(command.substring(10));
      if (val == 99) {
        NpcHtmlMessage html = new NpcHtmlMessage(player, this);
        html.setFile("warehouse/personal.htm");
        html.replace("%npcname%", getName());
        player.sendPacket(html);
      } else WarehouseFunctions.showRetrieveWindow(player, val);
    } else if (command.equals("DepositP")) WarehouseFunctions.showDepositWindow(player);
    else if (command.startsWith("WithdrawC")) {
      int val = Integer.parseInt(command.substring(10));
      if (val == 99) {
        NpcHtmlMessage html = new NpcHtmlMessage(player, this);
        html.setFile("warehouse/clan.htm");
        html.replace("%npcname%", getName());
        player.sendPacket(html);
      } else WarehouseFunctions.showWithdrawWindowClan(player, val);
    } else if (command.equals("DepositC")) WarehouseFunctions.showDepositWindowClan(player);
    else super.onBypassFeedback(player, command);
  }
Example #7
0
  private void showTeleportCharWindow(Player activeChar) {
    GameObject target = activeChar.getTarget();
    Player player = null;
    if (target.isPlayer()) player = (Player) target;
    else {
      activeChar.sendPacket(Msg.INVALID_TARGET);
      return;
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    StringBuilder replyMSG = new StringBuilder("<html><title>Teleport Character</title>");
    replyMSG.append("<body>");
    replyMSG.append("The character you will teleport is " + player.getName() + ".");
    replyMSG.append("<br>");

    replyMSG.append("Co-ordinate x");
    replyMSG.append("<edit var=\"char_cord_x\" width=110>");
    replyMSG.append("Co-ordinate y");
    replyMSG.append("<edit var=\"char_cord_y\" width=110>");
    replyMSG.append("Co-ordinate z");
    replyMSG.append("<edit var=\"char_cord_z\" width=110>");
    replyMSG.append(
        "<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
    replyMSG.append(
        "<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character "
            + activeChar.getX()
            + " "
            + activeChar.getY()
            + " "
            + activeChar.getZ()
            + "\" width=115 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\">");
    replyMSG.append(
        "<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></center>");
    replyMSG.append("</body></html>");

    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
 @Override
 public void showChatWindow(Player player, int val, Object... arg) {
   if (!validateCondition(player)) {
     NpcHtmlMessage html = new NpcHtmlMessage(player, this);
     html.setFile("wyvern/lord_only.htm");
     html.replace("%npcname%", "Wyvern Manager " + getName());
     player.sendPacket(html);
     player.sendActionFailed();
     return;
   }
   NpcHtmlMessage html = new NpcHtmlMessage(player, this);
   html.setFile("wyvern/lord_here.htm");
   html.replace("%Char_name%", String.valueOf(player.getName()));
   html.replace("%npcname%", "Wyvern Manager " + getName());
   player.sendPacket(html);
   player.sendActionFailed();
 }
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) return;

    StringTokenizer st = new StringTokenizer(command, " ");
    String actualCommand = st.nextToken();
    boolean condition = validateCondition(player);

    if (actualCommand.equalsIgnoreCase("RideHelp")) {
      NpcHtmlMessage html = new NpcHtmlMessage(player, this);
      html.setFile("wyvern/help_ride.htm");
      html.replace("%npcname%", "Wyvern Manager " + getName());
      player.sendPacket(html);
      player.sendActionFailed();
    }
    if (condition) {
      if (actualCommand.equalsIgnoreCase("RideWyvern") && player.isClanLeader())
        if (!player.isRiding() || !PetDataTable.isStrider(player.getMountNpcId())) {
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/not_ready.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        } else if (player.getInventory().getItemByItemId(1460) == null
            || player.getInventory().getItemByItemId(1460).getCount() < 25) {
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/havenot_cry.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        } else if (player.getInventory().destroyItemByItemId(1460, 25L)) {
          player.setMount(PetDataTable.WYVERN_ID, player.getMountObjId(), player.getMountLevel());
          NpcHtmlMessage html = new NpcHtmlMessage(player, this);
          html.setFile("wyvern/after_ride.htm");
          html.replace("%npcname%", "Wyvern Manager " + getName());
          player.sendPacket(html);
        }
    } else super.onBypassFeedback(player, command);
  }