Example #1
0
 public FetchRequest(FetchItemsCallback callback, ICollection<UUID> requestedItems)
 {
     ItemsFetched = 0;
     Callback = callback;
     RequestedItems = new Dictionary<UUID, ItemData?>(requestedItems.Count);
     foreach (UUID uuid in requestedItems)
         RequestedItems.Add(uuid, null);
 }
Example #2
0
        /// <summary>
        /// Request inventory items
        /// </summary>
        /// <param name="itemIDs">Inventory items to request</param>
        /// <param name="ownerID">Owners of the inventory items</param>
        /// <param name="callback"></param>
        /// <seealso cref="InventoryManager.OnItemReceived"/>
        public void RequestFetchItems(ICollection<UUID> itemIDs, UUID ownerID, FetchItemsCallback callback)
        {
            FetchRequest request = new FetchRequest(callback, itemIDs);
            lock (_FetchRequests)
                _FetchRequests.Add(request);

            // Send the packet:
            FetchInventoryPacket fetch = new FetchInventoryPacket();
            fetch.AgentData = new FetchInventoryPacket.AgentDataBlock();
            fetch.AgentData.AgentID = _Agents.AgentID;
            fetch.AgentData.SessionID = _Agents.SessionID;

            fetch.InventoryData = new FetchInventoryPacket.InventoryDataBlock[itemIDs.Count];
            int i = 0;
            foreach (UUID item in itemIDs)
            {
                fetch.InventoryData[i] = new FetchInventoryPacket.InventoryDataBlock();
                fetch.InventoryData[i].ItemID = item;
                fetch.InventoryData[i].OwnerID = ownerID;
                ++i;
            }

            _Network.SendPacket(fetch);
        }