RequestPartyMatchConfig.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.network.clientpackets;
  20. import com.l2jserver.gameserver.model.PartyMatchRoom;
  21. import com.l2jserver.gameserver.model.PartyMatchRoomList;
  22. import com.l2jserver.gameserver.model.PartyMatchWaitingList;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.network.SystemMessageId;
  25. import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
  26. import com.l2jserver.gameserver.network.serverpackets.ExPartyRoomMember;
  27. import com.l2jserver.gameserver.network.serverpackets.ListPartyWating;
  28. import com.l2jserver.gameserver.network.serverpackets.PartyMatchDetail;
  29. /**
  30. * This class ...
  31. * @version $Revision: 1.1.4.2 $ $Date: 2005/03/27 15:29:30 $
  32. */
  33. public final class RequestPartyMatchConfig extends L2GameClientPacket
  34. {
  35. private static final String _C__7F_REQUESTPARTYMATCHCONFIG = "[C] 7F RequestPartyMatchConfig";
  36. private int _auto, _loc, _lvl;
  37. @Override
  38. protected void readImpl()
  39. {
  40. _auto = readD(); //
  41. _loc = readD(); // Location
  42. _lvl = readD(); // my level
  43. }
  44. @Override
  45. protected void runImpl()
  46. {
  47. L2PcInstance _activeChar = getClient().getActiveChar();
  48. if (_activeChar == null)
  49. {
  50. return;
  51. }
  52. if (!_activeChar.isInPartyMatchRoom() && (_activeChar.getParty() != null) && (_activeChar.getParty().getLeader() != _activeChar))
  53. {
  54. _activeChar.sendPacket(SystemMessageId.CANT_VIEW_PARTY_ROOMS);
  55. _activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  56. return;
  57. }
  58. if (_activeChar.isInPartyMatchRoom())
  59. {
  60. // If Player is in Room show him room, not list
  61. PartyMatchRoomList _list = PartyMatchRoomList.getInstance();
  62. if (_list == null)
  63. {
  64. return;
  65. }
  66. PartyMatchRoom _room = _list.getPlayerRoom(_activeChar);
  67. if (_room == null)
  68. {
  69. return;
  70. }
  71. _activeChar.sendPacket(new PartyMatchDetail(_activeChar, _room));
  72. _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 2));
  73. _activeChar.setPartyRoom(_room.getId());
  74. // _activeChar.setPartyMatching(1);
  75. _activeChar.broadcastUserInfo();
  76. }
  77. else
  78. {
  79. // Add to waiting list
  80. PartyMatchWaitingList.getInstance().addPlayer(_activeChar);
  81. // Send Room list
  82. ListPartyWating matchList = new ListPartyWating(_activeChar, _auto, _loc, _lvl);
  83. _activeChar.sendPacket(matchList);
  84. }
  85. }
  86. @Override
  87. public String getType()
  88. {
  89. return _C__7F_REQUESTPARTYMATCHCONFIG;
  90. }
  91. }