diff options
author | UbitUmarov | 2016-12-06 17:05:02 +0000 |
---|---|---|
committer | UbitUmarov | 2016-12-06 17:05:02 +0000 |
commit | d4e285b1a1da036220d9b3a7141ebe1b865c5d35 (patch) | |
tree | 89c95decf61b38f16e6edf622db319728efaecc2 | |
parent | let NPCs have profile (diff) | |
download | opensim-SC_OLD-d4e285b1a1da036220d9b3a7141ebe1b865c5d35.zip opensim-SC_OLD-d4e285b1a1da036220d9b3a7141ebe1b865c5d35.tar.gz opensim-SC_OLD-d4e285b1a1da036220d9b3a7141ebe1b865c5d35.tar.bz2 opensim-SC_OLD-d4e285b1a1da036220d9b3a7141ebe1b865c5d35.tar.xz |
add osNpcSetProfileAbout(LSL_Key npc, string about) to set NPCs profile About text. requires OsNpcCreate rights
6 files changed, 40 insertions, 3 deletions
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 | |||
863 | if (p != null && p.isNPC) | 863 | if (p != null && p.isNPC) |
864 | { | 864 | { |
865 | remoteClient.SendAgentAlertMessage( | 865 | remoteClient.SendAgentAlertMessage( |
866 | "Notes for NPCs not avaiable", false); | 866 | "Notes for NPCs not available", false); |
867 | return; | 867 | return; |
868 | } | 868 | } |
869 | 869 | ||
@@ -1009,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
1009 | 1009 | ||
1010 | if (p != null && p.isNPC) | 1010 | if (p != null && p.isNPC) |
1011 | { | 1011 | { |
1012 | remoteClient.SendAvatarProperties(avatarID, "im a happy NPC", "5/25/1977" , | 1012 | remoteClient.SendAvatarProperties(avatarID, ((INPC)(p.ControllingClient)).profileAbout, "5/25/1977", |
1013 | Utils.StringToBytes("NPC"), "NPCs have no life", 0, | 1013 | Utils.StringToBytes("NPC"), "NPCs have no life", 0, |
1014 | UUID.Zero, UUID.Zero, "", UUID.Zero); | 1014 | UUID.Zero, UUID.Zero, "", UUID.Zero); |
1015 | remoteClient.SendAvatarInterestsReply(avatarID, 0, "", | 1015 | 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 | |||
58 | bool SenseAsAgent { get; } | 58 | bool SenseAsAgent { get; } |
59 | UUID ActiveGroupId { get; set; } | 59 | UUID ActiveGroupId { get; set; } |
60 | UUID Owner { get; } | 60 | UUID Owner { get; } |
61 | string profileAbout { get; set; } | ||
61 | } | 62 | } |
62 | 63 | ||
63 | public interface INPCModule | 64 | 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 | |||
69 | private readonly Scene m_scene; | 69 | private readonly Scene m_scene; |
70 | private readonly UUID m_ownerID; | 70 | private readonly UUID m_ownerID; |
71 | private UUID m_hostGroupID; | 71 | private UUID m_hostGroupID; |
72 | 72 | private string m_profileAbout = ""; | |
73 | public List<uint> SelectedObjects {get; private set;} | 73 | public List<uint> SelectedObjects {get; private set;} |
74 | 74 | ||
75 | public NPCAvatar( | 75 | public NPCAvatar( |
@@ -98,6 +98,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
98 | m_hostGroupID = UUID.Zero; | 98 | m_hostGroupID = UUID.Zero; |
99 | } | 99 | } |
100 | 100 | ||
101 | public string profileAbout | ||
102 | { | ||
103 | get { return m_profileAbout; } | ||
104 | set | ||
105 | { | ||
106 | if(value.Length > 255) | ||
107 | m_profileAbout = value.Substring(0,255); | ||
108 | else | ||
109 | m_profileAbout = value; | ||
110 | } | ||
111 | } | ||
101 | public IScene Scene | 112 | public IScene Scene |
102 | { | 113 | { |
103 | get { return m_scene; } | 114 | 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 | |||
2999 | } | 2999 | } |
3000 | } | 3000 | } |
3001 | 3001 | ||
3002 | public void osNpcSetProfileAbout(LSL_Key npc, string about) | ||
3003 | { | ||
3004 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | ||
3005 | m_host.AddScriptLPS(1); | ||
3006 | |||
3007 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
3008 | if (module != null) | ||
3009 | { | ||
3010 | UUID npcId = new UUID(npc.m_string); | ||
3011 | |||
3012 | if (!module.CheckPermissions(npcId, m_host.OwnerID)) | ||
3013 | return; | ||
3014 | |||
3015 | ScenePresence sp = World.GetScenePresence(npcId); | ||
3016 | if (sp != null) | ||
3017 | ((INPC)(sp.ControllingClient)).profileAbout = about; | ||
3018 | } | ||
3019 | } | ||
3020 | |||
3002 | public void osNpcSay(LSL_Key npc, string message) | 3021 | public void osNpcSay(LSL_Key npc, string message) |
3003 | { | 3022 | { |
3004 | osNpcSay(npc, 0, message); | 3023 | 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 | |||
343 | rotation osNpcGetRot(key npc); | 343 | rotation osNpcGetRot(key npc); |
344 | void osNpcSetRot(LSL_Key npc, rotation rot); | 344 | void osNpcSetRot(LSL_Key npc, rotation rot); |
345 | void osNpcStopMoveToTarget(LSL_Key npc); | 345 | void osNpcStopMoveToTarget(LSL_Key npc); |
346 | void osNpcSetProfileAbout(LSL_Key npc, string about); | ||
346 | void osNpcSay(key npc, string message); | 347 | void osNpcSay(key npc, string message); |
347 | void osNpcSay(key npc, int channel, string message); | 348 | void osNpcSay(key npc, int channel, string message); |
348 | void osNpcShout(key npc, int channel, string message); | 349 | 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 | |||
637 | m_OSSL_Functions.osNpcStopMoveToTarget(npc); | 637 | m_OSSL_Functions.osNpcStopMoveToTarget(npc); |
638 | } | 638 | } |
639 | 639 | ||
640 | public void osNpcSetProfileAbout(LSL_Key npc, string about) | ||
641 | { | ||
642 | m_OSSL_Functions.osNpcSetProfileAbout(npc, about); | ||
643 | } | ||
644 | |||
640 | public void osNpcSay(key npc, string message) | 645 | public void osNpcSay(key npc, string message) |
641 | { | 646 | { |
642 | m_OSSL_Functions.osNpcSay(npc, message); | 647 | m_OSSL_Functions.osNpcSay(npc, message); |