mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
cosmetics
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
@@ -64,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
||||
/// <returns></returns>
|
||||
public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier)
|
||||
{
|
||||
if(string.IsNullOrEmpty(identifier))
|
||||
if(string.IsNullOrEmpty(identifier) || part.Inventory is null)
|
||||
return UUID.Zero;
|
||||
|
||||
// if we can parse the string as a key, use it.
|
||||
@@ -73,14 +71,8 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
||||
if (UUID.TryParse(identifier, out UUID key))
|
||||
return key;
|
||||
|
||||
if (part.Inventory != null)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
|
||||
if (item != null)
|
||||
return item.AssetID;
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier);
|
||||
return item is not null ? item.AssetID : UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,17 +85,11 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
||||
/// <returns></returns>
|
||||
public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type)
|
||||
{
|
||||
if (UUID.TryParse(identifier, out UUID key))
|
||||
if (UUID.TryParse(identifier, out UUID key) || part.Inventory is null)
|
||||
return key;
|
||||
|
||||
if (part.Inventory is not null)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier, (int)type);
|
||||
if (item is not null)
|
||||
return item.AssetID;
|
||||
}
|
||||
|
||||
return UUID.Zero;
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier, (int)type);
|
||||
return item is not null ? item.AssetID : UUID.Zero;
|
||||
}
|
||||
|
||||
public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, SceneObjectPart host, string identifier, AssetType type)
|
||||
|
||||
Reference in New Issue
Block a user