diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scripting')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs index f08ba59..94653d5 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs | |||
@@ -93,15 +93,33 @@ namespace OpenSim.Region.Framework.Scenes.Scripting | |||
93 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type) | 93 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier, AssetType type) |
94 | { | 94 | { |
95 | UUID key; | 95 | UUID key; |
96 | if (UUID.TryParse(identifier, out key)) | ||
97 | return key; | ||
96 | 98 | ||
97 | if (!UUID.TryParse(identifier, out key)) | 99 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); |
100 | if (item != null && item.Type == (int)type) | ||
101 | return item.AssetID; | ||
102 | |||
103 | return UUID.Zero; | ||
104 | } | ||
105 | |||
106 | public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, SceneObjectPart host, string identifier, AssetType type) | ||
107 | { | ||
108 | UUID key; | ||
109 | if (UUID.TryParse(identifier, out key)) | ||
110 | return key; | ||
111 | |||
112 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | ||
113 | if (item != null && item.Type == (int)type) | ||
114 | return item.AssetID; | ||
115 | |||
116 | if (part.LocalId != host.LocalId) | ||
98 | { | 117 | { |
99 | TaskInventoryItem item = part.Inventory.GetInventoryItem(identifier); | 118 | item = host.Inventory.GetInventoryItem(identifier); |
100 | if (item != null && item.Type == (int)type) | 119 | if (item != null && item.Type == (int)type) |
101 | key = item.AssetID; | 120 | return item.AssetID; |
102 | } | 121 | } |
103 | 122 | return UUID.Zero; | |
104 | return key; | ||
105 | } | 123 | } |
106 | } | 124 | } |
107 | } \ No newline at end of file | 125 | } \ No newline at end of file |