aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot
diff options
context:
space:
mode:
Diffstat (limited to 'ExportBot')
-rw-r--r--ExportBot/Arguments.cs111
-rw-r--r--ExportBot/ClientManager.cs322
-rw-r--r--ExportBot/Command.cs29
-rw-r--r--ExportBot/Commands/AppearanceCommand.cs29
-rw-r--r--ExportBot/Commands/CloneProfileCommand.cs130
-rw-r--r--ExportBot/Commands/Communication/EchoMasterCommand.cs42
-rw-r--r--ExportBot/Commands/Communication/IMCommand.cs71
-rw-r--r--ExportBot/Commands/Communication/SayCommand.cs44
-rw-r--r--ExportBot/Commands/Communication/ShoutCommand.cs49
-rw-r--r--ExportBot/Commands/Communication/WhisperCommand.cs49
-rw-r--r--ExportBot/Commands/DebugCommand.cs37
-rw-r--r--ExportBot/Commands/DilationCommand.cs22
-rw-r--r--ExportBot/Commands/DumpOutfitCommand.cs98
-rw-r--r--ExportBot/Commands/ExportCommand.cs209
-rw-r--r--ExportBot/Commands/ExportOutfitCommand.cs68
-rw-r--r--ExportBot/Commands/ExportParticlesCommand.cs119
-rw-r--r--ExportBot/Commands/FindSimCommand.cs43
-rw-r--r--ExportBot/Commands/HelpCommand.cs29
-rw-r--r--ExportBot/Commands/ImportCommand.cs246
-rw-r--r--ExportBot/Commands/ImportOutfitCommand.cs66
-rw-r--r--ExportBot/Commands/Inventory/BalanceCommand.cs21
-rw-r--r--ExportBot/Commands/Inventory/DeleteFolderCommand.cs43
-rw-r--r--ExportBot/Commands/Inventory/GiveAllCommand.cs27
-rw-r--r--ExportBot/Commands/Inventory/InventoryCommand.cs62
-rw-r--r--ExportBot/Commands/Inventory/WearCommand.cs43
-rw-r--r--ExportBot/Commands/LoadCommand.cs28
-rw-r--r--ExportBot/Commands/LoginCommand.cs34
-rw-r--r--ExportBot/Commands/LogoutCommand.cs24
-rw-r--r--ExportBot/Commands/MD5Command.cs22
-rw-r--r--ExportBot/Commands/Movement/FollowCommand.cs90
-rw-r--r--ExportBot/Commands/Movement/GotoCommand.cs53
-rw-r--r--ExportBot/Commands/Movement/JumpCommand.cs34
-rw-r--r--ExportBot/Commands/Movement/LocationCommand.cs23
-rw-r--r--ExportBot/Commands/Movement/MoveToCommand.cs24
-rw-r--r--ExportBot/Commands/Movement/SitCommand.cs52
-rw-r--r--ExportBot/Commands/Movement/SitOnCommand.cs54
-rw-r--r--ExportBot/Commands/Movement/StandCommand.cs47
-rw-r--r--ExportBot/Commands/PacketLogCommand.cs84
-rw-r--r--ExportBot/Commands/ParcelInfoCommand.cs62
-rw-r--r--ExportBot/Commands/PrimCountCommand.cs32
-rw-r--r--ExportBot/Commands/QuitCommand.cs24
-rw-r--r--ExportBot/Commands/RegionInfoCommand.cs45
-rw-r--r--ExportBot/Commands/SetMasterCommand.cs73
-rw-r--r--ExportBot/Commands/SetMasterKeyCommand.cs35
-rw-r--r--ExportBot/Commands/ShowEffectsCommand.cs76
-rw-r--r--ExportBot/Commands/StatsCommand.cs39
-rw-r--r--ExportBot/Commands/TouchCommand.cs55
-rw-r--r--ExportBot/Commands/TreeCommand.cs51
-rw-r--r--ExportBot/Commands/UptimeCommand.cs25
-rw-r--r--ExportBot/Commands/WhoCommand.cs29
-rw-r--r--ExportBot/ExportBot.build67
-rw-r--r--ExportBot/ExportBot.csproj263
-rw-r--r--ExportBot/ExportBot.exe.build98
-rw-r--r--ExportBot/Parsing.cs61
-rw-r--r--ExportBot/Program.cs141
-rw-r--r--ExportBot/Properties/AssemblyInfo.cs33
-rw-r--r--ExportBot/README5
-rw-r--r--ExportBot/TestClient.cs328
-rw-r--r--ExportBot/TestClient.csproj120
59 files changed, 0 insertions, 4240 deletions
diff --git a/ExportBot/Arguments.cs b/ExportBot/Arguments.cs
deleted file mode 100644
index 01d852d..0000000
--- a/ExportBot/Arguments.cs
+++ /dev/null
@@ -1,111 +0,0 @@
1using System;
2using System.Collections.Specialized;
3using System.Text.RegularExpressions;
4
5namespace CommandLine.Utility
6{
7 /// <summary>
8 /// Arguments class
9 /// </summary>
10 public class Arguments
11 {
12 // Variables
13 private StringDictionary Parameters;
14
15 // Constructor
16 public Arguments(string[] Args)
17 {
18 Parameters = new StringDictionary();
19 Regex Splitter = new Regex(@"^-{1,2}|=|:",
20 RegexOptions.IgnoreCase | RegexOptions.Compiled);
21
22 Regex Remover = new Regex(@"^['""]?(.*?)['""]?$",
23 RegexOptions.IgnoreCase | RegexOptions.Compiled);
24
25 string Parameter = null;
26 string[] Parts;
27
28 // Valid parameters forms:
29 // {-,/,--}param{ ,=,:}((",')value(",'))
30 // Examples:
31 // -param1 value1 --param2 /param3:"Test-:-work"
32 // /param4=happy -param5 '--=nice=--'
33 foreach (string Txt in Args)
34 {
35 // Look for new parameters (-,/ or --) and a
36 // possible enclosed value (=,:)
37 Parts = Splitter.Split(Txt, 3);
38
39 switch (Parts.Length)
40 {
41 // Found a value (for the last parameter
42 // found (space separator))
43 case 1:
44 if (Parameter != null)
45 {
46 if (!Parameters.ContainsKey(Parameter))
47 {
48 Parts[0] =
49 Remover.Replace(Parts[0], "$1");
50
51 Parameters.Add(Parameter, Parts[0]);
52 }
53 Parameter = null;
54 }
55 // else Error: no parameter waiting for a value (skipped)
56 break;
57
58 // Found just a parameter
59 case 2:
60 // The last parameter is still waiting.
61 // With no value, set it to true.
62 if (Parameter != null)
63 {
64 if (!Parameters.ContainsKey(Parameter))
65 Parameters.Add(Parameter, "true");
66 }
67 Parameter = Parts[1];
68 break;
69
70 // Parameter with enclosed value
71 case 3:
72 // The last parameter is still waiting.
73 // With no value, set it to true.
74 if (Parameter != null)
75 {
76 if (!Parameters.ContainsKey(Parameter))
77 Parameters.Add(Parameter, "true");
78 }
79
80 Parameter = Parts[1];
81
82 // Remove possible enclosing characters (",')
83 if (!Parameters.ContainsKey(Parameter))
84 {
85 Parts[2] = Remover.Replace(Parts[2], "$1");
86 Parameters.Add(Parameter, Parts[2]);
87 }
88
89 Parameter = null;
90 break;
91 }
92 }
93 // In case a parameter is still waiting
94 if (Parameter != null)
95 {
96 if (!Parameters.ContainsKey(Parameter))
97 Parameters.Add(Parameter, "true");
98 }
99 }
100
101 // Retrieve a parameter value if it exists
102 // (overriding C# indexer property)
103 public string this[string Param]
104 {
105 get
106 {
107 return (Parameters[Param]);
108 }
109 }
110 }
111}
diff --git a/ExportBot/ClientManager.cs b/ExportBot/ClientManager.cs
deleted file mode 100644
index 79528ed..0000000
--- a/ExportBot/ClientManager.cs
+++ /dev/null
@@ -1,322 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using System.Xml;
5using System.Threading;
6using libsecondlife;
7using libsecondlife.Packets;
8using libsecondlife.AssetSystem;
9
10namespace libsecondlife.TestClient
11{
12 public class LoginDetails
13 {
14 public string FirstName;
15 public string LastName;
16 public string Password;
17 public string StartLocation;
18 public string MasterName;
19 public LLUUID MasterKey;
20 }
21
22 public class StartPosition
23 {
24 public string sim;
25 public int x;
26 public int y;
27 public int z;
28
29 public StartPosition()
30 {
31 this.sim = null;
32 this.x = 0;
33 this.y = 0;
34 this.z = 0;
35 }
36 }
37
38 public class ClientManager
39 {
40 public Dictionary<LLUUID, SecondLife> Clients = new Dictionary<LLUUID, SecondLife>();
41 public Dictionary<Simulator, Dictionary<uint, Primitive>> SimPrims = new Dictionary<Simulator, Dictionary<uint, Primitive>>();
42
43 public bool Running = true;
44
45 public static SecondLife MainClient;
46
47 string contactPerson = String.Empty;
48 private LLUUID resolvedMasterKey = LLUUID.Zero;
49 private ManualResetEvent keyResolution = new ManualResetEvent(false);
50
51 /// <summary>
52 ///
53 /// </summary>
54 /// <param name="accounts"></param>
55 public ClientManager(List<LoginDetails> accounts, string c)
56 {
57 this.contactPerson = c;
58 foreach (LoginDetails account in accounts)
59 Login(account);
60 }
61
62 public ClientManager(List<LoginDetails> accounts, string c, string s)
63 {
64 this.contactPerson = c;
65 char sep = '/';
66 string[] startbits = s.Split(sep);
67
68 foreach (LoginDetails account in accounts)
69 {
70 account.StartLocation = NetworkManager.StartLocation(startbits[0], Int32.Parse(startbits[1]),
71 Int32.Parse(startbits[2]), Int32.Parse(startbits[3]));
72 Login(account);
73 }
74 }
75
76 public string ExportAvatarRestMethod( string request, string path, string param )
77 {
78 Console.WriteLine("Got a request to export an avatar!");
79 DoCommandAll("Executing exportoutfitcommand " + param + " " + param + ".xml", null, null);
80
81 MainClient.Self.InstantMessage(new LLUUID(param), "(automated bot message) Your avatar has been copied OK, if you wish to use it to create your account please type yes, otherwise ignore this message. Note that you are responsible for obtaining all copyright permissions for textures etc on your avatar", new LLUUID(param));
82
83 return "OK";
84 }
85
86
87 /// <summary>
88 ///
89 /// </summary>
90 /// <param name="account"></param>
91 /// <returns></returns>
92 public TestClient Login(LoginDetails account)
93 {
94 // Check if this client is already logged in
95 foreach (TestClient c in Clients.Values)
96 {
97 if (c.Self.FirstName == account.FirstName && c.Self.LastName == account.LastName)
98 {
99 Logout(c);
100 break;
101 }
102 }
103
104 TestClient client = new TestClient(this);
105
106 // Optimize the throttle
107 client.Throttle.Wind = 0;
108 client.Throttle.Cloud = 0;
109 client.Throttle.Land = 1000000;
110 client.Throttle.Task = 1000000;
111
112 client.SimPrims = SimPrims;
113 client.MasterName = account.MasterName;
114 client.MasterKey = account.MasterKey;
115
116 if (!String.IsNullOrEmpty(account.StartLocation))
117 {
118 if (!client.Network.Login(account.FirstName, account.LastName, account.Password, "TestClient",
119 account.StartLocation, contactPerson))
120 {
121 Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
122 client.Network.LoginMessage);
123 }
124 }
125 else
126 {
127 if (!client.Network.Login(account.FirstName, account.LastName, account.Password, "TestClient",
128 contactPerson))
129 {
130 Console.WriteLine("Failed to login " + account.FirstName + " " + account.LastName + ": " +
131 client.Network.LoginStatusMessage);
132 }
133 }
134
135 if (client.Network.Connected)
136 {
137 if (account.MasterKey == LLUUID.Zero && !String.IsNullOrEmpty(account.MasterName))
138 {
139 Console.WriteLine("Resolving {0}'s UUID", account.MasterName);
140 // Find master's key from name
141 DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
142 client.Directory.OnDirPeopleReply += callback;
143 client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, account.MasterName);
144 if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
145 {
146 account.MasterKey = resolvedMasterKey;
147 Console.WriteLine("\"{0}\" resolved to {1}", account.MasterName, account.MasterKey);
148 }
149 else
150 {
151 Console.WriteLine("Unable to obtain UUID for \"{0}\". No master will be used. Try specifying a key with --masterkey.", account.MasterName);
152 }
153 client.Directory.OnDirPeopleReply -= callback;
154 keyResolution.Reset();
155 }
156
157 client.MasterKey = account.MasterKey;
158
159 Clients[client.Network.AgentID] = client;
160
161 MainClient = client;
162 Console.WriteLine("Logged in " + client.ToString());
163 }
164
165 return client;
166 }
167
168 private void KeyResolvHandler(LLUUID queryid, List<DirectoryManager.AgentSearchData> matches)
169 {
170 LLUUID master = matches[0].AgentID;
171 if (matches.Count > 1)
172 {
173 Console.WriteLine("Possible masters:");
174 for (int i = 0; i < matches.Count; ++i)
175 {
176 Console.WriteLine("{0}: {1}", i, matches[i].FirstName + " " + matches[i].LastName);
177 }
178 Console.Write("Ambiguous master, choose one:");
179 string read = Console.ReadLine();
180 while (read != null)
181 {
182 int choice = 0;
183 if (int.TryParse(read, out choice))
184 {
185 master = matches[choice].AgentID;
186 break;
187 }
188 else
189 {
190 Console.WriteLine("Responce misunderstood.");
191 Console.Write("Type the corresponding number:");
192 }
193 read = Console.ReadLine();
194 }
195 }
196 resolvedMasterKey = master;
197 keyResolution.Set();
198 }
199
200 /// <summary>
201 ///
202 /// </summary>
203 /// <param name="args"></param>
204 /// <returns></returns>
205 public TestClient Login(string[] args)
206 {
207 LoginDetails account = new LoginDetails();
208 account.FirstName = args[0];
209 account.LastName = args[1];
210 account.Password = args[2];
211
212 if (args.Length == 4)
213 {
214 account.StartLocation = NetworkManager.StartLocation(args[3], 128, 128, 40);
215 }
216
217 return Login(account);
218 }
219
220 /// <summary>
221 ///
222 /// </summary>
223 public void Run()
224 {
225 Console.WriteLine("Type quit to exit. Type help for a command list.");
226
227 while (Running)
228 {
229 PrintPrompt();
230 string input = Console.ReadLine();
231 DoCommandAll(input, null, null);
232 }
233
234 foreach (SecondLife client in Clients.Values)
235 {
236 if (client.Network.Connected)
237 client.Network.Logout();
238 }
239 }
240
241 private void PrintPrompt()
242 {
243 int online = 0;
244
245 foreach (SecondLife client in Clients.Values)
246 {
247 if (client.Network.Connected) online++;
248 }
249
250 Console.Write(online + " avatars online> ");
251 }
252
253 /// <summary>
254 ///
255 /// </summary>
256 /// <param name="cmd"></param>
257 /// <param name="fromAgentID"></param>
258 /// <param name="imSessionID"></param>
259 public void DoCommandAll(string cmd, LLUUID fromAgentID, LLUUID imSessionID)
260 {
261 string[] tokens = cmd.Trim().Split(new char[] { ' ', '\t' });
262 string firstToken = tokens[0].ToLower();
263
264 if (tokens.Length == 0)
265 return;
266
267 if (firstToken == "login")
268 {
269 // Special login case: Only call it once, and allow it with
270 // no logged in avatars
271 string[] args = new string[tokens.Length - 1];
272 Array.Copy(tokens, 1, args, 0, args.Length);
273 Login(args);
274 }
275 else if (firstToken == "quit")
276 {
277 Quit();
278 Console.WriteLine("All clients logged out and program finished running.");
279 }
280 else
281 {
282 // make a copy of the clients list so that it can be iterated without fear of being changed during iteration
283 Dictionary<LLUUID, SecondLife> clientsCopy = new Dictionary<LLUUID, SecondLife>(Clients);
284
285 foreach (TestClient client in clientsCopy.Values)
286 client.DoCommand(cmd, fromAgentID, imSessionID);
287 }
288 }
289
290 /// <summary>
291 ///
292 /// </summary>
293 /// <param name="client"></param>
294 public void Logout(TestClient client)
295 {
296 Clients.Remove(client.Network.AgentID);
297 client.Network.Logout();
298 }
299
300 /// <summary>
301 ///
302 /// </summary>
303 public void LogoutAll()
304 {
305 // make a copy of the clients list so that it can be iterated without fear of being changed during iteration
306 Dictionary<LLUUID, SecondLife> clientsCopy = new Dictionary<LLUUID, SecondLife>(Clients);
307
308 foreach (TestClient client in clientsCopy.Values)
309 Logout(client);
310 }
311
312 /// <summary>
313 ///
314 /// </summary>
315 public void Quit()
316 {
317 LogoutAll();
318 Running = false;
319 // TODO: It would be really nice if we could figure out a way to abort the ReadLine here in so that Run() will exit.
320 }
321 }
322}
diff --git a/ExportBot/Command.cs b/ExportBot/Command.cs
deleted file mode 100644
index 5f92f32..0000000
--- a/ExportBot/Command.cs
+++ /dev/null
@@ -1,29 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public abstract class Command
10 {
11 public string Name;
12 public string Description;
13 public TestClient Client;
14
15 public abstract string Execute(string[] args, LLUUID fromAgentID);
16
17 /// <summary>
18 /// When set to true, think will be called.
19 /// </summary>
20 public bool Active;
21
22 /// <summary>
23 /// Called twice per second, when Command.Active is set to true.
24 /// </summary>
25 public virtual void Think()
26 {
27 }
28 }
29}
diff --git a/ExportBot/Commands/AppearanceCommand.cs b/ExportBot/Commands/AppearanceCommand.cs
deleted file mode 100644
index 6f003a7..0000000
--- a/ExportBot/Commands/AppearanceCommand.cs
+++ /dev/null
@@ -1,29 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class AppearanceCommand : Command
10 {
11 Utilities.Assets.AssetManager Assets;
12 Utilities.Appearance.AppearanceManager Appearance;
13
14 public AppearanceCommand(TestClient testClient)
15 {
16 Name = "appearance";
17 Description = "Set your current appearance to your last saved appearance";
18
19 Assets = new libsecondlife.Utilities.Assets.AssetManager(testClient);
20 Appearance = new libsecondlife.Utilities.Appearance.AppearanceManager(testClient, Assets);
21 }
22
23 public override string Execute(string[] args, LLUUID fromAgentID)
24 {
25 Appearance.SetPreviousAppearance();
26 return "Done.";
27 }
28 }
29}
diff --git a/ExportBot/Commands/CloneProfileCommand.cs b/ExportBot/Commands/CloneProfileCommand.cs
deleted file mode 100644
index 68712ff..0000000
--- a/ExportBot/Commands/CloneProfileCommand.cs
+++ /dev/null
@@ -1,130 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Threading;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class CloneProfileCommand : Command
10 {
11 Avatar.AvatarProperties Properties;
12 Avatar.Interests Interests;
13 private Dictionary<LLUUID,ulong> Avatars = new Dictionary<LLUUID,ulong>();
14 List<LLUUID> Groups = new List<LLUUID>();
15 bool ReceivedProperties = false;
16 bool ReceivedInterests = false;
17 bool ReceivedGroups = false;
18 ManualResetEvent ReceivedProfileEvent = new ManualResetEvent(false);
19
20 public CloneProfileCommand(TestClient testClient)
21 {
22 testClient.Avatars.OnAvatarInterests += new AvatarManager.AvatarInterestsCallback(Avatars_OnAvatarInterests);
23 testClient.Avatars.OnAvatarProperties += new AvatarManager.AvatarPropertiesCallback(Avatars_OnAvatarProperties);
24 testClient.Avatars.OnAvatarGroups += new AvatarManager.AvatarGroupsCallback(Avatars_OnAvatarGroups);
25 testClient.Self.OnJoinGroup += new MainAvatar.JoinGroupCallback(Self_OnJoinGroup);
26
27// testClient.Self.Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(AvatarSeen);
28
29 Name = "cloneprofile";
30 Description = "Clones another avatars profile as closely as possible. WARNING: This command will " +
31 "destroy your existing profile! Usage: cloneprofile [targetuuid]";
32 }
33
34 /* void AvatarSeen(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
35 {
36 lock (Avatars)
37 {
38 Avatars.Add(avatar.UUID,avatar.LocalID);
39 }
40 }*/
41
42 public override string Execute(string[] args, LLUUID fromAgentID)
43 {
44 if (args.Length != 1)
45 return Description;
46
47 LLUUID targetID;
48 ReceivedProperties = false;
49 ReceivedInterests = false;
50 ReceivedGroups = false;
51
52 try
53 {
54 targetID = new LLUUID(args[0]);
55 }
56 catch (Exception)
57 {
58 return Description;
59 }
60
61 // Request all of the packets that make up an avatar profile
62 Client.Avatars.RequestAvatarProperties(targetID);
63
64 // Wait for all the packets to arrive
65 ReceivedProfileEvent.Reset();
66 ReceivedProfileEvent.WaitOne(5000, false);
67
68 // Check if everything showed up
69 if (!ReceivedInterests || !ReceivedProperties || !ReceivedGroups)
70 return "Failed to retrieve a complete profile for that UUID";
71
72 Client.Self.SetAvatarInformation();
73
74 return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated();
75 }
76
77 void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties)
78 {
79 lock (ReceivedProfileEvent)
80 {
81 Properties = properties;
82 ReceivedProperties = true;
83
84 if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
85 ReceivedProfileEvent.Set();
86 }
87 }
88
89 void Avatars_OnAvatarInterests(LLUUID avatarID, Avatar.Interests interests)
90 {
91 lock (ReceivedProfileEvent)
92 {
93 Interests = interests;
94 ReceivedInterests = true;
95
96 if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
97 ReceivedProfileEvent.Set();
98 }
99 }
100
101 void Avatars_OnAvatarGroups(LLUUID avatarID, AvatarGroupsReplyPacket.GroupDataBlock[] groups)
102 {
103 lock (ReceivedProfileEvent)
104 {
105 foreach (AvatarGroupsReplyPacket.GroupDataBlock block in groups)
106 {
107 Groups.Add(block.GroupID);
108 }
109
110 ReceivedGroups = true;
111
112 if (ReceivedInterests && ReceivedProperties && ReceivedGroups)
113 ReceivedProfileEvent.Set();
114 }
115 }
116
117 void Self_OnJoinGroup(LLUUID groupID, bool success)
118 {
119 Console.WriteLine(Client.ToString() + (success ? " joined " : " failed to join ") +
120 groupID.ToStringHyphenated());
121
122 if (success)
123 {
124 Console.WriteLine(Client.ToString() + " setting " + groupID.ToStringHyphenated() +
125 " as the active group");
126 Client.Self.ActivateGroup(groupID);
127 }
128 }
129 }
130}
diff --git a/ExportBot/Commands/Communication/EchoMasterCommand.cs b/ExportBot/Commands/Communication/EchoMasterCommand.cs
deleted file mode 100644
index 2e426a8..0000000
--- a/ExportBot/Commands/Communication/EchoMasterCommand.cs
+++ /dev/null
@@ -1,42 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class EchoMasterCommand: Command
10 {
11 public EchoMasterCommand(TestClient testClient)
12 {
13 Name = "echoMaster";
14 Description = "Repeat everything that master says.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (!Active)
20 {
21 Active = true;
22 Client.Self.OnChat += new MainAvatar.ChatCallback(Self_OnChat);
23 return "Echoing is now on.";
24 }
25 else
26 {
27 Active = false;
28 Client.Self.OnChat -= new MainAvatar.ChatCallback(Self_OnChat);
29 return "Echoing is now off.";
30 }
31 }
32
33 void Self_OnChat(string message, MainAvatar.ChatAudibleLevel audible, MainAvatar.ChatType type,
34 MainAvatar.ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
35 {
36 if (message.Length > 0 && Client.MasterKey == id)
37 {
38 Client.Self.Chat(message, 0, MainAvatar.ChatType.Normal);
39 }
40 }
41 }
42}
diff --git a/ExportBot/Commands/Communication/IMCommand.cs b/ExportBot/Commands/Communication/IMCommand.cs
deleted file mode 100644
index 32d7fff..0000000
--- a/ExportBot/Commands/Communication/IMCommand.cs
+++ /dev/null
@@ -1,71 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Threading;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class ImCommand : Command
10 {
11 string ToAvatarName = String.Empty;
12 ManualResetEvent NameSearchEvent = new ManualResetEvent(false);
13 Dictionary<string, LLUUID> Name2Key = new Dictionary<string, LLUUID>();
14
15 public ImCommand(TestClient testClient)
16 {
17 testClient.Avatars.OnAvatarNameSearch += new AvatarManager.AvatarNameSearchCallback(Avatars_OnAvatarNameSearch);
18
19 Name = "im";
20 Description = "Instant message someone. Usage: im [firstname] [lastname] [message]";
21 }
22
23 public override string Execute(string[] args, LLUUID fromAgentID)
24 {
25 if (args.Length < 3)
26 return "Usage: im [firstname] [lastname] [message]";
27
28 ToAvatarName = args[0] + " " + args[1];
29
30 // Build the message
31 string message = String.Empty;
32 for (int ct = 2; ct < args.Length; ct++)
33 message += args[ct] + " ";
34 message = message.TrimEnd();
35 if (message.Length > 1023) message = message.Remove(1023);
36
37 if (!Name2Key.ContainsKey(ToAvatarName.ToLower()))
38 {
39 // Send the Query
40 Client.Avatars.RequestAvatarNameSearch(ToAvatarName, LLUUID.Random());
41
42 NameSearchEvent.WaitOne(6000, false);
43 }
44
45 if (Name2Key.ContainsKey(ToAvatarName.ToLower()))
46 {
47 LLUUID id = Name2Key[ToAvatarName.ToLower()];
48
49 Client.Self.InstantMessage(id, message, id);
50 return "Instant Messaged " + id.ToStringHyphenated() + " with message: " + message;
51 }
52 else
53 {
54 return "Name lookup for " + ToAvatarName + " failed";
55 }
56 }
57
58 void Avatars_OnAvatarNameSearch(LLUUID queryID, Dictionary<LLUUID, string> avatars)
59 {
60 foreach (KeyValuePair<LLUUID, string> kvp in avatars)
61 {
62 if (kvp.Value.ToLower() == ToAvatarName.ToLower())
63 {
64 Name2Key[ToAvatarName.ToLower()] = kvp.Key;
65 NameSearchEvent.Set();
66 return;
67 }
68 }
69 }
70 }
71}
diff --git a/ExportBot/Commands/Communication/SayCommand.cs b/ExportBot/Commands/Communication/SayCommand.cs
deleted file mode 100644
index d5717a6..0000000
--- a/ExportBot/Commands/Communication/SayCommand.cs
+++ /dev/null
@@ -1,44 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace libsecondlife.TestClient
7{
8 public class SayCommand: Command
9 {
10 public SayCommand(TestClient testClient)
11 {
12 Name = "say";
13 Description = "Say something. (usage: say (optional channel) whatever)";
14 }
15
16 public override string Execute(string[] args, LLUUID fromAgentID)
17 {
18 int channel = 0;
19 int startIndex = 0;
20
21 if (args.Length < 1)
22 {
23 return "usage: say (optional channel) whatever";
24 }
25 else if (args.Length > 1)
26 {
27 if (Int32.TryParse(args[0], out channel))
28 startIndex = 1;
29 }
30
31 StringBuilder message = new StringBuilder();
32
33 for (int i = startIndex; i < args.Length; i++)
34 {
35 message.Append(args[i]);
36 if (i != args.Length - 1) message.Append(" ");
37 }
38
39 Client.Self.Chat(message.ToString(), channel, MainAvatar.ChatType.Normal);
40
41 return "Said " + message.ToString();
42 }
43 }
44}
diff --git a/ExportBot/Commands/Communication/ShoutCommand.cs b/ExportBot/Commands/Communication/ShoutCommand.cs
deleted file mode 100644
index cf4b6c5..0000000
--- a/ExportBot/Commands/Communication/ShoutCommand.cs
+++ /dev/null
@@ -1,49 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class ShoutCommand : Command
10 {
11 public ShoutCommand(TestClient testClient)
12 {
13 Name = "shout";
14 Description = "Shout something.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 int channel = 0;
20 int startIndex = 0;
21 string message = String.Empty;
22 if (args.Length < 1)
23 {
24 return "usage: shout (optional channel) whatever";
25 }
26 else if (args.Length > 1)
27 {
28 try
29 {
30 channel = Convert.ToInt32(args[0]);
31 startIndex = 1;
32 }
33 catch (FormatException)
34 {
35 channel = 0;
36 }
37 }
38
39 for (int i = startIndex; i < args.Length; i++)
40 {
41 message += args[i] + " ";
42 }
43
44 Client.Self.Chat(message, channel, MainAvatar.ChatType.Shout);
45
46 return "Shouted " + message;
47 }
48 }
49}
diff --git a/ExportBot/Commands/Communication/WhisperCommand.cs b/ExportBot/Commands/Communication/WhisperCommand.cs
deleted file mode 100644
index 89ba0f3..0000000
--- a/ExportBot/Commands/Communication/WhisperCommand.cs
+++ /dev/null
@@ -1,49 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class WhisperCommand : Command
10 {
11 public WhisperCommand(TestClient testClient)
12 {
13 Name = "whisper";
14 Description = "Whisper something.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 int channel = 0;
20 int startIndex = 0;
21 string message = String.Empty;
22 if (args.Length < 1)
23 {
24 return "usage: whisper (optional channel) whatever";
25 }
26 else if (args.Length > 1)
27 {
28 try
29 {
30 channel = Convert.ToInt32(args[0]);
31 startIndex = 1;
32 }
33 catch (FormatException)
34 {
35 channel = 0;
36 }
37 }
38
39 for (int i = startIndex; i < args.Length; i++)
40 {
41 message += args[i] + " ";
42 }
43
44 Client.Self.Chat(message, channel, MainAvatar.ChatType.Whisper);
45
46 return "Whispered " + message;
47 }
48 }
49}
diff --git a/ExportBot/Commands/DebugCommand.cs b/ExportBot/Commands/DebugCommand.cs
deleted file mode 100644
index fbfde7c..0000000
--- a/ExportBot/Commands/DebugCommand.cs
+++ /dev/null
@@ -1,37 +0,0 @@
1using System;
2using System.Collections.Generic;
3using libsecondlife;
4using libsecondlife.Packets;
5
6namespace libsecondlife.TestClient
7{
8 public class DebugCommand : Command
9 {
10 public DebugCommand(TestClient testClient)
11 {
12 Name = "debug";
13 Description = "Turn debug messages on or off. Usage: debug [on/off]";
14 }
15
16 public override string Execute(string[] args, LLUUID fromAgentID)
17 {
18 if (args.Length != 1)
19 return "Usage: debug [on/off]";
20
21 if (args[0].ToLower() == "on")
22 {
23 Client.Settings.DEBUG = true;
24 return "Debug logging is on";
25 }
26 else if (args[0].ToLower() == "off")
27 {
28 Client.Settings.DEBUG = false;
29 return "Debug logging is off";
30 }
31 else
32 {
33 return "Usage: debug [on/off]";
34 }
35 }
36 }
37}
diff --git a/ExportBot/Commands/DilationCommand.cs b/ExportBot/Commands/DilationCommand.cs
deleted file mode 100644
index c1d3c04..0000000
--- a/ExportBot/Commands/DilationCommand.cs
+++ /dev/null
@@ -1,22 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class DilationCommand : Command
10 {
11 public DilationCommand(TestClient testClient)
12 {
13 Name = "dilation";
14 Description = "Shows time dilation for current sim.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 return "Dilation is " + Client.Network.CurrentSim.Dilation.ToString();
20 }
21 }
22} \ No newline at end of file
diff --git a/ExportBot/Commands/DumpOutfitCommand.cs b/ExportBot/Commands/DumpOutfitCommand.cs
deleted file mode 100644
index 2d3d0d8..0000000
--- a/ExportBot/Commands/DumpOutfitCommand.cs
+++ /dev/null
@@ -1,98 +0,0 @@
1using System;
2using System.Text;
3using System.IO;
4using System.Collections.Generic;
5using libsecondlife;
6using libsecondlife.Utilities.Assets;
7using libsecondlife.Utilities.Appearance;
8
9namespace libsecondlife.TestClient
10{
11 public class DumpOutfitCommand : Command
12 {
13 libsecondlife.Utilities.Assets.AssetManager Assets;
14 List<LLUUID> OutfitAssets = new List<LLUUID>();
15
16 public DumpOutfitCommand(TestClient testClient)
17 {
18 Name = "dumpoutfit";
19 Description = "Dumps all of the textures from an avatars outfit to the hard drive. Usage: dumpoutfit [avatar-uuid]";
20
21 Assets = new AssetManager(testClient);
22 Assets.OnImageReceived += new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
23 }
24
25 public override string Execute(string[] args, LLUUID fromAgentID)
26 {
27 if (args.Length != 1)
28 return "Usage: dumpoutfit [avatar-uuid]";
29
30 LLUUID target;
31
32 if (!LLUUID.TryParse(args[0], out target))
33 return "Usage: dumpoutfit [avatar-uuid]";
34
35 lock (Client.AvatarList)
36 {
37 foreach (Avatar avatar in Client.AvatarList.Values)
38 {
39 if (avatar.ID == target)
40 {
41 StringBuilder output = new StringBuilder("Downloading ");
42
43 lock (OutfitAssets) OutfitAssets.Clear();
44
45 foreach (KeyValuePair<uint, LLObject.TextureEntryFace> face in avatar.Textures.FaceTextures)
46 {
47 ImageType type = ImageType.Normal;
48
49 switch ((AppearanceManager.TextureIndex)face.Key)
50 {
51 case AppearanceManager.TextureIndex.HeadBaked:
52 case AppearanceManager.TextureIndex.EyesBaked:
53 case AppearanceManager.TextureIndex.UpperBaked:
54 case AppearanceManager.TextureIndex.LowerBaked:
55 case AppearanceManager.TextureIndex.SkirtBaked:
56 type = ImageType.Baked;
57 break;
58 }
59
60 Assets.RequestImage(face.Value.TextureID, type, 100000.0f, 0);
61
62 output.Append(((AppearanceManager.TextureIndex)face.Key).ToString());
63 output.Append(" ");
64 }
65
66 return output.ToString();
67 }
68 }
69 }
70
71 return "Couldn't find avatar " + target.ToStringHyphenated();
72 }
73
74 private void Assets_OnImageReceived(ImageDownload image)
75 {
76 if (image.Success)
77 {
78 try
79 {
80 File.WriteAllBytes(image.ID.ToStringHyphenated() + ".jp2", image.AssetData);
81 Console.WriteLine("Wrote JPEG2000 image " + image.ID.ToStringHyphenated() + ".jp2");
82
83 byte[] tgaFile = OpenJPEGNet.OpenJPEG.DecodeToTGA(image.AssetData);
84 File.WriteAllBytes(image.ID.ToStringHyphenated() + ".tga", tgaFile);
85 Console.WriteLine("Wrote TGA image " + image.ID.ToStringHyphenated() + ".tga");
86 }
87 catch (Exception e)
88 {
89 Console.WriteLine(e.ToString());
90 }
91 }
92 else
93 {
94 Console.WriteLine("Failed to download image " + image.ID.ToStringHyphenated());
95 }
96 }
97 }
98}
diff --git a/ExportBot/Commands/ExportCommand.cs b/ExportBot/Commands/ExportCommand.cs
deleted file mode 100644
index 2baac1a..0000000
--- a/ExportBot/Commands/ExportCommand.cs
+++ /dev/null
@@ -1,209 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Xml;
5using System.Text;
6using System.Threading;
7using libsecondlife;
8using libsecondlife.Packets;
9
10namespace libsecondlife.TestClient
11{
12 public class ExportCommand : Command
13 {
14 AutoResetEvent GotPermissionsEvent = new AutoResetEvent(false);
15 LLObject.ObjectPropertiesFamily Properties;
16 bool GotPermissions = false;
17 LLUUID SelectedObject = LLUUID.Zero;
18
19 Dictionary<LLUUID, Primitive> PrimsWaiting = new Dictionary<LLUUID, Primitive>();
20 AutoResetEvent AllPropertiesReceived = new AutoResetEvent(false);
21
22 public ExportCommand(TestClient testClient)
23 {
24 testClient.Objects.OnObjectPropertiesFamily += new ObjectManager.ObjectPropertiesFamilyCallback(Objects_OnObjectPropertiesFamily);
25 testClient.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesCallback(Objects_OnObjectProperties);
26 testClient.Avatars.OnPointAt += new AvatarManager.PointAtCallback(Avatars_OnPointAt);
27
28 Name = "export";
29 Description = "Exports an object to an xml file. Usage: export uuid outputfile.xml";
30 }
31
32 public override string Execute(string[] args, LLUUID fromAgentID)
33 {
34 if (args.Length != 2 && !(args.Length == 1 && SelectedObject != LLUUID.Zero))
35 return "Usage: export uuid outputfile.xml";
36
37 LLUUID id;
38 uint localid = 0;
39 int count = 0;
40 string file;
41
42 if (args.Length == 2)
43 {
44 file = args[1];
45 if (!LLUUID.TryParse(args[0], out id))
46 return "Usage: export uuid outputfile.xml";
47 }
48 else
49 {
50 file = args[0];
51 id = SelectedObject;
52 }
53
54 lock (Client.SimPrims)
55 {
56 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
57 {
58 foreach (Primitive prim in Client.SimPrims[Client.Network.CurrentSim].Values)
59 {
60 if (prim.ID == id)
61 {
62 if (prim.ParentID != 0)
63 localid = prim.ParentID;
64 else
65 localid = prim.LocalID;
66
67 break;
68 }
69 }
70 }
71 }
72
73 if (localid != 0)
74 {
75 // Check for export permission first
76 Client.Objects.RequestObjectPropertiesFamily(Client.Network.CurrentSim, id);
77 GotPermissionsEvent.WaitOne(8000, false);
78
79 if (!GotPermissions)
80 {
81 return "Couldn't fetch permissions for the requested object, try again";
82 }
83 else
84 {
85 GotPermissions = false;
86 if (Properties.OwnerID != Client.Network.AgentID &&
87 Properties.OwnerID != Client.MasterKey &&
88 Client.Network.AgentID != Client.Self.ID)
89 {
90 return "That object is owned by " + Properties.OwnerID + ", we don't have permission " +
91 "to export it";
92 }
93 }
94
95 try
96 {
97 XmlWriterSettings settings = new XmlWriterSettings();
98 settings.Indent = true;
99 XmlWriter writer = XmlWriter.Create(file, settings);
100
101 try
102 {
103 List<Primitive> prims = new List<Primitive>();
104
105 lock (Client.SimPrims)
106 {
107 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
108 {
109 foreach (Primitive prim in Client.SimPrims[Client.Network.CurrentSim].Values)
110 {
111 if (prim.LocalID == localid || prim.ParentID == localid)
112 {
113 prims.Add(prim);
114 count++;
115 }
116 }
117 }
118 }
119
120 bool complete = RequestObjectProperties(prims, 250);
121
122 //Serialize it!
123 Helpers.PrimListToXml(prims, writer);
124
125 if (!complete) {
126 Console.WriteLine("Warning: Unable to retrieve full properties for:");
127 foreach (LLUUID uuid in PrimsWaiting.Keys)
128 Console.WriteLine(uuid);
129 }
130 }
131 finally
132 {
133 writer.Close();
134 }
135 }
136 catch (Exception e)
137 {
138 string ret = "Failed to write to " + file + ":" + e.ToString();
139 if (ret.Length > 1000)
140 {
141 ret = ret.Remove(1000);
142 }
143 return ret;
144 }
145 return "Exported " + count + " prims to " + file;
146 }
147 else
148 {
149 return "Couldn't find UUID " + id.ToString() + " in the " +
150 Client.SimPrims[Client.Network.CurrentSim].Count +
151 "objects currently indexed in the current simulator";
152 }
153 }
154
155 private bool RequestObjectProperties(List<Primitive> objects, int msPerRequest)
156 {
157 // Create an array of the local IDs of all the prims we are requesting properties for
158 uint[] localids = new uint[objects.Count];
159
160 lock (PrimsWaiting)
161 {
162 PrimsWaiting.Clear();
163
164 for (int i = 0; i < objects.Count; ++i)
165 {
166 localids[i] = objects[i].LocalID;
167 PrimsWaiting.Add(objects[i].ID, objects[i]);
168 }
169 }
170
171 Client.Objects.SelectObjects(Client.Network.CurrentSim, localids);
172
173 return AllPropertiesReceived.WaitOne(2000 + msPerRequest * objects.Count, false);
174 }
175
176 void Avatars_OnPointAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos,
177 MainAvatar.PointAtType pointType, float duration, LLUUID id)
178 {
179 if (sourceID == Client.MasterKey)
180 {
181 //Client.DebugLog("Master is now selecting " + targetID.ToStringHyphenated());
182 SelectedObject = targetID;
183 }
184 }
185
186 void Objects_OnObjectPropertiesFamily(Simulator simulator, LLObject.ObjectPropertiesFamily properties)
187 {
188 Properties = properties;
189 GotPermissions = true;
190 GotPermissionsEvent.Set();
191 }
192
193 void Objects_OnObjectProperties(Simulator simulator, LLObject.ObjectProperties properties)
194 {
195 lock (PrimsWaiting)
196 {
197 Primitive prim;
198 if (PrimsWaiting.TryGetValue(properties.ObjectID, out prim))
199 {
200 prim.Properties = properties;
201 }
202 PrimsWaiting.Remove(properties.ObjectID);
203
204 if (PrimsWaiting.Count == 0)
205 AllPropertiesReceived.Set();
206 }
207 }
208 }
209}
diff --git a/ExportBot/Commands/ExportOutfitCommand.cs b/ExportBot/Commands/ExportOutfitCommand.cs
deleted file mode 100644
index 5945942..0000000
--- a/ExportBot/Commands/ExportOutfitCommand.cs
+++ /dev/null
@@ -1,68 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Xml;
5using libsecondlife;
6using libsecondlife.Packets;
7
8namespace libsecondlife.TestClient
9{
10 public class ExportOutfitCommand : Command
11 {
12 public ExportOutfitCommand(TestClient testClient)
13 {
14 Name = "exportoutfit";
15 Description = "Exports an avatars outfit to an xml file. Usage: exportoutfit avataruuid outputfile.xml";
16 }
17
18 public override string Execute(string[] args, LLUUID fromAgentID)
19 {
20 if (args.Length != 2)
21 return "Usage: exportoutfit avataruuid outputfile.xml";
22
23 LLUUID id;
24
25 try
26 {
27 id = new LLUUID(args[0]);
28 }
29 catch (Exception)
30 {
31 return "Usage: exportoutfit avataruuid outputfile.xml";
32 }
33
34 lock (Client.Appearances)
35 {
36 if (Client.Appearances.ContainsKey(id))
37 {
38 try
39 {
40 StreamWriter Outfile = File.AppendText(args[1]);
41
42
43 try
44 {
45 Outfile.Write(Client.Appearances[id].ToString());
46 Console.WriteLine(Client.Appearances[id].ToString());
47 //Client.Appearances[id].ToXml(writer);
48 }
49 finally
50 {
51 Outfile.Close();
52 }
53 }
54 catch (Exception e)
55 {
56 return e.ToString();
57 }
58
59 return "Exported appearance for avatar " + id.ToString() + " to " + args[1];
60 }
61 else
62 {
63 return "Couldn't find an appearance for avatar " + id.ToString();
64 }
65 }
66 }
67 }
68}
diff --git a/ExportBot/Commands/ExportParticlesCommand.cs b/ExportBot/Commands/ExportParticlesCommand.cs
deleted file mode 100644
index 4b2c322..0000000
--- a/ExportBot/Commands/ExportParticlesCommand.cs
+++ /dev/null
@@ -1,119 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using libsecondlife;
6
7namespace libsecondlife.TestClient
8{
9 public class ExportParticlesCommand : Command
10 {
11 public ExportParticlesCommand(TestClient testClient)
12 {
13 Name = "exportparticles";
14 Description = "Reverse engineers a prim with a particle system to an LSL script. Usage: exportscript [prim-uuid]";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length != 1)
20 return "Usage: exportparticles [prim-uuid]";
21
22 LLUUID id;
23 if (!LLUUID.TryParse(args[0], out id))
24 return "Usage: exportparticles [prim-uuid]";
25
26 lock (Client.SimPrims)
27 {
28 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
29 {
30 foreach (Primitive prim in Client.SimPrims[Client.Network.CurrentSim].Values)
31 {
32 if (prim.ID == id)
33 {
34 if (prim.ParticleSys.CRC != 0)
35 {
36 StringBuilder lsl = new StringBuilder();
37
38 lsl.Append("default" + Environment.NewLine);
39 lsl.Append("{" + Environment.NewLine);
40 lsl.Append(" state_entry()" + Environment.NewLine);
41 lsl.Append(" {" + Environment.NewLine);
42 lsl.Append(" llParticleSystem([" + Environment.NewLine);
43
44 lsl.Append(" PSYS_PART_FLAGS, 0");
45
46 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpColor) != 0)
47 lsl.Append(" | PSYS_PART_INTERP_COLOR_MASK");
48 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.InterpScale) != 0)
49 lsl.Append(" | PSYS_PART_INTERP_SCALE_MASK");
50 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Bounce) != 0)
51 lsl.Append(" | PSYS_PART_BOUNCE_MASK");
52 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Wind) != 0)
53 lsl.Append(" | PSYS_PART_WIND_MASK");
54 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.FollowSrc) != 0)
55 lsl.Append(" | PSYS_PART_FOLLOW_SRC_MASK");
56 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.FollowVelocity) != 0)
57 lsl.Append(" | PSYS_PART_FOLLOW_VELOCITY_MASK");
58 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetPos) != 0)
59 lsl.Append(" | PSYS_PART_TARGET_POS_MASK");
60 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.TargetLinear) != 0)
61 lsl.Append(" | PSYS_PART_TARGET_LINEAR_MASK");
62 if ((prim.ParticleSys.PartDataFlags & Primitive.ParticleSystem.ParticleDataFlags.Emissive) != 0)
63 lsl.Append(" | PSYS_PART_EMISSIVE_MASK");
64
65 lsl.Append(","); lsl.Append(Environment.NewLine);
66 lsl.Append(" PSYS_SRC_PATTERN, 0");
67
68 if ((prim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Drop) != 0)
69 lsl.Append(" | PSYS_SRC_PATTERN_DROP");
70 if ((prim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Explode) != 0)
71 lsl.Append(" | PSYS_SRC_PATTERN_EXPLODE");
72 if ((prim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.Angle) != 0)
73 lsl.Append(" | PSYS_SRC_PATTERN_ANGLE");
74 if ((prim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleCone) != 0)
75 lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE");
76 if ((prim.ParticleSys.Pattern & Primitive.ParticleSystem.SourcePattern.AngleConeEmpty) != 0)
77 lsl.Append(" | PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY");
78
79 lsl.Append("," + Environment.NewLine);
80
81 lsl.Append(" PSYS_PART_START_ALPHA, " + String.Format("{0:0.00000}", prim.ParticleSys.PartStartColor.A) + "," + Environment.NewLine);
82 lsl.Append(" PSYS_PART_END_ALPHA, " + String.Format("{0:0.00000}", prim.ParticleSys.PartEndColor.A) + "," + Environment.NewLine);
83 lsl.Append(" PSYS_PART_START_COLOR, " + prim.ParticleSys.PartStartColor.ToStringRGB() + "," + Environment.NewLine);
84 lsl.Append(" PSYS_PART_END_COLOR, " + prim.ParticleSys.PartEndColor.ToStringRGB() + "," + Environment.NewLine);
85 lsl.Append(" PSYS_PART_START_SCALE, <" + String.Format("{0:0.00000}", prim.ParticleSys.PartStartScaleX) + ", " + String.Format("{0:0.00000}", prim.ParticleSys.PartStartScaleY) + ", 0>, " + Environment.NewLine);
86 lsl.Append(" PSYS_PART_END_SCALE, <" + String.Format("{0:0.00000}", prim.ParticleSys.PartEndScaleX) + ", " + String.Format("{0:0.00000}", prim.ParticleSys.PartEndScaleY) + ", 0>, " + Environment.NewLine);
87 lsl.Append(" PSYS_PART_MAX_AGE, " + String.Format("{0:0.00000}", prim.ParticleSys.PartMaxAge) + "," + Environment.NewLine);
88 lsl.Append(" PSYS_SRC_MAX_AGE, " + String.Format("{0:0.00000}", prim.ParticleSys.MaxAge) + "," + Environment.NewLine);
89 lsl.Append(" PSYS_SRC_ACCEL, " + prim.ParticleSys.PartAcceleration.ToString() + "," + Environment.NewLine);
90 lsl.Append(" PSYS_SRC_BURST_PART_COUNT, " + String.Format("{0:0}", prim.ParticleSys.BurstPartCount) + "," + Environment.NewLine);
91 lsl.Append(" PSYS_SRC_BURST_RADIUS, " + String.Format("{0:0.00000}", prim.ParticleSys.BurstRadius) + "," + Environment.NewLine);
92 lsl.Append(" PSYS_SRC_BURST_RATE, " + String.Format("{0:0.00000}", prim.ParticleSys.BurstRate) + "," + Environment.NewLine);
93 lsl.Append(" PSYS_SRC_BURST_SPEED_MIN, " + String.Format("{0:0.00000}", prim.ParticleSys.BurstSpeedMin) + "," + Environment.NewLine);
94 lsl.Append(" PSYS_SRC_BURST_SPEED_MAX, " + String.Format("{0:0.00000}", prim.ParticleSys.BurstSpeedMax) + "," + Environment.NewLine);
95 lsl.Append(" PSYS_SRC_INNERANGLE, " + String.Format("{0:0.00000}", prim.ParticleSys.InnerAngle) + "," + Environment.NewLine);
96 lsl.Append(" PSYS_SRC_OUTERANGLE, " + String.Format("{0:0.00000}", prim.ParticleSys.OuterAngle) + "," + Environment.NewLine);
97 lsl.Append(" PSYS_SRC_OMEGA, " + prim.ParticleSys.AngularVelocity.ToString() + "," + Environment.NewLine);
98 lsl.Append(" PSYS_SRC_TEXTURE, (key)\"" + prim.ParticleSys.Texture.ToStringHyphenated() + "\"," + Environment.NewLine);
99 lsl.Append(" PSYS_SRC_TARGET_KEY, (key)\"" + prim.ParticleSys.Target.ToStringHyphenated() + "\"" + Environment.NewLine);
100
101 lsl.Append(" ]);" + Environment.NewLine);
102 lsl.Append(" }" + Environment.NewLine);
103 lsl.Append("}" + Environment.NewLine);
104
105 return lsl.ToString();
106 }
107 else
108 {
109 return "Prim " + prim.LocalID + " does not have a particle system";
110 }
111 }
112 }
113 }
114 }
115
116 return "Couldn't find prim " + id.ToStringHyphenated();
117 }
118 }
119}
diff --git a/ExportBot/Commands/FindSimCommand.cs b/ExportBot/Commands/FindSimCommand.cs
deleted file mode 100644
index c6cc9c4..0000000
--- a/ExportBot/Commands/FindSimCommand.cs
+++ /dev/null
@@ -1,43 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class FindSimCommand : Command
10 {
11 public FindSimCommand(TestClient testClient)
12 {
13 Name = "findsim";
14 Description = "Searches for a simulator and returns information about it. Usage: findsim [Simulator Name]";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length < 1)
20 return "Usage: findsim [Simulator Name]";
21
22 // Build the simulator name from the args list
23 string simName = string.Empty;
24 for (int i = 0; i < args.Length; i++)
25 simName += args[i] + " ";
26 simName = simName.TrimEnd().ToLower();
27
28 //if (!GridDataCached[Client])
29 //{
30 // Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects);
31 // System.Threading.Thread.Sleep(5000);
32 // GridDataCached[Client] = true;
33 //}
34
35 GridRegion region;
36
37 if (Client.Grid.GetGridRegion(simName, out region))
38 return String.Format("{0}: handle={1} ({2},{3})", region.Name, region.RegionHandle, region.X, region.Y);
39 else
40 return "Lookup of " + simName + " failed";
41 }
42 }
43}
diff --git a/ExportBot/Commands/HelpCommand.cs b/ExportBot/Commands/HelpCommand.cs
deleted file mode 100644
index 5cbdcb2..0000000
--- a/ExportBot/Commands/HelpCommand.cs
+++ /dev/null
@@ -1,29 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class HelpCommand: Command
10 {
11 public HelpCommand(TestClient testClient)
12 {
13 Name = "help";
14 Description = "Lists available commands.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 StringBuilder result = new StringBuilder();
20 result.AppendFormat("\n\nHELP\nClient accept teleport lures from master and group members.\n");
21 foreach (Command c in Client.Commands.Values)
22 {
23 result.AppendFormat(" * {0} - {1}\n", c.Name, c.Description);
24 }
25
26 return result.ToString();
27 }
28 }
29}
diff --git a/ExportBot/Commands/ImportCommand.cs b/ExportBot/Commands/ImportCommand.cs
deleted file mode 100644
index 4cdcaee..0000000
--- a/ExportBot/Commands/ImportCommand.cs
+++ /dev/null
@@ -1,246 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Xml;
4using System.Xml.Serialization;
5using System.Threading;
6using System.IO;
7using libsecondlife;
8
9namespace libsecondlife.TestClient
10{
11 enum ImporterState
12 {
13 RezzingParent,
14 RezzingChildren,
15 Linking,
16 Idle
17 }
18
19 public class Linkset
20 {
21 public Primitive RootPrim;
22 public List<Primitive> Children = new List<Primitive>();
23
24 public Linkset()
25 {
26 RootPrim = new Primitive();
27 }
28
29 public Linkset(Primitive rootPrim)
30 {
31 RootPrim = rootPrim;
32 }
33 }
34
35 public class ImportCommand : Command
36 {
37 Primitive currentPrim;
38 LLVector3 currentPosition;
39 SecondLife currentClient;
40 AutoResetEvent primDone;
41 List<Primitive> primsCreated;
42 List<uint> linkQueue;
43 uint rootLocalID = 0;
44 bool registeredCreateEvent = false;
45
46 ImporterState state = ImporterState.Idle;
47
48 public ImportCommand(TestClient testClient)
49 {
50 Name = "import";
51 Description = "Import prims from an exported xml file. Usage: import inputfile.xml";
52 primDone = new AutoResetEvent(false);
53 registeredCreateEvent = false;
54 }
55
56 public override string Execute(string[] args, LLUUID fromAgentID)
57 {
58 if (args.Length != 1)
59 return "Usage: import inputfile.xml";
60
61 string filename = args[0];
62 Dictionary<uint, Primitive> prims;
63
64 currentClient = Client;
65
66 try
67 {
68 XmlReader reader = XmlReader.Create(filename);
69 List<Primitive> listprims = Helpers.PrimListFromXml(reader);
70 reader.Close();
71
72 // Create a dictionary indexed by the old local ID of the prims
73 prims = new Dictionary<uint, Primitive>();
74 foreach (Primitive prim in listprims)
75 {
76 prims.Add(prim.LocalID, prim);
77 }
78 }
79 catch (Exception)
80 {
81 return "Failed to import the object XML file, maybe it doesn't exist or is in the wrong format?";
82 }
83
84 if (!registeredCreateEvent)
85 {
86 Client.OnPrimCreated += new TestClient.PrimCreatedCallback(TestClient_OnPrimCreated);
87 registeredCreateEvent = true;
88 }
89
90 // Build an organized structure from the imported prims
91 Dictionary<uint, Linkset> linksets = new Dictionary<uint, Linkset>();
92 foreach (Primitive prim in prims.Values)
93 {
94 if (prim.ParentID == 0)
95 {
96 if (linksets.ContainsKey(prim.LocalID))
97 linksets[prim.LocalID].RootPrim = prim;
98 else
99 linksets[prim.LocalID] = new Linkset(prim);
100 }
101 else
102 {
103 if (!linksets.ContainsKey(prim.ParentID))
104 linksets[prim.ParentID] = new Linkset();
105
106 linksets[prim.ParentID].Children.Add(prim);
107 }
108 }
109
110 primsCreated = new List<Primitive>();
111 Console.WriteLine("Importing " + linksets.Count + " structures.");
112
113 foreach (Linkset linkset in linksets.Values)
114 {
115 if (linkset.RootPrim.LocalID != 0)
116 {
117 state = ImporterState.RezzingParent;
118 currentPrim = linkset.RootPrim;
119 // HACK: Offset the root prim position so it's not lying on top of the original
120 // We need a more elaborate solution for importing with relative or absolute offsets
121 linkset.RootPrim.Position = Client.Self.Position;
122 linkset.RootPrim.Position.Z += 3.0f;
123 currentPosition = linkset.RootPrim.Position;
124 // A better solution would move the bot to the desired position.
125 // or to check if we are within a certain distance of the desired position.
126
127 // Rez the root prim with no rotation
128 LLQuaternion rootRotation = linkset.RootPrim.Rotation;
129 linkset.RootPrim.Rotation = LLQuaternion.Identity;
130
131 Client.Objects.AddPrim(Client.Network.CurrentSim, linkset.RootPrim.Data, LLUUID.Zero,
132 linkset.RootPrim.Position, linkset.RootPrim.Scale, linkset.RootPrim.Rotation);
133
134 if (!primDone.WaitOne(10000, false))
135 return "Rez failed, timed out while creating the root prim.";
136
137 state = ImporterState.RezzingChildren;
138
139 // Rez the child prims
140 foreach (Primitive prim in linkset.Children)
141 {
142 currentPrim = prim;
143 currentPosition = prim.Position + linkset.RootPrim.Position;
144
145 Client.Objects.AddPrim(Client.Network.CurrentSim, prim.Data, LLUUID.Zero, currentPosition,
146 prim.Scale, prim.Rotation);
147
148 if (!primDone.WaitOne(10000, false))
149 return "Rez failed, timed out while creating child prim.";
150 }
151
152 if (linkset.Children.Count != 0)
153 {
154 // Create a list of the local IDs of the newly created prims
155 List<uint> primIDs = new List<uint>(primsCreated.Count);
156 primIDs.Add(rootLocalID); // Root prim is first in list.
157 foreach (Primitive prim in primsCreated)
158 {
159 if (prim.LocalID != rootLocalID)
160 primIDs.Add(prim.LocalID);
161 }
162 linkQueue = new List<uint>(primIDs.Count);
163 linkQueue.AddRange(primIDs);
164
165 // Link and set the permissions + rotation
166 state = ImporterState.Linking;
167 Client.Objects.LinkPrims(Client.Network.CurrentSim, linkQueue);
168 if (primDone.WaitOne(100000 * linkset.Children.Count, false))
169 {
170 Client.Objects.SetPermissions(Client.Network.CurrentSim, primIDs,
171 Helpers.PermissionWho.Everyone | Helpers.PermissionWho.Group | Helpers.PermissionWho.NextOwner,
172 Helpers.PermissionType.Copy | Helpers.PermissionType.Modify | Helpers.PermissionType.Move |
173 Helpers.PermissionType.Transfer, true);
174
175 Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation);
176 }
177 else
178 {
179 Console.WriteLine("Warning: Failed to link {0} prims", linkQueue.Count);
180 }
181 }
182 else
183 {
184 Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation);
185 }
186 state = ImporterState.Idle;
187 }
188 else
189 {
190 // Skip linksets with a missing root prim
191 Console.WriteLine("WARNING: Skipping a linkset with a missing root prim");
192 }
193
194 // Reset everything for the next linkset
195 primsCreated.Clear();
196 }
197
198 return "Import complete.";
199 }
200
201 void TestClient_OnPrimCreated(Simulator simulator, Primitive prim)
202 {
203 if ((prim.Flags & LLObject.ObjectFlags.CreateSelected) == 0)
204 return; // We received an update for an object we didn't create
205
206 switch (state)
207 {
208 case ImporterState.RezzingParent:
209 rootLocalID = prim.LocalID;
210 goto case ImporterState.RezzingChildren;
211 case ImporterState.RezzingChildren:
212 if (!primsCreated.Contains(prim))
213 {
214 Console.WriteLine("Setting properties for " + prim.LocalID);
215 // TODO: Is there a way to set all of this at once, and update more ObjectProperties stuff?
216 currentClient.Objects.SetPosition(simulator, prim.LocalID, currentPosition);
217 currentClient.Objects.SetTextures(simulator, prim.LocalID, currentPrim.Textures);
218 currentClient.Objects.SetLight(simulator, prim.LocalID, currentPrim.Light);
219 currentClient.Objects.SetFlexible(simulator, prim.LocalID, currentPrim.Flexible);
220
221 if (!String.IsNullOrEmpty(currentPrim.Properties.Name))
222 currentClient.Objects.SetName(simulator, prim.LocalID, currentPrim.Properties.Name);
223 if (!String.IsNullOrEmpty(currentPrim.Properties.Description))
224 currentClient.Objects.SetDescription(simulator, prim.LocalID,
225 currentPrim.Properties.Description);
226
227 primsCreated.Add(prim);
228 primDone.Set();
229 }
230 break;
231 case ImporterState.Linking:
232 lock (linkQueue)
233 {
234 int index = linkQueue.IndexOf(prim.LocalID);
235 if (index != -1)
236 {
237 linkQueue.RemoveAt(index);
238 if (linkQueue.Count == 0)
239 primDone.Set();
240 }
241 }
242 break;
243 }
244 }
245 }
246}
diff --git a/ExportBot/Commands/ImportOutfitCommand.cs b/ExportBot/Commands/ImportOutfitCommand.cs
deleted file mode 100644
index 5ac7b8a..0000000
--- a/ExportBot/Commands/ImportOutfitCommand.cs
+++ /dev/null
@@ -1,66 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Xml;
5using System.Xml.Serialization;
6using libsecondlife;
7using libsecondlife.Packets;
8
9namespace libsecondlife.TestClient
10{
11 public class ImportOutfitCommand : Command
12 {
13 private uint SerialNum = 1;
14
15 public ImportOutfitCommand(TestClient testClient)
16 {
17 Name = "importoutfit";
18 Description = "Imports an appearance from an xml file. Usage: importoutfit inputfile.xml";
19 }
20
21 public override string Execute(string[] args, LLUUID fromAgentID)
22 {
23 if (args.Length != 1)
24 return "Usage: importoutfit inputfile.xml";
25
26 try
27 {
28 XmlReader reader = XmlReader.Create(args[0]);
29 XmlSerializer serializer = new XmlSerializer(typeof(Packet));
30 AvatarAppearancePacket appearance = (AvatarAppearancePacket)serializer.Deserialize(reader);
31 reader.Close();
32
33 AgentSetAppearancePacket set = new AgentSetAppearancePacket();
34
35 set.AgentData.AgentID = Client.Network.AgentID;
36 set.AgentData.SessionID = Client.Network.SessionID;
37 set.AgentData.SerialNum = SerialNum++;
38
39 float AV_Height_Range = 2.025506f - 1.50856f;
40 float AV_Height = 1.50856f + (((float)appearance.VisualParam[25].ParamValue / 255.0f) * AV_Height_Range);
41 set.AgentData.Size = new LLVector3(0.45f, 0.6f, AV_Height);
42
43 set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry;
44 set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length];
45
46 int i = 0;
47 foreach (AvatarAppearancePacket.VisualParamBlock block in appearance.VisualParam)
48 {
49 set.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock();
50 set.VisualParam[i].ParamValue = block.ParamValue;
51 i++;
52 }
53
54 set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0];
55
56 Client.Network.SendPacket(set);
57 }
58 catch (Exception)
59 {
60 return "Failed to import the appearance XML file, maybe it doesn't exist or is in the wrong format?";
61 }
62
63 return "Imported " + args[0] + " and sent an AgentSetAppearance packet";
64 }
65 }
66}
diff --git a/ExportBot/Commands/Inventory/BalanceCommand.cs b/ExportBot/Commands/Inventory/BalanceCommand.cs
deleted file mode 100644
index 92e9b39..0000000
--- a/ExportBot/Commands/Inventory/BalanceCommand.cs
+++ /dev/null
@@ -1,21 +0,0 @@
1using System;
2using System.Collections.Generic;
3using libsecondlife;
4using libsecondlife.Packets;
5
6namespace libsecondlife.TestClient
7{
8 public class BalanceCommand: Command
9 {
10 public BalanceCommand(TestClient testClient)
11 {
12 Name = "balance";
13 Description = "Shows the amount of L$.";
14 }
15
16 public override string Execute(string[] args, LLUUID fromAgentID)
17 {
18 return Client.ToString() + " has L$: " + Client.Self.Balance;
19 }
20 }
21}
diff --git a/ExportBot/Commands/Inventory/DeleteFolderCommand.cs b/ExportBot/Commands/Inventory/DeleteFolderCommand.cs
deleted file mode 100644
index ddbb86c..0000000
--- a/ExportBot/Commands/Inventory/DeleteFolderCommand.cs
+++ /dev/null
@@ -1,43 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using System.Threading;
6using System.Xml;
7using System.Xml.Serialization;
8
9using libsecondlife;
10using libsecondlife.Packets;
11using libsecondlife.InventorySystem;
12
13namespace libsecondlife.TestClient
14{
15 public class DeleteFolderCommand : Command
16 {
17 public DeleteFolderCommand(TestClient testClient)
18 {
19 Name = "deleteFolder";
20 Description = "Deletes a folder from inventory.";
21 }
22
23 public override string Execute(string[] args, LLUUID fromAgentID)
24 {
25 return "Broken until someone fixes me";
26
27 //string target = String.Empty;
28 //for (int ct = 0; ct < args.Length; ct++)
29 // target = target + args[ct] + " ";
30 //target = target.TrimEnd();
31
32 //Client.Inventory.DownloadInventory();
33 //InventoryFolder folder = Client.Inventory.getFolder(target);
34 //if (folder != null)
35 //{
36 // folder.Delete();
37 // return "Folder " + target + " deleted.";
38 //}
39
40 //return "Unable to find: " + target;
41 }
42 }
43} \ No newline at end of file
diff --git a/ExportBot/Commands/Inventory/GiveAllCommand.cs b/ExportBot/Commands/Inventory/GiveAllCommand.cs
deleted file mode 100644
index fe42fce..0000000
--- a/ExportBot/Commands/Inventory/GiveAllCommand.cs
+++ /dev/null
@@ -1,27 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class GiveAllCommand: Command
10 {
11 public GiveAllCommand(TestClient testClient)
12 {
13 Name = "giveAll";
14 Description = "Gives you all it's money.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (fromAgentID == null)
20 return "Unable to send money to console. This command only works when IMed.";
21
22 int amount = Client.Self.Balance;
23 Client.Self.GiveMoney(fromAgentID, Client.Self.Balance, String.Empty);
24 return "Gave $" + amount + " to " + fromAgentID;
25 }
26 }
27}
diff --git a/ExportBot/Commands/Inventory/InventoryCommand.cs b/ExportBot/Commands/Inventory/InventoryCommand.cs
deleted file mode 100644
index 7b01bb1..0000000
--- a/ExportBot/Commands/Inventory/InventoryCommand.cs
+++ /dev/null
@@ -1,62 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using System.Threading;
6using System.Xml;
7using System.Xml.Serialization;
8
9using libsecondlife;
10using libsecondlife.Packets;
11using libsecondlife.InventorySystem;
12
13namespace libsecondlife.TestClient
14{
15 public class InventoryCommand : Command
16 {
17 public InventoryCommand(TestClient testClient)
18 {
19 Name = "i";
20 Description = "Prints out inventory.";
21 }
22
23 public override string Execute(string[] args, LLUUID fromAgentID)
24 {
25 return "Broken until someone fixes me";
26
27 //Client.Inventory.DownloadInventory();
28 //StringBuilder result = new StringBuilder();
29 //PrintFolder(Client.Inventory.GetRootFolder(), result, 0);
30 //return result.ToString();
31 }
32
33 //void PrintFolder(InventoryFolder folder, StringBuilder output, int indenting)
34 //{
35 // Indent(output, indenting);
36 // output.Append(folder.Name);
37 // output.Append("\n");
38 // foreach (InventoryBase b in folder.GetContents())
39 // {
40 // InventoryItem item = b as InventoryItem;
41 // if (item != null)
42 // {
43 // Indent(output, indenting + 1);
44 // output.Append(item.Name);
45 // output.Append("\n");
46 // continue;
47 // }
48 // InventoryFolder subFolder = b as InventoryFolder;
49 // if (subFolder != null)
50 // PrintFolder(subFolder, output, indenting + 1);
51 // }
52 //}
53
54 //void Indent(StringBuilder output, int indenting)
55 //{
56 // for (int count = 0; count < indenting; count++)
57 // {
58 // output.Append(" ");
59 // }
60 //}
61 }
62} \ No newline at end of file
diff --git a/ExportBot/Commands/Inventory/WearCommand.cs b/ExportBot/Commands/Inventory/WearCommand.cs
deleted file mode 100644
index d1bc32c..0000000
--- a/ExportBot/Commands/Inventory/WearCommand.cs
+++ /dev/null
@@ -1,43 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Text;
5using System.Threading;
6using System.Xml;
7using System.Xml.Serialization;
8
9using libsecondlife;
10using libsecondlife.Packets;
11using libsecondlife.InventorySystem;
12
13namespace libsecondlife.TestClient
14{
15 public class WearCommand : Command
16 {
17 public WearCommand(TestClient testClient)
18 {
19 Name = "wear";
20 Description = "Wear an outfit folder from inventory.";
21 }
22
23 public override string Execute(string[] args, LLUUID fromAgentID)
24 {
25 return "Broken until someone fixes me";
26
27 //string target = String.Empty;
28 //for (int ct = 0; ct < args.Length; ct++)
29 // target = target + args[ct] + " ";
30 //target = target.TrimEnd();
31
32 //Client.Inventory.DownloadInventory();
33 //InventoryFolder folder = Client.Inventory.getFolder(target);
34 //if (folder != null)
35 //{
36 // Client.Appearance.WearOutfit(folder);
37 // return "Outfit " + target + " worn.";
38 //}
39
40 //return "Unable to find: " + target;
41 }
42 }
43} \ No newline at end of file
diff --git a/ExportBot/Commands/LoadCommand.cs b/ExportBot/Commands/LoadCommand.cs
deleted file mode 100644
index 70dada4..0000000
--- a/ExportBot/Commands/LoadCommand.cs
+++ /dev/null
@@ -1,28 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5using libsecondlife;
6using libsecondlife.Packets;
7
8namespace libsecondlife.TestClient
9{
10 public class LoadCommand: Command
11 {
12 public LoadCommand(TestClient testClient)
13 {
14 Name = "load";
15 Description = "Loads commands from a dll. (Usage: load AssemblyNameWithoutExtension)";
16 }
17
18 public override string Execute(string[] args, LLUUID fromAgentID)
19 {
20 if (args.Length < 1)
21 return "Usage: load AssemblyNameWithoutExtension";
22
23 string filename = AppDomain.CurrentDomain.BaseDirectory + args[0] + ".dll";
24 Client.RegisterAllCommands(Assembly.LoadFile(filename));
25 return "Assembly " + filename + " loaded.";
26 }
27 }
28}
diff --git a/ExportBot/Commands/LoginCommand.cs b/ExportBot/Commands/LoginCommand.cs
deleted file mode 100644
index 64675f5..0000000
--- a/ExportBot/Commands/LoginCommand.cs
+++ /dev/null
@@ -1,34 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class LoginCommand : Command
10 {
11 public LoginCommand(TestClient testClient)
12 {
13 Name = "login";
14 Description = "Logs in another avatar";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length != 3 && args.Length != 4)
20 return "usage: login firstname lastname password [simname]";
21
22 SecondLife newClient = Client.ClientManager.Login(args);
23
24 if (newClient.Network.Connected)
25 {
26 return "Logged in " + newClient.ToString();
27 }
28 else
29 {
30 return "Failed to login: " + newClient.Network.LoginStatusMessage;
31 }
32 }
33 }
34}
diff --git a/ExportBot/Commands/LogoutCommand.cs b/ExportBot/Commands/LogoutCommand.cs
deleted file mode 100644
index cdb5bde..0000000
--- a/ExportBot/Commands/LogoutCommand.cs
+++ /dev/null
@@ -1,24 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class LogoutCommand : Command
10 {
11 public LogoutCommand(TestClient testClient)
12 {
13 Name = "logout";
14 Description = "Log this avatar out";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 string name = Client.ToString();
20 Client.ClientManager.Logout(Client);
21 return "Logged " + name + " out";
22 }
23 }
24}
diff --git a/ExportBot/Commands/MD5Command.cs b/ExportBot/Commands/MD5Command.cs
deleted file mode 100644
index 0a2ee5d..0000000
--- a/ExportBot/Commands/MD5Command.cs
+++ /dev/null
@@ -1,22 +0,0 @@
1using System;
2using libsecondlife;
3
4namespace libsecondlife.TestClient
5{
6 public class MD5Command : Command
7 {
8 public MD5Command(TestClient testClient)
9 {
10 Name = "md5";
11 Description = "Creates an MD5 hash from a given password. Usage: md5 [password]";
12 }
13
14 public override string Execute(string[] args, LLUUID fromAgentID)
15 {
16 if (args.Length == 1)
17 return Helpers.MD5(args[0]);
18 else
19 return "Usage: md5 [password]";
20 }
21 }
22}
diff --git a/ExportBot/Commands/Movement/FollowCommand.cs b/ExportBot/Commands/Movement/FollowCommand.cs
deleted file mode 100644
index f5074a3..0000000
--- a/ExportBot/Commands/Movement/FollowCommand.cs
+++ /dev/null
@@ -1,90 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class FollowCommand: Command
10 {
11 public FollowCommand(TestClient testClient)
12 {
13 Name = "follow";
14 Description = "Follow another avatar. (usage: follow [FirstName LastName]) If no target is set then will follow master.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 string target = String.Empty;
20 for (int ct = 0; ct < args.Length; ct++)
21 target = target + args[ct] + " ";
22 target = target.TrimEnd();
23
24 if (target.Length > 0)
25 {
26 if (Follow(target))
27 return "Following " + target;
28 else
29 return "Unable to follow " + target + ". Client may not be able to see that avatar.";
30 }
31 else
32 {
33 if (Follow(Client.MasterKey))
34 return "Following " + Client.MasterKey;
35 else
36 return "No target specified and no master not found. usage: follow [FirstName LastName])";
37 }
38 }
39
40 const float DISTANCE_BUFFER = 3.0f;
41 Avatar followAvatar;
42
43 bool Follow(string name)
44 {
45 foreach (Avatar av in Client.AvatarList.Values)
46 {
47 if (av.Name == name)
48 {
49 followAvatar = av;
50 Active = true;
51 return true;
52 }
53 }
54 return false;
55 }
56
57 bool Follow(LLUUID id)
58 {
59 foreach (Avatar av in Client.AvatarList.Values)
60 {
61 if (av.ID == id)
62 {
63 followAvatar = av;
64 Active = true;
65 return true;
66 }
67 }
68 return false;
69 }
70
71 public override void Think()
72 {
73 if (Helpers.VecDist(followAvatar.Position, Client.Self.Position) > DISTANCE_BUFFER)
74 {
75 //move toward target
76 LLVector3 avPos = followAvatar.Position;
77 Client.Self.AutoPilot((ulong)avPos.X + (ulong)Client.regionX, (ulong)avPos.Y + (ulong)Client.regionY, avPos.Z);
78 }
79 //else
80 //{
81 // //stop at current position
82 // LLVector3 myPos = client.Self.Position;
83 // client.Self.AutoPilot((ulong)myPos.x, (ulong)myPos.y, myPos.Z);
84 //}
85
86 base.Think();
87 }
88
89 }
90}
diff --git a/ExportBot/Commands/Movement/GotoCommand.cs b/ExportBot/Commands/Movement/GotoCommand.cs
deleted file mode 100644
index df2b8a7..0000000
--- a/ExportBot/Commands/Movement/GotoCommand.cs
+++ /dev/null
@@ -1,53 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class GotoCommand: Command
10 {
11 public GotoCommand(TestClient testClient)
12 {
13 Name = "goto";
14 Description = "Teleport to a location (e.g. \"goto Hooper/100/100/30\")";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length < 1)
20 return "usage: Destination should be specified as sim/x/y/z";
21
22 string destination = String.Empty;
23
24 // Handle multi-word sim names by combining the arguments
25 foreach (string arg in args)
26 {
27 destination += arg + " ";
28 }
29 destination = destination.Trim();
30
31 string[] tokens = destination.Split(new char[] { '/' });
32 if (tokens.Length != 4)
33 return "usage: Destination should be specified as sim/x/y/z";
34
35 string sim = tokens[0];
36 float x = Client.Self.Position.X;
37 float y = Client.Self.Position.Y;
38 float z = Client.Self.Position.Z;
39 float.TryParse(tokens[1], out x);
40 float.TryParse(tokens[2], out y);
41 float.TryParse(tokens[3], out z);
42
43 if (Client.Self.Teleport(sim, new LLVector3(x, y, z)))
44 {
45 return "Teleported to " + Client.Network.CurrentSim;
46 }
47 else
48 {
49 return "Teleport failed: " + Client.Self.TeleportMessage;
50 }
51 }
52 }
53}
diff --git a/ExportBot/Commands/Movement/JumpCommand.cs b/ExportBot/Commands/Movement/JumpCommand.cs
deleted file mode 100644
index 29b11a0..0000000
--- a/ExportBot/Commands/Movement/JumpCommand.cs
+++ /dev/null
@@ -1,34 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class JumpCommand: Command
10 {
11 public JumpCommand(TestClient testClient)
12 {
13 Name = "jump";
14 Description = "Teleports to the specified height. (e.g. \"jump 1000\")";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length != 1)
20 return "usage: jump 1000";
21
22 float height = 0;
23 float.TryParse(args[0], out height);
24
25 Client.Self.Teleport
26 (
27 Client.Network.CurrentSim.Name,
28 new LLVector3(Client.Self.Position.X, Client.Self.Position.Y, Client.Self.Position.Z + height)
29 );
30
31 return "Jumped " + height;
32 }
33 }
34}
diff --git a/ExportBot/Commands/Movement/LocationCommand.cs b/ExportBot/Commands/Movement/LocationCommand.cs
deleted file mode 100644
index 2fd62bb..0000000
--- a/ExportBot/Commands/Movement/LocationCommand.cs
+++ /dev/null
@@ -1,23 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class LocationCommand: Command
10 {
11 public LocationCommand(TestClient testClient)
12 {
13 Name = "location";
14 Description = "Show the location.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 return "CurrentSim: '" + Client.Network.CurrentSim.ToString() + "' Position: " +
20 Client.Self.Position.ToString();
21 }
22 }
23}
diff --git a/ExportBot/Commands/Movement/MoveToCommand.cs b/ExportBot/Commands/Movement/MoveToCommand.cs
deleted file mode 100644
index 6d0a225..0000000
--- a/ExportBot/Commands/Movement/MoveToCommand.cs
+++ /dev/null
@@ -1,24 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace libsecondlife.TestClient.Commands.Movement {
6 class MovetoCommand : Command {
7 public MovetoCommand(TestClient client) {
8 Name = "moveto";
9 Description = "Moves the avatar to the specified global position using simulator autopilot.";
10 }
11 public override string Execute(string[] args, LLUUID fromAgentID) {
12 if (args.Length != 3)
13 return "usage: moveto x y z";
14 float x = Client.Self.Position.X + Client.regionX;
15 float y = Client.Self.Position.Y + Client.regionY;
16 float z = Client.Self.Position.Z;
17 float.TryParse(args[0], out x);
18 float.TryParse(args[1], out y);
19 float.TryParse(args[2], out z);
20 Client.Self.AutoPilot((ulong)x, (ulong)y, z);
21 return "Attempting to move to <" + x + ", " + y + ", " + z + ">";
22 }
23 }
24}
diff --git a/ExportBot/Commands/Movement/SitCommand.cs b/ExportBot/Commands/Movement/SitCommand.cs
deleted file mode 100644
index b9ef6be..0000000
--- a/ExportBot/Commands/Movement/SitCommand.cs
+++ /dev/null
@@ -1,52 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class SitCommand: Command
10 {
11 public SitCommand(TestClient testClient)
12 {
13 Name = "sit";
14 Description = "Attempt to sit on the closest prim";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 Primitive closest = null;
20 double closestDistance = Double.MaxValue;
21
22 lock (Client.SimPrims)
23 {
24 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
25 {
26 foreach (Primitive p in Client.SimPrims[Client.Network.CurrentSim].Values)
27 {
28 float distance = Helpers.VecDist(Client.Self.Position, p.Position);
29
30 if (closest == null || distance < closestDistance)
31 {
32 closest = p;
33 closestDistance = distance;
34 }
35 }
36 }
37 }
38
39 if (closest != null)
40 {
41 Client.Self.RequestSit(closest.ID, LLVector3.Zero);
42 Client.Self.Sit();
43
44 return "Sat on " + closest.ID + ". Distance: " + closestDistance;
45 }
46 else
47 {
48 return "Couldn't find a nearby prim to sit on";
49 }
50 }
51 }
52}
diff --git a/ExportBot/Commands/Movement/SitOnCommand.cs b/ExportBot/Commands/Movement/SitOnCommand.cs
deleted file mode 100644
index ec9d201..0000000
--- a/ExportBot/Commands/Movement/SitOnCommand.cs
+++ /dev/null
@@ -1,54 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class SitOnCommand: Command
10 {
11 public SitOnCommand(TestClient testClient)
12 {
13 Name = "siton";
14 Description = "Attempt to sit on a particular prim, with specified UUID";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 LLObject targetSeat = null;
20
21 lock (Client.SimPrims)
22 {
23 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
24 {
25 foreach (LLObject p in Client.SimPrims[Client.Network.CurrentSim].Values)
26 {
27 try
28 {
29 if (p.ID == args[0])
30 targetSeat = p;
31 }
32 catch
33 {
34 // handle exception
35 return "Sorry, I don't think " + args[0] + " is a valid UUID. I'm unable to sit there.";
36 }
37 }
38 }
39 }
40
41 if (targetSeat != null)
42 {
43 Client.Self.RequestSit(targetSeat.ID, LLVector3.Zero);
44 Client.Self.Sit();
45
46 return "Sat on prim " + targetSeat.ID + ".";
47 }
48 else
49 {
50 return "Couldn't find specified prim to sit on";
51 }
52 }
53 }
54} \ No newline at end of file
diff --git a/ExportBot/Commands/Movement/StandCommand.cs b/ExportBot/Commands/Movement/StandCommand.cs
deleted file mode 100644
index 8a00552..0000000
--- a/ExportBot/Commands/Movement/StandCommand.cs
+++ /dev/null
@@ -1,47 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class StandCommand: Command
10 {
11 public StandCommand(TestClient testClient)
12 {
13 Name = "stand";
14 Description = "Stand";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 Client.Self.Status.StandUp = true;
20 stand(Client);
21 return "Standing up.";
22 }
23
24 void stand(SecondLife client)
25 {
26 SendAgentUpdate(client, (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP);
27 }
28
29 const float DRAW_DISTANCE = 96.0f;
30 void SendAgentUpdate(SecondLife client, uint ControlID)
31 {
32 AgentUpdatePacket p = new AgentUpdatePacket();
33 p.AgentData.Far = DRAW_DISTANCE;
34 //LLVector3 myPos = client.Self.Position;
35 p.AgentData.CameraCenter = new LLVector3(0, 0, 0);
36 p.AgentData.CameraAtAxis = new LLVector3(0, 0, 0);
37 p.AgentData.CameraLeftAxis = new LLVector3(0, 0, 0);
38 p.AgentData.CameraUpAxis = new LLVector3(0, 0, 0);
39 p.AgentData.HeadRotation = new LLQuaternion(0, 0, 0, 1); ;
40 p.AgentData.BodyRotation = new LLQuaternion(0, 0, 0, 1); ;
41 p.AgentData.AgentID = client.Network.AgentID;
42 p.AgentData.SessionID = client.Network.SessionID;
43 p.AgentData.ControlFlags = ControlID;
44 client.Network.SendPacket(p);
45 }
46 }
47}
diff --git a/ExportBot/Commands/PacketLogCommand.cs b/ExportBot/Commands/PacketLogCommand.cs
deleted file mode 100644
index 827b147..0000000
--- a/ExportBot/Commands/PacketLogCommand.cs
+++ /dev/null
@@ -1,84 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Xml;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class PacketLogCommand : Command
10 {
11 List<Packet> Packets = new List<Packet>();
12 bool Done = false;
13 int Count = 0;
14 int Total = 0;
15
16 public PacketLogCommand(TestClient testClient)
17 {
18 Name = "packetlog";
19 Description = "Logs a given number of packets to an xml file. Usage: packetlog 10 tenpackets.xml";
20 }
21
22 public override string Execute(string[] args, LLUUID fromAgentID)
23 {
24 if (args.Length != 2)
25 return "Usage: packetlog 10 tenpackets.xml";
26
27 XmlWriter writer;
28 NetworkManager.PacketCallback callback = new NetworkManager.PacketCallback(OnPacket);
29
30 Packets.Clear();
31 Done = false;
32 Count = 0;
33
34 try
35 {
36 Total = Int32.Parse(args[0]);
37 writer = XmlWriter.Create(args[1]);
38
39 Client.Network.RegisterCallback(PacketType.Default, callback);
40 }
41 catch (Exception e)
42 {
43 return "Usage: packetlog 10 tenpackets.xml (" + e + ")";
44 }
45
46 while (!Done)
47 {
48 System.Threading.Thread.Sleep(100);
49 }
50
51 Client.Network.UnregisterCallback(PacketType.Default, callback);
52
53 try
54 {
55 Helpers.PacketListToXml(Packets, writer);
56 }
57 catch (Exception e)
58 {
59 return "Serialization failed: " + e.ToString();
60 }
61
62 writer.Close();
63 Packets.Clear();
64
65 return "Exported " + Count + " packets to " + args[1];
66 }
67
68 private void OnPacket(Packet packet, Simulator simulator)
69 {
70 lock (Packets)
71 {
72 if (Count >= Total)
73 {
74 Done = true;
75 }
76 else
77 {
78 Packets.Add(packet);
79 Count++;
80 }
81 }
82 }
83 }
84}
diff --git a/ExportBot/Commands/ParcelInfoCommand.cs b/ExportBot/Commands/ParcelInfoCommand.cs
deleted file mode 100644
index e4108a9..0000000
--- a/ExportBot/Commands/ParcelInfoCommand.cs
+++ /dev/null
@@ -1,62 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Threading;
4using libsecondlife;
5using libsecondlife.Utilities;
6
7namespace libsecondlife.TestClient
8{
9 public class ParcelInfoCommand : Command
10 {
11 private ParcelDownloader ParcelDownloader;
12 private ManualResetEvent ParcelsDownloaded = new ManualResetEvent(false);
13 private int ParcelCount = 0;
14
15 public ParcelInfoCommand(TestClient testClient)
16 {
17 Name = "parcelinfo";
18 Description = "Prints out info about all the parcels in this simulator";
19
20 ParcelDownloader = new ParcelDownloader(testClient);
21 ParcelDownloader.OnParcelsDownloaded += new ParcelDownloader.ParcelsDownloadedCallback(Parcels_OnParcelsDownloaded);
22 testClient.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
23 }
24
25 public override string Execute(string[] args, LLUUID fromAgentID)
26 {
27 ParcelDownloader.DownloadSimParcels(Client.Network.CurrentSim);
28
29 ParcelsDownloaded.Reset();
30 ParcelsDownloaded.WaitOne(20000, false);
31
32 if (Client.Network.CurrentSim != null)
33 return "Downloaded information for " + ParcelCount + " parcels in " + Client.Network.CurrentSim.Name;
34 else
35 return String.Empty;
36 }
37
38 void Parcels_OnParcelsDownloaded(Simulator simulator, Dictionary<int, Parcel> Parcels, int[,] map)
39 {
40 foreach (KeyValuePair<int, Parcel> parcel in Parcels)
41 {
42 WaterType type = ParcelDownloader.GetWaterType(map, parcel.Value.LocalID);
43 float delta = ParcelDownloader.GetHeightRange(map, parcel.Value.LocalID);
44 int deviation = ParcelDownloader.GetRectangularDeviation(parcel.Value.AABBMin, parcel.Value.AABBMax,
45 parcel.Value.Area);
46
47 Console.WriteLine("Parcels[{0}]: Name: \"{1}\", Description: \"{2}\" ACL Count: {3}, " +
48 "Location: {4}, Height Range: {5}, Shape Deviation: {6}", parcel.Key, parcel.Value.Name,
49 parcel.Value.Desc, parcel.Value.AccessList.Count, type.ToString(), delta, deviation);
50 }
51
52 ParcelCount = Parcels.Count;
53
54 ParcelsDownloaded.Set();
55 }
56
57 void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message)
58 {
59 ParcelsDownloaded.Set();
60 }
61 }
62}
diff --git a/ExportBot/Commands/PrimCountCommand.cs b/ExportBot/Commands/PrimCountCommand.cs
deleted file mode 100644
index 8adc563..0000000
--- a/ExportBot/Commands/PrimCountCommand.cs
+++ /dev/null
@@ -1,32 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class PrimCountCommand: Command
10 {
11 public PrimCountCommand(TestClient testClient)
12 {
13 Name = "primcount";
14 Description = "Shows the number of prims that have been received.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 int count = 0;
20
21 lock (Client.SimPrims)
22 {
23 foreach (Dictionary<uint, Primitive> prims in Client.SimPrims.Values)
24 {
25 count += prims.Count;
26 }
27 }
28
29 return count.ToString();
30 }
31 }
32}
diff --git a/ExportBot/Commands/QuitCommand.cs b/ExportBot/Commands/QuitCommand.cs
deleted file mode 100644
index 4cd7209..0000000
--- a/ExportBot/Commands/QuitCommand.cs
+++ /dev/null
@@ -1,24 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class QuitCommand: Command
10 {
11 public QuitCommand(TestClient testClient)
12 {
13 Name = "quit";
14 Description = "Log all avatars out and shut down";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 Client.ClientManager.LogoutAll();
20 Client.ClientManager.Running = false;
21 return "All avatars logged out";
22 }
23 }
24}
diff --git a/ExportBot/Commands/RegionInfoCommand.cs b/ExportBot/Commands/RegionInfoCommand.cs
deleted file mode 100644
index 7581137..0000000
--- a/ExportBot/Commands/RegionInfoCommand.cs
+++ /dev/null
@@ -1,45 +0,0 @@
1using System;
2using System.Text;
3using libsecondlife;
4
5namespace libsecondlife.TestClient
6{
7 public class RegionInfoCommand : Command
8 {
9 public RegionInfoCommand(TestClient testClient)
10 {
11 Name = "regioninfo";
12 Description = "Prints out info about all the current region";
13 }
14
15 public override string Execute(string[] args, LLUUID fromAgentID)
16 {
17 StringBuilder output = new StringBuilder();
18 output.AppendLine(Client.Network.CurrentSim.ToString());
19 output.Append("Access: ");
20 output.AppendLine(Client.Network.CurrentSim.Access.ToString());
21 output.Append("Flags: ");
22 output.AppendLine(Client.Network.CurrentSim.Flags.ToString());
23 output.Append("TerrainBase0: ");
24 output.AppendLine(Client.Network.CurrentSim.TerrainBase0.ToStringHyphenated());
25 output.Append("TerrainBase1: ");
26 output.AppendLine(Client.Network.CurrentSim.TerrainBase1.ToStringHyphenated());
27 output.Append("TerrainBase2: ");
28 output.AppendLine(Client.Network.CurrentSim.TerrainBase2.ToStringHyphenated());
29 output.Append("TerrainBase3: ");
30 output.AppendLine(Client.Network.CurrentSim.TerrainBase3.ToStringHyphenated());
31 output.Append("TerrainDetail0: ");
32 output.AppendLine(Client.Network.CurrentSim.TerrainDetail0.ToStringHyphenated());
33 output.Append("TerrainDetail1: ");
34 output.AppendLine(Client.Network.CurrentSim.TerrainDetail1.ToStringHyphenated());
35 output.Append("TerrainDetail2: ");
36 output.AppendLine(Client.Network.CurrentSim.TerrainDetail2.ToStringHyphenated());
37 output.Append("TerrainDetail3: ");
38 output.AppendLine(Client.Network.CurrentSim.TerrainDetail3.ToStringHyphenated());
39 output.Append("Water Height: ");
40 output.AppendLine(Client.Network.CurrentSim.WaterHeight.ToString());
41
42 return output.ToString();
43 }
44 }
45}
diff --git a/ExportBot/Commands/SetMasterCommand.cs b/ExportBot/Commands/SetMasterCommand.cs
deleted file mode 100644
index a6ecbdc..0000000
--- a/ExportBot/Commands/SetMasterCommand.cs
+++ /dev/null
@@ -1,73 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Threading;
5using libsecondlife;
6using libsecondlife.Packets;
7
8namespace libsecondlife.TestClient
9{
10 public class SetMasterCommand: Command
11 {
12 public DateTime Created = DateTime.Now;
13 private LLUUID resolvedMasterKey = LLUUID.Zero;
14 private ManualResetEvent keyResolution = new ManualResetEvent(false);
15 private LLUUID query = LLUUID.Zero;
16
17 public SetMasterCommand(TestClient testClient)
18 {
19 Name = "setMaster";
20 Description = "Sets the user name of the master user. The master user can IM to run commands.";
21
22 }
23
24 public override string Execute(string[] args, LLUUID fromAgentID)
25 {
26 string masterName = String.Empty;
27 for (int ct = 0; ct < args.Length;ct++)
28 masterName = masterName + args[ct] + " ";
29 masterName = masterName.TrimEnd();
30
31 if (masterName.Length == 0)
32 return "Usage setMaster name";
33
34 DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
35 Client.Directory.OnDirPeopleReply += callback;
36 query = Client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, masterName);
37 if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
38 {
39 Client.MasterKey = resolvedMasterKey;
40 keyResolution.Reset();
41 Client.Directory.OnDirPeopleReply -= callback;
42 }
43 else
44 {
45 keyResolution.Reset();
46 Client.Directory.OnDirPeopleReply -= callback;
47 return "Unable to obtain UUID for \"" + masterName + "\". Master unchanged.";
48 }
49
50
51 foreach (Avatar av in Client.AvatarList.Values)
52 {
53 if (av.ID == Client.MasterKey)
54 {
55 Client.Self.InstantMessage(av.ID, "You are now my master. IM me with \"help\" for a command list.");
56 break;
57 }
58 }
59
60 return "Master set to " + masterName + " (" + Client.MasterKey.ToStringHyphenated() + ")";
61 }
62
63 private void KeyResolvHandler(LLUUID queryid, List<DirectoryManager.AgentSearchData> matches)
64 {
65 if (query != queryid)
66 return;
67 // We can't handle ambiguities here as nicely as we can in ClientManager.
68 resolvedMasterKey = matches[0].AgentID;
69 keyResolution.Set();
70 query = LLUUID.Zero;
71 }
72 }
73}
diff --git a/ExportBot/Commands/SetMasterKeyCommand.cs b/ExportBot/Commands/SetMasterKeyCommand.cs
deleted file mode 100644
index 0085f79..0000000
--- a/ExportBot/Commands/SetMasterKeyCommand.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class SetMasterKeyCommand : Command
10 {
11 public DateTime Created = DateTime.Now;
12
13 public SetMasterKeyCommand(TestClient testClient)
14 {
15 Name = "setMasterKey";
16 Description = "Sets the key of the master user. The master user can IM to run commands.";
17 }
18
19 public override string Execute(string[] args, LLUUID fromAgentID)
20 {
21 Client.MasterKey = LLUUID.Parse(args[0]);
22
23 foreach (Avatar av in Client.AvatarList.Values)
24 {
25 if (av.ID == Client.MasterKey)
26 {
27 Client.Self.InstantMessage(av.ID, "You are now my master. IM me with \"help\" for a command list.");
28 break;
29 }
30 }
31
32 return "Master set to " + Client.MasterKey;
33 }
34 }
35}
diff --git a/ExportBot/Commands/ShowEffectsCommand.cs b/ExportBot/Commands/ShowEffectsCommand.cs
deleted file mode 100644
index c0b20a7..0000000
--- a/ExportBot/Commands/ShowEffectsCommand.cs
+++ /dev/null
@@ -1,76 +0,0 @@
1using System;
2using libsecondlife;
3
4namespace libsecondlife.TestClient
5{
6 public class ShowEffectsCommand : Command
7 {
8 bool ShowEffects = false;
9
10 public ShowEffectsCommand(TestClient testClient)
11 {
12 Name = "showeffects";
13 Description = "Prints out information for every viewer effect that is received. Usage: showeffects [on/off]";
14
15 testClient.Avatars.OnEffect += new AvatarManager.EffectCallback(Avatars_OnEffect);
16 testClient.Avatars.OnLookAt += new AvatarManager.LookAtCallback(Avatars_OnLookAt);
17 testClient.Avatars.OnPointAt += new AvatarManager.PointAtCallback(Avatars_OnPointAt);
18 }
19
20 public override string Execute(string[] args, LLUUID fromAgentID)
21 {
22 if (args.Length == 0)
23 {
24 ShowEffects = true;
25 return "Viewer effects will be shown on the console";
26 }
27 else if (args.Length == 1)
28 {
29 if (args[0] == "on")
30 {
31 ShowEffects = true;
32 return "Viewer effects will be shown on the console";
33 }
34 else
35 {
36 ShowEffects = false;
37 return "Viewer effects will not be shown";
38 }
39 }
40 else
41 {
42 return "Usage: showeffects [on/off]";
43 }
44 }
45
46 private void Avatars_OnPointAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos,
47 MainAvatar.PointAtType pointType, float duration, LLUUID id)
48 {
49 if (ShowEffects)
50 Console.WriteLine(
51 "ViewerEffect [PointAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
52 sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, pointType, duration,
53 id.ToStringHyphenated());
54 }
55
56 private void Avatars_OnLookAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos,
57 MainAvatar.LookAtType lookType, float duration, LLUUID id)
58 {
59 if (ShowEffects)
60 Console.WriteLine(
61 "ViewerEffect [LookAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
62 sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, lookType, duration,
63 id.ToStringHyphenated());
64 }
65
66 private void Avatars_OnEffect(MainAvatar.EffectType type, LLUUID sourceID, LLUUID targetID,
67 LLVector3d targetPos, float duration, LLUUID id)
68 {
69 if (ShowEffects)
70 Console.WriteLine(
71 "ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}",
72 type, sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, duration,
73 id.ToStringHyphenated());
74 }
75 }
76}
diff --git a/ExportBot/Commands/StatsCommand.cs b/ExportBot/Commands/StatsCommand.cs
deleted file mode 100644
index 7835ec8..0000000
--- a/ExportBot/Commands/StatsCommand.cs
+++ /dev/null
@@ -1,39 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class StatsCommand : Command
10 {
11 public StatsCommand(TestClient testClient)
12 {
13 Name = "stats";
14 Description = "Provide connection figures and statistics";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 StringBuilder output = new StringBuilder();
20
21 lock (Client.Network.Simulators)
22 {
23 for (int i = 0; i < Client.Network.Simulators.Count; i++)
24 {
25 Simulator sim = Client.Network.Simulators[i];
26
27 output.AppendLine(String.Format(
28 "[{0}] Dilation: {1} InBPS: {2} OutBPS: {3} ResentOut: {4} ResentIn: {5}",
29 sim.ToString(), sim.Dilation, sim.IncomingBPS, sim.OutgoingBPS, sim.ResentPackets,
30 sim.ReceivedResends));
31 }
32 }
33
34 output.Append("Packets in the queue: " + Client.Network.InboxCount);
35
36 return output.ToString();
37 }
38 }
39}
diff --git a/ExportBot/Commands/TouchCommand.cs b/ExportBot/Commands/TouchCommand.cs
deleted file mode 100644
index 4103d21..0000000
--- a/ExportBot/Commands/TouchCommand.cs
+++ /dev/null
@@ -1,55 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class TouchCommand: Command
10 {
11 public TouchCommand(TestClient testClient)
12 {
13 Name = "touch";
14 Description = "Attempt to touch a prim with specified UUID";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 Primitive target = null;
20
21 lock (Client.SimPrims)
22 {
23 if (Client.SimPrims.ContainsKey(Client.Network.CurrentSim))
24 {
25 foreach (Primitive p in Client.SimPrims[Client.Network.CurrentSim].Values)
26 {
27 if (args.Length == 0)
28 return "You must specify a UUID of the prim.";
29
30 try
31 {
32 if (p.ID == args[0])
33 target = p;
34 }
35 catch
36 {
37 // handle exception
38 return "Sorry, I don't think " + args[0] + " is a valid UUID. I'm unable to touch it.";
39 }
40 }
41 }
42 }
43
44 if (target != null)
45 {
46 Client.Self.Touch(target.LocalID);
47 return "Touched prim " + target.ID + ".";
48 }
49 else
50 {
51 return "Couldn't find that prim.";
52 }
53 }
54 }
55} \ No newline at end of file
diff --git a/ExportBot/Commands/TreeCommand.cs b/ExportBot/Commands/TreeCommand.cs
deleted file mode 100644
index 2029e37..0000000
--- a/ExportBot/Commands/TreeCommand.cs
+++ /dev/null
@@ -1,51 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class TreeCommand: Command
10 {
11 public TreeCommand(TestClient testClient)
12 {
13 Name = "tree";
14 Description = "Rez a tree.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 if (args.Length == 1)
20 {
21 try
22 {
23 string treeName = args[0].Trim(new char[] { ' ' });
24 ObjectManager.Tree tree = (ObjectManager.Tree)Enum.Parse(typeof(ObjectManager.Tree), treeName);
25
26 LLVector3 treePosition = new LLVector3(Client.Self.Position.X, Client.Self.Position.Y,
27 Client.Self.Position.Z);
28 treePosition.Z += 3.0f;
29
30 Client.Objects.AddTree(Client.Network.CurrentSim, new LLVector3(0.5f, 0.5f, 0.5f),
31 LLQuaternion.Identity, treePosition, tree, Client.GroupID, false);
32
33 return "Attempted to rez a " + treeName + " tree";
34 }
35 catch (Exception)
36 {
37 return "Type !tree for usage";
38 }
39 }
40
41 string usage = "Usage: !tree [";
42 foreach (string value in Enum.GetNames(typeof(ObjectManager.Tree)))
43 {
44 usage += value + ",";
45 }
46 usage = usage.TrimEnd(new char[] { ',' });
47 usage += "]";
48 return usage;
49 }
50 }
51}
diff --git a/ExportBot/Commands/UptimeCommand.cs b/ExportBot/Commands/UptimeCommand.cs
deleted file mode 100644
index 3edec73..0000000
--- a/ExportBot/Commands/UptimeCommand.cs
+++ /dev/null
@@ -1,25 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class UptimeCommand : Command
10 {
11 public DateTime Created = DateTime.Now;
12
13 public UptimeCommand(TestClient testClient)
14 {
15 Name = "uptime";
16 Description = "Shows the login name, login time and length of time logged on.";
17 }
18
19 public override string Execute(string[] args, LLUUID fromAgentID)
20 {
21 string name = Client.ToString();
22 return "I am " + name + ", Up Since: " + Created + " (" + (DateTime.Now - Created) + ")";
23 }
24 }
25} \ No newline at end of file
diff --git a/ExportBot/Commands/WhoCommand.cs b/ExportBot/Commands/WhoCommand.cs
deleted file mode 100644
index 83d8610..0000000
--- a/ExportBot/Commands/WhoCommand.cs
+++ /dev/null
@@ -1,29 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using libsecondlife.Packets;
6
7namespace libsecondlife.TestClient
8{
9 public class WhoCommand: Command
10 {
11 public WhoCommand(TestClient testClient)
12 {
13 Name = "who";
14 Description = "Lists seen avatars.";
15 }
16
17 public override string Execute(string[] args, LLUUID fromAgentID)
18 {
19 StringBuilder result = new StringBuilder();
20 foreach (Avatar av in Client.AvatarList.Values)
21 {
22 result.AppendFormat("\n{0} {1} {2}/{3} ID: {4}", av.Name, av.GroupName,
23 (av.CurrentSim != null ? av.CurrentSim.Name : String.Empty), av.Position, av.ID);
24 }
25
26 return result.ToString();
27 }
28 }
29}
diff --git a/ExportBot/ExportBot.build b/ExportBot/ExportBot.build
deleted file mode 100644
index 87b9d6d..0000000
--- a/ExportBot/ExportBot.build
+++ /dev/null
@@ -1,67 +0,0 @@
1<?xml version="1.0" ?>
2<project name="ExportBot" default="build">
3 <echo message="Using '${nant.settings.currentframework}' Framework"/>
4
5 <property name="bin.dir" value="bin" />
6 <property name="obj.dir" value="obj" />
7 <property name="doc.dir" value="doc" />
8 <property name="project.main.dir" value="${project::get-base-directory()}" />
9
10 <target name="Debug" description="">
11 <property name="project.config" value="Debug" />
12 <property name="build.debug" value="true" />
13 </target>
14
15 <property name="project.config" value="Release" />
16
17 <target name="Release" description="">
18 <property name="project.config" value="Release" />
19 <property name="build.debug" value="false" />
20 </target>
21
22 <target name="net-1.1" description="Sets framework to .NET 1.1">
23 <property name="nant.settings.currentframework" value="net-1.1" />
24 </target>
25
26 <target name="net-2.0" description="Sets framework to .NET 2.0">
27 <property name="nant.settings.currentframework" value="net-2.0" />
28 </target>
29
30 <target name="mono-2.0" description="Sets framework to mono 2.0">
31 <property name="nant.settings.currentframework" value="mono-2.0" />
32 </target>
33
34 <target name="mono-1.0" description="Sets framework to mono 1.0">
35 <property name="nant.settings.currentframework" value="mono-1.0" />
36 </target>
37
38 <target name="init" description="">
39 <call target="${project.config}" />
40 <sysinfo />
41 <echo message="Platform ${sys.os.platform}" />
42 <property name="build.dir" value="${bin.dir}/${project.config}" />
43 </target>
44
45 <target name="clean" description="">
46 <echo message="Deleting all builds from all configurations" />
47 <delete dir="${bin.dir}" failonerror="false" />
48 <delete dir="${obj.dir}" failonerror="false" />
49 <nant buildfile="./ExportBot.exe.build" target="clean" />
50 </target>
51
52 <target name="build" depends="init" description="">
53 <nant buildfile="./ExportBot.exe.build" target="build" />
54 </target>
55
56 <target name="build-release" depends="Release, init, build" description="Builds in Release mode" />
57
58 <target name="build-debug" depends="Debug, init, build" description="Builds in Debug mode" />
59
60 <target name="package" depends="clean, doc" description="Builds all" />
61
62 <target name="doc" depends="build-release">
63 <echo message="Generating all documentation from all builds" />
64 <nant buildfile="./ExportBot.exe.build" target="doc" />
65 </target>
66
67</project>
diff --git a/ExportBot/ExportBot.csproj b/ExportBot/ExportBot.csproj
deleted file mode 100644
index 95531e4..0000000
--- a/ExportBot/ExportBot.csproj
+++ /dev/null
@@ -1,263 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion>
5 <SchemaVersion>2.0</SchemaVersion>
6 <ProjectGuid>{C4071317-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon>
10 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName>
12 <AssemblyName>ExportBot</AssemblyName>
13 <DefaultClientScript>JScript</DefaultClientScript>
14 <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
15 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder>
19 <RootNamespace>ExportBot</RootNamespace>
20 <StartupObject></StartupObject>
21 <FileUpgradeFlags>
22 </FileUpgradeFlags>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
26 <BaseAddress>285212672</BaseAddress>
27 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
28 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile>
32 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize>
35 <OutputPath>..\bin\</OutputPath>
36 <RegisterForComInterop>False</RegisterForComInterop>
37 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn>
41 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
44 <BaseAddress>285212672</BaseAddress>
45 <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
46 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile>
50 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize>
53 <OutputPath>..\bin\</OutputPath>
54 <RegisterForComInterop>False</RegisterForComInterop>
55 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn>
59 </PropertyGroup>
60 <ItemGroup>
61 <Reference Include="System" >
62 <HintPath>System.dll</HintPath>
63 <Private>False</Private>
64 </Reference>
65 <Reference Include="System.Xml" >
66 <HintPath>System.Xml.dll</HintPath>
67 <Private>False</Private>
68 </Reference>
69 <Reference Include="libsecondlife.dll" >
70 <HintPath>..\bin\libsecondlife.dll</HintPath>
71 <Private>False</Private>
72 </Reference>
73 <Reference Include="openjpegnet.dll" >
74 <HintPath>..\bin\openjpegnet.dll</HintPath>
75 <Private>False</Private>
76 </Reference>
77 <Reference Include="OpenSim.Framework.dll" >
78 <HintPath>..\bin\OpenSim.Framework.dll</HintPath>
79 <Private>False</Private>
80 </Reference>
81 <Reference Include="OpenSim.Framework.Console.dll" >
82 <HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath>
83 <Private>False</Private>
84 </Reference>
85 <Reference Include="OpenSim.Servers.dll" >
86 <HintPath>..\bin\OpenSim.Servers.dll</HintPath>
87 <Private>False</Private>
88 </Reference>
89 </ItemGroup>
90 <ItemGroup>
91 </ItemGroup>
92 <ItemGroup>
93 <Compile Include="Arguments.cs">
94 <SubType>Code</SubType>
95 </Compile>
96 <Compile Include="ClientManager.cs">
97 <SubType>Code</SubType>
98 </Compile>
99 <Compile Include="Command.cs">
100 <SubType>Code</SubType>
101 </Compile>
102 <Compile Include="Parsing.cs">
103 <SubType>Code</SubType>
104 </Compile>
105 <Compile Include="Program.cs">
106 <SubType>Code</SubType>
107 </Compile>
108 <Compile Include="TestClient.cs">
109 <SubType>Code</SubType>
110 </Compile>
111 <Compile Include="Commands\AppearanceCommand.cs">
112 <SubType>Code</SubType>
113 </Compile>
114 <Compile Include="Commands\CloneProfileCommand.cs">
115 <SubType>Code</SubType>
116 </Compile>
117 <Compile Include="Commands\DebugCommand.cs">
118 <SubType>Code</SubType>
119 </Compile>
120 <Compile Include="Commands\DilationCommand.cs">
121 <SubType>Code</SubType>
122 </Compile>
123 <Compile Include="Commands\DumpOutfitCommand.cs">
124 <SubType>Code</SubType>
125 </Compile>
126 <Compile Include="Commands\ExportCommand.cs">
127 <SubType>Code</SubType>
128 </Compile>
129 <Compile Include="Commands\ExportOutfitCommand.cs">
130 <SubType>Code</SubType>
131 </Compile>
132 <Compile Include="Commands\ExportParticlesCommand.cs">
133 <SubType>Code</SubType>
134 </Compile>
135 <Compile Include="Commands\FindSimCommand.cs">
136 <SubType>Code</SubType>
137 </Compile>
138 <Compile Include="Commands\HelpCommand.cs">
139 <SubType>Code</SubType>
140 </Compile>
141 <Compile Include="Commands\ImportCommand.cs">
142 <SubType>Code</SubType>
143 </Compile>
144 <Compile Include="Commands\ImportOutfitCommand.cs">
145 <SubType>Code</SubType>
146 </Compile>
147 <Compile Include="Commands\LoadCommand.cs">
148 <SubType>Code</SubType>
149 </Compile>
150 <Compile Include="Commands\LoginCommand.cs">
151 <SubType>Code</SubType>
152 </Compile>
153 <Compile Include="Commands\LogoutCommand.cs">
154 <SubType>Code</SubType>
155 </Compile>
156 <Compile Include="Commands\MD5Command.cs">
157 <SubType>Code</SubType>
158 </Compile>
159 <Compile Include="Commands\PacketLogCommand.cs">
160 <SubType>Code</SubType>
161 </Compile>
162 <Compile Include="Commands\ParcelInfoCommand.cs">
163 <SubType>Code</SubType>
164 </Compile>
165 <Compile Include="Commands\PrimCountCommand.cs">
166 <SubType>Code</SubType>
167 </Compile>
168 <Compile Include="Commands\QuitCommand.cs">
169 <SubType>Code</SubType>
170 </Compile>
171 <Compile Include="Commands\RegionInfoCommand.cs">
172 <SubType>Code</SubType>
173 </Compile>
174 <Compile Include="Commands\SetMasterCommand.cs">
175 <SubType>Code</SubType>
176 </Compile>
177 <Compile Include="Commands\SetMasterKeyCommand.cs">
178 <SubType>Code</SubType>
179 </Compile>
180 <Compile Include="Commands\ShowEffectsCommand.cs">
181 <SubType>Code</SubType>
182 </Compile>
183 <Compile Include="Commands\StatsCommand.cs">
184 <SubType>Code</SubType>
185 </Compile>
186 <Compile Include="Commands\TouchCommand.cs">
187 <SubType>Code</SubType>
188 </Compile>
189 <Compile Include="Commands\TreeCommand.cs">
190 <SubType>Code</SubType>
191 </Compile>
192 <Compile Include="Commands\UptimeCommand.cs">
193 <SubType>Code</SubType>
194 </Compile>
195 <Compile Include="Commands\WhoCommand.cs">
196 <SubType>Code</SubType>
197 </Compile>
198 <Compile Include="Commands\Communication\EchoMasterCommand.cs">
199 <SubType>Code</SubType>
200 </Compile>
201 <Compile Include="Commands\Communication\IMCommand.cs">
202 <SubType>Code</SubType>
203 </Compile>
204 <Compile Include="Commands\Communication\SayCommand.cs">
205 <SubType>Code</SubType>
206 </Compile>
207 <Compile Include="Commands\Communication\ShoutCommand.cs">
208 <SubType>Code</SubType>
209 </Compile>
210 <Compile Include="Commands\Communication\WhisperCommand.cs">
211 <SubType>Code</SubType>
212 </Compile>
213 <Compile Include="Commands\Inventory\BalanceCommand.cs">
214 <SubType>Code</SubType>
215 </Compile>
216 <Compile Include="Commands\Inventory\DeleteFolderCommand.cs">
217 <SubType>Code</SubType>
218 </Compile>
219 <Compile Include="Commands\Inventory\GiveAllCommand.cs">
220 <SubType>Code</SubType>
221 </Compile>
222 <Compile Include="Commands\Inventory\InventoryCommand.cs">
223 <SubType>Code</SubType>
224 </Compile>
225 <Compile Include="Commands\Inventory\WearCommand.cs">
226 <SubType>Code</SubType>
227 </Compile>
228 <Compile Include="Commands\Movement\FollowCommand.cs">
229 <SubType>Code</SubType>
230 </Compile>
231 <Compile Include="Commands\Movement\GotoCommand.cs">
232 <SubType>Code</SubType>
233 </Compile>
234 <Compile Include="Commands\Movement\JumpCommand.cs">
235 <SubType>Code</SubType>
236 </Compile>
237 <Compile Include="Commands\Movement\LocationCommand.cs">
238 <SubType>Code</SubType>
239 </Compile>
240 <Compile Include="Commands\Movement\MoveToCommand.cs">
241 <SubType>Code</SubType>
242 </Compile>
243 <Compile Include="Commands\Movement\SitCommand.cs">
244 <SubType>Code</SubType>
245 </Compile>
246 <Compile Include="Commands\Movement\SitOnCommand.cs">
247 <SubType>Code</SubType>
248 </Compile>
249 <Compile Include="Commands\Movement\StandCommand.cs">
250 <SubType>Code</SubType>
251 </Compile>
252 <Compile Include="Properties\AssemblyInfo.cs">
253 <SubType>Code</SubType>
254 </Compile>
255 </ItemGroup>
256 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
257 <PropertyGroup>
258 <PreBuildEvent>
259 </PreBuildEvent>
260 <PostBuildEvent>
261 </PostBuildEvent>
262 </PropertyGroup>
263</Project>
diff --git a/ExportBot/ExportBot.exe.build b/ExportBot/ExportBot.exe.build
deleted file mode 100644
index 8f2bc46..0000000
--- a/ExportBot/ExportBot.exe.build
+++ /dev/null
@@ -1,98 +0,0 @@
1<?xml version="1.0" ?>
2<project name="ExportBot" default="build">
3 <target name="build">
4 <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" />
5 <mkdir dir="${project::get-base-directory()}/${build.dir}" />
6 <copy todir="${project::get-base-directory()}/${build.dir}">
7 <fileset basedir="${project::get-base-directory()}">
8 </fileset>
9 </copy>
10 <csc target="exe" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.exe">
11 <resources prefix="ExportBot" dynamicprefix="true" >
12 </resources>
13 <sources failonempty="true">
14 <include name="Arguments.cs" />
15 <include name="ClientManager.cs" />
16 <include name="Command.cs" />
17 <include name="Parsing.cs" />
18 <include name="Program.cs" />
19 <include name="TestClient.cs" />
20 <include name="Commands/AppearanceCommand.cs" />
21 <include name="Commands/CloneProfileCommand.cs" />
22 <include name="Commands/DebugCommand.cs" />
23 <include name="Commands/DilationCommand.cs" />
24 <include name="Commands/DumpOutfitCommand.cs" />
25 <include name="Commands/ExportCommand.cs" />
26 <include name="Commands/ExportOutfitCommand.cs" />
27 <include name="Commands/ExportParticlesCommand.cs" />
28 <include name="Commands/FindSimCommand.cs" />
29 <include name="Commands/HelpCommand.cs" />
30 <include name="Commands/ImportCommand.cs" />
31 <include name="Commands/ImportOutfitCommand.cs" />
32 <include name="Commands/LoadCommand.cs" />
33 <include name="Commands/LoginCommand.cs" />
34 <include name="Commands/LogoutCommand.cs" />
35 <include name="Commands/MD5Command.cs" />
36 <include name="Commands/PacketLogCommand.cs" />
37 <include name="Commands/ParcelInfoCommand.cs" />
38 <include name="Commands/PrimCountCommand.cs" />
39 <include name="Commands/QuitCommand.cs" />
40 <include name="Commands/RegionInfoCommand.cs" />
41 <include name="Commands/SetMasterCommand.cs" />
42 <include name="Commands/SetMasterKeyCommand.cs" />
43 <include name="Commands/ShowEffectsCommand.cs" />
44 <include name="Commands/StatsCommand.cs" />
45 <include name="Commands/TouchCommand.cs" />
46 <include name="Commands/TreeCommand.cs" />
47 <include name="Commands/UptimeCommand.cs" />
48 <include name="Commands/WhoCommand.cs" />
49 <include name="Commands/Communication/EchoMasterCommand.cs" />
50 <include name="Commands/Communication/IMCommand.cs" />
51 <include name="Commands/Communication/SayCommand.cs" />
52 <include name="Commands/Communication/ShoutCommand.cs" />
53 <include name="Commands/Communication/WhisperCommand.cs" />
54 <include name="Commands/Inventory/BalanceCommand.cs" />
55 <include name="Commands/Inventory/DeleteFolderCommand.cs" />
56 <include name="Commands/Inventory/GiveAllCommand.cs" />
57 <include name="Commands/Inventory/InventoryCommand.cs" />
58 <include name="Commands/Inventory/WearCommand.cs" />
59 <include name="Commands/Movement/FollowCommand.cs" />
60 <include name="Commands/Movement/GotoCommand.cs" />
61 <include name="Commands/Movement/JumpCommand.cs" />
62 <include name="Commands/Movement/LocationCommand.cs" />
63 <include name="Commands/Movement/MoveToCommand.cs" />
64 <include name="Commands/Movement/SitCommand.cs" />
65 <include name="Commands/Movement/SitOnCommand.cs" />
66 <include name="Commands/Movement/StandCommand.cs" />
67 <include name="Properties/AssemblyInfo.cs" />
68 </sources>
69 <references basedir="${project::get-base-directory()}">
70 <lib>
71 <include name="${project::get-base-directory()}" />
72 <include name="${project::get-base-directory()}/${build.dir}" />
73 </lib>
74 <include name="System.dll" />
75 <include name="System.Xml.dll" />
76 <include name="../bin/libsecondlife.dll" />
77 <include name="../bin/openjpegnet.dll" />
78 <include name="../bin/OpenSim.Framework.dll" />
79 <include name="../bin/OpenSim.Framework.Console.dll" />
80 <include name="../bin/OpenSim.Servers.dll" />
81 </references>
82 </csc>
83 <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../bin/" />
84 <mkdir dir="${project::get-base-directory()}/../bin/"/>
85 <copy todir="${project::get-base-directory()}/../bin/">
86 <fileset basedir="${project::get-base-directory()}/${build.dir}/" >
87 <include name="*.dll"/>
88 <include name="*.exe"/>
89 </fileset>
90 </copy>
91 </target>
92 <target name="clean">
93 <delete dir="${bin.dir}" failonerror="false" />
94 <delete dir="${obj.dir}" failonerror="false" />
95 </target>
96 <target name="doc" description="Creates documentation.">
97 </target>
98</project>
diff --git a/ExportBot/Parsing.cs b/ExportBot/Parsing.cs
deleted file mode 100644
index 1e081c1..0000000
--- a/ExportBot/Parsing.cs
+++ /dev/null
@@ -1,61 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace libsecondlife.TestClient {
6 class Parsing {
7 public static string[] ParseArguments(string str) {
8 List<string> list = new List<string>();
9 string current = "";
10 string trimmed = null;
11 bool withinQuote = false;
12 bool escaped = false;
13 foreach (char c in str) {
14 if (c == '"') {
15 if (escaped) {
16 current += '"';
17 escaped = false;
18 } else {
19 current += '"';
20 withinQuote = !withinQuote;
21 }
22 } else if (c == ' ' || c == '\t') {
23 if (escaped || withinQuote) {
24 current += c;
25 escaped = false;
26 } else {
27 trimmed = current.Trim();
28 if (trimmed.StartsWith("\"") && trimmed.EndsWith("\"")) {
29 trimmed = trimmed.Remove(0, 1);
30 trimmed = trimmed.Remove(trimmed.Length - 1);
31 trimmed = trimmed.Trim();
32 }
33 if (trimmed.Length > 0)
34 list.Add(trimmed);
35 current = "";
36 }
37 } else if (c == '\\') {
38 if (escaped) {
39 current += '\\';
40 escaped = false;
41 } else {
42 escaped = true;
43 }
44 } else {
45 if (escaped)
46 throw new FormatException(c.ToString() + " is not an escapable character.");
47 current += c;
48 }
49 }
50 trimmed = current.Trim();
51 if (trimmed.StartsWith("\"") && trimmed.EndsWith("\"")) {
52 trimmed = trimmed.Remove(0, 1);
53 trimmed = trimmed.Remove(trimmed.Length - 1);
54 trimmed = trimmed.Trim();
55 }
56 if (trimmed.Length > 0)
57 list.Add(trimmed);
58 return list.ToArray();
59 }
60 }
61}
diff --git a/ExportBot/Program.cs b/ExportBot/Program.cs
deleted file mode 100644
index 8855be1..0000000
--- a/ExportBot/Program.cs
+++ /dev/null
@@ -1,141 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Threading;
5using CommandLine.Utility;
6using OpenSim.Framework;
7using OpenSim.Framework.Console;
8using OpenSim.Servers;
9
10namespace libsecondlife.TestClient
11{
12 public class Program : conscmd_callback
13 {
14 private static void Usage()
15 {
16 }
17
18 public void RunCmd(string cmd, string[] cmdparams) {}
19 public void Show(string ShowWhat) {}
20
21 static void Main(string[] args)
22 {
23 ConsoleBase m_console = new ConsoleBase("exportbot-console.log", "ExportBot", new Program() , false);
24 MainConsole.Instance = m_console;
25
26 Arguments arguments = new Arguments(args);
27
28 ClientManager manager;
29 List<LoginDetails> accounts = new List<LoginDetails>();
30 LoginDetails account;
31 string masterName = String.Empty;
32 LLUUID masterKey = LLUUID.Zero;
33 string file = String.Empty;
34 string contact = String.Empty;
35
36 if (arguments["masterkey"] != null)
37 {
38 masterKey = LLUUID.Parse(arguments["masterkey"]);
39 }
40 if (arguments["master"] != null)
41 {
42 masterName = arguments["master"];
43 }
44
45 if (arguments["contact"] != null)
46 {
47 contact = arguments["contact"];
48 if (arguments["file"] != null)
49 {
50 file = arguments["file"];
51
52 // Loading names from a file
53 try
54 {
55 using (StreamReader reader = new StreamReader(file))
56 {
57 string line;
58 int lineNumber = 0;
59
60 while ((line = reader.ReadLine()) != null)
61 {
62 lineNumber++;
63 string[] tokens = line.Trim().Split(new char[] { ' ', ',' });
64
65 if (tokens.Length >= 3)
66 {
67 account = new LoginDetails();
68 account.FirstName = tokens[0];
69 account.LastName = tokens[1];
70 account.Password = tokens[2];
71
72 accounts.Add(account);
73
74 // Leaving this out until we have per-account masters (if that
75 // is desirable). For now the command-line option can
76 // specify the single master that TestClient supports
77
78 //if (tokens.Length == 5)
79 //{
80 // master = tokens[3] + " " + tokens[4];
81 //}
82 }
83 else
84 {
85 Console.WriteLine("Invalid data on line " + lineNumber +
86 ", must be in the format of: FirstName LastName Password");
87 }
88 }
89 }
90 }
91 catch (Exception e)
92 {
93 Console.WriteLine("Error reading from " + args[1]);
94 Console.WriteLine(e.ToString());
95 return;
96 }
97 }
98 else
99 {
100 if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null)
101 {
102 // Taking a single login off the command-line
103 account = new LoginDetails();
104 account.FirstName = arguments["first"];
105 account.LastName = arguments["last"];
106 account.Password = arguments["pass"];
107
108 accounts.Add(account);
109 }
110 }
111 }
112 else
113 {
114 Usage();
115 return;
116 }
117
118 foreach (LoginDetails a in accounts)
119 {
120 a.MasterName = masterName;
121 a.MasterKey = masterKey;
122 }
123
124 // Login the accounts and run the input loop
125 manager = new ClientManager(accounts, contact, "Theta/16/229/25");
126/* if ( arguments["start"] != null ) {
127 manager = new ClientManager(accounts, contact, arguments["start"]);
128 } else {
129 manager = new ClientManager(accounts, contact);
130 }*/
131
132 Console.WriteLine("Starting the HTTP listener");
133 BaseHttpServer httpServer = new BaseHttpServer(12035);
134 httpServer.AddRestHandler("GET", "/exportaccount/", manager.ExportAvatarRestMethod);
135 httpServer.Start();
136
137 manager.Run();
138
139 }
140 }
141}
diff --git a/ExportBot/Properties/AssemblyInfo.cs b/ExportBot/Properties/AssemblyInfo.cs
deleted file mode 100644
index 471a306..0000000
--- a/ExportBot/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("TestClient")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("TestClient")]
13[assembly: AssemblyCopyright("Copyright © 2006")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("0563f706-7fa9-42f6-bf23-c6acd1175964")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ExportBot/README b/ExportBot/README
deleted file mode 100644
index 1de2db1..0000000
--- a/ExportBot/README
+++ /dev/null
@@ -1,5 +0,0 @@
1This is a fork of TestClient from the main libsl project, it is not built as a normal part of the opensim release and is designed to allow migration of avatars from the main LL grid to an OGS system.
2
3It's essentially a "good CopyBot" - before an avatar is copied consent is taken and the avatar data is exported out to the remote grid via a web service. The bot is designed to be evoked remotely via an LSL script in-world.
4
5THE AUTHOR ACCEPTS NO RESPONSIBILITY WHATSOEVER FOR ANY POTENTIALLY INFRINGING USES OF THIS CODE.
diff --git a/ExportBot/TestClient.cs b/ExportBot/TestClient.cs
deleted file mode 100644
index f939aa0..0000000
--- a/ExportBot/TestClient.cs
+++ /dev/null
@@ -1,328 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using System.Xml;
5using libsecondlife;
6using libsecondlife.Packets;
7using libsecondlife.AssetSystem;
8
9namespace libsecondlife.TestClient
10{
11 public class TestClient : SecondLife
12 {
13 public delegate void PrimCreatedCallback(Simulator simulator, Primitive prim);
14
15 public event PrimCreatedCallback OnPrimCreated;
16
17 public Dictionary<Simulator, Dictionary<uint, Primitive>> SimPrims;
18 public LLUUID GroupID = LLUUID.Zero;
19 public Dictionary<LLUUID, GroupMember> GroupMembers;
20 public Dictionary<uint, Avatar> AvatarList = new Dictionary<uint,Avatar>();
21 public Dictionary<LLUUID, AvatarAppearancePacket> Appearances = new Dictionary<LLUUID, AvatarAppearancePacket>();
22 public Dictionary<string, Command> Commands = new Dictionary<string,Command>();
23 public bool Running = true;
24 public string MasterName = String.Empty;
25 public LLUUID MasterKey = LLUUID.Zero;
26 public ClientManager ClientManager;
27 public int regionX;
28 public int regionY;
29
30 //internal libsecondlife.InventorySystem.InventoryFolder currentDirectory;
31
32 private LLQuaternion bodyRotation = LLQuaternion.Identity;
33 private LLVector3 forward = new LLVector3(0, 0.9999f, 0);
34 private LLVector3 left = new LLVector3(0.9999f, 0, 0);
35 private LLVector3 up = new LLVector3(0, 0, 0.9999f);
36 private System.Timers.Timer updateTimer;
37
38
39 /// <summary>
40 ///
41 /// </summary>
42 public TestClient(ClientManager manager)
43 {
44 ClientManager = manager;
45
46 updateTimer = new System.Timers.Timer(1000);
47 updateTimer.Elapsed += new System.Timers.ElapsedEventHandler(updateTimer_Elapsed);
48
49 RegisterAllCommands(Assembly.GetExecutingAssembly());
50
51 Settings.DEBUG = true;
52 Settings.STORE_LAND_PATCHES = true;
53 Settings.ALWAYS_REQUEST_OBJECTS = true;
54
55 Network.RegisterCallback(PacketType.AgentDataUpdate, new NetworkManager.PacketCallback(AgentDataUpdateHandler));
56
57 Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim);
58 Objects.OnObjectUpdated += new ObjectManager.ObjectUpdatedCallback(Objects_OnObjectUpdated);
59 Objects.OnObjectKilled += new ObjectManager.KillObjectCallback(Objects_OnObjectKilled);
60 Objects.OnNewAvatar += new ObjectManager.NewAvatarCallback(Objects_OnNewAvatar);
61 Self.OnInstantMessage += new MainAvatar.InstantMessageCallback(Self_OnInstantMessage);
62 Groups.OnGroupMembers += new GroupManager.GroupMembersCallback(GroupMembersHandler);
63 this.OnLogMessage += new LogCallback(TestClient_OnLogMessage);
64
65 Network.RegisterCallback(PacketType.AvatarAppearance, new NetworkManager.PacketCallback(AvatarAppearanceHandler));
66
67 updateTimer.Start();
68 }
69
70 public void RegisterAllCommands(Assembly assembly)
71 {
72 foreach (Type t in assembly.GetTypes())
73 {
74 try
75 {
76 if (t.IsSubclassOf(typeof(Command)))
77 {
78 ConstructorInfo info = t.GetConstructor(new Type[] { typeof(TestClient) });
79 Command command = (Command)info.Invoke(new object[] { this });
80 RegisterCommand(command);
81 }
82 }
83 catch (Exception e)
84 {
85 Console.WriteLine(e.ToString());
86 }
87 }
88 }
89
90 public void RegisterCommand(Command command)
91 {
92 command.Client = this;
93 if (!Commands.ContainsKey(command.Name.ToLower()))
94 {
95 Commands.Add(command.Name.ToLower(), command);
96 }
97 }
98
99 //breaks up large responses to deal with the max IM size
100 private void SendResponseIM(SecondLife client, LLUUID fromAgentID, string data, LLUUID imSessionID)
101 {
102 for ( int i = 0 ; i < data.Length ; i += 1024 ) {
103 int y;
104 if ((i + 1023) > data.Length)
105 {
106 y = data.Length - i;
107 }
108 else
109 {
110 y = 1023;
111 }
112 string message = data.Substring(i, y);
113 client.Self.InstantMessage(fromAgentID, message, imSessionID);
114 }
115 }
116
117 public void DoCommand(string cmd, LLUUID fromAgentID, LLUUID imSessionID)
118 {
119 string[] tokens = Parsing.ParseArguments(cmd);
120
121 if (tokens.Length == 0)
122 return;
123
124 string firstToken = tokens[0].ToLower();
125
126 // "all balance" will send the balance command to all currently logged in bots
127 if (firstToken == "all" && tokens.Length > 1)
128 {
129 cmd = String.Empty;
130
131 // Reserialize all of the arguments except for "all"
132 for (int i = 1; i < tokens.Length; i++)
133 {
134 cmd += tokens[i] + " ";
135 }
136
137 ClientManager.DoCommandAll(cmd, fromAgentID, imSessionID);
138
139 return;
140 }
141
142 if (Commands.ContainsKey(firstToken))
143 {
144 string[] args = new string[tokens.Length - 1];
145 Array.Copy(tokens, 1, args, 0, args.Length);
146 string response = response = Commands[firstToken].Execute(args, fromAgentID);
147
148 if (response.Length > 0)
149 {
150 Console.WriteLine(response);
151
152 if (fromAgentID != null && Network.Connected)
153 {
154 // IMs don't like \r\n line endings, clean them up first
155 response = response.Replace("\r", "");
156 SendResponseIM(this, fromAgentID, response, imSessionID);
157 }
158 }
159 }
160 }
161
162 private void updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
163 {
164 foreach (Command c in Commands.Values)
165 if (c.Active)
166 c.Think();
167 }
168
169 private void AgentDataUpdateHandler(Packet packet, Simulator sim)
170 {
171 AgentDataUpdatePacket p = (AgentDataUpdatePacket)packet;
172 if (p.AgentData.AgentID == sim.Client.Network.AgentID)
173 {
174 Console.WriteLine("Got the group ID for " + sim.Client.ToString() + ", requesting group members...");
175 GroupID = p.AgentData.ActiveGroupID;
176
177 sim.Client.Groups.BeginGetGroupMembers(GroupID);
178 }
179 }
180
181 private void TestClient_OnLogMessage(string message, Helpers.LogLevel level)
182 {
183 Console.WriteLine("<" + this.ToString() + "> " + level.ToString() + ": " + message);
184 }
185
186 private void GroupMembersHandler(Dictionary<LLUUID, GroupMember> members)
187 {
188 Console.WriteLine("Got " + members.Count + " group members.");
189 GroupMembers = members;
190 }
191
192 private void Objects_OnObjectKilled(Simulator simulator, uint objectID)
193 {
194 lock (SimPrims)
195 {
196 if (SimPrims.ContainsKey(simulator) && SimPrims[simulator].ContainsKey(objectID))
197 SimPrims[simulator].Remove(objectID);
198 }
199
200 lock (AvatarList)
201 {
202 if (AvatarList.ContainsKey(objectID))
203 AvatarList.Remove(objectID);
204 }
205 }
206
207 private void Objects_OnObjectUpdated(Simulator simulator, ObjectUpdate update, ulong regionHandle, ushort timeDilation)
208 {
209 regionX = (int)(regionHandle >> 32);
210 regionY = (int)(regionHandle & 0xFFFFFFFF);
211
212 if (update.Avatar)
213 {
214 lock (AvatarList)
215 {
216 // TODO: We really need a solid avatar and object tracker in Utilities to use here
217 if (AvatarList.ContainsKey(update.LocalID))
218 {
219 AvatarList[update.LocalID].CollisionPlane = update.CollisionPlane;
220 AvatarList[update.LocalID].Position = update.Position;
221 AvatarList[update.LocalID].Velocity = update.Velocity;
222 AvatarList[update.LocalID].Acceleration = update.Acceleration;
223 AvatarList[update.LocalID].Rotation = update.Rotation;
224 AvatarList[update.LocalID].AngularVelocity = update.AngularVelocity;
225 AvatarList[update.LocalID].Textures = update.Textures;
226 }
227 }
228 }
229 else
230 {
231 lock (SimPrims)
232 {
233 if (SimPrims.ContainsKey(simulator) && SimPrims[simulator].ContainsKey(update.LocalID))
234 {
235 SimPrims[simulator][update.LocalID].Position = update.Position;
236 SimPrims[simulator][update.LocalID].Velocity = update.Velocity;
237 SimPrims[simulator][update.LocalID].Acceleration = update.Acceleration;
238 SimPrims[simulator][update.LocalID].Rotation = update.Rotation;
239 SimPrims[simulator][update.LocalID].AngularVelocity = update.AngularVelocity;
240 SimPrims[simulator][update.LocalID].Textures = update.Textures;
241 }
242 }
243 }
244 }
245
246 private void Objects_OnNewPrim(Simulator simulator, Primitive prim, ulong regionHandle, ushort timeDilation)
247 {
248 lock (SimPrims)
249 {
250 if (!SimPrims.ContainsKey(simulator))
251 {
252 SimPrims[simulator] = new Dictionary<uint, Primitive>(10000);
253 }
254
255 SimPrims[simulator][prim.LocalID] = prim;
256 }
257
258 if ((prim.Flags & LLObject.ObjectFlags.CreateSelected) != 0 && OnPrimCreated != null)
259 {
260 OnPrimCreated(simulator, prim);
261 }
262 }
263
264 private void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation)
265 {
266 lock (AvatarList)
267 {
268 AvatarList[avatar.LocalID] = avatar;
269 }
270 }
271
272 private void AvatarAppearanceHandler(Packet packet, Simulator simulator)
273 {
274 AvatarAppearancePacket appearance = (AvatarAppearancePacket)packet;
275
276 lock (Appearances) Appearances[appearance.Sender.ID] = appearance;
277 }
278
279 private void Self_OnInstantMessage(LLUUID fromAgentID, string fromAgentName, LLUUID toAgentID,
280 uint parentEstateID, LLUUID regionID, LLVector3 position, MainAvatar.InstantMessageDialog dialog,
281 bool groupIM, LLUUID imSessionID, DateTime timestamp, string message,
282 MainAvatar.InstantMessageOnline offline, byte[] binaryBucket)
283 {
284 if (MasterKey != LLUUID.Zero)
285 {
286 if (fromAgentID != MasterKey)
287 {
288 // Received an IM from someone that is not the bot's master, ignore
289 Console.WriteLine("<IM>" + fromAgentName + " (not master): " + message + "@" + regionID.ToString() + ":" + position.ToString() );
290 return;
291 }
292 }
293 else
294 {
295 if (GroupMembers != null && !GroupMembers.ContainsKey(fromAgentID))
296 {
297 // Received an IM from someone outside the bot's group, ignore
298 Console.WriteLine("<IM>" + fromAgentName + " (not in group): " + message + "@" + regionID.ToString() + ":" + position.ToString());
299 return;
300 }
301 }
302
303 Console.WriteLine("<IM>" + fromAgentName + ": " + message);
304
305 if (dialog == MainAvatar.InstantMessageDialog.RequestTeleport)
306 {
307 Console.WriteLine("Accepting teleport lure.");
308 Self.TeleportLureRespond(fromAgentID, true);
309 }
310 else
311 {
312 if (dialog == MainAvatar.InstantMessageDialog.InventoryOffered)
313 {
314 Console.WriteLine("Accepting inventory offer.");
315
316 Self.InstantMessage(Self.FirstName + " " + Self.LastName, fromAgentID, String.Empty,
317 imSessionID, MainAvatar.InstantMessageDialog.InventoryAccepted,
318 MainAvatar.InstantMessageOnline.Offline, Self.Position, LLUUID.Zero,
319 Self.InventoryRootFolderUUID.GetBytes());
320 }
321 else
322 {
323 DoCommand(message, fromAgentID, imSessionID);
324 }
325 }
326 }
327 }
328}
diff --git a/ExportBot/TestClient.csproj b/ExportBot/TestClient.csproj
deleted file mode 100644
index 16d4afe..0000000
--- a/ExportBot/TestClient.csproj
+++ /dev/null
@@ -1,120 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{B87682F6-B2D7-4C4D-A529-400C24FD4880}</ProjectGuid>
8 <OutputType>Exe</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>libsecondlife.TestClient</RootNamespace>
11 <AssemblyName>TestClient</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>..\..\..\bin\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>..\..\bin\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Speech, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
34 <Reference Include="System.Xml" />
35 </ItemGroup>
36 <ItemGroup>
37 <Compile Include="Arguments.cs" />
38 <Compile Include="Command.cs" />
39 <Compile Include="Commands\AppearanceCommand.cs" />
40 <Compile Include="Commands\CloneProfileCommand.cs" />
41 <Compile Include="Commands\DebugCommand.cs" />
42 <Compile Include="Commands\DumpOutfitCommand.cs" />
43 <Compile Include="Commands\ExportParticlesCommand.cs" />
44 <Compile Include="Commands\Inventory\BalanceCommand.cs" />
45 <Compile Include="Commands\Inventory\DeleteFolderCommand.cs" />
46 <Compile Include="Commands\Inventory\GiveAllCommand.cs" />
47 <Compile Include="Commands\Inventory\WearCommand.cs" />
48 <Compile Include="Commands\Inventory\InventoryCommand.cs" />
49 <Compile Include="Commands\ExportOutfitCommand.cs" />
50 <Compile Include="Commands\FindSimCommand.cs" />
51 <Compile Include="Commands\ImportOutfitCommand.cs" />
52 <Compile Include="Commands\LoginCommand.cs">
53 <SubType>Code</SubType>
54 </Compile>
55 <Compile Include="Commands\LogoutCommand.cs">
56 <SubType>Code</SubType>
57 </Compile>
58 <Compile Include="Commands\Communication\EchoMasterCommand.cs" />
59 <Compile Include="Commands\Communication\IMCommand.cs" />
60 <Compile Include="Commands\Communication\SayCommand.cs" />
61 <Compile Include="Commands\Communication\ShoutCommand.cs" />
62 <Compile Include="Commands\Communication\WhisperCommand.cs" />
63 <Compile Include="Commands\MD5Command.cs" />
64 <Compile Include="Commands\Movement\FollowCommand.cs" />
65 <Compile Include="Commands\Movement\GotoCommand.cs" />
66 <Compile Include="Commands\Movement\JumpCommand.cs" />
67 <Compile Include="Commands\Movement\LocationCommand.cs" />
68 <Compile Include="Commands\Movement\SitCommand.cs" />
69 <Compile Include="Commands\PacketLogCommand.cs" />
70 <Compile Include="Commands\ParcelInfoCommand.cs" />
71 <Compile Include="Commands\QuitCommand.cs">
72 <SubType>Code</SubType>
73 </Compile>
74 <Compile Include="Commands\RegionInfoCommand.cs" />
75 <Compile Include="Commands\SetMasterCommand.cs">
76 <SubType>Code</SubType>
77 </Compile>
78 <Compile Include="Commands\ExportCommand.cs" />
79 <Compile Include="Commands\ImportCommand.cs" />
80 <Compile Include="Commands\LoadCommand.cs" />
81 <Compile Include="Commands\PrimCountCommand.cs" />
82 <Compile Include="Commands\SetMasterKeyCommand.cs" />
83 <Compile Include="Commands\ShowEffectsCommand.cs" />
84 <Compile Include="Commands\StatsCommand.cs" />
85 <Compile Include="Commands\TouchCommand.cs" />
86 <Compile Include="Commands\TreeCommand.cs" />
87 <Compile Include="Commands\UptimeCommand.cs" />
88 <Compile Include="Commands\HelpCommand.cs" />
89 <Compile Include="ClientManager.cs" />
90 <Compile Include="Commands\WhoCommand.cs">
91 <SubType>Code</SubType>
92 </Compile>
93 <Compile Include="Parsing.cs" />
94 <Compile Include="Program.cs" />
95 <Compile Include="TestClient.cs" />
96 <Compile Include="Properties\AssemblyInfo.cs" />
97 </ItemGroup>
98 <ItemGroup>
99 <ProjectReference Include="..\..\..\openjpegnet\openjpegnet.csproj">
100 <Project>{D0DCFDCB-71FA-4343-A8D1-24D4665A94A4}</Project>
101 <Name>openjpegnet</Name>
102 </ProjectReference>
103 <ProjectReference Include="..\..\libsecondlife.csproj">
104 <Project>{D9CDEDFB-8169-4B03-B57F-0DF638F044EC}</Project>
105 <Name>libsecondlife</Name>
106 </ProjectReference>
107 <ProjectReference Include="..\..\libsecondlife.Utilities\libsecondlife.Utilities.csproj">
108 <Project>{CE5E06C2-2428-416B-ADC1-F1FE16A0FB27}</Project>
109 <Name>libsecondlife.Utilities</Name>
110 </ProjectReference>
111 </ItemGroup>
112 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
113 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
114 Other similar extension points exist, see Microsoft.Common.targets.
115 <Target Name="BeforeBuild">
116 </Target>
117 <Target Name="AfterBuild">
118 </Target>
119 -->
120</Project> \ No newline at end of file