FlyToLocation.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 L2Character _cha;
  25. private final int _destX, _destY, _destZ;
  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. _cha = cha;
  37. _destX = destX;
  38. _destY = destY;
  39. _destZ = destZ;
  40. _type = type;
  41. }
  42. public FlyToLocation(L2Character cha, L2Object dest, FlyType type)
  43. {
  44. this(cha, dest.getX(), dest.getY(), dest.getZ(), type);
  45. }
  46. /**
  47. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#getType()
  48. */
  49. @Override
  50. public String getType()
  51. {
  52. return "[S] 0xd4 FlyToLocation";
  53. }
  54. /**
  55. * @see com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket#writeImpl()
  56. */
  57. @Override
  58. protected void writeImpl()
  59. {
  60. writeC(0xd4);
  61. writeD(_cha.getObjectId());
  62. writeD(_destX);
  63. writeD(_destY);
  64. writeD(_destZ);
  65. writeD(_cha.getX());
  66. writeD(_cha.getY());
  67. writeD(_cha.getZ());
  68. writeD(_type.ordinal());
  69. }
  70. }