RequestWithDrawalParty.java 2.6 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.gameserver.model.L2Party;
  17. import com.l2jserver.gameserver.model.PartyMatchRoom;
  18. import com.l2jserver.gameserver.model.PartyMatchRoomList;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.network.serverpackets.ExClosePartyRoom;
  21. import com.l2jserver.gameserver.network.serverpackets.ExPartyRoomMember;
  22. import com.l2jserver.gameserver.network.serverpackets.PartyMatchDetail;
  23. /**
  24. *
  25. * This class ...
  26. *
  27. * @version $Revision: 1.3.4.2 $ $Date: 2005/03/27 15:29:30 $
  28. */
  29. public final class RequestWithDrawalParty extends L2GameClientPacket
  30. {
  31. private static final String _C__2B_REQUESTWITHDRAWALPARTY = "[C] 44 RequestWithDrawalParty";
  32. //private static Logger _log = Logger.getLogger(RequestWithDrawalParty.class.getName());
  33. @Override
  34. protected void readImpl()
  35. {
  36. //trigger
  37. }
  38. @Override
  39. protected void runImpl()
  40. {
  41. L2PcInstance player = getClient().getActiveChar();
  42. if (player == null)
  43. return;
  44. L2Party party = player.getParty();
  45. if (party != null)
  46. {
  47. if (party.isInDimensionalRift() && !party.getDimensionalRift().getRevivedAtWaitingRoom().contains(player))
  48. player.sendMessage("You can't exit party when you are in Dimensional Rift.");
  49. else
  50. {
  51. party.removePartyMember(player);
  52. if(player.isInPartyMatchRoom())
  53. {
  54. PartyMatchRoom _room = PartyMatchRoomList.getInstance().getPlayerRoom(player);
  55. if(_room != null)
  56. {
  57. player.sendPacket(new PartyMatchDetail(player, _room));
  58. player.sendPacket(new ExPartyRoomMember(player, _room, 0));
  59. player.sendPacket(new ExClosePartyRoom());
  60. _room.deleteMember(player);
  61. }
  62. player.setPartyRoom(0);
  63. //player.setPartyMatching(0);
  64. player.broadcastUserInfo();
  65. }
  66. }
  67. }
  68. }
  69. @Override
  70. public String getType()
  71. {
  72. return _C__2B_REQUESTWITHDRAWALPARTY;
  73. }
  74. }