aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs624
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs176
-rw-r--r--OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs772
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs332
4 files changed, 952 insertions, 952 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
index f9896bd..84487e8 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/Commander.cs
@@ -1,313 +1,313 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Text; 31using System.Text;
32using log4net; 32using log4net;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35 35
36namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander 36namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// A single function call encapsulated in a class which enforces arguments when passing around as Object[]'s. 39 /// A single function call encapsulated in a class which enforces arguments when passing around as Object[]'s.
40 /// Used for console commands and script API generation 40 /// Used for console commands and script API generation
41 /// </summary> 41 /// </summary>
42 public class Command : ICommand 42 public class Command : ICommand
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 private List<CommandArgument> m_args = new List<CommandArgument>(); 45 private List<CommandArgument> m_args = new List<CommandArgument>();
46 46
47 private Action<object[]> m_command; 47 private Action<object[]> m_command;
48 private string m_help; 48 private string m_help;
49 private string m_name; 49 private string m_name;
50 50
51 public Command(string name, Action<Object[]> command, string help) 51 public Command(string name, Action<Object[]> command, string help)
52 { 52 {
53 m_name = name; 53 m_name = name;
54 m_command = command; 54 m_command = command;
55 m_help = help; 55 m_help = help;
56 } 56 }
57 57
58 #region ICommand Members 58 #region ICommand Members
59 59
60 public void AddArgument(string name, string helptext, string type) 60 public void AddArgument(string name, string helptext, string type)
61 { 61 {
62 m_args.Add(new CommandArgument(name, helptext, type)); 62 m_args.Add(new CommandArgument(name, helptext, type));
63 } 63 }
64 64
65 public string Name 65 public string Name
66 { 66 {
67 get { return m_name; } 67 get { return m_name; }
68 } 68 }
69 69
70 public string Help 70 public string Help
71 { 71 {
72 get { return m_help; } 72 get { return m_help; }
73 } 73 }
74 74
75 public Dictionary<string, string> Arguments 75 public Dictionary<string, string> Arguments
76 { 76 {
77 get 77 get
78 { 78 {
79 Dictionary<string, string> tmp = new Dictionary<string, string>(); 79 Dictionary<string, string> tmp = new Dictionary<string, string>();
80 foreach (CommandArgument arg in m_args) 80 foreach (CommandArgument arg in m_args)
81 { 81 {
82 tmp.Add(arg.Name, arg.ArgumentType); 82 tmp.Add(arg.Name, arg.ArgumentType);
83 } 83 }
84 return tmp; 84 return tmp;
85 } 85 }
86 } 86 }
87 87
88 public void ShowConsoleHelp() 88 public void ShowConsoleHelp()
89 { 89 {
90 m_log.Info("== " + Name + " =="); 90 m_log.Info("== " + Name + " ==");
91 m_log.Info(m_help); 91 m_log.Info(m_help);
92 m_log.Info("= Parameters ="); 92 m_log.Info("= Parameters =");
93 foreach (CommandArgument arg in m_args) 93 foreach (CommandArgument arg in m_args)
94 { 94 {
95 m_log.Info("* " + arg.Name + " (" + arg.ArgumentType + ")"); 95 m_log.Info("* " + arg.Name + " (" + arg.ArgumentType + ")");
96 m_log.Info("\t" + arg.HelpText); 96 m_log.Info("\t" + arg.HelpText);
97 } 97 }
98 } 98 }
99 99
100 public void Run(Object[] args) 100 public void Run(Object[] args)
101 { 101 {
102 Object[] cleanArgs = new Object[m_args.Count]; 102 Object[] cleanArgs = new Object[m_args.Count];
103 103
104 if (args.Length < cleanArgs.Length) 104 if (args.Length < cleanArgs.Length)
105 { 105 {
106 m_log.Error("Missing " + (cleanArgs.Length - args.Length) + " argument(s)"); 106 m_log.Error("Missing " + (cleanArgs.Length - args.Length) + " argument(s)");
107 ShowConsoleHelp(); 107 ShowConsoleHelp();
108 return; 108 return;
109 } 109 }
110 if (args.Length > cleanArgs.Length) 110 if (args.Length > cleanArgs.Length)
111 { 111 {
112 m_log.Error("Too many arguments for this command. Type '<module> <command> help' for help."); 112 m_log.Error("Too many arguments for this command. Type '<module> <command> help' for help.");
113 return; 113 return;
114 } 114 }
115 115
116 int i = 0; 116 int i = 0;
117 foreach (Object arg in args) 117 foreach (Object arg in args)
118 { 118 {
119 if (string.IsNullOrEmpty(arg.ToString())) 119 if (string.IsNullOrEmpty(arg.ToString()))
120 { 120 {
121 m_log.Error("Empty arguments are not allowed"); 121 m_log.Error("Empty arguments are not allowed");
122 return; 122 return;
123 } 123 }
124 try 124 try
125 { 125 {
126 switch (m_args[i].ArgumentType) 126 switch (m_args[i].ArgumentType)
127 { 127 {
128 case "String": 128 case "String":
129 m_args[i].ArgumentValue = arg.ToString(); 129 m_args[i].ArgumentValue = arg.ToString();
130 break; 130 break;
131 case "Integer": 131 case "Integer":
132 m_args[i].ArgumentValue = Int32.Parse(arg.ToString()); 132 m_args[i].ArgumentValue = Int32.Parse(arg.ToString());
133 break; 133 break;
134 case "Double": 134 case "Double":
135 m_args[i].ArgumentValue = Double.Parse(arg.ToString()); 135 m_args[i].ArgumentValue = Double.Parse(arg.ToString());
136 break; 136 break;
137 case "Boolean": 137 case "Boolean":
138 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); 138 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString());
139 break; 139 break;
140 default: 140 default:
141 m_log.Error("Unknown desired type for argument " + m_args[i].Name + " on command " + m_name); 141 m_log.Error("Unknown desired type for argument " + m_args[i].Name + " on command " + m_name);
142 break; 142 break;
143 } 143 }
144 } 144 }
145 catch (FormatException) 145 catch (FormatException)
146 { 146 {
147 m_log.Error("Argument number " + (i + 1) + 147 m_log.Error("Argument number " + (i + 1) +
148 " (" + m_args[i].Name + ") must be a valid " + 148 " (" + m_args[i].Name + ") must be a valid " +
149 m_args[i].ArgumentType.ToLower() + "."); 149 m_args[i].ArgumentType.ToLower() + ".");
150 } 150 }
151 cleanArgs[i] = m_args[i].ArgumentValue; 151 cleanArgs[i] = m_args[i].ArgumentValue;
152 152
153 i++; 153 i++;
154 } 154 }
155 155
156 m_command.Invoke(cleanArgs); 156 m_command.Invoke(cleanArgs);
157 } 157 }
158 158
159 #endregion 159 #endregion
160 } 160 }
161 161
162 /// <summary> 162 /// <summary>
163 /// A single command argument, contains name, type and at runtime, value. 163 /// A single command argument, contains name, type and at runtime, value.
164 /// </summary> 164 /// </summary>
165 public class CommandArgument 165 public class CommandArgument
166 { 166 {
167 private string m_help; 167 private string m_help;
168 private string m_name; 168 private string m_name;
169 private string m_type; 169 private string m_type;
170 private Object m_val; 170 private Object m_val;
171 171
172 public CommandArgument(string name, string help, string type) 172 public CommandArgument(string name, string help, string type)
173 { 173 {
174 m_name = name; 174 m_name = name;
175 m_help = help; 175 m_help = help;
176 m_type = type; 176 m_type = type;
177 } 177 }
178 178
179 public string Name 179 public string Name
180 { 180 {
181 get { return m_name; } 181 get { return m_name; }
182 } 182 }
183 183
184 public string HelpText 184 public string HelpText
185 { 185 {
186 get { return m_help; } 186 get { return m_help; }
187 } 187 }
188 188
189 public string ArgumentType 189 public string ArgumentType
190 { 190 {
191 get { return m_type; } 191 get { return m_type; }
192 } 192 }
193 193
194 public Object ArgumentValue 194 public Object ArgumentValue
195 { 195 {
196 get { return m_val; } 196 get { return m_val; }
197 set { m_val = value; } 197 set { m_val = value; }
198 } 198 }
199 } 199 }
200 200
201 /// <summary> 201 /// <summary>
202 /// A class to enable modules to register console and script commands, which enforces typing and valid input. 202 /// A class to enable modules to register console and script commands, which enforces typing and valid input.
203 /// </summary> 203 /// </summary>
204 public class Commander : ICommander 204 public class Commander : ICommander
205 { 205 {
206 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 206 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
207 private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>(); 207 private Dictionary<string, ICommand> m_commands = new Dictionary<string, ICommand>();
208 private string m_name; 208 private string m_name;
209 209
210 public Commander(string name) 210 public Commander(string name)
211 { 211 {
212 m_name = name; 212 m_name = name;
213 } 213 }
214 214
215 public Dictionary<string, ICommand> Commands 215 public Dictionary<string, ICommand> Commands
216 { 216 {
217 get { return m_commands; } 217 get { return m_commands; }
218 } 218 }
219 219
220 #region ICommander Members 220 #region ICommander Members
221 221
222 public void RegisterCommand(string commandName, ICommand command) 222 public void RegisterCommand(string commandName, ICommand command)
223 { 223 {
224 m_commands[commandName] = command; 224 m_commands[commandName] = command;
225 } 225 }
226 226
227 /// <summary> 227 /// <summary>
228 /// Generates a runtime C# class which can be compiled and inserted via reflection to enable modules to register new script commands 228 /// Generates a runtime C# class which can be compiled and inserted via reflection to enable modules to register new script commands
229 /// </summary> 229 /// </summary>
230 /// <returns>Returns C# source code to create a binding</returns> 230 /// <returns>Returns C# source code to create a binding</returns>
231 public string GenerateRuntimeAPI() 231 public string GenerateRuntimeAPI()
232 { 232 {
233 string classSrc = "\n\tpublic class " + m_name + " {\n"; 233 string classSrc = "\n\tpublic class " + m_name + " {\n";
234 foreach (ICommand com in m_commands.Values) 234 foreach (ICommand com in m_commands.Values)
235 { 235 {
236 classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( "; 236 classSrc += "\tpublic void " + EscapeRuntimeAPICommand(com.Name) + "( ";
237 foreach (KeyValuePair<string, string> arg in com.Arguments) 237 foreach (KeyValuePair<string, string> arg in com.Arguments)
238 { 238 {
239 classSrc += arg.Value + " " + Util.Md5Hash(arg.Key) + ","; 239 classSrc += arg.Value + " " + Util.Md5Hash(arg.Key) + ",";
240 } 240 }
241 classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma 241 classSrc = classSrc.Remove(classSrc.Length - 1); // Delete the last comma
242 classSrc += " )\n\t{\n"; 242 classSrc += " )\n\t{\n";
243 classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n"; 243 classSrc += "\t\tObject[] args = new Object[" + com.Arguments.Count.ToString() + "];\n";
244 int i = 0; 244 int i = 0;
245 foreach (KeyValuePair<string, string> arg in com.Arguments) 245 foreach (KeyValuePair<string, string> arg in com.Arguments)
246 { 246 {
247 classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n"; 247 classSrc += "\t\targs[" + i.ToString() + "] = " + Util.Md5Hash(arg.Key) + " " + ";\n";
248 i++; 248 i++;
249 } 249 }
250 classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n"; 250 classSrc += "\t\tGetCommander(\"" + m_name + "\").Run(\"" + com.Name + "\", args);\n";
251 classSrc += "\t}\n"; 251 classSrc += "\t}\n";
252 } 252 }
253 classSrc += "}\n"; 253 classSrc += "}\n";
254 254
255 return classSrc; 255 return classSrc;
256 } 256 }
257 257
258 /// <summary> 258 /// <summary>
259 /// Runs a specified function with attached arguments 259 /// Runs a specified function with attached arguments
260 /// *** <b>DO NOT CALL DIRECTLY.</b> *** 260 /// *** <b>DO NOT CALL DIRECTLY.</b> ***
261 /// Call ProcessConsoleCommand instead if handling human input. 261 /// Call ProcessConsoleCommand instead if handling human input.
262 /// </summary> 262 /// </summary>
263 /// <param name="function">The function name to call</param> 263 /// <param name="function">The function name to call</param>
264 /// <param name="args">The function parameters</param> 264 /// <param name="args">The function parameters</param>
265 public void Run(string function, object[] args) 265 public void Run(string function, object[] args)
266 { 266 {
267 m_commands[function].Run(args); 267 m_commands[function].Run(args);
268 } 268 }
269 269
270 public void ProcessConsoleCommand(string function, string[] args) 270 public void ProcessConsoleCommand(string function, string[] args)
271 { 271 {
272 if (m_commands.ContainsKey(function)) 272 if (m_commands.ContainsKey(function))
273 { 273 {
274 if (args.Length > 0 && args[0] == "help") 274 if (args.Length > 0 && args[0] == "help")
275 { 275 {
276 m_commands[function].ShowConsoleHelp(); 276 m_commands[function].ShowConsoleHelp();
277 } 277 }
278 else 278 else
279 { 279 {
280 m_commands[function].Run(args); 280 m_commands[function].Run(args);
281 } 281 }
282 } 282 }
283 else 283 else
284 { 284 {
285 if (function != "help") 285 if (function != "help")
286 m_log.Error("Invalid command - No such command exists"); 286 m_log.Error("Invalid command - No such command exists");
287 if (function == "api") 287 if (function == "api")
288 m_log.Info(GenerateRuntimeAPI()); 288 m_log.Info(GenerateRuntimeAPI());
289 ShowConsoleHelp(); 289 ShowConsoleHelp();
290 } 290 }
291 } 291 }
292 292
293 #endregion 293 #endregion
294 294
295 private void ShowConsoleHelp() 295 private void ShowConsoleHelp()
296 { 296 {
297 m_log.Info("===" + m_name + "==="); 297 m_log.Info("===" + m_name + "===");
298 foreach (ICommand com in m_commands.Values) 298 foreach (ICommand com in m_commands.Values)
299 { 299 {
300 m_log.Info("* " + com.Name + " - " + com.Help); 300 m_log.Info("* " + com.Name + " - " + com.Help);
301 } 301 }
302 } 302 }
303 303
304 private string EscapeRuntimeAPICommand(string command) 304 private string EscapeRuntimeAPICommand(string command)
305 { 305 {
306 command = command.Replace('-', '_'); 306 command = command.Replace('-', '_');
307 StringBuilder tmp = new StringBuilder(command); 307 StringBuilder tmp = new StringBuilder(command);
308 tmp[0] = tmp[0].ToString().ToUpper().ToCharArray()[0]; 308 tmp[0] = tmp[0].ToString().ToUpper().ToCharArray()[0];
309 309
310 return tmp.ToString(); 310 return tmp.ToString();
311 } 311 }
312 } 312 }
313} \ No newline at end of file 313} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
index fffb19e..8d1371c 100644
--- a/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/InterfaceCommander/CommanderTestModule.cs
@@ -1,89 +1,89 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using Nini.Config; 29using Nini.Config;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander; 31using OpenSim.Region.Environment.Modules.Framework.InterfaceCommander;
32using OpenSim.Region.Environment.Scenes; 32using OpenSim.Region.Environment.Scenes;
33 33
34namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander 34namespace OpenSim.Region.Environment.Modules.Framework.InterfaceCommander
35{ 35{
36 public class CommanderTestModule : IRegionModule, ICommandableModule 36 public class CommanderTestModule : IRegionModule, ICommandableModule
37 { 37 {
38 private readonly Commander m_commander = new Commander("CommanderTest"); 38 private readonly Commander m_commander = new Commander("CommanderTest");
39 private Scene m_scene; 39 private Scene m_scene;
40 40
41 #region ICommandableModule Members 41 #region ICommandableModule Members
42 42
43 public ICommander CommandInterface 43 public ICommander CommandInterface
44 { 44 {
45 get { throw new NotImplementedException(); } 45 get { throw new NotImplementedException(); }
46 } 46 }
47 47
48 #endregion 48 #endregion
49 49
50 #region IRegionModule Members 50 #region IRegionModule Members
51 51
52 public void Initialise(Scene scene, IConfigSource source) 52 public void Initialise(Scene scene, IConfigSource source)
53 { 53 {
54 m_scene = scene; 54 m_scene = scene;
55 } 55 }
56 56
57 public void PostInitialise() 57 public void PostInitialise()
58 { 58 {
59 Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string"); 59 Command testCommand = new Command("hello", InterfaceHelloWorld, "Says a simple debugging test string");
60 testCommand.AddArgument("world", "Write world here", "string"); 60 testCommand.AddArgument("world", "Write world here", "string");
61 61
62 m_commander.RegisterCommand("hello", testCommand); 62 m_commander.RegisterCommand("hello", testCommand);
63 63
64 // Register me 64 // Register me
65 m_scene.RegisterModuleCommander("commandertest", m_commander); 65 m_scene.RegisterModuleCommander("commandertest", m_commander);
66 } 66 }
67 67
68 public void Close() 68 public void Close()
69 { 69 {
70 } 70 }
71 71
72 public string Name 72 public string Name
73 { 73 {
74 get { return "CommanderTestModule"; } 74 get { return "CommanderTestModule"; }
75 } 75 }
76 76
77 public bool IsSharedModule 77 public bool IsSharedModule
78 { 78 {
79 get { return false; } 79 get { return false; }
80 } 80 }
81 81
82 #endregion 82 #endregion
83 83
84 private void InterfaceHelloWorld(Object[] args) 84 private void InterfaceHelloWorld(Object[] args)
85 { 85 {
86 Console.WriteLine("Hello World"); 86 Console.WriteLine("Hello World");
87 } 87 }
88 } 88 }
89} \ No newline at end of file 89} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
index 3e466dc..403ab5b 100644
--- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs
@@ -1,387 +1,387 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection; 29using System.Reflection;
30using libsecondlife; 30using libsecondlife;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Scenes; 35using OpenSim.Region.Environment.Scenes;
36 36
37namespace OpenSim.Region.Environment.Modules.World.Estate 37namespace OpenSim.Region.Environment.Modules.World.Estate
38{ 38{
39 public class EstateManagementModule : IRegionModule 39 public class EstateManagementModule : IRegionModule
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 private Scene m_scene; 43 private Scene m_scene;
44 44
45 #region Packet Data Responders 45 #region Packet Data Responders
46 46
47 private static void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice) 47 private static void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice)
48 { 48 {
49 remote_client.sendDetailedEstateData(invoice); 49 remote_client.sendDetailedEstateData(invoice);
50 remote_client.sendEstateManagersList(invoice); 50 remote_client.sendEstateManagersList(invoice);
51 } 51 }
52 52
53 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, 53 private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
54 int matureLevel, bool restrictPushObject, bool allowParcelChanges) 54 int matureLevel, bool restrictPushObject, bool allowParcelChanges)
55 { 55 {
56 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None; 56 m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None;
57 57
58 if (blockTerraform) 58 if (blockTerraform)
59 { 59 {
60 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 60 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
61 Simulator.RegionFlags.BlockTerraform; 61 Simulator.RegionFlags.BlockTerraform;
62 } 62 }
63 63
64 if (noFly) 64 if (noFly)
65 { 65 {
66 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 66 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
67 Simulator.RegionFlags.NoFly; 67 Simulator.RegionFlags.NoFly;
68 } 68 }
69 69
70 if (allowDamage) 70 if (allowDamage)
71 { 71 {
72 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 72 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
73 Simulator.RegionFlags.AllowDamage; 73 Simulator.RegionFlags.AllowDamage;
74 } 74 }
75 75
76 if (blockLandResell) 76 if (blockLandResell)
77 { 77 {
78 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 78 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
79 Simulator.RegionFlags.BlockLandResell; 79 Simulator.RegionFlags.BlockLandResell;
80 } 80 }
81 81
82 m_scene.RegionInfo.EstateSettings.maxAgents = (byte) maxAgents; 82 m_scene.RegionInfo.EstateSettings.maxAgents = (byte) maxAgents;
83 83
84 m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor; 84 m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor;
85 85
86 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess) matureLevel; 86 m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess) matureLevel;
87 87
88 88
89 if (restrictPushObject) 89 if (restrictPushObject)
90 { 90 {
91 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 91 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
92 Simulator.RegionFlags.RestrictPushObject; 92 Simulator.RegionFlags.RestrictPushObject;
93 } 93 }
94 94
95 if (allowParcelChanges) 95 if (allowParcelChanges)
96 { 96 {
97 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | 97 m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags |
98 Simulator.RegionFlags.AllowParcelChanges; 98 Simulator.RegionFlags.AllowParcelChanges;
99 } 99 }
100 100
101 sendRegionInfoPacketToAll(); 101 sendRegionInfoPacketToAll();
102 } 102 }
103 103
104 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture) 104 public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, LLUUID texture)
105 { 105 {
106 switch (corner) 106 switch (corner)
107 { 107 {
108 case 0: 108 case 0:
109 m_scene.RegionInfo.EstateSettings.terrainBase0 = texture; 109 m_scene.RegionInfo.EstateSettings.terrainBase0 = texture;
110 break; 110 break;
111 case 1: 111 case 1:
112 m_scene.RegionInfo.EstateSettings.terrainBase1 = texture; 112 m_scene.RegionInfo.EstateSettings.terrainBase1 = texture;
113 break; 113 break;
114 case 2: 114 case 2:
115 m_scene.RegionInfo.EstateSettings.terrainBase2 = texture; 115 m_scene.RegionInfo.EstateSettings.terrainBase2 = texture;
116 break; 116 break;
117 case 3: 117 case 3:
118 m_scene.RegionInfo.EstateSettings.terrainBase3 = texture; 118 m_scene.RegionInfo.EstateSettings.terrainBase3 = texture;
119 break; 119 break;
120 } 120 }
121 } 121 }
122 122
123 public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID) 123 public void setEstateTerrainDetailTexture(IClientAPI client, int corner, LLUUID textureUUID)
124 { 124 {
125 switch (corner) 125 switch (corner)
126 { 126 {
127 case 0: 127 case 0:
128 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID; 128 m_scene.RegionInfo.EstateSettings.terrainDetail0 = textureUUID;
129 break; 129 break;
130 case 1: 130 case 1:
131 m_scene.RegionInfo.EstateSettings.terrainDetail1 = textureUUID; 131 m_scene.RegionInfo.EstateSettings.terrainDetail1 = textureUUID;
132 break; 132 break;
133 case 2: 133 case 2:
134 m_scene.RegionInfo.EstateSettings.terrainDetail2 = textureUUID; 134 m_scene.RegionInfo.EstateSettings.terrainDetail2 = textureUUID;
135 break; 135 break;
136 case 3: 136 case 3:
137 m_scene.RegionInfo.EstateSettings.terrainDetail3 = textureUUID; 137 m_scene.RegionInfo.EstateSettings.terrainDetail3 = textureUUID;
138 break; 138 break;
139 } 139 }
140 } 140 }
141 141
142 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) 142 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
143 { 143 {
144 switch (corner) 144 switch (corner)
145 { 145 {
146 case 0: 146 case 0:
147 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue; 147 m_scene.RegionInfo.EstateSettings.terrainStartHeight0 = lowValue;
148 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue; 148 m_scene.RegionInfo.EstateSettings.terrainHeightRange0 = highValue;
149 break; 149 break;
150 case 1: 150 case 1:
151 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue; 151 m_scene.RegionInfo.EstateSettings.terrainStartHeight1 = lowValue;
152 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue; 152 m_scene.RegionInfo.EstateSettings.terrainHeightRange1 = highValue;
153 break; 153 break;
154 case 2: 154 case 2:
155 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue; 155 m_scene.RegionInfo.EstateSettings.terrainStartHeight2 = lowValue;
156 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue; 156 m_scene.RegionInfo.EstateSettings.terrainHeightRange2 = highValue;
157 break; 157 break;
158 case 3: 158 case 3:
159 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue; 159 m_scene.RegionInfo.EstateSettings.terrainStartHeight3 = lowValue;
160 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue; 160 m_scene.RegionInfo.EstateSettings.terrainHeightRange3 = highValue;
161 break; 161 break;
162 } 162 }
163 } 163 }
164 164
165 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) 165 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
166 { 166 {
167 sendRegionHandshakeToAll(); 167 sendRegionHandshakeToAll();
168 } 168 }
169 169
170 public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, 170 public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit,
171 bool UseFixedSun, float SunHour) 171 bool UseFixedSun, float SunHour)
172 { 172 {
173 // Water Height 173 // Water Height
174 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight; 174 m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight;
175 175
176 // Terraforming limits 176 // Terraforming limits
177 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; 177 m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit;
178 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; 178 m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit;
179 179
180 // Time of day / fixed sun 180 // Time of day / fixed sun
181 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; 181 m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun;
182 m_scene.RegionInfo.EstateSettings.sunHour = SunHour; 182 m_scene.RegionInfo.EstateSettings.sunHour = SunHour;
183 183
184 sendRegionInfoPacketToAll(); 184 sendRegionInfoPacketToAll();
185 } 185 }
186 186
187 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 187 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
188 { 188 {
189 m_scene.Restart(timeInSeconds); 189 m_scene.Restart(timeInSeconds);
190 } 190 }
191 191
192 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID) 192 private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID)
193 { 193 {
194 m_scene.RegionInfo.CovenantID = estateCovenantID; 194 m_scene.RegionInfo.CovenantID = estateCovenantID;
195 m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID); 195 m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID);
196 } 196 }
197 197
198 private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user) 198 private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user)
199 { 199 {
200 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. 200 // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
201 201
202 switch (estateAccessType) 202 switch (estateAccessType)
203 { 203 {
204 case 256: 204 case 256:
205 205
206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 206 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 207 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 208 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
209 { 209 {
210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user); 210 m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
211 remote_client.sendEstateManagersList(invoice); 211 remote_client.sendEstateManagersList(invoice);
212 } 212 }
213 else 213 else
214 { 214 {
215 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 215 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
216 } 216 }
217 217
218 break; 218 break;
219 case 512: 219 case 512:
220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml 220 // This needs to be updated for SuperEstateOwnerUser.. a non existing user in the estatesettings.xml
221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates 221 // So make sure you really trust your region owners. because they can add other estate manaagers to your other estates
222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions) 222 if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.PermissionsMngr.BypassPermissions)
223 { 223 {
224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 224 m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
225 remote_client.sendEstateManagersList(invoice); 225 remote_client.sendEstateManagersList(invoice);
226 } 226 }
227 else 227 else
228 { 228 {
229 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 229 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
230 } 230 }
231 break; 231 break;
232 232
233 default: 233 default:
234 234
235 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta"); 235 m_log.Error("EstateOwnerMessage: Unknown EstateAccessType requested in estateAccessDelta");
236 break; 236 break;
237 } 237 }
238 } 238 }
239 239
240 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) 240 private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
241 { 241 {
242 m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message); 242 m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message);
243 } 243 }
244 244
245 private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message) 245 private void SendEstateBlueBoxMessage(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, LLUUID sessionID, string senderName, string message)
246 { 246 {
247 m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message); 247 m_scene.SendEstateMessageFromEstateTools(senderID, sessionID, senderName, message);
248 } 248 }
249 249
250 private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics) 250 private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics)
251 { 251 {
252 if (physics) 252 if (physics)
253 { 253 {
254 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics; 254 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics;
255 } 255 }
256 else 256 else
257 { 257 {
258 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics; 258 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics;
259 } 259 }
260 260
261 if (scripted) 261 if (scripted)
262 { 262 {
263 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts; 263 m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts;
264 } 264 }
265 else 265 else
266 { 266 {
267 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts; 267 m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts;
268 } 268 }
269 269
270 270
271 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); 271 m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics);
272 } 272 }
273 273
274 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey) 274 private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, LLUUID invoice, LLUUID senderID, LLUUID prey)
275 { 275 {
276 if (prey != LLUUID.Zero) 276 if (prey != LLUUID.Zero)
277 { 277 {
278 ScenePresence s = m_scene.GetScenePresence(prey); 278 ScenePresence s = m_scene.GetScenePresence(prey);
279 if (s != null) 279 if (s != null)
280 { 280 {
281 m_scene.TeleportClientHome(prey, s.ControllingClient); 281 m_scene.TeleportClientHome(prey, s.ControllingClient);
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 private static void HandleRegionInfoRequest(IClientAPI remote_client) 286 private static void HandleRegionInfoRequest(IClientAPI remote_client)
287 { 287 {
288 remote_client.sendRegionInfoToEstateMenu(); 288 remote_client.sendRegionInfoToEstateMenu();
289 } 289 }
290 290
291 private static void HandleEstateCovenantRequest(IClientAPI remote_client) 291 private static void HandleEstateCovenantRequest(IClientAPI remote_client)
292 { 292 {
293 remote_client.sendEstateCovenantInformation(); 293 remote_client.sendEstateCovenantInformation();
294 } 294 }
295 295
296 #endregion 296 #endregion
297 297
298 #region Outgoing Packets 298 #region Outgoing Packets
299 299
300 public void sendRegionInfoPacketToAll() 300 public void sendRegionInfoPacketToAll()
301 { 301 {
302 List<ScenePresence> avatars = m_scene.GetAvatars(); 302 List<ScenePresence> avatars = m_scene.GetAvatars();
303 303
304 for (int i = 0; i < avatars.Count; i++) 304 for (int i = 0; i < avatars.Count; i++)
305 { 305 {
306 avatars[i].ControllingClient.sendRegionInfoToEstateMenu(); 306 avatars[i].ControllingClient.sendRegionInfoToEstateMenu();
307 } 307 }
308 } 308 }
309 309
310 public void sendRegionHandshake(IClientAPI remoteClient) 310 public void sendRegionHandshake(IClientAPI remoteClient)
311 { 311 {
312 remoteClient.SendRegionHandshake(m_scene.RegionInfo); 312 remoteClient.SendRegionHandshake(m_scene.RegionInfo);
313 } 313 }
314 314
315 public void sendRegionHandshakeToAll() 315 public void sendRegionHandshakeToAll()
316 { 316 {
317 m_scene.Broadcast( 317 m_scene.Broadcast(
318 sendRegionHandshake 318 sendRegionHandshake
319 ); 319 );
320 } 320 }
321 321
322 #endregion 322 #endregion
323 323
324 #region IRegionModule Members 324 #region IRegionModule Members
325 325
326 public void Initialise(Scene scene, IConfigSource source) 326 public void Initialise(Scene scene, IConfigSource source)
327 { 327 {
328 m_scene = scene; 328 m_scene = scene;
329 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 329 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
330 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; 330 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
331 } 331 }
332 332
333 333
334 public void PostInitialise() 334 public void PostInitialise()
335 { 335 {
336 } 336 }
337 337
338 public void Close() 338 public void Close()
339 { 339 {
340 } 340 }
341 341
342 public string Name 342 public string Name
343 { 343 {
344 get { return "EstateManagementModule"; } 344 get { return "EstateManagementModule"; }
345 } 345 }
346 346
347 public bool IsSharedModule 347 public bool IsSharedModule
348 { 348 {
349 get { return false; } 349 get { return false; }
350 } 350 }
351 351
352 #endregion 352 #endregion
353 353
354 #region Other Functions 354 #region Other Functions
355 355
356 public void changeWaterHeight(float height) 356 public void changeWaterHeight(float height)
357 { 357 {
358 setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, 358 setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit,
359 m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); 359 m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour);
360 sendRegionInfoPacketToAll(); 360 sendRegionInfoPacketToAll();
361 } 361 }
362 362
363 #endregion 363 #endregion
364 364
365 private void EventManager_OnNewClient(IClientAPI client) 365 private void EventManager_OnNewClient(IClientAPI client)
366 { 366 {
367 client.OnDetailedEstateDataRequest += sendDetailedEstateData; 367 client.OnDetailedEstateDataRequest += sendDetailedEstateData;
368 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; 368 client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler;
369 client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; 369 client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture;
370 client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture; 370 client.OnSetEstateTerrainDetailTexture += setEstateTerrainDetailTexture;
371 client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights; 371 client.OnSetEstateTerrainTextureHeights += setEstateTerrainTextureHeights;
372 client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest; 372 client.OnCommitEstateTerrainTextureRequest += handleCommitEstateTerrainTextureRequest;
373 client.OnSetRegionTerrainSettings += setRegionTerrainSettings; 373 client.OnSetRegionTerrainSettings += setRegionTerrainSettings;
374 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; 374 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
375 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; 375 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
376 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; 376 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
377 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; 377 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
378 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; 378 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
379 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; 379 client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
380 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; 380 client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
381 381
382 client.OnRegionInfoRequest += HandleRegionInfoRequest; 382 client.OnRegionInfoRequest += HandleRegionInfoRequest;
383 client.OnEstateCovenantRequest += HandleEstateCovenantRequest; 383 client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
384 sendRegionHandshake(client); 384 sendRegionHandshake(client);
385 } 385 }
386 } 386 }
387} \ No newline at end of file 387} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
index 8ebe33e..68c8046 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs
@@ -1,167 +1,167 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Drawing; 29using System.Drawing;
30using Nini.Config; 30using Nini.Config;
31using OpenJPEGNet; 31using OpenJPEGNet;
32using OpenSim.Region.Environment.Interfaces; 32using OpenSim.Region.Environment.Interfaces;
33using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
34 34
35namespace OpenSim.Region.Environment.Modules.World.WorldMap 35namespace OpenSim.Region.Environment.Modules.World.WorldMap
36{ 36{
37 internal class MapImageModule : IMapImageGenerator, IRegionModule 37 internal class MapImageModule : IMapImageGenerator, IRegionModule
38 { 38 {
39 private Scene m_scene; 39 private Scene m_scene;
40 40
41 #region IMapImageGenerator Members 41 #region IMapImageGenerator Members
42 42
43 public byte[] WriteJpeg2000Image(string gradientmap) 43 public byte[] WriteJpeg2000Image(string gradientmap)
44 { 44 {
45 byte[] imageData = null; 45 byte[] imageData = null;
46 46
47 Bitmap bmp = TerrainToBitmap(gradientmap); 47 Bitmap bmp = TerrainToBitmap(gradientmap);
48 48
49 try 49 try
50 { 50 {
51 imageData = OpenJPEG.EncodeFromImage(bmp, true); 51 imageData = OpenJPEG.EncodeFromImage(bmp, true);
52 } 52 }
53 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke 53 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
54 { 54 {
55 Console.WriteLine("Failed generating terrain map: " + e); 55 Console.WriteLine("Failed generating terrain map: " + e);
56 } 56 }
57 57
58 return imageData; 58 return imageData;
59 } 59 }
60 60
61 #endregion 61 #endregion
62 62
63 #region IRegionModule Members 63 #region IRegionModule Members
64 64
65 public void Initialise(Scene scene, IConfigSource source) 65 public void Initialise(Scene scene, IConfigSource source)
66 { 66 {
67 m_scene = scene; 67 m_scene = scene;
68 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 68 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
69 } 69 }
70 70
71 public void PostInitialise() 71 public void PostInitialise()
72 { 72 {
73 } 73 }
74 74
75 public void Close() 75 public void Close()
76 { 76 {
77 } 77 }
78 78
79 public string Name 79 public string Name
80 { 80 {
81 get { return "MapImageModule"; } 81 get { return "MapImageModule"; }
82 } 82 }
83 83
84 public bool IsSharedModule 84 public bool IsSharedModule
85 { 85 {
86 get { return false; } 86 get { return false; }
87 } 87 }
88 88
89 #endregion 89 #endregion
90 90
91 private void ShadeBuildings(Bitmap map) 91 private void ShadeBuildings(Bitmap map)
92 { 92 {
93 lock (map) 93 lock (map)
94 { 94 {
95 lock (m_scene.Entities) 95 lock (m_scene.Entities)
96 { 96 {
97 foreach (EntityBase entity in m_scene.Entities.Values) 97 foreach (EntityBase entity in m_scene.Entities.Values)
98 { 98 {
99 if (entity is SceneObjectGroup) 99 if (entity is SceneObjectGroup)
100 { 100 {
101 SceneObjectGroup sog = (SceneObjectGroup) entity; 101 SceneObjectGroup sog = (SceneObjectGroup) entity;
102 102
103 foreach (SceneObjectPart primitive in sog.Children.Values) 103 foreach (SceneObjectPart primitive in sog.Children.Values)
104 { 104 {
105 int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); 105 int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2));
106 int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); 106 int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2));
107 int w = (int) primitive.Scale.X; 107 int w = (int) primitive.Scale.X;
108 int h = (int) primitive.Scale.Y; 108 int h = (int) primitive.Scale.Y;
109 109
110 int dx; 110 int dx;
111 for (dx = x; dx < x + w; dx++) 111 for (dx = x; dx < x + w; dx++)
112 { 112 {
113 int dy; 113 int dy;
114 for (dy = y; dy < y + h; dy++) 114 for (dy = y; dy < y + h; dy++)
115 { 115 {
116 if (x < 0 || y < 0) 116 if (x < 0 || y < 0)
117 continue; 117 continue;
118 if (x >= map.Width || y >= map.Height) 118 if (x >= map.Width || y >= map.Height)
119 continue; 119 continue;
120 120
121 map.SetPixel(dx, dy, Color.DarkGray); 121 map.SetPixel(dx, dy, Color.DarkGray);
122 } 122 }
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 private Bitmap TerrainToBitmap(string gradientmap) 131 private Bitmap TerrainToBitmap(string gradientmap)
132 { 132 {
133 Bitmap gradientmapLd = new Bitmap(gradientmap); 133 Bitmap gradientmapLd = new Bitmap(gradientmap);
134 134
135 int pallete = gradientmapLd.Height; 135 int pallete = gradientmapLd.Height;
136 136
137 Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); 137 Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height);
138 Color[] colours = new Color[pallete]; 138 Color[] colours = new Color[pallete];
139 139
140 for (int i = 0; i < pallete; i++) 140 for (int i = 0; i < pallete; i++)
141 { 141 {
142 colours[i] = gradientmapLd.GetPixel(0, i); 142 colours[i] = gradientmapLd.GetPixel(0, i);
143 } 143 }
144 144
145 lock (m_scene.Heightmap) 145 lock (m_scene.Heightmap)
146 { 146 {
147 ITerrainChannel copy = m_scene.Heightmap; 147 ITerrainChannel copy = m_scene.Heightmap;
148 for (int y = 0; y < copy.Height; y++) 148 for (int y = 0; y < copy.Height; y++)
149 { 149 {
150 for (int x = 0; x < copy.Width; x++) 150 for (int x = 0; x < copy.Width; x++)
151 { 151 {
152 // 512 is the largest possible height before colours clamp 152 // 512 is the largest possible height before colours clamp
153 int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); 153 int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1));
154 154
155 // Handle error conditions 155 // Handle error conditions
156 if (colorindex > pallete - 1 || colorindex < 0) 156 if (colorindex > pallete - 1 || colorindex < 0)
157 bmp.SetPixel(x, copy.Height - y - 1, Color.Red); 157 bmp.SetPixel(x, copy.Height - y - 1, Color.Red);
158 else 158 else
159 bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]); 159 bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]);
160 } 160 }
161 } 161 }
162 ShadeBuildings(bmp); 162 ShadeBuildings(bmp);
163 return bmp; 163 return bmp;
164 } 164 }
165 } 165 }
166 } 166 }
167} \ No newline at end of file 167} \ No newline at end of file