2
0

BaseBBSManager.java 2.9 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.gameserver.communitybbs.Manager;
  16. import java.util.List;
  17. import javolution.util.FastList;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.serverpackets.ShowBoard;
  20. public abstract class BaseBBSManager
  21. {
  22. public abstract void parsecmd(String command, L2PcInstance activeChar);
  23. public abstract void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar);
  24. protected void separateAndSend(String html, L2PcInstance acha)
  25. {
  26. if (html == null)
  27. {
  28. return;
  29. }
  30. if (html.length() < 4090)
  31. {
  32. acha.sendPacket(new ShowBoard(html, "101"));
  33. acha.sendPacket(new ShowBoard(null, "102"));
  34. acha.sendPacket(new ShowBoard(null, "103"));
  35. }
  36. else if (html.length() < 8180)
  37. {
  38. acha.sendPacket(new ShowBoard(html.substring(0, 4090), "101"));
  39. acha.sendPacket(new ShowBoard(html.substring(4090, html.length()), "102"));
  40. acha.sendPacket(new ShowBoard(null, "103"));
  41. }
  42. else if (html.length() < 12270)
  43. {
  44. acha.sendPacket(new ShowBoard(html.substring(0, 4090), "101"));
  45. acha.sendPacket(new ShowBoard(html.substring(4090, 8180), "102"));
  46. acha.sendPacket(new ShowBoard(html.substring(8180, html.length()), "103"));
  47. }
  48. }
  49. /**
  50. * @param html
  51. * @param acha
  52. */
  53. protected void send1001(String html, L2PcInstance acha)
  54. {
  55. if (html.length() < 8180)
  56. {
  57. acha.sendPacket(new ShowBoard(html, "1001"));
  58. }
  59. }
  60. /**
  61. * @param acha
  62. */
  63. protected void send1002(L2PcInstance acha)
  64. {
  65. send1002(acha, " ", " ", "0");
  66. }
  67. /**
  68. * @param activeChar
  69. * @param string
  70. * @param string2
  71. * @param string3
  72. */
  73. protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
  74. {
  75. List<String> _arg = new FastList<>();
  76. _arg.add("0");
  77. _arg.add("0");
  78. _arg.add("0");
  79. _arg.add("0");
  80. _arg.add("0");
  81. _arg.add("0");
  82. _arg.add(activeChar.getName());
  83. _arg.add(Integer.toString(activeChar.getObjectId()));
  84. _arg.add(activeChar.getAccountName());
  85. _arg.add("9");
  86. _arg.add(string2);
  87. _arg.add(string2);
  88. _arg.add(string);
  89. _arg.add(string3);
  90. _arg.add(string3);
  91. _arg.add("0");
  92. _arg.add("0");
  93. activeChar.sendPacket(new ShowBoard(_arg));
  94. }
  95. }