Ejemplo n.º 1
0
  public void viewPetition(L2PcInstance activeChar, int petitionId) {
    if (!activeChar.isGM()) return;

    if (!isValidPetition(petitionId)) return;

    Petition currPetition = getPendingPetitions().get(petitionId);
    TextBuilder htmlContent = new TextBuilder("<html><body>");
    SimpleDateFormat dateFormat = new SimpleDateFormat("EEE dd MMM HH:mm z");

    htmlContent
        .append("<center><br><font color=\"LEVEL\">Petition #")
        .append(currPetition.getId())
        .append("</font><br1>");
    htmlContent.append("<img src=\"L2UI.SquareGray\" width=\"200\" height=\"1\"></center><br>");
    htmlContent
        .append("Submit Time: ")
        .append(dateFormat.format(new Date(currPetition.getSubmitTime())))
        .append("<br1>");
    htmlContent
        .append("Petitioner: ")
        .append(currPetition.getPetitioner().getName())
        .append("<br1>");
    htmlContent
        .append("Petition Type: ")
        .append(currPetition.getTypeAsString())
        .append("<br>")
        .append(currPetition.getContent())
        .append("<br>");
    htmlContent
        .append("<center><button value=\"Accept\" action=\"bypass -h admin_accept_petition ")
        .append(currPetition.getId())
        .append("\"")
        .append("width=\"50\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br1>");
    htmlContent
        .append("<button value=\"Reject\" action=\"bypass -h admin_reject_petition ")
        .append(currPetition.getId())
        .append("\" ")
        .append("width=\"50\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>");
    htmlContent.append(
        "<button value=\"Back\" action=\"bypass -h admin_view_petitions\" width=\"40\" height=\"15\" back=\"sek.cbui94\" "
            + "fore=\"sek.cbui92\"></center>");
    htmlContent.append("</body></html>");

    NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
    htmlMsg.setHtml(htmlContent.toString());
    activeChar.sendPacket(htmlMsg);
  }
Ejemplo n.º 2
0
  public void sendPendingPetitionList(L2PcInstance activeChar) {
    TextBuilder htmlContent =
        new TextBuilder(
            "<html><body>"
                + "<center><font color=\"LEVEL\">Current Petitions</font><br><table width=\"300\">");
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd MMM HH:mm z");

    if (getPendingPetitionCount() == 0)
      htmlContent.append(
          "<tr><td colspan=\"4\">There are no currently pending petitions.</td></tr>");
    else
      htmlContent.append(
          "<tr><td></td><td><font color=\"999999\">Petitioner</font></td>"
              + "<td><font color=\"999999\">Petition Type</font></td><td><font color=\"999999\">Submitted</font></td></tr>");

    for (Petition currPetition : getPendingPetitions().values()) {
      if (currPetition == null) continue;

      htmlContent.append("<tr><td>");

      if (currPetition.getState() != PetitionState.In_Process)
        htmlContent
            .append("<button value=\"View\" action=\"bypass -h admin_view_petition ")
            .append(currPetition.getId())
            .append("\" ")
            .append("width=\"40\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\">");
      else htmlContent.append("<font color=\"999999\">In Process</font>");

      htmlContent
          .append("</td><td>")
          .append(currPetition.getPetitioner().getName())
          .append("</td><td>")
          .append(currPetition.getTypeAsString())
          .append("</td><td>")
          .append(dateFormat.format(new Date(currPetition.getSubmitTime())))
          .append("</td></tr>");
    }

    htmlContent.append(
        "</table><br><button value=\"Refresh\" action=\"bypass -h admin_view_petitions\" width=\"50\" "
            + "height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"><br><button value=\"Back\" action=\"bypass -h admin_admin\" "
            + "width=\"40\" height=\"15\" back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>");

    NpcHtmlMessage htmlMsg = new NpcHtmlMessage(0);
    htmlMsg.setHtml(htmlContent.toString());
    activeChar.sendPacket(htmlMsg);
  }