From d4e285b1a1da036220d9b3a7141ebe1b865c5d35 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 6 Dec 2016 17:05:02 +0000 Subject: add osNpcSetProfileAbout(LSL_Key npc, string about) to set NPCs profile About text. requires OsNpcCreate rights --- .../Avatar/UserProfiles/UserProfileModule.cs | 4 ++-- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 1 + OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 13 ++++++++++++- .../Shared/Api/Implementation/OSSL_Api.cs | 19 +++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 6 files changed, 40 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 47914cc..94dc5f5 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -863,7 +863,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (p != null && p.isNPC) { remoteClient.SendAgentAlertMessage( - "Notes for NPCs not avaiable", false); + "Notes for NPCs not available", false); return; } @@ -1009,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles if (p != null && p.isNPC) { - remoteClient.SendAvatarProperties(avatarID, "im a happy NPC", "5/25/1977" , + remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, "5/25/1977", Utils.StringToBytes("NPC"), "NPCs have no life", 0, UUID.Zero, UUID.Zero, "", UUID.Zero); remoteClient.SendAvatarInterestsReply(avatarID, 0, "", diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 58ea309..1310358 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces bool SenseAsAgent { get; } UUID ActiveGroupId { get; set; } UUID Owner { get; } + string profileAbout { get; set; } } public interface INPCModule diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 1ad71ba..1096eae 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC private readonly Scene m_scene; private readonly UUID m_ownerID; private UUID m_hostGroupID; - + private string m_profileAbout = ""; public List SelectedObjects {get; private set;} public NPCAvatar( @@ -98,6 +98,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_hostGroupID = UUID.Zero; } + public string profileAbout + { + get { return m_profileAbout; } + set + { + if(value.Length > 255) + m_profileAbout = value.Substring(0,255); + else + m_profileAbout = value; + } + } public IScene Scene { get { return m_scene; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 19f2d09..b101cf9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2999,6 +2999,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcSetProfileAbout(LSL_Key npc, string about) + { + CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); + m_host.AddScriptLPS(1); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + UUID npcId = new UUID(npc.m_string); + + if (!module.CheckPermissions(npcId, m_host.OwnerID)) + return; + + ScenePresence sp = World.GetScenePresence(npcId); + if (sp != null) + ((INPC)(sp.ControllingClient)).profileAbout = about; + } + } + public void osNpcSay(LSL_Key npc, string message) { osNpcSay(npc, 0, message); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 5ce859e..87b0967 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -343,6 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces rotation osNpcGetRot(key npc); void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcStopMoveToTarget(LSL_Key npc); + void osNpcSetProfileAbout(LSL_Key npc, string about); void osNpcSay(key npc, string message); void osNpcSay(key npc, int channel, string message); void osNpcShout(key npc, int channel, string message); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index c5cb88e..5bc998e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -637,6 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcStopMoveToTarget(npc); } + public void osNpcSetProfileAbout(LSL_Key npc, string about) + { + m_OSSL_Functions.osNpcSetProfileAbout(npc, about); + } + public void osNpcSay(key npc, string message) { m_OSSL_Functions.osNpcSay(npc, message); -- cgit v1.1