aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot
diff options
context:
space:
mode:
authorJeff Ames2009-05-20 01:32:06 +0000
committerJeff Ames2009-05-20 01:32:06 +0000
commite0bc5c5db2b88691c04b06be2fa73a75746126cb (patch)
treefa33ed724c57578d7ed76044f68940a4e09a8026 /OpenSim/Tools/pCampBot
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-e0bc5c5db2b88691c04b06be2fa73a75746126cb.zip
opensim-SC_OLD-e0bc5c5db2b88691c04b06be2fa73a75746126cb.tar.gz
opensim-SC_OLD-e0bc5c5db2b88691c04b06be2fa73a75746126cb.tar.bz2
opensim-SC_OLD-e0bc5c5db2b88691c04b06be2fa73a75746126cb.tar.xz
Add copyright headers, formatting cleanup.
Diffstat (limited to 'OpenSim/Tools/pCampBot')
-rw-r--r--OpenSim/Tools/pCampBot/PhysicsBot.cs72
1 files changed, 36 insertions, 36 deletions
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs
index 8548aed..b84993e 100644
--- a/OpenSim/Tools/pCampBot/PhysicsBot.cs
+++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs
@@ -191,9 +191,9 @@ namespace pCampBot
191 public void SaveDefaultAppearance() 191 public void SaveDefaultAppearance()
192 { 192 {
193 saveDir = "MyAppearance/" + firstname + "_" + lastname; 193 saveDir = "MyAppearance/" + firstname + "_" + lastname;
194 if (!Directory.Exists(saveDir)) 194 if (!Directory.Exists(saveDir))
195 { 195 {
196 Directory.CreateDirectory(saveDir); 196 Directory.CreateDirectory(saveDir);
197 } 197 }
198 198
199 Array wtypes = Enum.GetValues(typeof(WearableType)); 199 Array wtypes = Enum.GetValues(typeof(WearableType));
@@ -212,7 +212,7 @@ namespace pCampBot
212 { 212 {
213 if (asset != null) 213 if (asset != null)
214 { 214 {
215 try 215 try
216 { 216 {
217 if (asset.Decode()) 217 if (asset.Decode())
218 { 218 {
@@ -220,14 +220,14 @@ namespace pCampBot
220 asset.AssetType.ToString().ToLower(), 220 asset.AssetType.ToString().ToLower(),
221 asset.WearableType)), asset.AssetData); 221 asset.WearableType)), asset.AssetData);
222 } 222 }
223 else 223 else
224 { 224 {
225 MainConsole.Instance.Error(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID)); 225 MainConsole.Instance.Error(String.Format("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID));
226 } 226 }
227 } 227 }
228 catch (Exception e) 228 catch (Exception e)
229 { 229 {
230 MainConsole.Instance.Error(String.Format("Exception: {0}",e.ToString())); 230 MainConsole.Instance.Error(String.Format("Exception: {0}",e.ToString()));
231 } 231 }
232 } 232 }
233 } 233 }
@@ -235,7 +235,7 @@ namespace pCampBot
235 public WearableType GetWearableType(string path) 235 public WearableType GetWearableType(string path)
236 { 236 {
237 string type = ((((path.Split('/'))[2]).Split('.'))[0]).Trim(); 237 string type = ((((path.Split('/'))[2]).Split('.'))[0]).Trim();
238 switch(type) 238 switch (type)
239 { 239 {
240 case "Eyes": 240 case "Eyes":
241 return WearableType.Eyes; 241 return WearableType.Eyes;
@@ -256,7 +256,7 @@ namespace pCampBot
256 256
257 public void MakeDefaultAppearance(string wear) 257 public void MakeDefaultAppearance(string wear)
258 { 258 {
259 try 259 try
260 { 260 {
261 if (wear == "yes") 261 if (wear == "yes")
262 { 262 {
@@ -267,54 +267,54 @@ namespace pCampBot
267 saveDir = "MyAppearance/" + wear; 267 saveDir = "MyAppearance/" + wear;
268 saveDir = saveDir + "/"; 268 saveDir = saveDir + "/";
269 269
270 string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly); 270 string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly);
271 string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly); 271 string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly);
272 InventoryFolder clothfolder = FindClothingFolder(); 272 InventoryFolder clothfolder = FindClothingFolder();
273 UUID transid = UUID.Random(); 273 UUID transid = UUID.Random();
274 List<InventoryBase> listwearables = new List<InventoryBase>(); 274 List<InventoryBase> listwearables = new List<InventoryBase>();
275 275
276 for (int i = 0; i < clothing.Length; i++) 276 for (int i = 0; i < clothing.Length; i++)
277 { 277 {
278 UUID assetID = UUID.Random(); 278 UUID assetID = UUID.Random();
279 AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i])); 279 AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i]));
280 asset.Decode(); 280 asset.Decode();
281 asset.Owner = client.Self.AgentID; 281 asset.Owner = client.Self.AgentID;
282 asset.WearableType = GetWearableType(clothing[i]); 282 asset.WearableType = GetWearableType(clothing[i]);
283 asset.Encode(); 283 asset.Encode();
284 transid = client.Assets.RequestUpload(asset,true); 284 transid = client.Assets.RequestUpload(asset,true);
285 client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing, 285 client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing,
286 transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item) 286 transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
287 { 287 {
288 if (success) 288 if (success)
289 { 289 {
290 listwearables.Add(item); 290 listwearables.Add(item);
291 } 291 }
292 else 292 else
293 MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name)); 293 MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
294 } 294 }
295 ); 295 );
296 } 296 }
297 297
298 for (int i = 0; i < bodyparts.Length; i++) 298 for (int i = 0; i < bodyparts.Length; i++)
299 { 299 {
300 UUID assetID = UUID.Random(); 300 UUID assetID = UUID.Random();
301 AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i])); 301 AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i]));
302 asset.Decode(); 302 asset.Decode();
303 asset.Owner = client.Self.AgentID; 303 asset.Owner = client.Self.AgentID;
304 asset.WearableType = GetWearableType(bodyparts[i]); 304 asset.WearableType = GetWearableType(bodyparts[i]);
305 asset.Encode(); 305 asset.Encode();
306 transid = client.Assets.RequestUpload(asset,true); 306 transid = client.Assets.RequestUpload(asset,true);
307 client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart, 307 client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart,
308 transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item) 308 transid, InventoryType.Wearable, asset.WearableType, PermissionMask.All, delegate(bool success, InventoryItem item)
309 { 309 {
310 if (success) 310 if (success)
311 { 311 {
312 listwearables.Add(item); 312 listwearables.Add(item);
313 } 313 }
314 else 314 else
315 MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name)); 315 MainConsole.Instance.Error(String.Format("Failed to create item {0}",item.Name));
316 } 316 }
317 ); 317 );
318 } 318 }
319 319
320 Thread.Sleep(1000); 320 Thread.Sleep(1000);
@@ -326,10 +326,10 @@ namespace pCampBot
326 MainConsole.Instance.Notice(String.Format("Sending {0} wearables...",listwearables.Count)); 326 MainConsole.Instance.Notice(String.Format("Sending {0} wearables...",listwearables.Count));
327 client.Appearance.WearOutfit(listwearables, false); 327 client.Appearance.WearOutfit(listwearables, false);
328 } 328 }
329 } 329 }
330 catch (Exception ex) 330 catch (Exception ex)
331 { 331 {
332 Console.WriteLine(ex.ToString()); 332 Console.WriteLine(ex.ToString());
333 } 333 }
334 } 334 }
335 335