public boolean isPetitionInProcess() { for (Petition currPetition : getPendingPetitions().values()) { if (currPetition == null) continue; if (currPetition.getState() == PetitionState.In_Process) return true; } return false; }
public boolean isPlayerInConsultation(L2PcInstance player) { if (player != null) for (Petition currPetition : getPendingPetitions().values()) { if (currPetition == null) continue; if (currPetition.getState() != PetitionState.In_Process) continue; if ((currPetition.getPetitioner() != null && currPetition.getPetitioner().getObjectId() == player.getObjectId()) || (currPetition.getResponder() != null && currPetition.getResponder().getObjectId() == player.getObjectId())) return true; } return false; }
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); }
public boolean isPetitionInProcess(int petitionId) { if (!isValidPetition(petitionId)) return false; Petition currPetition = getPendingPetitions().get(petitionId); return (currPetition.getState() == PetitionState.In_Process); }