From 06a35b955944f3da8229b9e15ac3602a8de50654 Mon Sep 17 00:00:00 2001 From: Mandarinka Tasty Date: Sat, 22 Sep 2018 07:21:13 +0200 Subject: [PATCH] llName2Key. Thanks to mewtwo0641 and watcher64. Signed-off-by: UbitUmarov --- .../Shared/Api/Implementation/LSL_Api.cs | 20 +++++++++++++++++++ .../Shared/Api/Interface/ILSL_Api.cs | 1 + .../Shared/Api/Runtime/LSL_Stub.cs | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6a61670f79..36f8a28520 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6844,6 +6844,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; } + public LSL_Key llName2Key(string name) + { + m_host.AddScriptLPS(1); + + foreach (ScenePresence sp in World.GetScenePresences()) + { + string test = sp.ControllingClient.Name; + if (!name.Contains(" ")) + test = test.Replace(" ", "."); + + if (String.Compare(name, test, true) == 0) + { + if (!sp.IsNPC) + return sp.UUID.ToString(); + } + } + + return UUID.Zero.ToString(); + } + public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 11f671053d..c924844418 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -225,6 +225,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llInstantMessage(string user, string message); LSL_String llIntegerToBase64(int number); LSL_String llKey2Name(string id); + LSL_Key llName2Key(string name); LSL_String llGetUsername(string id); LSL_Key llRequestUsername(string id); LSL_String llGetDisplayName(string id); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index cafcf379a8..10300d6d48 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -961,6 +961,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_LSL_Functions.llKey2Name(id); } + public LSL_Key llName2Key(string name) + { + return m_LSL_Functions.llName2Key(name); + } + public LSL_String llGetUsername(string id) { return m_LSL_Functions.llGetUsername(id);