mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
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>
This commit is contained in:
@@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
|
||||
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)
|
||||
{
|
||||
SendOnChatFromClient(message, ChatTypeEnum.Broadcast);
|
||||
SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast);
|
||||
}
|
||||
|
||||
public void GiveMoney(UUID target, int amount)
|
||||
@@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
|
||||
#region Internal Functions
|
||||
|
||||
private void SendOnChatFromClient(string message, ChatTypeEnum chatType)
|
||||
private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
|
||||
{
|
||||
OSChatMessage chatFromClient = new OSChatMessage();
|
||||
chatFromClient.Channel = 0;
|
||||
chatFromClient.Channel = channel;
|
||||
chatFromClient.From = Name;
|
||||
chatFromClient.Message = message;
|
||||
chatFromClient.Position = StartPos;
|
||||
|
||||
@@ -211,6 +211,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
ScenePresence 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;
|
||||
}
|
||||
@@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
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)
|
||||
{
|
||||
lock (m_avatars)
|
||||
|
||||
Reference in New Issue
Block a user