BaseBBSManager.java 2.9 KB

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