aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs39
-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
5 files changed, 81 insertions, 26 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index d2f6327..ac638f1 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
50 TestHelpers.InMethod(); 50 TestHelpers.InMethod();
51// log4net.Config.XmlConfigurator.Configure(); 51// log4net.Config.XmlConfigurator.Configure();
52 52
53 TestScene scene = SceneHelpers.SetupScene(); 53 TestScene scene = new SceneHelpers().SetupScene();
54 IConfigSource configSource = new IniConfigSource(); 54 IConfigSource configSource = new IniConfigSource();
55 IConfig config = configSource.AddConfig("Groups"); 55 IConfig config = configSource.AddConfig("Groups");
56 config.Set("Enabled", true); 56 config.Set("Enabled", true);
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index eda2aef..4949097 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -163,28 +163,37 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
163 return; 163 return;
164 } 164 }
165 165
166 m_comms.RegisterScriptInvocation(this,"JsonCreateStore"); 166 try
167 m_comms.RegisterScriptInvocation(this,"JsonDestroyStore"); 167 {
168 m_comms.RegisterScriptInvocation(this,"JsonCreateStore");
169 m_comms.RegisterScriptInvocation(this,"JsonDestroyStore");
168 170
169 m_comms.RegisterScriptInvocation(this,"JsonReadNotecard"); 171 m_comms.RegisterScriptInvocation(this,"JsonReadNotecard");
170 m_comms.RegisterScriptInvocation(this,"JsonWriteNotecard"); 172 m_comms.RegisterScriptInvocation(this,"JsonWriteNotecard");
171 173
172 m_comms.RegisterScriptInvocation(this,"JsonTestPath"); 174 m_comms.RegisterScriptInvocation(this,"JsonTestPath");
173 m_comms.RegisterScriptInvocation(this,"JsonTestPathJson"); 175 m_comms.RegisterScriptInvocation(this,"JsonTestPathJson");
174 176
175 m_comms.RegisterScriptInvocation(this,"JsonGetValue"); 177 m_comms.RegisterScriptInvocation(this,"JsonGetValue");
176 m_comms.RegisterScriptInvocation(this,"JsonGetValueJson"); 178 m_comms.RegisterScriptInvocation(this,"JsonGetValueJson");
177 179
178 m_comms.RegisterScriptInvocation(this,"JsonTakeValue"); 180 m_comms.RegisterScriptInvocation(this,"JsonTakeValue");
179 m_comms.RegisterScriptInvocation(this,"JsonTakeValueJson"); 181 m_comms.RegisterScriptInvocation(this,"JsonTakeValueJson");
180 182
181 m_comms.RegisterScriptInvocation(this,"JsonReadValue"); 183 m_comms.RegisterScriptInvocation(this,"JsonReadValue");
182 m_comms.RegisterScriptInvocation(this,"JsonReadValueJson"); 184 m_comms.RegisterScriptInvocation(this,"JsonReadValueJson");
183 185
184 m_comms.RegisterScriptInvocation(this,"JsonSetValue"); 186 m_comms.RegisterScriptInvocation(this,"JsonSetValue");
185 m_comms.RegisterScriptInvocation(this,"JsonSetValueJson"); 187 m_comms.RegisterScriptInvocation(this,"JsonSetValueJson");
186 188
187 m_comms.RegisterScriptInvocation(this,"JsonRemoveValue"); 189 m_comms.RegisterScriptInvocation(this,"JsonRemoveValue");
190 }
191 catch (Exception e)
192 {
193 // See http://opensimulator.org/mantis/view.php?id=5971 for more information
194 m_log.WarnFormat("[JsonStroreScripts] script method registration failed; {0}",e.Message);
195 m_enabled = false;
196 }
188 } 197 }
189 } 198 }
190 199
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