Package lineage2.gameserver.network.clientpackets

Source Code of lineage2.gameserver.network.clientpackets.RequestRegistPartySubstitute

package lineage2.gameserver.network.clientpackets;

import lineage2.gameserver.model.GameObjectsStorage;
import lineage2.gameserver.model.Party;
import lineage2.gameserver.model.Player;
import lineage2.gameserver.model.party.PartySubstitute;
import lineage2.gameserver.network.serverpackets.ExRegistPartySubstitute;

/**
* @author ALF
* @date 22.08.2012
*/
public class RequestRegistPartySubstitute extends L2GameClientPacket
{
  private int _changeCharId;

  @Override
  protected void readImpl()
  {
    _changeCharId = readD();
  }

  @Override
  protected void runImpl()
  {
    Player player = getClient().getActiveChar();

    if (player == null)
      return;

    Party p = player.getParty();

    if (p == null)
      return;

    if (!p.isLeader(player))
      return;

    Player chp = GameObjectsStorage.getPlayer(_changeCharId);

    if (!p.containsMember(chp))
      return;

    PartySubstitute.getInstance().addPlayerToReplace(chp);

    player.sendPacket(new ExRegistPartySubstitute(_changeCharId, ExRegistPartySubstitute.REGISTER_OK));

  }
}
TOP

Related Classes of lineage2.gameserver.network.clientpackets.RequestRegistPartySubstitute

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.