FlyToLocation.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* This program is free software; you can redistribute it and/or modify
  2. * it under the terms of the GNU General Public License as published by
  3. * the Free Software Foundation; either version 2, or (at your option)
  4. * any later version.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  14. * 02111-1307, USA.
  15. *
  16. * http://www.gnu.org/copyleft/gpl.html
  17. */
  18. package net.sf.l2j.gameserver.serverpackets;
  19. import net.sf.l2j.gameserver.model.L2Character;
  20. import net.sf.l2j.gameserver.model.L2Object;
  21. /**
  22. *
  23. * @author KenM
  24. */
  25. public final class FlyToLocation extends L2GameServerPacket
  26. {
  27. private final L2Character _cha;
  28. private final int _destX, _destY, _destZ;
  29. private final FlyType _type;
  30. public enum FlyType
  31. {
  32. THROW_UP,
  33. THROW_HORIZONTAL,
  34. DUMMY, // no effect
  35. CHARGE;
  36. }
  37. public FlyToLocation(L2Character cha, int destX, int destY, int destZ, FlyType type)
  38. {
  39. _cha = cha;
  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 net.sf.l2j.gameserver.serverpackets.L2GameServerPacket#getType()
  51. */
  52. @Override
  53. public String getType()
  54. {
  55. return "[S] 0xd4 FlyToLocation";
  56. }
  57. /**
  58. * @see net.sf.l2j.gameserver.serverpackets.L2GameServerPacket#writeImpl()
  59. */
  60. @Override
  61. protected void writeImpl()
  62. {
  63. writeC(0xd4);
  64. writeD(_cha.getObjectId());
  65. writeD(_destX);
  66. writeD(_destY);
  67. writeD(_destZ);
  68. writeD(_cha.getX());
  69. writeD(_cha.getY());
  70. writeD(_cha.getZ());
  71. writeD(_type.ordinal());
  72. }
  73. }