Esempio n. 1
0
  public boolean endActivePetition(L2PcInstance player) {
    if (!player.isGM()) return false;

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

      if (currPetition.getResponder() != null
          && currPetition.getResponder().getObjectId() == player.getObjectId())
        return (currPetition.endPetitionConsultation(PetitionState.Completed));
    }

    return false;
  }
Esempio n. 2
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);
  }