diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b18aa3b..939602a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2165,7 +2165,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2165 | 2165 | ||
2166 | if (npcModule != null) | 2166 | if (npcModule != null) |
2167 | { | 2167 | { |
2168 | UUID npcId = new UUID(npc.m_string); | 2168 | UUID npcId; |
2169 | if (!UUID.TryParse(npc.m_string, out npcId)) | ||
2170 | return new LSL_Key(UUID.Zero.ToString()); | ||
2169 | 2171 | ||
2170 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | 2172 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) |
2171 | return new LSL_Key(UUID.Zero.ToString()); | 2173 | return new LSL_Key(UUID.Zero.ToString()); |
@@ -2273,14 +2275,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2273 | return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); | 2275 | return SaveAppearanceToNotecard(m_host.OwnerID, notecardName); |
2274 | } | 2276 | } |
2275 | 2277 | ||
2276 | protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) | 2278 | public LSL_Key osAgentSaveAppearance(LSL_Key avatarId, string notecardName) |
2279 | { | ||
2280 | CheckThreatLevel(ThreatLevel.VeryHigh, "osAgentSaveAppearance"); | ||
2281 | |||
2282 | return SaveAppearanceToNotecard(avatarId, notecardName); | ||
2283 | } | ||
2284 | |||
2285 | protected LSL_Key SaveAppearanceToNotecard(ScenePresence sp, string notecardName) | ||
2277 | { | 2286 | { |
2278 | IAvatarFactory appearanceModule = World.RequestModuleInterface<IAvatarFactory>(); | 2287 | IAvatarFactory appearanceModule = World.RequestModuleInterface<IAvatarFactory>(); |
2279 | 2288 | ||
2280 | if (appearanceModule != null) | 2289 | if (appearanceModule != null) |
2281 | { | 2290 | { |
2282 | appearanceModule.SaveBakedTextures(m_host.OwnerID); | 2291 | appearanceModule.SaveBakedTextures(sp.UUID); |
2283 | ScenePresence sp = m_host.ParentGroup.Scene.GetScenePresence(m_host.OwnerID); | ||
2284 | OSDMap appearancePacked = sp.Appearance.Pack(); | 2292 | OSDMap appearancePacked = sp.Appearance.Pack(); |
2285 | 2293 | ||
2286 | TaskInventoryItem item | 2294 | TaskInventoryItem item |
@@ -2293,6 +2301,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2293 | return new LSL_Key(UUID.Zero.ToString()); | 2301 | return new LSL_Key(UUID.Zero.ToString()); |
2294 | } | 2302 | } |
2295 | } | 2303 | } |
2304 | |||
2305 | protected LSL_Key SaveAppearanceToNotecard(UUID avatarId, string notecardName) | ||
2306 | { | ||
2307 | ScenePresence sp = World.GetScenePresence(avatarId); | ||
2308 | |||
2309 | if (sp == null || sp.IsChildAgent) | ||
2310 | return new LSL_Key(UUID.Zero.ToString()); | ||
2311 | |||
2312 | return SaveAppearanceToNotecard(sp, notecardName); | ||
2313 | } | ||
2314 | |||
2315 | protected LSL_Key SaveAppearanceToNotecard(LSL_Key rawAvatarId, string notecardName) | ||
2316 | { | ||
2317 | UUID avatarId; | ||
2318 | if (!UUID.TryParse(rawAvatarId, out avatarId)) | ||
2319 | return new LSL_Key(UUID.Zero.ToString()); | ||
2320 | |||
2321 | return SaveAppearanceToNotecard(avatarId, notecardName); | ||
2322 | } | ||
2296 | 2323 | ||
2297 | /// <summary> | 2324 | /// <summary> |
2298 | /// Get current region's map texture UUID | 2325 | /// Get current region's map texture UUID |