Package l2p.gameserver.clientpackets

Source Code of l2p.gameserver.clientpackets.RequestGetOnVehicle

package l2p.gameserver.clientpackets;

import l2p.gameserver.model.L2Player;
import l2p.gameserver.model.entity.vehicle.L2Ship;
import l2p.gameserver.model.entity.vehicle.L2VehicleManager;
import l2p.gameserver.serverpackets.GetOnVehicle;
import l2p.util.Location;

public class RequestGetOnVehicle extends L2GameClientPacket
{
  private int _id;
  private Location loc = new Location();

  /**
   * packet type id 0x53
   * format:      cdddd
   */
  @Override
  public void readImpl()
  {
    _id = readD();
    loc.x = readD();
    loc.y = readD();
    loc.z = readD();
  }

  @Override
  public void runImpl()
  {
    L2Player activeChar = getClient().getActiveChar();
    if(activeChar == null)
    {
      return;
    }
    L2Ship boat = (L2Ship) L2VehicleManager.getInstance().getBoat(_id);
    if(boat == null)
    {
      return;
    }
    activeChar.stopMove();
    activeChar.setVehicle(boat);
    activeChar.setInVehiclePosition(loc);
    activeChar.setLoc(boat.getLoc());
    activeChar.broadcastPacket(new GetOnVehicle(activeChar, boat, loc));
  }
}
TOP

Related Classes of l2p.gameserver.clientpackets.RequestGetOnVehicle

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.