BaseBBSManager.java 2.8 KB

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