diff --git a/libsecondlife/InventoryManager.cs b/libsecondlife/InventoryManager.cs index 4acdc3e4..b74501a4 100644 --- a/libsecondlife/InventoryManager.cs +++ b/libsecondlife/InventoryManager.cs @@ -118,6 +118,19 @@ namespace libsecondlife SystemFoldersToTop = 4 } + /// + /// Possible destinations for DeRezObject request + /// + public enum DeRezDestination : byte + { + /// Derez to TaskInventory + TaskInventory = 2, + /// Take Object + ObjectsFolder = 4, + /// Delete Object + TrashFolder = 6 + } + #endregion Enums #region Inventory Object Classes @@ -1999,6 +2012,47 @@ namespace libsecondlife return queryID; } + /// + /// DeRez an object from the simulator to the agents Objects folder in the agents Inventory + /// + /// The simulator Local ID of the object + public void RequestDeRezToInventory(uint objectLocalID) + { + RequestDeRezToInventory(objectLocalID, DeRezDestination.ObjectsFolder, + _Client.Inventory.FindFolderForType(AssetType.Object), LLUUID.Random()); + } + + /// + /// DeRez an object from the simulator and return to inventory + /// + /// The simulator Local ID of the object + /// The type of destination from the enum + /// The destination inventory folders -or- + /// if DeRezzing object to a tasks Inventory, the Tasks + /// The transaction ID for this request which + /// can be used to correlate this request with other packets + public void RequestDeRezToInventory(uint objectLocalID, DeRezDestination destType, LLUUID destFolder, LLUUID transactionID) + { + DeRezObjectPacket take = new DeRezObjectPacket(); + + take.AgentData.AgentID = _Client.Self.AgentID; + take.AgentData.SessionID = _Client.Self.SessionID; + take.AgentBlock = new DeRezObjectPacket.AgentBlockBlock(); + take.AgentBlock.GroupID = LLUUID.Zero; + take.AgentBlock.Destination = (byte)destType; + take.AgentBlock.DestinationID = destFolder; + take.AgentBlock.PacketCount = 1; + take.AgentBlock.PacketNumber = 1; + take.AgentBlock.TransactionID = transactionID; + + take.ObjectData = new DeRezObjectPacket.ObjectDataBlock[1]; + take.ObjectData[0] = new DeRezObjectPacket.ObjectDataBlock(); + take.ObjectData[0].ObjectLocalID = objectLocalID; + + _Client.Network.SendPacket(take); + } + + /// /// Give an inventory item to another avatar ///