ExAirShipInfo.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.serverpackets;
  16. import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
  17. public class ExAirShipInfo extends L2GameServerPacket
  18. {
  19. private static final String _S__FE_60_EXAIRSHIPINFO = "[S] FE:60 ExAirShipInfo";
  20. // store some parameters, because they can be changed during broadcast
  21. private final L2AirShipInstance _ship;
  22. private final int _x, _y, _z, _heading, _moveSpeed, _rotationSpeed, _captain, _helm;
  23. public ExAirShipInfo(L2AirShipInstance ship)
  24. {
  25. _ship = ship;
  26. _x = ship.getX();
  27. _y = ship.getY();
  28. _z = ship.getZ();
  29. _heading = ship.getHeading();
  30. _moveSpeed = (int)ship.getStat().getMoveSpeed();
  31. _rotationSpeed = ship.getStat().getRotationSpeed();
  32. _captain = ship.getCaptainId();
  33. _helm = ship.getHelmObjectId();
  34. }
  35. @Override
  36. protected void writeImpl()
  37. {
  38. writeC(0xfe);
  39. writeH(0x60);
  40. writeD(_ship.getObjectId());
  41. writeD(_x);
  42. writeD(_y);
  43. writeD(_z);
  44. writeD(_heading);
  45. writeD(_captain);
  46. writeD(_moveSpeed);
  47. writeD(_rotationSpeed);
  48. writeD(_helm);
  49. if (_helm != 0)
  50. {
  51. writeD(0x16e); // Controller X
  52. writeD(0x00); // Controller Y
  53. writeD(0x6b); // Controller Z
  54. writeD(0x15c); // Captain X
  55. writeD(0x00); // Captain Y
  56. writeD(0x69); // Captain Z
  57. }
  58. else
  59. {
  60. writeD(0x00);
  61. writeD(0x00);
  62. writeD(0x00);
  63. writeD(0x00);
  64. writeD(0x00);
  65. writeD(0x00);
  66. }
  67. writeD(_ship.getFuel());
  68. writeD(_ship.getMaxFuel());
  69. }
  70. @Override
  71. public String getType()
  72. {
  73. return _S__FE_60_EXAIRSHIPINFO;
  74. }
  75. }