RequestPartyMatchDetail.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.ExManagePartyRoomMember;
  22. import com.l2jserver.gameserver.network.serverpackets.ExPartyRoomMember;
  23. import com.l2jserver.gameserver.network.serverpackets.PartyMatchDetail;
  24. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  25. /**
  26. * @author Gnacik
  27. */
  28. public final class RequestPartyMatchDetail extends L2GameClientPacket
  29. {
  30. private int _roomid;
  31. @SuppressWarnings("unused")
  32. private int _unk1;
  33. @SuppressWarnings("unused")
  34. private int _unk2;
  35. @SuppressWarnings("unused")
  36. private int _unk3;
  37. @Override
  38. protected void readImpl()
  39. {
  40. _roomid = readD();
  41. /*
  42. * IF player click on Room all unk are 0
  43. * IF player click AutoJoin values are -1 1 1
  44. */
  45. _unk1 = readD();
  46. _unk2 = readD();
  47. _unk3 = readD();
  48. }
  49. @Override
  50. protected void runImpl()
  51. {
  52. L2PcInstance _activeChar = getClient().getActiveChar();
  53. if (_activeChar == null)
  54. return;
  55. PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(_roomid);
  56. if (_room == null)
  57. return;
  58. if ((_activeChar.getLevel() >= _room.getMinLvl()) && (_activeChar.getLevel() <= _room.getMaxLvl()))
  59. {
  60. // Remove from waiting list
  61. PartyMatchWaitingList.getInstance().removePlayer(_activeChar);
  62. _activeChar.setPartyRoom(_roomid);
  63. _activeChar.sendPacket(new PartyMatchDetail(_activeChar, _room));
  64. _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 0));
  65. for(L2PcInstance _member : _room.getPartyMembers())
  66. {
  67. if(_member == null)
  68. continue;
  69. _member.sendPacket(new ExManagePartyRoomMember(_activeChar, _room, 0));
  70. SystemMessage sm = new SystemMessage(SystemMessageId.C1_ENTERED_PARTY_ROOM);
  71. sm.addCharName(_activeChar);
  72. _member.sendPacket(sm);
  73. }
  74. _room.addMember(_activeChar);
  75. // Info Broadcast
  76. _activeChar.broadcastUserInfo();
  77. }
  78. else
  79. {
  80. _activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_ENTER_PARTY_ROOM));
  81. }
  82. }
  83. @Override
  84. public String getType()
  85. {
  86. return "[C] 81 RequestPartyMatchDetail";
  87. }
  88. }