FlyToLocation.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.L2Object;
  17. import com.l2jserver.gameserver.model.actor.L2Character;
  18. /**
  19. *
  20. * @author KenM
  21. */
  22. public final class FlyToLocation extends L2GameServerPacket
  23. {
  24. private final int _destX, _destY, _destZ;
  25. private final int _chaObjId, _chaX, _chaY, _chaZ;
  26. private final FlyType _type;
  27. public enum FlyType
  28. {
  29. THROW_UP,
  30. THROW_HORIZONTAL,
  31. DUMMY, // no effect
  32. CHARGE;
  33. }
  34. public FlyToLocation(L2Character cha, int destX, int destY, int destZ, FlyType type)
  35. {
  36. _chaObjId = cha.getObjectId();
  37. _chaX = cha.getX();
  38. _chaY = cha.getY();
  39. _chaZ = cha.getZ();
  40. _destX = destX;
  41. _destY = destY;
  42. _destZ = destZ;
  43. _type = type;
  44. }
  45. public FlyToLocation(L2Character cha, L2Object dest, FlyType type)
  46. {
  47. this(cha, dest.getX(), dest.getY(), dest.getZ(), type);
  48. }
  49. /**
  50. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#getType()
  51. */
  52. @Override
  53. public String getType()
  54. {
  55. return "[S] 0xd4 FlyToLocation";
  56. }
  57. /**
  58. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#writeImpl()
  59. */
  60. @Override
  61. protected void writeImpl()
  62. {
  63. writeC(0xd4);
  64. writeD(_chaObjId);
  65. writeD(_destX);
  66. writeD(_destY);
  67. writeD(_destZ);
  68. writeD(_chaX);
  69. writeD(_chaY);
  70. writeD(_chaZ);
  71. writeD(_type.ordinal());
  72. }
  73. }