2
0

RequestShowBoard.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.network.clientpackets;
  16. import com.l2jserver.Config;
  17. import com.l2jserver.gameserver.communitybbs.CommunityBoard;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.SystemMessageId;
  20. import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
  21. import com.l2jserver.gameserver.network.communityserver.writepackets.RequestShowCommunityBoard;
  22. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  23. /**
  24. * This class ...
  25. *
  26. * @version $Revision: 1.2.4.2 $ $Date: 2005/03/27 15:29:30 $
  27. */
  28. public final class RequestShowBoard extends L2GameClientPacket
  29. {
  30. private static final String _C__57_REQUESTSHOWBOARD = "[C] 57 RequestShowBoard";
  31. @SuppressWarnings("unused")
  32. private int _unknown;
  33. /**
  34. * packet type id 0x57
  35. *
  36. * sample
  37. *
  38. * 57
  39. * 01 00 00 00 // unknown (always 1?)
  40. *
  41. * format: cd
  42. * @param decrypt
  43. */
  44. @Override
  45. protected final void readImpl()
  46. {
  47. _unknown = readD();
  48. }
  49. @Override
  50. protected void runImpl()
  51. {
  52. if (Config.ENABLE_COMMUNITY_BOARD)
  53. {
  54. L2PcInstance activeChar = getClient().getActiveChar();
  55. if (activeChar == null)
  56. return;
  57. if (CommunityServerThread.getInstance().isAuthed())
  58. CommunityServerThread.getInstance().sendPacket(new RequestShowCommunityBoard(activeChar.getObjectId(), "_bbshome"), true);
  59. else
  60. activeChar.sendPacket(new SystemMessage(SystemMessageId.CB_OFFLINE));
  61. }
  62. else
  63. CommunityBoard.getInstance().handleCommands(getClient(), Config.BBS_DEFAULT);
  64. }
  65. @Override
  66. public final String getType()
  67. {
  68. return _C__57_REQUESTSHOWBOARD;
  69. }
  70. @Override
  71. protected boolean triggersOnActionRequest()
  72. {
  73. return false;
  74. }
  75. }