Пример #1
0
        private void MoveTaskInventoryHandler(Packet packet, LLAgent agent)
        {
            MoveTaskInventoryPacket move = (MoveTaskInventoryPacket)packet;

            if (m_inventory != null)
            {
                LLInventoryTaskItem item;
                ISceneEntity        sourceObj;

                if (m_scene.TryGetEntity(move.InventoryData.LocalID, out sourceObj) && sourceObj is LLPrimitive)
                {
                    LLPrimitive sourcePrim = (LLPrimitive)sourceObj;

                    if (sourcePrim.Inventory.TryGetItem(move.InventoryData.ItemID, out item))
                    {
                        InventoryBase obj;
                        if (m_inventory.TryGetInventory(agent.ID, move.AgentData.FolderID, out obj) && obj is InventoryFolder)
                        {
                            LLInventoryItem invItem = new LLInventoryItem
                            {
                                AssetID      = item.AssetID,
                                ContentType  = item.ContentType,
                                CreationDate = item.CreationDate,
                                CreatorID    = item.CreatorID,
                                Description  = item.Description,
                                ExtraData    = item.ExtraData,
                                ID           = UUID.Random(),
                                Name         = item.Name,
                                OwnerID      = agent.ID,
                                ParentID     = move.AgentData.FolderID
                            };

                            if (m_inventory.TryCreateItem(agent.ID, invItem))
                            {
                                RemoveTaskInventory(agent, sourcePrim, item.ID);
                                SendItemCreatedPacket(agent, invItem, UUID.Zero, 0);
                                m_log.Debug(agent.Name + " moved task inventory item " + item.Name + " to agent inventory folder " + invItem.ParentID);
                            }
                            else
                            {
                                m_log.Warn(agent.Name + "attempted to move item " + move.InventoryData.ItemID +
                                           " to agent inventory folder " + move.AgentData.FolderID + " but item creation failed");
                            }
                        }
                        else
                        {
                            m_log.Warn(agent.Name + "attempted to move item " + move.InventoryData.ItemID +
                                       " to unknown agent inventory folder " + move.AgentData.FolderID);
                        }
                    }
                }
            }
            else
            {
                m_log.Warn(agent.Name + "attempted to move item " + move.InventoryData.ItemID +
                           " to agent inventory, but we have no IInventoryClient");
            }
        }
Пример #2
0
        /// <summary>
        /// Move an item from a tasks (Primitive) inventory to the specified folder in the avatars inventory
        /// </summary>
        /// <param name="objectLocalID">LocalID of the object in the simulator</param>
        /// <param name="taskItemID">UUID of the task item to move</param>
        /// <param name="inventoryFolderID">The ID of the destination folder in this agents inventory</param>
        /// <param name="simulator">Simulator Object</param>
        /// <remarks>Raises the <see cref="OnTaskItemReceived"/> event</remarks>
        public void MoveTaskInventory(uint objectLocalID, UUID taskItemID, UUID inventoryFolderID, Simulator simulator)
        {
            MoveTaskInventoryPacket request = new MoveTaskInventoryPacket();
            request.AgentData.AgentID = Client.Self.AgentID;
            request.AgentData.SessionID = Client.Self.SessionID;

            request.AgentData.FolderID = inventoryFolderID;

            request.InventoryData.ItemID = taskItemID;
            request.InventoryData.LocalID = objectLocalID;

            Client.Network.SendPacket(request, simulator);
        }