EquipUpdate.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 java.util.logging.Logger;
  17. import com.l2jserver.Config;
  18. import com.l2jserver.gameserver.model.L2ItemInstance;
  19. import com.l2jserver.gameserver.templates.item.L2Item;
  20. /**
  21. * 5e
  22. * 01 00 00 00 01 - added ? 02 - modified
  23. * 7b 86 73 42 object id
  24. * 08 00 00 00 body slot
  25. *
  26. *
  27. *
  28. * body slot
  29. * 0000 ?? underwear
  30. * 0001 ear
  31. * 0002 ear
  32. * 0003 neck
  33. * 0004 finger (magic ring)
  34. * 0005 finger (magic ring)
  35. * 0006 head (l.cap)
  36. * 0007 r.hand (dagger)
  37. * 0008 l.hand (arrows)
  38. * 0009 hands (short gloves)
  39. * 000a chest (squire shirt)
  40. * 000b legs (squire pants)
  41. * 000c feet
  42. * 000d ?? back
  43. * 000e lr.hand (bow)
  44. *
  45. *
  46. *
  47. * format ddd
  48. *
  49. * @version $Revision: 1.4.2.1.2.4 $ $Date: 2005/03/27 15:29:40 $
  50. */
  51. public final class EquipUpdate extends L2GameServerPacket
  52. {
  53. private static final String _S__5E_EQUIPUPDATE = "[S] 4b EquipUpdate";
  54. private static Logger _log = Logger.getLogger(EquipUpdate.class.getName());
  55. private L2ItemInstance _item;
  56. private int _change;
  57. public EquipUpdate(L2ItemInstance item, int change)
  58. {
  59. _item = item;
  60. _change = change;
  61. }
  62. @Override
  63. protected final void writeImpl()
  64. {
  65. int bodypart = 0;
  66. writeC(0x4b);
  67. writeD(_change);
  68. writeD(_item.getObjectId());
  69. switch (_item.getItem().getBodyPart())
  70. {
  71. case L2Item.SLOT_L_EAR:
  72. bodypart = 0x01;
  73. break;
  74. case L2Item.SLOT_R_EAR:
  75. bodypart = 0x02;
  76. break;
  77. case L2Item.SLOT_NECK:
  78. bodypart = 0x03;
  79. break;
  80. case L2Item.SLOT_R_FINGER:
  81. bodypart = 0x04;
  82. break;
  83. case L2Item.SLOT_L_FINGER:
  84. bodypart = 0x05;
  85. break;
  86. case L2Item.SLOT_HEAD:
  87. bodypart = 0x06;
  88. break;
  89. case L2Item.SLOT_R_HAND:
  90. bodypart = 0x07;
  91. break;
  92. case L2Item.SLOT_L_HAND:
  93. bodypart = 0x08;
  94. break;
  95. case L2Item.SLOT_GLOVES:
  96. bodypart = 0x09;
  97. break;
  98. case L2Item.SLOT_CHEST:
  99. bodypart = 0x0a;
  100. break;
  101. case L2Item.SLOT_LEGS:
  102. bodypart = 0x0b;
  103. break;
  104. case L2Item.SLOT_FEET:
  105. bodypart = 0x0c;
  106. break;
  107. case L2Item.SLOT_BACK:
  108. bodypart = 0x0d;
  109. break;
  110. case L2Item.SLOT_LR_HAND:
  111. bodypart = 0x0e;
  112. break;
  113. case L2Item.SLOT_HAIR:
  114. bodypart = 0x0f;
  115. break;
  116. case L2Item.SLOT_BELT:
  117. bodypart = 0x10;
  118. break;
  119. }
  120. if (Config.DEBUG) _log.fine("body:" +bodypart);
  121. writeD(bodypart);
  122. }
  123. /* (non-Javadoc)
  124. * @see com.l2jserver.gameserver.serverpackets.ServerBasePacket#getType()
  125. */
  126. @Override
  127. public String getType()
  128. {
  129. return _S__5E_EQUIPUPDATE;
  130. }
  131. }