PartyInfo.java 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. * Support for /partyinfo command
  23. * Added by Tempy - 28 Jul 05
  24. */
  25. public class PartyInfo implements IUserCommandHandler
  26. {
  27. private static final int[] COMMAND_IDS =
  28. {
  29. 81
  30. };
  31. /**
  32. *
  33. * @see com.l2jserver.gameserver.handler.IUserCommandHandler#useUserCommand(int, com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
  34. */
  35. public boolean useUserCommand(int id, L2PcInstance activeChar)
  36. {
  37. if (id != COMMAND_IDS[0])
  38. return false;
  39. if (!activeChar.isInParty())
  40. {
  41. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PARTY_INFORMATION));
  42. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FRIEND_LIST_FOOTER));
  43. return false;
  44. }
  45. L2Party playerParty = activeChar.getParty();
  46. int memberCount = playerParty.getMemberCount();
  47. int lootDistribution = playerParty.getLootDistribution();
  48. String partyLeader = playerParty.getPartyMembers().get(0).getName();
  49. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PARTY_INFORMATION));
  50. switch (lootDistribution)
  51. {
  52. case L2Party.ITEM_LOOTER:
  53. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_FINDERS_KEEPERS));
  54. break;
  55. case L2Party.ITEM_ORDER:
  56. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_BY_TURN));
  57. break;
  58. case L2Party.ITEM_ORDER_SPOIL:
  59. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_BY_TURN_INCLUDE_SPOIL));
  60. break;
  61. case L2Party.ITEM_RANDOM:
  62. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_RANDOM));
  63. break;
  64. case L2Party.ITEM_RANDOM_SPOIL:
  65. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.LOOTING_RANDOM_INCLUDE_SPOIL));
  66. break;
  67. }
  68. SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.PARTY_LEADER_C1);
  69. sm.addString(partyLeader);
  70. activeChar.sendPacket(sm);
  71. activeChar.sendMessage("Members: " + memberCount + "/9");
  72. activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FRIEND_LIST_FOOTER));
  73. return true;
  74. }
  75. /**
  76. *
  77. * @see com.l2jserver.gameserver.handler.IUserCommandHandler#getUserCommandList()
  78. */
  79. public int[] getUserCommandList()
  80. {
  81. return COMMAND_IDS;
  82. }
  83. }