RequestPartyMatchConfig.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.gameserver.model.PartyMatchRoom;
  17. import com.l2jserver.gameserver.model.PartyMatchRoomList;
  18. import com.l2jserver.gameserver.model.PartyMatchWaitingList;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.network.SystemMessageId;
  21. import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
  22. import com.l2jserver.gameserver.network.serverpackets.ExPartyRoomMember;
  23. import com.l2jserver.gameserver.network.serverpackets.ListPartyWating;
  24. import com.l2jserver.gameserver.network.serverpackets.PartyMatchDetail;
  25. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  26. /**
  27. * This class ...
  28. *
  29. * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:29:30 $
  30. */
  31. public final class RequestPartyMatchConfig extends L2GameClientPacket
  32. {
  33. private static final String _C__7F_REQUESTPARTYMATCHCONFIG = "[C] 7F RequestPartyMatchConfig";
  34. private int _auto, _loc, _lvl;
  35. @Override
  36. protected void readImpl()
  37. {
  38. _auto = readD(); //
  39. _loc = readD(); // Location
  40. _lvl = readD(); // my level
  41. }
  42. @Override
  43. protected void runImpl()
  44. {
  45. L2PcInstance _activeChar = getClient().getActiveChar();
  46. if (_activeChar == null)
  47. return;
  48. if( !_activeChar.isInPartyMatchRoom() && _activeChar.getParty() != null && _activeChar.getParty().getLeader() != _activeChar)
  49. {
  50. _activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_VIEW_PARTY_ROOMS));
  51. _activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  52. return;
  53. }
  54. if(_activeChar.isInPartyMatchRoom())
  55. {
  56. // If Player is in Room show him room, not list
  57. PartyMatchRoomList _list = PartyMatchRoomList.getInstance();
  58. if (_list==null)
  59. return;
  60. PartyMatchRoom _room = _list.getPlayerRoom(_activeChar);
  61. if (_room == null)
  62. return;
  63. _activeChar.sendPacket(new PartyMatchDetail(_activeChar,_room));
  64. _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 2));
  65. _activeChar.setPartyRoom(_room.getId());
  66. //_activeChar.setPartyMatching(1);
  67. _activeChar.broadcastUserInfo();
  68. }
  69. else
  70. {
  71. // Add to waiting list
  72. PartyMatchWaitingList.getInstance().addPlayer(_activeChar);
  73. // Send Room list
  74. ListPartyWating matchList = new ListPartyWating(_activeChar,_auto,_loc,_lvl);
  75. _activeChar.sendPacket(matchList);
  76. }
  77. }
  78. @Override
  79. public String getType()
  80. {
  81. return _C__7F_REQUESTPARTYMATCHCONFIG;
  82. }
  83. }