/// <summary> /// Creates a notecard in the objects folder and specify an item id. /// </summary> /// <param name="scene"></param> /// <param name="itemName"></param> /// <param name="itemId"></param> /// <param name="assetId"></param> /// <param name="userId"></param> /// <param name="type">Type of item to create</param> /// <returns></returns> public static InventoryItemBase CreateInventoryItem( Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType itemType) { AssetBase asset = null; if (itemType == InventoryType.Notecard) { asset = AssetHelpers.CreateNotecardAsset(); asset.CreatorID = userId.ToString(); } else if (itemType == InventoryType.Object) { asset = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); } else { throw new Exception(string.Format("Inventory type {0} not supported", itemType)); } return(AddInventoryItem(scene, itemName, itemId, itemType, asset, userId)); }
/// <summary> /// Creates a notecard in the objects folder and specify an item id. /// </summary> /// <param name="scene"></param> /// <param name="itemName"></param> /// <param name="itemId"></param> /// <param name="assetId"></param> /// <param name="userId"></param> /// <param name="type">Type of item to create</param> /// <returns></returns> public static InventoryItemBase CreateInventoryItem( Scene scene, string itemName, UUID itemId, UUID assetId, UUID userId, InventoryType type) { AssetBase asset = null; if (type == InventoryType.Notecard) { asset = AssetHelpers.CreateNotecardAsset(); asset.CreatorID = userId.ToString(); } else if (type == InventoryType.Object) { asset = AssetHelpers.CreateAsset(assetId, SceneHelpers.CreateSceneObject(1, userId)); } else { throw new Exception(string.Format("Inventory type {0} not supported", type)); } scene.AssetService.Store(asset); InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; item.AssetID = asset.FullID; item.ID = itemId; item.Owner = userId; item.AssetType = asset.Type; item.InvType = (int)type; InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); item.Folder = folder.ID; scene.AddInventoryItem(item); return(item); }