| 1730 | |
| 1731 | |
| 1732 | int cProtocol125::ParseItem(cItem & a_Item) |
| 1733 | { |
| 1734 | HANDLE_PACKET_READ(ReadBEShort, short, ItemType); |
| 1735 | |
| 1736 | if (ItemType <= -1) |
| 1737 | { |
| 1738 | a_Item.Empty(); |
| 1739 | return PARSE_OK; |
| 1740 | } |
| 1741 | a_Item.m_ItemType = ItemType; |
| 1742 | |
| 1743 | HANDLE_PACKET_READ(ReadChar, char, ItemCount); |
| 1744 | HANDLE_PACKET_READ(ReadBEShort, short, ItemDamage); |
| 1745 | a_Item.m_ItemCount = ItemCount; |
| 1746 | a_Item.m_ItemDamage = ItemDamage; |
| 1747 | if (ItemCount <= 0) |
| 1748 | { |
| 1749 | a_Item.Empty(); |
| 1750 | } |
| 1751 | |
| 1752 | if (!cItem::IsEnchantable(ItemType)) |
| 1753 | { |
| 1754 | return PARSE_OK; |
| 1755 | } |
| 1756 | |
| 1757 | HANDLE_PACKET_READ(ReadBEShort, short, EnchantNumBytes); |
| 1758 | |
| 1759 | if (EnchantNumBytes <= 0) |
| 1760 | { |
| 1761 | return PARSE_OK; |
| 1762 | } |
| 1763 | |
| 1764 | // TODO: Enchantment not implemented yet! |
| 1765 | if (!m_ReceivedData.SkipRead((size_t)EnchantNumBytes)) |
| 1766 | { |
| 1767 | return PARSE_INCOMPLETE; |
| 1768 | } |
| 1769 | |
| 1770 | return PARSE_OK; |
| 1771 | } |
| 1772 | |
| 1773 | |
| 1774 | |