RequestPledgePower.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 java.util.logging.Logger;
  17. import com.l2jserver.gameserver.model.L2Clan;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.serverpackets.ManagePledgePower;
  20. public final class RequestPledgePower extends L2GameClientPacket
  21. {
  22. static Logger _log = Logger.getLogger(ManagePledgePower.class.getName());
  23. private static final String _C__C0_REQUESTPLEDGEPOWER = "[C] C0 RequestPledgePower";
  24. private int _rank;
  25. private int _action;
  26. private int _privs;
  27. @Override
  28. protected void readImpl()
  29. {
  30. _rank = readD();
  31. _action = readD();
  32. if (_action == 2)
  33. {
  34. _privs = readD();
  35. }
  36. else _privs = 0;
  37. }
  38. @Override
  39. protected void runImpl()
  40. {
  41. L2PcInstance player = getClient().getActiveChar();
  42. if (player == null) return;
  43. if(_action == 2)
  44. {
  45. if(player.getClan() != null && player.isClanLeader())
  46. {
  47. if(_rank == 9)
  48. {
  49. //The rights below cannot be bestowed upon Academy members:
  50. //Join a clan or be dismissed
  51. //Title management, crest management, master management, level management,
  52. //bulletin board administration
  53. //Clan war, right to dismiss, set functions
  54. //Auction, manage taxes, attack/defend registration, mercenary management
  55. //=> Leaves only CP_CL_VIEW_WAREHOUSE, CP_CH_OPEN_DOOR, CP_CS_OPEN_DOOR?
  56. _privs = (_privs & L2Clan.CP_CL_VIEW_WAREHOUSE) + (_privs & L2Clan.CP_CH_OPEN_DOOR)
  57. + (_privs & L2Clan.CP_CS_OPEN_DOOR);
  58. }
  59. player.getClan().setRankPrivs(_rank, _privs);
  60. }
  61. } else
  62. {
  63. ManagePledgePower mpp = new ManagePledgePower(getClient().getActiveChar().getClan(), _action, _rank);
  64. player.sendPacket(mpp);
  65. }
  66. }
  67. /* (non-Javadoc)
  68. * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
  69. */
  70. @Override
  71. public String getType()
  72. {
  73. return _C__C0_REQUESTPLEDGEPOWER;
  74. }
  75. }