diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
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 5ea5af7..e57e5e6 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 435a683..3ac1eb1 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -212,6 +212,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
212 | 212 | ||
213 | public bool Say(UUID agentID, Scene scene, string text) | 213 | public bool Say(UUID agentID, Scene scene, string text) |
214 | { | 214 | { |
215 | return Say(agentID, scene, text, 0); | ||
216 | } | ||
217 | |||
218 | public bool Say(UUID agentID, Scene scene, string text, int channel) | ||
219 | { | ||
215 | lock (m_avatars) | 220 | lock (m_avatars) |
216 | { | 221 | { |
217 | if (m_avatars.ContainsKey(agentID)) | 222 | if (m_avatars.ContainsKey(agentID)) |
@@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
219 | ScenePresence sp; | 224 | ScenePresence sp; |
220 | scene.TryGetScenePresence(agentID, out sp); | 225 | scene.TryGetScenePresence(agentID, out sp); |
221 | 226 | ||
222 | m_avatars[agentID].Say(text); | 227 | m_avatars[agentID].Say(channel, text); |
228 | |||
229 | return true; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | return false; | ||
234 | } | ||
235 | |||
236 | public bool Shout(UUID agentID, Scene scene, string text, int channel) | ||
237 | { | ||
238 | lock (m_avatars) | ||
239 | { | ||
240 | if (m_avatars.ContainsKey(agentID)) | ||
241 | { | ||
242 | ScenePresence sp; | ||
243 | scene.TryGetScenePresence(agentID, out sp); | ||
244 | |||
245 | m_avatars[agentID].Shout(channel, text); | ||
223 | 246 | ||
224 | return true; | 247 | return true; |
225 | } | 248 | } |
@@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
246 | return false; | 269 | return false; |
247 | } | 270 | } |
248 | 271 | ||
272 | public bool Whisper(UUID agentID, Scene scene, string text, int channel) | ||
273 | { | ||
274 | lock (m_avatars) | ||
275 | { | ||
276 | if (m_avatars.ContainsKey(agentID)) | ||
277 | { | ||
278 | ScenePresence sp; | ||
279 | scene.TryGetScenePresence(agentID, out sp); | ||
280 | |||
281 | m_avatars[agentID].Whisper(channel, text); | ||
282 | |||
283 | return true; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | return false; | ||
288 | } | ||
289 | |||
249 | public bool Stand(UUID agentID, Scene scene) | 290 | public bool Stand(UUID agentID, Scene scene) |
250 | { | 291 | { |
251 | lock (m_avatars) | 292 | 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 | ||