aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTalun2012-04-24 21:54:13 +0100
committerBlueWall2012-04-26 16:13:29 -0400
commitb8114d2b67c8ae8d7551a2ece2177f8b7e958112 (patch)
tree0b453a72beae6e4a1f9ee86f00df3ec77d12d178
parentMantis 5977 Corrections to llRegionSayTo (diff)
downloadopensim-SC-b8114d2b67c8ae8d7551a2ece2177f8b7e958112.zip
opensim-SC-b8114d2b67c8ae8d7551a2ece2177f8b7e958112.tar.gz
opensim-SC-b8114d2b67c8ae8d7551a2ece2177f8b7e958112.tar.bz2
opensim-SC-b8114d2b67c8ae8d7551a2ece2177f8b7e958112.tar.xz
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>
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs30
-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/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs41
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs16
6 files changed, 144 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index dc3ff89..b4dc3c3 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -135,6 +135,36 @@ namespace OpenSim.Region.Framework.Interfaces
135 bool Say(UUID agentID, Scene scene, string text); 135 bool Say(UUID agentID, Scene scene, string text);
136 136
137 /// <summary> 137 /// <summary>
138 /// Get the NPC to say something.
139 /// </summary>
140 /// <param name="agentID">The UUID of the NPC</param>
141 /// <param name="scene"></param>
142 /// <param name="text"></param>
143 /// <param name="channel"></param>
144 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
145 bool Say(UUID agentID, Scene scene, string text, int channel);
146
147 /// <summary>
148 /// Get the NPC to shout something.
149 /// </summary>
150 /// <param name="agentID">The UUID of the NPC</param>
151 /// <param name="scene"></param>
152 /// <param name="text"></param>
153 /// <param name="channel"></param>
154 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
155 bool Shout(UUID agentID, Scene scene, string text, int channel);
156
157 /// <summary>
158 /// Get the NPC to whisper something.
159 /// </summary>
160 /// <param name="agentID">The UUID of the NPC</param>
161 /// <param name="scene"></param>
162 /// <param name="text"></param>
163 /// <param name="channel"></param>
164 /// <returns>True if the operation succeeded, false if there was no such agent or the agent was not an NPC</returns>
165 bool Whisper(UUID agentID, Scene scene, string text, int channel);
166
167 /// <summary>
138 /// Sit the NPC. 168 /// Sit the NPC.
139 /// </summary> 169 /// </summary>
140 /// <param name="agentID"></param> 170 /// <param name="agentID"></param>
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 2b8379d..adc6f9c 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/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index fe94b79..890115d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2531,6 +2531,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2531 2531
2532 public void osNpcSay(LSL_Key npc, string message) 2532 public void osNpcSay(LSL_Key npc, string message)
2533 { 2533 {
2534 osNpcSay(npc, 0, message);
2535 }
2536
2537 public void osNpcSay(LSL_Key npc, int channel, string message)
2538 {
2534 CheckThreatLevel(ThreatLevel.High, "osNpcSay"); 2539 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
2535 m_host.AddScriptLPS(1); 2540 m_host.AddScriptLPS(1);
2536 2541
@@ -2542,7 +2547,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2542 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2547 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2543 return; 2548 return;
2544 2549
2545 module.Say(npcId, World, message); 2550 module.Say(npcId, World, message, channel);
2551 }
2552 }
2553
2554 public void osNpcShout(LSL_Key npc, int channel, string message)
2555 {
2556 CheckThreatLevel(ThreatLevel.High, "osNpcShout");
2557 m_host.AddScriptLPS(1);
2558
2559 INPCModule module = World.RequestModuleInterface<INPCModule>();
2560 if (module != null)
2561 {
2562 UUID npcId = new UUID(npc.m_string);
2563
2564 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2565 return;
2566
2567 module.Shout(npcId, World, message, channel);
2546 } 2568 }
2547 } 2569 }
2548 2570
@@ -2627,6 +2649,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2627 } 2649 }
2628 } 2650 }
2629 2651
2652 public void osNpcWhisper(LSL_Key npc, int channel, string message)
2653 {
2654 CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
2655 m_host.AddScriptLPS(1);
2656
2657 INPCModule module = World.RequestModuleInterface<INPCModule>();
2658 if (module != null)
2659 {
2660 UUID npcId = new UUID(npc.m_string);
2661
2662 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2663 return;
2664
2665 module.Whisper(npcId, World, message, channel);
2666 }
2667 }
2668
2630 /// <summary> 2669 /// <summary>
2631 /// Save the current appearance of the script owner permanently to the named notecard. 2670 /// Save the current appearance of the script owner permanently to the named notecard.
2632 /// </summary> 2671 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 545bbee..2d3e8e8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -203,11 +203,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
203 void osNpcSetRot(LSL_Key npc, rotation rot); 203 void osNpcSetRot(LSL_Key npc, rotation rot);
204 void osNpcStopMoveToTarget(LSL_Key npc); 204 void osNpcStopMoveToTarget(LSL_Key npc);
205 void osNpcSay(key npc, string message); 205 void osNpcSay(key npc, string message);
206 void osNpcSay(key npc, int channel, string message);
207 void osNpcShout(key npc, int channel, string message);
206 void osNpcSit(key npc, key target, int options); 208 void osNpcSit(key npc, key target, int options);
207 void osNpcStand(LSL_Key npc); 209 void osNpcStand(LSL_Key npc);
208 void osNpcRemove(key npc); 210 void osNpcRemove(key npc);
209 void osNpcPlayAnimation(LSL_Key npc, string animation); 211 void osNpcPlayAnimation(LSL_Key npc, string animation);
210 void osNpcStopAnimation(LSL_Key npc, string animation); 212 void osNpcStopAnimation(LSL_Key npc, string animation);
213 void osNpcWhisper(key npc, int channel, string message);
211 214
212 LSL_Key osOwnerSaveAppearance(string notecard); 215 LSL_Key osOwnerSaveAppearance(string notecard);
213 LSL_Key osAgentSaveAppearance(key agentId, string notecard); 216 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index b94b9bf..e836959 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -569,6 +569,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
569 m_OSSL_Functions.osNpcSay(npc, message); 569 m_OSSL_Functions.osNpcSay(npc, message);
570 } 570 }
571 571
572 public void osNpcSay(key npc, int channel, string message)
573 {
574 m_OSSL_Functions.osNpcSay(npc, channel, message);
575 }
576
577
578 public void osNpcShout(key npc, int channel, string message)
579 {
580 m_OSSL_Functions.osNpcShout(npc, channel, message);
581 }
582
572 public void osNpcSit(LSL_Key npc, LSL_Key target, int options) 583 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
573 { 584 {
574 m_OSSL_Functions.osNpcSit(npc, target, options); 585 m_OSSL_Functions.osNpcSit(npc, target, options);
@@ -594,6 +605,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
594 m_OSSL_Functions.osNpcStopAnimation(npc, animation); 605 m_OSSL_Functions.osNpcStopAnimation(npc, animation);
595 } 606 }
596 607
608 public void osNpcWhisper(key npc, int channel, string message)
609 {
610 m_OSSL_Functions.osNpcWhisper(npc, channel, message);
611 }
612
597 public LSL_Key osOwnerSaveAppearance(string notecard) 613 public LSL_Key osOwnerSaveAppearance(string notecard)
598 { 614 {
599 return m_OSSL_Functions.osOwnerSaveAppearance(notecard); 615 return m_OSSL_Functions.osOwnerSaveAppearance(notecard);