PartyInfo.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 handlers.usercommandhandlers;
  16. import com.l2jserver.gameserver.handler.IUserCommandHandler;
  17. import com.l2jserver.gameserver.model.L2Party;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.SystemMessageId;
  20. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  21. /**
  22. * Party Info user command.
  23. * @author Tempy
  24. */
  25. public class PartyInfo implements IUserCommandHandler
  26. {
  27. private static final int[] COMMAND_IDS =
  28. {
  29. 81
  30. };
  31. @Override
  32. public boolean useUserCommand(int id, L2PcInstance activeChar)
  33. {
  34. if (id != COMMAND_IDS[0])
  35. {
  36. return false;
  37. }
  38. activeChar.sendPacket(SystemMessageId.PARTY_INFORMATION);
  39. if (activeChar.isInParty())
  40. {
  41. final L2Party party = activeChar.getParty();
  42. switch (party.getLootDistribution())
  43. {
  44. case L2Party.ITEM_LOOTER:
  45. activeChar.sendPacket(SystemMessageId.LOOTING_FINDERS_KEEPERS);
  46. break;
  47. case L2Party.ITEM_ORDER:
  48. activeChar.sendPacket(SystemMessageId.LOOTING_BY_TURN);
  49. break;
  50. case L2Party.ITEM_ORDER_SPOIL:
  51. activeChar.sendPacket(SystemMessageId.LOOTING_BY_TURN_INCLUDE_SPOIL);
  52. break;
  53. case L2Party.ITEM_RANDOM:
  54. activeChar.sendPacket(SystemMessageId.LOOTING_RANDOM);
  55. break;
  56. case L2Party.ITEM_RANDOM_SPOIL:
  57. activeChar.sendPacket(SystemMessageId.LOOTING_RANDOM_INCLUDE_SPOIL);
  58. break;
  59. }
  60. if (!party.isLeader(activeChar))
  61. {
  62. final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PARTY_LEADER_C1);
  63. sm.addPcName(party.getLeader());
  64. activeChar.sendPacket(sm);
  65. }
  66. activeChar.sendMessage("Members: " + party.getMemberCount() + "/9"); // TODO: Custom?
  67. }
  68. activeChar.sendPacket(SystemMessageId.FRIEND_LIST_FOOTER);
  69. return true;
  70. }
  71. @Override
  72. public int[] getUserCommandList()
  73. {
  74. return COMMAND_IDS;
  75. }
  76. }