RequestWithdrawPartyRoom.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.SystemMessageId;
  20. import com.l2jserver.gameserver.network.serverpackets.ExClosePartyRoom;
  21. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  22. /**
  23. *
  24. * @author Gnacik
  25. *
  26. */
  27. public final class RequestWithdrawPartyRoom extends L2GameClientPacket
  28. {
  29. private int _roomid;
  30. @SuppressWarnings("unused")
  31. private int _unk1;
  32. @Override
  33. protected void readImpl()
  34. {
  35. _roomid = readD();
  36. _unk1 = readD();
  37. }
  38. @Override
  39. protected void runImpl()
  40. {
  41. final L2PcInstance _activeChar = getClient().getActiveChar();
  42. if (_activeChar == null)
  43. return;
  44. PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(_roomid);
  45. if (_room == null)
  46. return;
  47. if((_activeChar.isInParty() && _room.getOwner().isInParty()) && (_activeChar.getParty().getPartyLeaderOID() == _room.getOwner().getParty().getPartyLeaderOID()))
  48. {
  49. // If user is in party with Room Owner
  50. // is not removed from Room
  51. //_activeChar.setPartyMatching(0);
  52. _activeChar.broadcastUserInfo();
  53. }
  54. else
  55. {
  56. _room.deleteMember(_activeChar);
  57. _activeChar.setPartyRoom(0);
  58. //_activeChar.setPartyMatching(0);
  59. _activeChar.sendPacket(new ExClosePartyRoom());
  60. _activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PARTY_ROOM_EXITED));
  61. }
  62. }
  63. @Override
  64. public String getType()
  65. {
  66. return "[C] D0:0B RequestWithdrawPartyRoom";
  67. }
  68. }