add osNpcSetProfileAbout(LSL_Key npc, string about) to set NPCs profile About text. requires OsNpcCreate rights

melanie
UbitUmarov 2016-12-06 17:05:02 +00:00
parent 240ab951b5
commit d4e285b1a1
6 changed files with 40 additions and 3 deletions

View File

@ -863,7 +863,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if (p != null && p.isNPC) if (p != null && p.isNPC)
{ {
remoteClient.SendAgentAlertMessage( remoteClient.SendAgentAlertMessage(
"Notes for NPCs not avaiable", false); "Notes for NPCs not available", false);
return; return;
} }
@ -1009,7 +1009,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
if (p != null && p.isNPC) 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, Utils.StringToBytes("NPC"), "NPCs have no life", 0,
UUID.Zero, UUID.Zero, "", UUID.Zero); UUID.Zero, UUID.Zero, "", UUID.Zero);
remoteClient.SendAvatarInterestsReply(avatarID, 0, "", remoteClient.SendAvatarInterestsReply(avatarID, 0, "",

View File

@ -58,6 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
bool SenseAsAgent { get; } bool SenseAsAgent { get; }
UUID ActiveGroupId { get; set; } UUID ActiveGroupId { get; set; }
UUID Owner { get; } UUID Owner { get; }
string profileAbout { get; set; }
} }
public interface INPCModule public interface INPCModule

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
private readonly Scene m_scene; private readonly Scene m_scene;
private readonly UUID m_ownerID; private readonly UUID m_ownerID;
private UUID m_hostGroupID; private UUID m_hostGroupID;
private string m_profileAbout = "";
public List<uint> SelectedObjects {get; private set;} public List<uint> SelectedObjects {get; private set;}
public NPCAvatar( public NPCAvatar(
@ -98,6 +98,17 @@ namespace OpenSim.Region.OptionalModules.World.NPC
m_hostGroupID = UUID.Zero; 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 public IScene Scene
{ {
get { return m_scene; } get { return m_scene; }

View File

@ -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<INPCModule>();
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) public void osNpcSay(LSL_Key npc, string message)
{ {
osNpcSay(npc, 0, message); osNpcSay(npc, 0, message);

View File

@ -343,6 +343,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
rotation osNpcGetRot(key npc); rotation osNpcGetRot(key npc);
void osNpcSetRot(LSL_Key npc, rotation rot); void osNpcSetRot(LSL_Key npc, rotation rot);
void osNpcStopMoveToTarget(LSL_Key npc); void osNpcStopMoveToTarget(LSL_Key npc);
void osNpcSetProfileAbout(LSL_Key npc, string about);
void osNpcSay(key npc, string message); void osNpcSay(key npc, string message);
void osNpcSay(key npc, int channel, string message); void osNpcSay(key npc, int channel, string message);
void osNpcShout(key npc, int channel, string message); void osNpcShout(key npc, int channel, string message);

View File

@ -637,6 +637,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osNpcStopMoveToTarget(npc); 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) public void osNpcSay(key npc, string message)
{ {
m_OSSL_Functions.osNpcSay(npc, message); m_OSSL_Functions.osNpcSay(npc, message);