BaseBBSManager.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (C) 2004-2014 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.communitybbs.Manager;
  20. import java.util.List;
  21. import javolution.util.FastList;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
  24. public abstract class BaseBBSManager
  25. {
  26. public abstract void parsecmd(String command, L2PcInstance activeChar);
  27. public abstract void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar);
  28. protected void separateAndSend(String html, L2PcInstance acha)
  29. {
  30. if (html == null)
  31. {
  32. return;
  33. }
  34. if (html.length() < 4096)
  35. {
  36. acha.sendPacket(new ShowBoard(html, "101"));
  37. acha.sendPacket(new ShowBoard(null, "102"));
  38. acha.sendPacket(new ShowBoard(null, "103"));
  39. }
  40. else if (html.length() < 8192)
  41. {
  42. acha.sendPacket(new ShowBoard(html.substring(0, 4096), "101"));
  43. acha.sendPacket(new ShowBoard(html.substring(4096), "102"));
  44. acha.sendPacket(new ShowBoard(null, "103"));
  45. }
  46. else if (html.length() < 16384)
  47. {
  48. acha.sendPacket(new ShowBoard(html.substring(0, 4096), "101"));
  49. acha.sendPacket(new ShowBoard(html.substring(4096, 8192), "102"));
  50. acha.sendPacket(new ShowBoard(html.substring(8192), "103"));
  51. }
  52. }
  53. /**
  54. * @param html
  55. * @param acha
  56. */
  57. protected void send1001(String html, L2PcInstance acha)
  58. {
  59. if (html.length() < 8192)
  60. {
  61. acha.sendPacket(new ShowBoard(html, "1001"));
  62. }
  63. }
  64. /**
  65. * @param acha
  66. */
  67. protected void send1002(L2PcInstance acha)
  68. {
  69. send1002(acha, " ", " ", "0");
  70. }
  71. /**
  72. * @param activeChar
  73. * @param string
  74. * @param string2
  75. * @param string3
  76. */
  77. protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
  78. {
  79. List<String> _arg = new FastList<>();
  80. _arg.add("0");
  81. _arg.add("0");
  82. _arg.add("0");
  83. _arg.add("0");
  84. _arg.add("0");
  85. _arg.add("0");
  86. _arg.add(activeChar.getName());
  87. _arg.add(Integer.toString(activeChar.getObjectId()));
  88. _arg.add(activeChar.getAccountName());
  89. _arg.add("9");
  90. _arg.add(string2); // subject?
  91. _arg.add(string2); // subject?
  92. _arg.add(string); // text
  93. _arg.add(string3); // date?
  94. _arg.add(string3); // date?
  95. _arg.add("0");
  96. _arg.add("0");
  97. activeChar.sendPacket(new ShowBoard(_arg));
  98. }
  99. }