diff --git a/libsecondlife/AppearanceManager.cs b/libsecondlife/AppearanceManager.cs index e91b52d7..ce995ed0 100644 --- a/libsecondlife/AppearanceManager.cs +++ b/libsecondlife/AppearanceManager.cs @@ -549,7 +549,7 @@ namespace libsecondlife /// the on the avatar /// to attach the item to public void Attach(LLUUID itemID, LLUUID ownerID, string name, string description, - Permissions perms, InventoryItemFlags itemFlags, AttachmentPoint attachPoint) + Permissions perms, uint itemFlags, AttachmentPoint attachPoint) { // TODO: At some point it might be beneficial to have AppearanceManager track what we // are currently wearing for attachments to make enumeration and detachment easier @@ -563,7 +563,7 @@ namespace libsecondlife attach.ObjectData.Description = Helpers.StringToField(description); attach.ObjectData.EveryoneMask = (uint)perms.EveryoneMask; attach.ObjectData.GroupMask = (uint)perms.GroupMask; - attach.ObjectData.ItemFlags = (uint)itemFlags; + attach.ObjectData.ItemFlags = itemFlags; attach.ObjectData.ItemID = itemID; attach.ObjectData.Name = Helpers.StringToField(name); attach.ObjectData.NextOwnerMask = (uint)perms.NextOwnerMask; diff --git a/libsecondlife/AssetTypes.cs b/libsecondlife/AssetTypes.cs index 63373089..789e609b 100644 --- a/libsecondlife/AssetTypes.cs +++ b/libsecondlife/AssetTypes.cs @@ -30,24 +30,71 @@ using System.Collections.Generic; namespace libsecondlife { + /// + /// + /// + [Flags] public enum WearableType : byte { + /// A shape Shape = 0, + /// Skin, + /// Hair, + /// Eyes, + /// Shirt, + /// Pants, + /// Shoes, + /// Socks, + /// Jacket, + /// Gloves, + /// Undershirt, + /// Underpants, + /// Skirt, + /// Invalid = 255 }; + /// + /// Each inventory AssetType will have its own set of flags, these are the known flags for AssetType=Object + /// + [Flags] + public enum ObjectType : uint + { + None = 0, + /// + /// A Landmark that has not been previously visited shows up as a dark red pushpin, one that has been + /// visited shows up as a light red pushpin + /// + VisitedLandmark = 1, + /// If set, indicates rezzed object will have more restrictive permissions masks; + /// Which masks will be affected are below + RestrictNextOwner = 0x100, + /// If set, and RestrictNextOwner bit is set indicates BaseMask will be overwritten on Rez + OverwriteBase = 0x010000, + /// If set, and RestrictNextOwner bit is set indicates OwnerMask will be overwritten on Rez + OverwriteOwner = 0x020000, + /// If set, and RestrictNextOwner bit is set indicates GroupMask will be overwritten on Rez + OverwriteGroup = 0x040000, + /// If set, and RestrictNextOwner bit is set indicates EveryoneMask will be overwritten on Rez + OverwriteEveryone = 0x080000, + /// If set, and RestrictNextOwner bit is set indicates NextOwnerMask will be overwritten on Rez + OverwriteNextOwner = 0x100000, + /// If set, indicates item is multiple items coalesced into a single item + MultipleObjects = 0x200000 + } + public abstract class Asset { public byte[] AssetData; diff --git a/libsecondlife/InventoryManager.cs b/libsecondlife/InventoryManager.cs index 93307290..9862f926 100644 --- a/libsecondlife/InventoryManager.cs +++ b/libsecondlife/InventoryManager.cs @@ -64,7 +64,7 @@ namespace libsecondlife /// Folder Folder = 8, /// - RootCategory = 0, + RootCategory = 9, /// an LSL Script LSL = 10, /// @@ -89,36 +89,6 @@ namespace libsecondlife Gesture = 20 } - /// - /// - /// - [Flags] - public enum InventoryItemFlags : uint - { - None = 0, - /// - /// A Landmark that has not been previously visited shows up as a dark red pushpin, one that has been - /// visited shows up as a light red pushpin - /// - VisitedLandmark = 1, - /// If set, indicates rezzed object will have more restrictive permissions masks; - /// Which masks will be affected are below - RestrictNextOwner = 0x100, - /// If set, and RestrictNextOwner bit is set indicates BaseMask will be overwritten on Rez - OverwriteBase = 0x010000, - /// If set, and RestrictNextOwner bit is set indicates OwnerMask will be overwritten on Rez - OverwriteOwner = 0x020000, - /// If set, and RestrictNextOwner bit is set indicates GroupMask will be overwritten on Rez - OverwriteGroup = 0x040000, - /// If set, and RestrictNextOwner bit is set indicates EveryoneMask will be overwritten on Rez - OverwriteEveryone = 0x080000, - /// If set, and RestrictNextOwner bit is set indicates NextOwnerMask will be overwritten on Rez - OverwriteNextOwner = 0x100000, - /// If set, indicates item is multiple items coalesced into a single item - MultipleObjects = 0x200000 - } - - /// /// Item Sale Status /// @@ -237,7 +207,7 @@ namespace libsecondlife /// The type of sale from the enum public SaleType SaleType; /// Combined flags from - public InventoryItemFlags Flags; + public uint Flags; /// Time and date this inventory item was created, stored as /// UTC (Coordinated Universal Time) public DateTime CreationDate; @@ -359,7 +329,7 @@ namespace libsecondlife public InventoryCallingCard(LLUUID itemID) : base(itemID) { InventoryType = InventoryType.CallingCard; - } + } } /// @@ -375,7 +345,16 @@ namespace libsecondlife public InventoryLandmark(LLUUID itemID) : base(itemID) { InventoryType = InventoryType.Landmark; - } + } + + /// + /// Landmarks use the ObjectType struct and will have a flag of 1 set if they have been visited + /// + public ObjectType LandmarkType + { + get { return (ObjectType)Flags; } + set { Flags = (uint)value; } + } } /// @@ -391,7 +370,19 @@ namespace libsecondlife public InventoryObject(LLUUID itemID) : base(itemID) { InventoryType = InventoryType.Object; - } + } + + /// + /// Get the Objects permission override settings + /// + /// These will indicate the which permissions that + /// will be overwritten when the object is rezzed in-world + /// + public ObjectType ObjectType + { + get { return (ObjectType)Flags; } + set { Flags = (uint)value; } + } } /// @@ -472,7 +463,16 @@ namespace libsecondlife public InventoryAttachment(LLUUID itemID) : base(itemID) { InventoryType = InventoryType.Attachment; - } + } + + /// + /// Get the last AttachmentPoint this object was attached to + /// + public AttachmentPoint AttachmentPoint + { + get { return (AttachmentPoint)Flags; } + set { Flags = (uint)value; } + } } /// @@ -493,7 +493,7 @@ namespace libsecondlife public WearableType WearableType { get { return (WearableType)Flags; } - set { Flags = (InventoryItemFlags)value; } + set { Flags = (uint)value; } } } @@ -643,6 +643,7 @@ namespace libsecondlife /// /// public delegate void ItemCopiedCallback(InventoryBase item); + /// /// /// @@ -2212,7 +2213,7 @@ namespace libsecondlife /// Remove an item from an objects (Prim) Inventory /// /// LocalID of the object in the simulator - /// UUID of the task item to remove + /// LLUUID of the task item to remove /// Simulator Object public void RemoveTaskInventory(uint objectLocalID, LLUUID taskItemID, Simulator simulator) { @@ -2230,11 +2231,21 @@ namespace libsecondlife #region Helper Functions + /// + /// Takes an AssetType and returns the string representation + /// + /// The source + /// The string version of the AssetType public static string AssetTypeToString(AssetType type) { return _AssetTypeNames[(int)type]; } + /// + /// Translate a string name of an AssetType into the proper Type + /// + /// A string containing the AssetType name + /// The AssetType which matches the string name, or AssetType.Unknown if no match was found public static AssetType StringToAssetType(string type) { for (int i = 0; i < _AssetTypeNames.Length; i++) @@ -2257,7 +2268,7 @@ namespace libsecondlife } /// - /// Converty a string into a valid InventoryType + /// Convert a string into a valid InventoryType /// /// A string representation of the InventoryType to convert /// A InventoryType object which matched the type @@ -2436,7 +2447,7 @@ namespace libsecondlife } /// - /// Parse the results of a tasks inventory reply + /// Parse the results of a RequestTaskInventory() response /// /// A string which contains the data from the task reply /// A List containing the items contained within the tasks inventory @@ -2709,7 +2720,7 @@ namespace libsecondlife item.CreationDate = creationDate; item.CreatorID = creatorID; item.Description = desc; - item.Flags = (InventoryItemFlags)flags; + item.Flags = flags; item.GroupID = groupID; item.GroupOwned = groupOwned; item.Name = name; @@ -2826,14 +2837,34 @@ namespace libsecondlife { if (reply.ItemData[i].ItemID != LLUUID.Zero) { - InventoryItem item = CreateInventoryItem((InventoryType)reply.ItemData[i].InvType,reply.ItemData[i].ItemID); + InventoryItem item; + /* + * Objects that have been attached in-world prior to being stored on the + * asset server are stored with the InventoryType of 0 (Texture) + * instead of 17 (Attachment) + * + * This corrects that behavior by forcing Object Asset types that have an + * invalid InventoryType with the proper InventoryType of Attachment. + */ + if ((AssetType)reply.ItemData[i].Type == AssetType.Object + && (InventoryType)reply.ItemData[i].InvType == InventoryType.Texture) + { + item = CreateInventoryItem(InventoryType.Attachment, reply.ItemData[i].ItemID); + item.InventoryType = InventoryType.Attachment; + } + else + { + item = CreateInventoryItem((InventoryType)reply.ItemData[i].InvType, reply.ItemData[i].ItemID); + item.InventoryType = (InventoryType)reply.ItemData[i].InvType; + } + item.ParentUUID = reply.ItemData[i].FolderID; item.CreatorID = reply.ItemData[i].CreatorID; item.AssetType = (AssetType)reply.ItemData[i].Type; item.AssetUUID = reply.ItemData[i].AssetID; item.CreationDate = Helpers.UnixTimeToDateTime((uint)reply.ItemData[i].CreationDate); item.Description = Helpers.FieldToUTF8String(reply.ItemData[i].Description); - item.Flags = (InventoryItemFlags)reply.ItemData[i].Flags; + item.Flags = reply.ItemData[i].Flags; item.Name = Helpers.FieldToUTF8String(reply.ItemData[i].Name); item.GroupID = reply.ItemData[i].GroupID; item.GroupOwned = reply.ItemData[i].GroupOwned; @@ -2969,7 +3000,7 @@ namespace libsecondlife item.CreationDate = Helpers.UnixTimeToDateTime(dataBlock.CreationDate); item.CreatorID = dataBlock.CreatorID; item.Description = Helpers.FieldToUTF8String(dataBlock.Description); - item.Flags = (InventoryItemFlags)dataBlock.Flags; + item.Flags = dataBlock.Flags; item.GroupID = dataBlock.GroupID; item.GroupOwned = dataBlock.GroupOwned; item.Name = Helpers.FieldToUTF8String(dataBlock.Name); @@ -3059,6 +3090,8 @@ namespace libsecondlife { BulkUpdateInventoryPacket.ItemDataBlock dataBlock = update.ItemData[i]; + // If we are given a folder of items, the item information might arrive before the folder + // (parent) is in the store if (!_Store.Contains(dataBlock.ItemID)) _Client.Log("Received BulkUpdate for unknown item: " + dataBlock.ItemID, Helpers.LogLevel.Warning); @@ -3069,7 +3102,7 @@ namespace libsecondlife item.CreationDate = Helpers.UnixTimeToDateTime(dataBlock.CreationDate); item.CreatorID = dataBlock.CreatorID; item.Description = Helpers.FieldToUTF8String(dataBlock.Description); - item.Flags = (InventoryItemFlags)dataBlock.Flags; + item.Flags = dataBlock.Flags; item.GroupID = dataBlock.GroupID; item.GroupOwned = dataBlock.GroupOwned; item.Name = Helpers.FieldToUTF8String(dataBlock.Name); @@ -3128,7 +3161,7 @@ namespace libsecondlife item.CreationDate = Helpers.UnixTimeToDateTime(dataBlock.CreationDate); item.CreatorID = dataBlock.CreatorID; item.Description = Helpers.FieldToUTF8String(dataBlock.Description); - item.Flags = (InventoryItemFlags)dataBlock.Flags; + item.Flags = dataBlock.Flags; item.GroupID = dataBlock.GroupID; item.GroupOwned = dataBlock.GroupOwned; item.Name = Helpers.FieldToUTF8String(dataBlock.Name); diff --git a/libsecondlife/ObjectManager.cs b/libsecondlife/ObjectManager.cs index b3ee35c4..6e385953 100644 --- a/libsecondlife/ObjectManager.cs +++ b/libsecondlife/ObjectManager.cs @@ -59,9 +59,6 @@ namespace libsecondlife /// /// /// Both InventoryObject and InventoryAttachment types can be attached - /// - /// The last attachment point is stored on the simulator and is not known - /// to the client until item is attached /// public enum AttachmentPoint : byte { @@ -252,7 +249,15 @@ namespace libsecondlife /// Sit on object Sit = 1, /// Purchase object or contents - Buy = 2 + Buy = 2, + /// Pay the object + Pay = 3, + /// Open task inventory + OpenTask = 4, + /// Play parcel media + PlayMedia = 5, + /// Open parcel media + OpenMedia = 6 } #endregion Enums