RequestGetOnVehicle.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 com.l2jserver.gameserver.instancemanager.BoatManager;
  17. import com.l2jserver.gameserver.model.actor.instance.L2BoatInstance;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.network.serverpackets.GetOnVehicle;
  20. import com.l2jserver.util.Point3D;
  21. /**
  22. * This class ...
  23. *
  24. * @version $Revision: 1.1.4.3 $ $Date: 2005/03/27 15:29:30 $
  25. */
  26. public final class RequestGetOnVehicle extends L2GameClientPacket
  27. {
  28. private static final String _C__5C_GETONVEHICLE = "[C] 5C GetOnVehicle";
  29. private int _id, _x, _y, _z;
  30. @Override
  31. protected void readImpl()
  32. {
  33. _id = readD();
  34. _x = readD();
  35. _y = readD();
  36. _z = readD();
  37. }
  38. @Override
  39. protected void runImpl()
  40. {
  41. L2PcInstance activeChar = getClient().getActiveChar();
  42. if (activeChar == null) return;
  43. L2BoatInstance boat = BoatManager.getInstance().getBoat(_id);
  44. if (boat == null) return;
  45. GetOnVehicle Gon = new GetOnVehicle(activeChar,boat,_x,_y,_z);
  46. activeChar.setInBoatPosition(new Point3D(_x,_y,_z));
  47. activeChar.getPosition().setXYZ(boat.getPosition().getX(),boat.getPosition().getY(),boat.getPosition().getZ());
  48. activeChar.broadcastPacket(Gon);
  49. activeChar.revalidateZone(true);
  50. }
  51. /* (non-Javadoc)
  52. * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
  53. */
  54. @Override
  55. public String getType()
  56. {
  57. return _C__5C_GETONVEHICLE;
  58. }
  59. }