public virtual void StashItems()
{
bool onCursor = false;
List<Item> items;
lock (ItemListLock)
{
items = new List<Item>(BotGameData.Items.Values);
}
foreach (Item i in items)
{
onCursor = false;
if (i.action == (uint)Item.Action.to_cursor)
onCursor = true;
else if (i.container == Item.ContainerType.inventory)
onCursor = false;
else
continue;
if (i.type == "tbk" || i.type == "cm1" || i.type == "cm2")
continue;
Coordinate stashLocation;
if (!BotGameData.Stash.FindFreeSpace(i, out stashLocation))
{
continue;
}
Console.WriteLine("{0}: [D2GS] Stashing item {1}, at {2}, {3}", Account, i.name, stashLocation.X, stashLocation.Y);
if (!onCursor)
{
SendPacket(0x19, BitConverter.GetBytes((UInt32)i.id));
Thread.Sleep(500);
}
SendPacket(0x18, BitConverter.GetBytes((UInt32)i.id), BitConverter.GetBytes((UInt32)stashLocation.X), BitConverter.GetBytes((UInt32)stashLocation.Y), new byte[] { 0x04, 0x00, 0x00, 0x00 });
Thread.Sleep(400);
}
}