ClanPenalty.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package net.sf.l2j.gameserver.handler.usercommandhandlers;
  16. import javolution.text.TextBuilder;
  17. import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
  20. /**
  21. * Support for clan penalty user command.
  22. * @author Tempy
  23. */
  24. public class ClanPenalty implements IUserCommandHandler
  25. {
  26. private static final int[] COMMAND_IDS =
  27. {
  28. 100
  29. };
  30. /**
  31. *
  32. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
  33. */
  34. public boolean useUserCommand(int id, L2PcInstance activeChar)
  35. {
  36. if (id != COMMAND_IDS[0])
  37. return false;
  38. String penaltyStr = "No current penalties in effect.";
  39. TextBuilder htmlContent = new TextBuilder("<html><body>");
  40. htmlContent.append("<center><table width=\"270\" border=\"0\" bgcolor=\"111111\">");
  41. htmlContent.append("<tr><td width=\"170\">Penalty</td>");
  42. htmlContent.append("<td width=\"100\" align=\"center\">Expiration Date</td></tr>");
  43. htmlContent.append("</table><table width=\"270\" border=\"0\">");
  44. htmlContent.append("<tr><td>" + penaltyStr + "</td></tr>");
  45. htmlContent.append("</table></center>");
  46. htmlContent.append("</body></html>");
  47. NpcHtmlMessage penaltyHtml = new NpcHtmlMessage(0);
  48. penaltyHtml.setHtml(htmlContent.toString());
  49. activeChar.sendPacket(penaltyHtml);
  50. return true;
  51. }
  52. /**
  53. *
  54. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
  55. */
  56. public int[] getUserCommandList()
  57. {
  58. return COMMAND_IDS;
  59. }
  60. }