BaseBBSManager.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. 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. * @param acha
  50. */
  51. protected void send1001(String html, L2PcInstance acha)
  52. {
  53. if (html.length() < 8180)
  54. {
  55. acha.sendPacket(new ShowBoard(html, "1001"));
  56. }
  57. }
  58. /**
  59. * @param acha
  60. */
  61. protected void send1002(L2PcInstance acha)
  62. {
  63. send1002(acha, " ", " ", "0");
  64. }
  65. /**
  66. * @param activeChar
  67. * @param string
  68. * @param string2
  69. * @param string3
  70. */
  71. protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
  72. {
  73. List<String> _arg = new FastList<String>();
  74. _arg.add("0");
  75. _arg.add("0");
  76. _arg.add("0");
  77. _arg.add("0");
  78. _arg.add("0");
  79. _arg.add("0");
  80. _arg.add(activeChar.getName());
  81. _arg.add(Integer.toString(activeChar.getObjectId()));
  82. _arg.add(activeChar.getAccountName());
  83. _arg.add("9");
  84. _arg.add(string2);
  85. _arg.add(string2);
  86. _arg.add(string);
  87. _arg.add(string3);
  88. _arg.add(string3);
  89. _arg.add("0");
  90. _arg.add("0");
  91. activeChar.sendPacket(new ShowBoard(_arg));
  92. }
  93. }