Warehouse packet fixes.
Contributed by rocknowx.
This commit is contained in:
@ -43,6 +43,9 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
private long _playerAdena;
|
private long _playerAdena;
|
||||||
private List<L2WarehouseItem> _objects = new ArrayList<>();
|
private List<L2WarehouseItem> _objects = new ArrayList<>();
|
||||||
private int _whType;
|
private int _whType;
|
||||||
|
private L2ItemInstance[] _items;
|
||||||
|
private L2ItemInstance[] _invItems;
|
||||||
|
private final List<Integer> _itemsStackable = new ArrayList<>();
|
||||||
|
|
||||||
public static enum WarehouseListType
|
public static enum WarehouseListType
|
||||||
{
|
{
|
||||||
@ -183,6 +186,20 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_items = player.getActiveWarehouse().getItems();
|
||||||
|
_invItems = player.getInventory().getItems();
|
||||||
|
|
||||||
|
for (L2ItemInstance item : _items)
|
||||||
|
{
|
||||||
|
for (L2ItemInstance invitem : _invItems)
|
||||||
|
{
|
||||||
|
if (item.isStackable() && (item.getDisplayId() == invitem.getDisplayId()))
|
||||||
|
{
|
||||||
|
_itemsStackable.add(item.getDisplayId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -743,7 +760,12 @@ public class SortedWareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
writeH(_whType);
|
writeH(_whType);
|
||||||
writeQ(_playerAdena);
|
writeQ(_playerAdena);
|
||||||
writeH(_objects.size());
|
writeH(_objects.size());
|
||||||
|
writeH(_itemsStackable.size());
|
||||||
|
for (int itemId : _itemsStackable)
|
||||||
|
{
|
||||||
|
writeD(itemId);
|
||||||
|
}
|
||||||
|
writeD(_invItems.length);
|
||||||
for (L2WarehouseItem item : _objects)
|
for (L2WarehouseItem item : _objects)
|
||||||
{
|
{
|
||||||
writeItem(item);
|
writeItem(item);
|
||||||
|
@ -30,9 +30,9 @@ public final class WareHouseDepositList extends AbstractItemPacket
|
|||||||
public static final int PRIVATE = 1;
|
public static final int PRIVATE = 1;
|
||||||
public static final int CLAN = 2;
|
public static final int CLAN = 2;
|
||||||
public static final int CASTLE = 3;
|
public static final int CASTLE = 3;
|
||||||
public static final int FREIGHT = 1;
|
public static final int FREIGHT = 4;
|
||||||
private final long _playerAdena;
|
private final long _playerAdena;
|
||||||
private int _itemsInWarehouse;
|
private L2ItemInstance[] _itemsInWarehouse;
|
||||||
private final List<L2ItemInstance> _items = new ArrayList<>();
|
private final List<L2ItemInstance> _items = new ArrayList<>();
|
||||||
private final List<Integer> _itemsStackable = new ArrayList<>();
|
private final List<Integer> _itemsStackable = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ public final class WareHouseDepositList extends AbstractItemPacket
|
|||||||
{
|
{
|
||||||
_whType = type;
|
_whType = type;
|
||||||
_playerAdena = player.getAdena();
|
_playerAdena = player.getAdena();
|
||||||
_itemsInWarehouse = 0;
|
_itemsInWarehouse = player.getActiveWarehouse().getItems();
|
||||||
|
|
||||||
final boolean isPrivate = _whType == PRIVATE;
|
final boolean isPrivate = _whType == PRIVATE;
|
||||||
for (L2ItemInstance temp : player.getInventory().getAvailableItems(true, isPrivate, false))
|
for (L2ItemInstance temp : player.getInventory().getAvailableItems(true, isPrivate, false))
|
||||||
@ -62,14 +62,13 @@ public final class WareHouseDepositList extends AbstractItemPacket
|
|||||||
{
|
{
|
||||||
_items.add(temp);
|
_items.add(temp);
|
||||||
}
|
}
|
||||||
if (temp.isDepositable(isPrivate) && temp.isStackable())
|
}
|
||||||
|
for (L2ItemInstance temp : _itemsInWarehouse)
|
||||||
|
{
|
||||||
|
if (temp.isStackable())
|
||||||
{
|
{
|
||||||
_itemsStackable.add(temp.getDisplayId());
|
_itemsStackable.add(temp.getDisplayId());
|
||||||
}
|
}
|
||||||
if (temp.getItemLocation() == (isPrivate ? ItemLocation.WAREHOUSE : ItemLocation.CLANWH))
|
|
||||||
{
|
|
||||||
_itemsInWarehouse++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ public final class WareHouseDepositList extends AbstractItemPacket
|
|||||||
writeC(0x41);
|
writeC(0x41);
|
||||||
writeH(_whType);
|
writeH(_whType);
|
||||||
writeQ(_playerAdena);
|
writeQ(_playerAdena);
|
||||||
writeD(_itemsInWarehouse);
|
writeD(_itemsInWarehouse.length);
|
||||||
writeH(_itemsStackable.size());
|
writeH(_itemsStackable.size());
|
||||||
|
|
||||||
for (int itemId : _itemsStackable)
|
for (int itemId : _itemsStackable)
|
||||||
|
@ -29,11 +29,11 @@ public final class WareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
public static final int PRIVATE = 1;
|
public static final int PRIVATE = 1;
|
||||||
public static final int CLAN = 2;
|
public static final int CLAN = 2;
|
||||||
public static final int CASTLE = 3; // not sure
|
public static final int CASTLE = 3; // not sure
|
||||||
public static final int FREIGHT = 1;
|
public static final int FREIGHT = 4;
|
||||||
private L2PcInstance _activeChar;
|
private L2PcInstance _activeChar;
|
||||||
private long _playerAdena;
|
private long _playerAdena;
|
||||||
private final int _invSize;
|
|
||||||
private L2ItemInstance[] _items;
|
private L2ItemInstance[] _items;
|
||||||
|
private L2ItemInstance[] _invItems;
|
||||||
private final List<Integer> _itemsStackable = new ArrayList<>();
|
private final List<Integer> _itemsStackable = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* <ul>
|
* <ul>
|
||||||
@ -51,7 +51,6 @@ public final class WareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
_whType = type;
|
_whType = type;
|
||||||
|
|
||||||
_playerAdena = _activeChar.getAdena();
|
_playerAdena = _activeChar.getAdena();
|
||||||
_invSize = player.getInventory().getSize();
|
|
||||||
if (_activeChar.getActiveWarehouse() == null)
|
if (_activeChar.getActiveWarehouse() == null)
|
||||||
{
|
{
|
||||||
_log.warning("error while sending withdraw request to: " + _activeChar.getName());
|
_log.warning("error while sending withdraw request to: " + _activeChar.getName());
|
||||||
@ -59,12 +58,16 @@ public final class WareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
_items = _activeChar.getActiveWarehouse().getItems();
|
_items = _activeChar.getActiveWarehouse().getItems();
|
||||||
|
_invItems = _activeChar.getInventory().getItems();
|
||||||
|
|
||||||
for (L2ItemInstance item : _items)
|
for (L2ItemInstance item : _items)
|
||||||
{
|
{
|
||||||
if (item.isStackable())
|
for (L2ItemInstance invitem : _invItems)
|
||||||
{
|
{
|
||||||
_itemsStackable.add(item.getDisplayId());
|
if (item.isStackable() && (item.getDisplayId() == invitem.getDisplayId()))
|
||||||
|
{
|
||||||
|
_itemsStackable.add(item.getDisplayId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,7 +84,7 @@ public final class WareHouseWithdrawalList extends AbstractItemPacket
|
|||||||
{
|
{
|
||||||
writeD(itemId);
|
writeD(itemId);
|
||||||
}
|
}
|
||||||
writeD(_invSize);
|
writeD(_invItems.length);
|
||||||
for (L2ItemInstance item : _items)
|
for (L2ItemInstance item : _items)
|
||||||
{
|
{
|
||||||
writeItem(item);
|
writeItem(item);
|
||||||
|
Reference in New Issue
Block a user