public InventoryType RemoveItem(UUID itemID) { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; LLInventoryTaskItem item; if (items.TryGetValue(itemID, out item)) { items.Remove(itemID, item.Name); // Update the inventory serial number ++InventorySerial; // Post a script event // FIXME: //m_hostObject.Scene.ScriptEngine.PostObjectEvent(hostObject.Prim.ID, "changed", // new object[] { new ScriptTypes.LSL_Integer((uint)Changed.INVENTORY) }, new DetectParams[0]); // FIXME: Check if this prim still classifies as "scripted" return((InventoryType)LLUtil.ContentTypeToLLInvType(item.ContentType)); } else { return(InventoryType.Unknown); } }
public void AddOrUpdateItem(LLInventoryTaskItem item, bool replace) { item.ParentObjectID = m_hostObject.Prim.ID; DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; if (replace) { LLInventoryTaskItem oldItem; if (items.TryGetValue(item.Name, out oldItem)) { item.ID = oldItem.ID; items.Remove(item.ID, item.Name); } } else { item.Name = NextAvailableFilename(items, item.Name); } if (item.ID == UUID.Zero) { item.ID = UUID.Random(); } items.Add(item.ID, item.Name, item); // Update the inventory serial number ++InventorySerial; // Post a script event // FIXME: //Changed change = allowedDrop ? Changed.ALLOWED_DROP : Changed.INVENTORY; //m_hostObject.Scene.ScriptEngine.PostObjectEvent(m_hostObject.Prim.ID, "changed", // new object[] { new ScriptTypes.LSL_Integer((uint)change) }, new DetectParams[0]); }
private static string NextAvailableFilename(DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items, string name) { string tryName = name; int suffix = 1; while (items.ContainsKey(tryName) && suffix < 256) { tryName = String.Format("{0} {1}", name, suffix++); } return(tryName); }
public string GetTaskInventoryAsset() { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; TaskInventoryStringBuilder invString = new TaskInventoryStringBuilder(m_hostObject.Prim.ID, UUID.Zero); items.ForEach( delegate(LLInventoryTaskItem item) { invString.AddItemStart(); invString.AddNameValueLine("item_id", item.ID.ToString()); invString.AddNameValueLine("parent_id", m_hostObject.Prim.ID.ToString()); invString.AddPermissionsStart(); invString.AddNameValueLine("base_mask", Utils.UIntToHexString((uint)item.Permissions.BaseMask)); invString.AddNameValueLine("owner_mask", Utils.UIntToHexString((uint)item.Permissions.OwnerMask)); invString.AddNameValueLine("group_mask", Utils.UIntToHexString((uint)item.Permissions.GroupMask)); invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString((uint)item.Permissions.EveryoneMask)); invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString((uint)item.Permissions.NextOwnerMask)); invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); invString.AddNameValueLine("last_owner_id", item.CreatorID.ToString()); // FIXME: Do we need InventoryItem.LastOwnerID? invString.AddNameValueLine("group_id", item.GroupID.ToString()); invString.AddSectionEnd(); invString.AddNameValueLine("asset_id", item.AssetID.ToString()); invString.AddNameValueLine("type", Utils.AssetTypeToString(item.AssetType)); invString.AddNameValueLine("inv_type", Utils.InventoryTypeToString(item.InventoryType)); invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); invString.AddSaleStart(); invString.AddNameValueLine("sale_type", Utils.SaleTypeToString(item.SaleType)); invString.AddNameValueLine("sale_price", item.SalePrice.ToString()); invString.AddSectionEnd(); invString.AddNameValueLine("name", item.Name + "|"); invString.AddNameValueLine("desc", item.Description + "|"); invString.AddNameValueLine("creation_date", Utils.DateTimeToUnixTime(item.CreationDate).ToString()); invString.AddSectionEnd(); } ); return(invString.ToString()); }
public void Start(IScene scene) { m_scene = scene; m_dataStore = m_scene.Simian.GetAppModule <IDataStore>(); // Set the prims per square meter value m_primsPerSquareMeter = DEFAULT_PRIMS_PER_SQM; IConfig config = scene.Config.Configs["LindenRegion"]; if (config != null) { // Parse the floating point value as a string and convert manually to avoid // localization issues. This hack should be removed when we fix our build of Nini // to always parse with EnUsCulture string primsPerSquareMeterStr = config.GetString("PrimsPerSquareMeter", DEFAULT_PRIMS_PER_SQM.ToString()); if (!Single.TryParse(primsPerSquareMeterStr, System.Globalization.NumberStyles.Float, Utils.EnUsCulture.NumberFormat, out m_primsPerSquareMeter)) { m_primsPerSquareMeter = DEFAULT_PRIMS_PER_SQM; } } m_parcels = new DoubleDictionarySlim <UUID, int, SceneParcel>(); m_parcelOverlay = new int[64 * 64]; // Load serialized parcel information if we have any Deserialize(); if (m_currentParcelID == 0) { // Create a default parcel if nothing was serialized CreateDefaultParcel(); } // Put all of the initial scene entities in parcels m_scene.ForEachEntity(AddEntityToParcel); m_scene.OnEntitySignificantMovement += EntitySignificantMovementHandler; }
public void FromTaskInventoryAsset(string asset) { if (String.IsNullOrEmpty(asset)) { if (m_items != null) { m_items.Clear(); } return; } DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = new DoubleDictionarySlim <UUID, string, LLInventoryTaskItem>(); List <LLInventoryTaskItem> parsedItems = ParseTaskInventory(m_hostObject.ID, asset); for (int i = 0; i < parsedItems.Count; i++) { LLInventoryTaskItem item = parsedItems[i]; items.Add(item.ID, item.Name, item); } Items = items; }
public void Start(IScene scene) { m_scene = scene; m_dataStore = m_scene.Simian.GetAppModule<IDataStore>(); // Set the prims per square meter value m_primsPerSquareMeter = DEFAULT_PRIMS_PER_SQM; IConfig config = scene.Config.Configs["LindenRegion"]; if (config != null) { // Parse the floating point value as a string and convert manually to avoid // localization issues. This hack should be removed when we fix our build of Nini // to always parse with EnUsCulture string primsPerSquareMeterStr = config.GetString("PrimsPerSquareMeter", DEFAULT_PRIMS_PER_SQM.ToString()); if (!Single.TryParse(primsPerSquareMeterStr, out m_primsPerSquareMeter)) m_primsPerSquareMeter = DEFAULT_PRIMS_PER_SQM; } m_parcels = new DoubleDictionarySlim<UUID, int, SceneParcel>(); m_parcelOverlay = new int[64 * 64]; // Load serialized parcel information if we have any Deserialize(); if (m_currentParcelID == 0) { // Create a default parcel if nothing was serialized CreateDefaultParcel(); } // Put all of the initial scene entities in parcels m_scene.ForEachEntity(AddEntityToParcel); m_scene.OnEntitySignificantMovement += EntitySignificantMovementHandler; }
private static string NextAvailableFilename(DoubleDictionarySlim<UUID, string, LLInventoryTaskItem> items, string name) { string tryName = name; int suffix = 1; while (items.ContainsKey(tryName) && suffix < 256) tryName = String.Format("{0} {1}", name, suffix++); return tryName; }
public void FromTaskInventoryAsset(string asset) { if (String.IsNullOrEmpty(asset)) { if (m_items != null) m_items.Clear(); return; } DoubleDictionarySlim<UUID, string, LLInventoryTaskItem> items = new DoubleDictionarySlim<UUID, string, LLInventoryTaskItem>(); List<LLInventoryTaskItem> parsedItems = ParseTaskInventory(m_hostObject.ID, asset); for (int i = 0; i < parsedItems.Count; i++) { LLInventoryTaskItem item = parsedItems[i]; items.Add(item.ID, item.Name, item); } Items = items; }
public IList <LLInventoryTaskItem> FindAllItems(Predicate <LLInventoryTaskItem> match) { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; return(items.FindAll(match)); }
public LLInventoryTaskItem FindItem(Predicate <LLInventoryTaskItem> match) { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; return(items.FindValue(match)); }
public void ForEachItem(Action <LLInventoryTaskItem> action) { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; items.ForEach(action); }
public bool TryGetItem(string name, out LLInventoryTaskItem item) { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; return(items.TryGetValue(name, out item)); }
public IList <LLInventoryTaskItem> GetScripts() { DoubleDictionarySlim <UUID, string, LLInventoryTaskItem> items = Items; return(items.FindAll(delegate(LLInventoryTaskItem match) { return match.AssetType == AssetType.LSLText; })); }