ExShowTrace.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 java.util.List;
  20. import net.sf.l2j.gameserver.model.L2Object;
  21. import javolution.util.FastList;
  22. /**
  23. *
  24. * @author KenM
  25. */
  26. public final class ExShowTrace extends L2GameServerPacket
  27. {
  28. private final List<Trace> _traces = new FastList<Trace>();
  29. public void addTrace(int x, int y, int z, int time)
  30. {
  31. _traces.add(new Trace(x, y, z, time));
  32. }
  33. public void addTrace(L2Object obj, int time)
  34. {
  35. this.addTrace(obj.getX(), obj.getY(), obj.getZ(), time);
  36. }
  37. static final class Trace
  38. {
  39. public final int _x;
  40. public final int _y;
  41. public final int _z;
  42. public final int _time;
  43. public Trace(int x, int y, int z, int time)
  44. {
  45. _x = x;
  46. _y = y;
  47. _z = z;
  48. _time = time;
  49. }
  50. }
  51. /**
  52. * @see net.sf.l2j.gameserver.serverpackets.L2GameServerPacket#getType()
  53. */
  54. @Override
  55. public String getType()
  56. {
  57. return "[S] FE:67 ExShowTrace";
  58. }
  59. /**
  60. * @see net.sf.l2j.gameserver.serverpackets.L2GameServerPacket#writeImpl()
  61. */
  62. @Override
  63. protected void writeImpl()
  64. {
  65. writeC(0xfe);
  66. writeH(0x67);
  67. writeH(_traces.size());
  68. for (Trace t : _traces)
  69. {
  70. writeD(t._x);
  71. writeD(t._y);
  72. writeD(t._z);
  73. writeH(t._time);
  74. }
  75. }
  76. }