Minor item packet cleanup.

This commit is contained in:
MobiusDevelopment 2020-02-04 17:33:54 +00:00
parent c7bb990be4
commit bc4502146b
2 changed files with 8 additions and 20 deletions

View File

@ -53,9 +53,6 @@ public class InventoryUpdate extends GameServerPacket
_items = new ArrayList<>(); _items = new ArrayList<>();
} }
/**
* @param items
*/
public InventoryUpdate(List<ItemInfo> items) public InventoryUpdate(List<ItemInfo> items)
{ {
_items = items; _items = items;
@ -111,8 +108,7 @@ public class InventoryUpdate extends GameServerPacket
protected final void writeImpl() protected final void writeImpl()
{ {
writeC(0x27); writeC(0x27);
final int count = _items.size(); writeH(_items.size());
writeH(count);
for (ItemInfo item : _items) for (ItemInfo item : _items)
{ {
writeH(item.getChange()); // Update type : 01-add, 02-modify, writeH(item.getChange()); // Update type : 01-add, 02-modify,

View File

@ -47,33 +47,25 @@ public class ItemList extends GameServerPacket
{ {
writeC(0x1b); writeC(0x1b);
writeH(_showWindow ? 0x01 : 0x00); writeH(_showWindow ? 0x01 : 0x00);
final int count = _items.length; writeH(_items.length);
writeH(count);
for (ItemInstance temp : _items) for (ItemInstance temp : _items)
{ {
if ((temp == null) || (temp.getItem() == null)) if ((temp == null) || (temp.getItem() == null))
{ {
continue; continue;
} }
writeH(temp.getItem().getType1()); // item type1 writeH(temp.getItem().getType1());
writeD(temp.getObjectId()); writeD(temp.getObjectId());
writeD(temp.getItemId()); writeD(temp.getItemId());
writeD(temp.getCount()); writeD(temp.getCount());
writeH(temp.getItem().getType2()); // item type2 writeH(temp.getItem().getType2());
writeH(temp.getCustomType1()); // item type3 writeH(temp.getCustomType1());
writeH(temp.isEquipped() ? 0x01 : 0x00); writeH(temp.isEquipped() ? 0x01 : 0x00);
writeD(temp.getItem().getBodyPart()); writeD(temp.getItem().getBodyPart());
writeH(temp.getEnchantLevel()); // enchant level writeH(temp.getEnchantLevel());
// race tickets // race tickets
writeH(temp.getCustomType2()); // item type3 writeH(temp.getCustomType2());
if (temp.isAugmented()) writeD((temp.isAugmented()) ? temp.getAugmentation().getAugmentationId() : 0x00);
{
writeD(temp.getAugmentation().getAugmentationId());
}
else
{
writeD(0x00);
}
writeD(temp.getMana()); writeD(temp.getMana());
} }
} }