aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World/NPC
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/NPC')
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs21
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs43
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs2
3 files changed, 56 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index c3335f0..c9c12c6 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC
76 76
77 public void Say(string message) 77 public void Say(string message)
78 { 78 {
79 SendOnChatFromClient(message, ChatTypeEnum.Say); 79 SendOnChatFromClient(0, message, ChatTypeEnum.Say);
80 } 80 }
81 81
82 public void Shout(string message) 82 public void Say(int channel, string message)
83 { 83 {
84 SendOnChatFromClient(message, ChatTypeEnum.Shout); 84 SendOnChatFromClient(channel, message, ChatTypeEnum.Say);
85 } 85 }
86 86
87 public void Whisper(string message) 87 public void Shout(int channel, string message)
88 { 88 {
89 SendOnChatFromClient(message, ChatTypeEnum.Whisper); 89 SendOnChatFromClient(channel, message, ChatTypeEnum.Shout);
90 }
91
92 public void Whisper(int channel, string message)
93 {
94 SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper);
90 } 95 }
91 96
92 public void Broadcast(string message) 97 public void Broadcast(string message)
93 { 98 {
94 SendOnChatFromClient(message, ChatTypeEnum.Broadcast); 99 SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast);
95 } 100 }
96 101
97 public void GiveMoney(UUID target, int amount) 102 public void GiveMoney(UUID target, int amount)
@@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
146 151
147 #region Internal Functions 152 #region Internal Functions
148 153
149 private void SendOnChatFromClient(string message, ChatTypeEnum chatType) 154 private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType)
150 { 155 {
151 OSChatMessage chatFromClient = new OSChatMessage(); 156 OSChatMessage chatFromClient = new OSChatMessage();
152 chatFromClient.Channel = 0; 157 chatFromClient.Channel = channel;
153 chatFromClient.From = Name; 158 chatFromClient.From = Name;
154 chatFromClient.Message = message; 159 chatFromClient.Message = message;
155 chatFromClient.Position = StartPos; 160 chatFromClient.Position = StartPos;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 4f80dea..9c77b59 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -213,6 +213,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
213 213
214 public bool Say(UUID agentID, Scene scene, string text) 214 public bool Say(UUID agentID, Scene scene, string text)
215 { 215 {
216 return Say(agentID, scene, text, 0);
217 }
218
219 public bool Say(UUID agentID, Scene scene, string text, int channel)
220 {
216 lock (m_avatars) 221 lock (m_avatars)
217 { 222 {
218 if (m_avatars.ContainsKey(agentID)) 223 if (m_avatars.ContainsKey(agentID))
@@ -220,7 +225,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC
220 ScenePresence sp; 225 ScenePresence sp;
221 scene.TryGetScenePresence(agentID, out sp); 226 scene.TryGetScenePresence(agentID, out sp);
222 227
223 m_avatars[agentID].Say(text); 228 m_avatars[agentID].Say(channel, text);
229
230 return true;
231 }
232 }
233
234 return false;
235 }
236
237 public bool Shout(UUID agentID, Scene scene, string text, int channel)
238 {
239 lock (m_avatars)
240 {
241 if (m_avatars.ContainsKey(agentID))
242 {
243 ScenePresence sp;
244 scene.TryGetScenePresence(agentID, out sp);
245
246 m_avatars[agentID].Shout(channel, text);
224 247
225 return true; 248 return true;
226 } 249 }
@@ -247,6 +270,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC
247 return false; 270 return false;
248 } 271 }
249 272
273 public bool Whisper(UUID agentID, Scene scene, string text, int channel)
274 {
275 lock (m_avatars)
276 {
277 if (m_avatars.ContainsKey(agentID))
278 {
279 ScenePresence sp;
280 scene.TryGetScenePresence(agentID, out sp);
281
282 m_avatars[agentID].Whisper(channel, text);
283
284 return true;
285 }
286 }
287
288 return false;
289 }
290
250 public bool Stand(UUID agentID, Scene scene) 291 public bool Stand(UUID agentID, Scene scene)
251 { 292 {
252 lock (m_avatars) 293 lock (m_avatars)
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index eea0b2e..a39257e 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
85 m_attMod = new AttachmentsModule(); 85 m_attMod = new AttachmentsModule();
86 m_npcMod = new NPCModule(); 86 m_npcMod = new NPCModule();
87 87
88 m_scene = SceneHelpers.SetupScene(); 88 m_scene = new SceneHelpers().SetupScene();
89 SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); 89 SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
90 } 90 }
91 91