DropItem.java 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.L2ItemInstance;
  17. /**
  18. * 16
  19. * d6 6d c0 4b player id who dropped it
  20. * ee cc 11 43 object id
  21. * 39 00 00 00 item id
  22. * 8f 14 00 00 x
  23. * b7 f1 00 00 y
  24. * 60 f2 ff ff z
  25. * 01 00 00 00 show item-count 1=yes
  26. * 7a 00 00 00 count .
  27. *
  28. * format dddddddd rev 377
  29. * ddddddddd rev 417
  30. *
  31. * @version $Revision: 1.3.2.1.2.3 $ $Date: 2005/03/27 15:29:39 $
  32. */
  33. public class DropItem extends L2GameServerPacket
  34. {
  35. private static final String _S__16_DROPITEM = "[S] 16 DropItem";
  36. private L2ItemInstance _item;
  37. private int _charObjId;
  38. /**
  39. * Constructor of the DropItem server packet
  40. * @param item : L2ItemInstance designating the item
  41. * @param playerObjId : int designating the player ID who dropped the item
  42. */
  43. public DropItem(L2ItemInstance item, int playerObjId)
  44. {
  45. _item=item;
  46. _charObjId = playerObjId;
  47. }
  48. @Override
  49. protected final void writeImpl()
  50. {
  51. writeC(0x16);
  52. writeD(_charObjId);
  53. writeD(_item.getObjectId());
  54. writeD(_item.getItemId());
  55. writeD(_item.getX());
  56. writeD(_item.getY());
  57. writeD(_item.getZ());
  58. // only show item count if it is a stackable item
  59. if (_item.isStackable())
  60. {
  61. writeD(0x01);
  62. }
  63. else
  64. {
  65. writeD(0x00);
  66. }
  67. writeQ(_item.getCount());
  68. writeD(1); // unknown
  69. }
  70. /* (non-Javadoc)
  71. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  72. */
  73. @Override
  74. public String getType()
  75. {
  76. return _S__16_DROPITEM;
  77. }
  78. }