RequestPartyMatchDetail.java 3.3 KB

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