RegionBoard.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 com.l2jserver.communityserver.communityboard.boards;
  16. import java.text.DateFormat;
  17. import java.util.Date;
  18. import javolution.text.TextBuilder;
  19. import com.l2jserver.communityserver.cache.HtmCache;
  20. import com.l2jserver.communityserver.communityboard.CommunityBoard;
  21. import com.l2jserver.communityserver.communityboard.CommunityBoardManager;
  22. import com.l2jserver.communityserver.model.L2Castle;
  23. import com.l2jserver.communityserver.model.L2Clan;
  24. public final class RegionBoard extends CommunityBoard
  25. {
  26. public RegionBoard(final CommunityBoardManager mgr)
  27. {
  28. super(mgr);
  29. }
  30. @Override
  31. public void parseCmd(final int playerObjId, final String cmd)
  32. {
  33. // this board is disabled on retail, and its not fully implemented here, so for now it is disabled
  34. super.send(playerObjId, "");
  35. /*if (cmd.equals("_bbsloc"))
  36. showMainPage(playerObjId);
  37. else
  38. showCastlePage(playerObjId, super.getCommunityBoardManager().getCastle(Integer.valueOf(cmd.split(";")[1])));*/
  39. }
  40. public final void showMainPage(final int playerObjId)
  41. {
  42. String content = HtmCache.getInstance().getHtm("data/staticfiles/html/castlelist.htm");
  43. TextBuilder cList = new TextBuilder();
  44. for (L2Castle c : super.getCommunityBoardManager().getCastleList())
  45. {
  46. L2Clan cl = super.getCommunityBoardManager().getClan(c.getOwnerId());
  47. String cName = "NPC Clan";
  48. String aName = "";
  49. if (cl != null)
  50. {
  51. cName = cl.getName();
  52. aName = cl.getAllianceName();
  53. }
  54. cList.append("<table border=0 cellspacing=0 cellpadding=5 width=750>");
  55. cList.append("<tr>");
  56. cList.append("<td FIXWIDTH=5></td>");
  57. cList.append("<td FIXWIDTH=150><a action=\"bypass _bbsloc;" + c.getId() + "\">&^" + c.getId() + ";</a></td>");
  58. cList.append("<td FIXWIDTH=155>" + cName + "</td>");
  59. cList.append("<td FIXWIDTH=155>" + aName + "</td>");
  60. cList.append("<td FIXWIDTH=140 align=center>" + c.getTax() + "</td>");
  61. cList.append("<td FIXWIDTH=140 align=center>" + c.getTax() + "</td>");
  62. cList.append("<td FIXWIDTH=5></td>");
  63. cList.append("</tr>");
  64. cList.append("</table>");
  65. cList.append("<img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\">");
  66. }
  67. content = content.replaceAll("%castleList%", cList.toString());
  68. super.send(playerObjId, content);
  69. }
  70. public final void showCastlePage(final int playerObjId, L2Castle castle)
  71. {
  72. String content = HtmCache.getInstance().getHtm("data/staticfiles/html/castle.htm");
  73. L2Clan cl = super.getCommunityBoardManager().getClan(castle.getOwnerId());
  74. content = content.replaceAll("%castleId%", String.valueOf(castle.getId()));
  75. content = content.replaceAll("%siegeDate%", DateFormat.getInstance().format(new Date(castle.getSiegeDate())));
  76. content = content.replaceAll("%tax%", String.valueOf(castle.getTax()));
  77. int clanId = 0;
  78. String clanName = "NPC Clan";
  79. String clanLord = "NPC";
  80. String clanAlly = "none";
  81. if (cl != null)
  82. {
  83. clanId = cl.getClanId();
  84. clanName = cl.getName();
  85. clanLord = cl.getLordName();
  86. clanAlly = cl.getAllianceName();
  87. }
  88. content = content.replaceAll("%clanid%", String.valueOf(clanId));
  89. content = content.replaceAll("%lord%", clanLord);
  90. content = content.replaceAll("%clanName%", clanName);
  91. content = content.replaceAll("%allyName%", clanAlly);
  92. super.send(playerObjId, content);
  93. }
  94. @Override
  95. public final void parseWrite(final int playerObjId, final String ar1, final String ar2, final String ar3, final String ar4, final String ar5)
  96. {
  97. }
  98. }