aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-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 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/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7fc7337..893fda1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2539,6 +2539,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2539 2539
2540 public void osNpcSay(LSL_Key npc, string message) 2540 public void osNpcSay(LSL_Key npc, string message)
2541 { 2541 {
2542 osNpcSay(npc, 0, message);
2543 }
2544
2545 public void osNpcSay(LSL_Key npc, int channel, string message)
2546 {
2542 CheckThreatLevel(ThreatLevel.High, "osNpcSay"); 2547 CheckThreatLevel(ThreatLevel.High, "osNpcSay");
2543 m_host.AddScriptLPS(1); 2548 m_host.AddScriptLPS(1);
2544 2549
@@ -2550,7 +2555,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2550 if (!module.CheckPermissions(npcId, m_host.OwnerID)) 2555 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2551 return; 2556 return;
2552 2557
2553 module.Say(npcId, World, message); 2558 module.Say(npcId, World, message, channel);
2559 }
2560 }
2561
2562 public void osNpcShout(LSL_Key npc, int channel, string message)
2563 {
2564 CheckThreatLevel(ThreatLevel.High, "osNpcShout");
2565 m_host.AddScriptLPS(1);
2566
2567 INPCModule module = World.RequestModuleInterface<INPCModule>();
2568 if (module != null)
2569 {
2570 UUID npcId = new UUID(npc.m_string);
2571
2572 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2573 return;
2574
2575 module.Shout(npcId, World, message, channel);
2554 } 2576 }
2555 } 2577 }
2556 2578
@@ -2635,6 +2657,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2635 } 2657 }
2636 } 2658 }
2637 2659
2660 public void osNpcWhisper(LSL_Key npc, int channel, string message)
2661 {
2662 CheckThreatLevel(ThreatLevel.High, "osNpcWhisper");
2663 m_host.AddScriptLPS(1);
2664
2665 INPCModule module = World.RequestModuleInterface<INPCModule>();
2666 if (module != null)
2667 {
2668 UUID npcId = new UUID(npc.m_string);
2669
2670 if (!module.CheckPermissions(npcId, m_host.OwnerID))
2671 return;
2672
2673 module.Whisper(npcId, World, message, channel);
2674 }
2675 }
2676
2638 /// <summary> 2677 /// <summary>
2639 /// Save the current appearance of the script owner permanently to the named notecard. 2678 /// Save the current appearance of the script owner permanently to the named notecard.
2640 /// </summary> 2679 /// </summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index d0c852b..e92518d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -217,11 +217,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
217 void osNpcSetRot(LSL_Key npc, rotation rot); 217 void osNpcSetRot(LSL_Key npc, rotation rot);
218 void osNpcStopMoveToTarget(LSL_Key npc); 218 void osNpcStopMoveToTarget(LSL_Key npc);
219 void osNpcSay(key npc, string message); 219 void osNpcSay(key npc, string message);
220 void osNpcSay(key npc, int channel, string message);
221 void osNpcShout(key npc, int channel, string message);
220 void osNpcSit(key npc, key target, int options); 222 void osNpcSit(key npc, key target, int options);
221 void osNpcStand(LSL_Key npc); 223 void osNpcStand(LSL_Key npc);
222 void osNpcRemove(key npc); 224 void osNpcRemove(key npc);
223 void osNpcPlayAnimation(LSL_Key npc, string animation); 225 void osNpcPlayAnimation(LSL_Key npc, string animation);
224 void osNpcStopAnimation(LSL_Key npc, string animation); 226 void osNpcStopAnimation(LSL_Key npc, string animation);
227 void osNpcWhisper(key npc, int channel, string message);
225 228
226 LSL_Key osOwnerSaveAppearance(string notecard); 229 LSL_Key osOwnerSaveAppearance(string notecard);
227 LSL_Key osAgentSaveAppearance(key agentId, string notecard); 230 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 36ac0e3..d230662 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -580,6 +580,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
580 m_OSSL_Functions.osNpcSay(npc, message); 580 m_OSSL_Functions.osNpcSay(npc, message);
581 } 581 }
582 582
583 public void osNpcSay(key npc, int channel, string message)
584 {
585 m_OSSL_Functions.osNpcSay(npc, channel, message);
586 }
587
588
589 public void osNpcShout(key npc, int channel, string message)
590 {
591 m_OSSL_Functions.osNpcShout(npc, channel, message);
592 }
593
583 public void osNpcSit(LSL_Key npc, LSL_Key target, int options) 594 public void osNpcSit(LSL_Key npc, LSL_Key target, int options)
584 { 595 {
585 m_OSSL_Functions.osNpcSit(npc, target, options); 596 m_OSSL_Functions.osNpcSit(npc, target, options);
@@ -605,6 +616,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
605 m_OSSL_Functions.osNpcStopAnimation(npc, animation); 616 m_OSSL_Functions.osNpcStopAnimation(npc, animation);
606 } 617 }
607 618
619 public void osNpcWhisper(key npc, int channel, string message)
620 {
621 m_OSSL_Functions.osNpcWhisper(npc, channel, message);
622 }
623
608 public LSL_Key osOwnerSaveAppearance(string notecard) 624 public LSL_Key osOwnerSaveAppearance(string notecard)
609 { 625 {
610 return m_OSSL_Functions.osOwnerSaveAppearance(notecard); 626 return m_OSSL_Functions.osOwnerSaveAppearance(notecard);