Add a version of osNpcSay that takes a channel number Mantis 5747
osNpcSay(UUID npc, string message) left untouched New functions:- osNpcSay(UUID npc, int channel, string message) osNpcShout(UUID npc, int channel, string message) osNpcWhisper(UUID npc, int channel, string message) Signed-off-by: BlueWall <jamesh@bluewallgroup.com>integration
parent
679da63da6
commit
b8114d2b67
|
@ -134,6 +134,36 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||||
bool Say(UUID agentID, Scene scene, string text);
|
bool Say(UUID agentID, Scene scene, string text);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the NPC to say something.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="channel"></param>
|
||||||
|
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||||
|
bool Say(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the NPC to shout something.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="channel"></param>
|
||||||
|
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||||
|
bool Shout(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the NPC to whisper something.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID">The UUID of the NPC</param>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="channel"></param>
|
||||||
|
/// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
|
||||||
|
bool Whisper(UUID agentID, Scene scene, string text, int channel);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sit the NPC.
|
/// Sit the NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
public void Say(string message)
|
public void Say(string message)
|
||||||
{
|
{
|
||||||
SendOnChatFromClient(message, ChatTypeEnum.Say);
|
SendOnChatFromClient(0, message, ChatTypeEnum.Say);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shout(string message)
|
public void Say(int channel, string message)
|
||||||
{
|
{
|
||||||
SendOnChatFromClient(message, ChatTypeEnum.Shout);
|
SendOnChatFromClient(channel, message, ChatTypeEnum.Say);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Whisper(string message)
|
public void Shout(int channel, string message)
|
||||||
{
|
{
|
||||||
SendOnChatFromClient(message, ChatTypeEnum.Whisper);
|
SendOnChatFromClient(channel, message, ChatTypeEnum.Shout);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Whisper(int channel, string message)
|
||||||
|
{
|
||||||
|
SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Broadcast(string message)
|
public void Broadcast(string message)
|
||||||
{
|
{
|
||||||
SendOnChatFromClient(message, ChatTypeEnum.Broadcast);
|
SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GiveMoney(UUID target, int amount)
|
public void GiveMoney(UUID target, int amount)
|
||||||
|
@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
|
|
||||||
#region Internal Functions
|
#region Internal Functions
|
||||||
|
|
||||||
private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
|
private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
|
||||||
{
|
{
|
||||||
OSChatMessage chatFromClient = new OSChatMessage();
|
OSChatMessage chatFromClient = new OSChatMessage();
|
||||||
chatFromClient.Channel = 0;
|
chatFromClient.Channel = channel;
|
||||||
chatFromClient.From = Name;
|
chatFromClient.From = Name;
|
||||||
chatFromClient.Message = message;
|
chatFromClient.Message = message;
|
||||||
chatFromClient.Position = StartPos;
|
chatFromClient.Position = StartPos;
|
||||||
|
|
|
@ -211,6 +211,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Say(UUID agentID, Scene scene, string text)
|
public bool Say(UUID agentID, Scene scene, string text)
|
||||||
|
{
|
||||||
|
return Say(agentID, scene, text, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Say(UUID agentID, Scene scene, string text, int channel)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
scene.TryGetScenePresence(agentID, out sp);
|
scene.TryGetScenePresence(agentID, out sp);
|
||||||
|
|
||||||
m_avatars[agentID].Say(text);
|
m_avatars[agentID].Say(channel, text);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Shout(UUID agentID, Scene scene, string text, int channel)
|
||||||
|
{
|
||||||
|
lock (m_avatars)
|
||||||
|
{
|
||||||
|
if (m_avatars.ContainsKey(agentID))
|
||||||
|
{
|
||||||
|
ScenePresence sp;
|
||||||
|
scene.TryGetScenePresence(agentID, out sp);
|
||||||
|
|
||||||
|
m_avatars[agentID].Shout(channel, text);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Whisper(UUID agentID, Scene scene, string text, int channel)
|
||||||
|
{
|
||||||
|
lock (m_avatars)
|
||||||
|
{
|
||||||
|
if (m_avatars.ContainsKey(agentID))
|
||||||
|
{
|
||||||
|
ScenePresence sp;
|
||||||
|
scene.TryGetScenePresence(agentID, out sp);
|
||||||
|
|
||||||
|
m_avatars[agentID].Whisper(channel, text);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool Stand(UUID agentID, Scene scene)
|
public bool Stand(UUID agentID, Scene scene)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
|
|
|
@ -2530,6 +2530,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osNpcSay(LSL_Key npc, string message)
|
public void osNpcSay(LSL_Key npc, string message)
|
||||||
|
{
|
||||||
|
osNpcSay(npc, 0, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osNpcSay(LSL_Key npc, int channel, string message)
|
||||||
{
|
{
|
||||||
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
|
CheckThreatLevel(ThreatLevel.High, "osNpcSay");
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
@ -2542,7 +2547,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
if (!module.CheckPermissions(npcId, m_host.OwnerID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
module.Say(npcId, World, message);
|
module.Say(npcId, World, message, channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void osNpcShout(LSL_Key npc, int channel, string message)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osNpcShout");
|
||||||
|
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;
|
||||||
|
|
||||||
|
module.Shout(npcId, World, message, channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2627,6 +2649,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osNpcWhisper(LSL_Key npc, int channel, string message)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
|
||||||
|
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;
|
||||||
|
|
||||||
|
module.Whisper(npcId, World, message, channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the current appearance of the script owner permanently to the named notecard.
|
/// Save the current appearance of the script owner permanently to the named notecard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -203,11 +203,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
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 osNpcSay(key npc, string message);
|
void osNpcSay(key npc, string message);
|
||||||
|
void osNpcSay(key npc, int channel, string message);
|
||||||
|
void osNpcShout(key npc, int channel, string message);
|
||||||
void osNpcSit(key npc, key target, int options);
|
void osNpcSit(key npc, key target, int options);
|
||||||
void osNpcStand(LSL_Key npc);
|
void osNpcStand(LSL_Key npc);
|
||||||
void osNpcRemove(key npc);
|
void osNpcRemove(key npc);
|
||||||
void osNpcPlayAnimation(LSL_Key npc, string animation);
|
void osNpcPlayAnimation(LSL_Key npc, string animation);
|
||||||
void osNpcStopAnimation(LSL_Key npc, string animation);
|
void osNpcStopAnimation(LSL_Key npc, string animation);
|
||||||
|
void osNpcWhisper(key npc, int channel, string message);
|
||||||
|
|
||||||
LSL_Key osOwnerSaveAppearance(string notecard);
|
LSL_Key osOwnerSaveAppearance(string notecard);
|
||||||
LSL_Key osAgentSaveAppearance(key agentId, string notecard);
|
LSL_Key osAgentSaveAppearance(key agentId, string notecard);
|
||||||
|
|
|
@ -569,6 +569,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osNpcSay(npc, message);
|
m_OSSL_Functions.osNpcSay(npc, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osNpcSay(key npc, int channel, string message)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osNpcSay(npc, channel, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void osNpcShout(key npc, int channel, string message)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osNpcShout(npc, channel, message);
|
||||||
|
}
|
||||||
|
|
||||||
public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
|
public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osNpcSit(npc, target, options);
|
m_OSSL_Functions.osNpcSit(npc, target, options);
|
||||||
|
@ -594,6 +605,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osNpcStopAnimation(npc, animation);
|
m_OSSL_Functions.osNpcStopAnimation(npc, animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osNpcWhisper(key npc, int channel, string message)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osNpcWhisper(npc, channel, message);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Key osOwnerSaveAppearance(string notecard)
|
public LSL_Key osOwnerSaveAppearance(string notecard)
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osOwnerSaveAppearance(notecard);
|
return m_OSSL_Functions.osOwnerSaveAppearance(notecard);
|
||||||
|
|
Loading…
Reference in New Issue