ExAirShipInfo.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2004-2015 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J Server is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package com.l2jserver.gameserver.network.serverpackets;
  20. import com.l2jserver.gameserver.model.actor.instance.L2AirShipInstance;
  21. public class ExAirShipInfo extends L2GameServerPacket
  22. {
  23. // store some parameters, because they can be changed during broadcast
  24. private final L2AirShipInstance _ship;
  25. private final int _x, _y, _z, _heading, _moveSpeed, _rotationSpeed, _captain, _helm;
  26. public ExAirShipInfo(L2AirShipInstance ship)
  27. {
  28. _ship = ship;
  29. _x = ship.getX();
  30. _y = ship.getY();
  31. _z = ship.getZ();
  32. _heading = ship.getHeading();
  33. _moveSpeed = (int) ship.getStat().getMoveSpeed();
  34. _rotationSpeed = (int) ship.getStat().getRotationSpeed();
  35. _captain = ship.getCaptainId();
  36. _helm = ship.getHelmObjectId();
  37. }
  38. @Override
  39. protected void writeImpl()
  40. {
  41. writeC(0xfe);
  42. writeH(0x60);
  43. writeD(_ship.getObjectId());
  44. writeD(_x);
  45. writeD(_y);
  46. writeD(_z);
  47. writeD(_heading);
  48. writeD(_captain);
  49. writeD(_moveSpeed);
  50. writeD(_rotationSpeed);
  51. writeD(_helm);
  52. if (_helm != 0)
  53. {
  54. // TODO: unhardcode these!
  55. writeD(0x16e); // Controller X
  56. writeD(0x00); // Controller Y
  57. writeD(0x6b); // Controller Z
  58. writeD(0x15c); // Captain X
  59. writeD(0x00); // Captain Y
  60. writeD(0x69); // Captain Z
  61. }
  62. else
  63. {
  64. writeD(0x00);
  65. writeD(0x00);
  66. writeD(0x00);
  67. writeD(0x00);
  68. writeD(0x00);
  69. writeD(0x00);
  70. }
  71. writeD(_ship.getFuel());
  72. writeD(_ship.getMaxFuel());
  73. }
  74. }