From ee22569c9262277467df9a4b15674a1472fa0b71 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 11 Aug 2011 02:19:13 +0100 Subject: only accept npc UUIDs to osNpc* functions, not names (except for create) --- .../Shared/Api/Implementation/OSSL_Api.cs | 26 +++++++++------------- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++--- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 12 +++++----- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 71fc15f..91ac3b7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2153,7 +2153,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// The name of the notecard to which to save the appearance. /// The asset ID of the notecard saved. - public LSL_Key osNpcSaveAppearance(string avatar, string notecardName) + public LSL_Key osNpcSaveAppearance(LSL_Key npc, string notecardName) { CheckThreatLevel(ThreatLevel.High, "osNpcSaveAppearance"); @@ -2161,20 +2161,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) - return new LSL_Key(UUID.Zero.ToString()); + UUID npcId = new UUID(npc.m_string); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return new LSL_Key(UUID.Zero.ToString()); - return SaveAppearanceToNotecard(avatarId, notecardName); + return SaveAppearanceToNotecard(npcId, notecardName); } return new LSL_Key(UUID.Zero.ToString()); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(LSL_Key npc, string notecardNameOrUuid) { CheckThreatLevel(ThreatLevel.High, "osNpcLoadAppearance"); @@ -2182,11 +2180,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (npcModule != null) { - UUID avatarId = UUID.Zero; - if (!UUID.TryParse(avatar, out avatarId)) - return; + UUID npcId = new UUID(npc.m_string); - if (!npcModule.IsNPC(avatarId, m_host.ParentGroup.Scene)) + if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) return; string appearanceSerialized = LoadNotecard(notecardNameOrUuid); @@ -2197,7 +2193,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api AvatarAppearance appearance = new AvatarAppearance(); appearance.Unpack(appearanceOsd); - npcModule.SetNPCAppearance(avatarId, appearance, m_host.ParentGroup.Scene); + npcModule.SetNPCAppearance(npcId, appearance, m_host.ParentGroup.Scene); } } @@ -2213,7 +2209,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int moveParams) + public void osNpcMoveToTarget(LSL_Key npc, LSL_Vector position, int options) { CheckThreatLevel(ThreatLevel.High, "osNpcMoveToTarget"); @@ -2225,8 +2221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api new UUID(npc.m_string), World, pos, - (moveParams & ScriptBaseClass.OS_NPC_NO_FLY) != 0, - (moveParams & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); + (options & ScriptBaseClass.OS_NPC_NO_FLY) != 0, + (options & ScriptBaseClass.OS_NPC_LAND_AT_TARGET) != 0); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 56be9d9..f4a618b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -170,10 +170,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces key osNpcCreate(string user, string name, vector position, key cloneFrom); - LSL_Key osNpcSaveAppearance(string avatar, string notecardName); - void osNpcLoadAppearance(string avatar, string notecardNameOrUuid); + LSL_Key osNpcSaveAppearance(key npc, string notecardName); + void osNpcLoadAppearance(key npc, string notecardNameOrUuid); void osNpcMoveTo(key npc, vector position); - void osNpcMoveToTarget(key npc, vector position, int noFly); + void osNpcMoveToTarget(key npc, vector position, int options); void osNpcStopMoveTo(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcRemove(key npc); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c745e5c..84d61f4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -483,14 +483,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); } - public key osNpcSaveAppearance(string avatar, string notecardName) + public key osNpcSaveAppearance(key npc, string notecardName) { - return m_OSSL_Functions.osNpcSaveAppearance(avatar, notecardName); + return m_OSSL_Functions.osNpcSaveAppearance(npc, notecardName); } - public void osNpcLoadAppearance(string avatar, string notecardNameOrUuid) + public void osNpcLoadAppearance(key npc, string notecardNameOrUuid) { - m_OSSL_Functions.osNpcLoadAppearance(avatar, notecardNameOrUuid); + m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid); } public void osNpcMoveTo(key npc, vector position) @@ -498,9 +498,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcMoveTo(npc, position); } - public void osNpcMoveToTarget(key npc, vector position, int noFly) + public void osNpcMoveToTarget(key npc, vector position, int options) { - m_OSSL_Functions.osNpcMoveToTarget(npc, position, noFly); + m_OSSL_Functions.osNpcMoveToTarget(npc, position, options); } public void osNpcStopMoveTo(LSL_Key npc) -- cgit v1.1