OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Bot.cs
Go to the documentation of this file.
1 /*
2  * Copyright (c) Contributors, http://opensimulator.org/
3  * See CONTRIBUTORS.TXT for a full list of copyright holders.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of the OpenSimulator Project nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 using System;
29 using System.Collections.Generic;
30 using System.Text;
31 using System.IO;
32 using System.Reflection;
33 using System.Threading;
34 using System.Timers;
35 using log4net;
36 using OpenMetaverse;
37 using OpenMetaverse.Assets;
38 using OpenMetaverse.Packets;
39 using Nini.Config;
40 using OpenSim.Framework;
41 using OpenSim.Framework.Console;
42 using pCampBot.Interfaces;
45 
46 namespace pCampBot
47 {
48  public enum ConnectionState
49  {
51  Connecting,
52  Connected,
54  }
55 
56  public class Bot
57  {
58  private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 
60  public int PacketDebugLevel
61  {
62  get { return m_packetDebugLevel; }
63  set
64  {
65  if (value == m_packetDebugLevel)
66  return;
67 
68  m_packetDebugLevel = value;
69 
70  if (Client != null)
71  {
72  if (m_packetDebugLevel <= 0)
73  Client.Network.UnregisterCallback(PacketType.Default, PacketReceivedDebugHandler);
74  else
75  Client.Network.RegisterCallback(PacketType.Default, PacketReceivedDebugHandler, false);
76  }
77  }
78  }
79  private int m_packetDebugLevel;
80 
81  public delegate void AnEvent(Bot callbot, EventType someevent); // event delegate for bot events
82 
86  public bool RequestObjectTextures { get; set; }
87 
91  public BotManager Manager { get; private set; }
92 
100  public Dictionary<string, IBehaviour> Behaviours { get; private set; }
101 
108  public Dictionary<UUID, Primitive> Objects
109  {
110  get
111  {
112  lock (m_objects)
113  return new Dictionary<UUID, Primitive>(m_objects);
114  }
115  }
116  private Dictionary<UUID, Primitive> m_objects = new Dictionary<UUID, Primitive>();
117 
121  public ConnectionState ConnectionState { get; private set; }
122 
123  public List<Simulator> Simulators
124  {
125  get
126  {
127  lock (Client.Network.Simulators)
128  return new List<Simulator>(Client.Network.Simulators);
129  }
130  }
131 
136  public int SimulatorsCount
137  {
138  get
139  {
140  lock (Client.Network.Simulators)
141  return Client.Network.Simulators.Count;
142  }
143  }
144 
145  public string FirstName { get; private set; }
146  public string LastName { get; private set; }
147  public string Name { get; private set; }
148  public string Password { get; private set; }
149  public string LoginUri { get; private set; }
150  public string StartLocation { get; private set; }
151 
152  public string saveDir;
153  public string wear;
154 
155  public event AnEvent OnConnected;
156  public event AnEvent OnDisconnected;
157 
161  private Thread m_actionThread;
162 
163  protected List<uint> objectIDs = new List<uint>();
164 
168  public Random Random { get; private set; }
169 
173  public GridClient Client { get; private set; }
174 
185  public Bot(
186  BotManager bm, List<IBehaviour> behaviours,
187  string firstName, string lastName, string password, string startLocation, string loginUri)
188  {
189  ConnectionState = ConnectionState.Disconnected;
190 
191  Random = new Random(bm.Rng.Next());
192  FirstName = firstName;
193  LastName = lastName;
194  Name = string.Format("{0} {1}", FirstName, LastName);
195  Password = password;
196  LoginUri = loginUri;
197  StartLocation = startLocation;
198 
199  Manager = bm;
200 
201  Behaviours = new Dictionary<string, IBehaviour>();
202  foreach (IBehaviour behaviour in behaviours)
203  AddBehaviour(behaviour);
204 
205  // Only calling for use as a template.
206  CreateLibOmvClient();
207  }
208 
209  public bool TryGetBehaviour(string abbreviatedName, out IBehaviour behaviour)
210  {
211  lock (Behaviours)
212  return Behaviours.TryGetValue(abbreviatedName, out behaviour);
213  }
214 
215  public bool AddBehaviour(IBehaviour behaviour)
216  {
217  Dictionary<string, IBehaviour> updatedBehaviours = new Dictionary<string, IBehaviour>(Behaviours);
218 
219  if (!updatedBehaviours.ContainsKey(behaviour.AbbreviatedName))
220  {
221  behaviour.Initialize(this);
222  updatedBehaviours.Add(behaviour.AbbreviatedName, behaviour);
223  Behaviours = updatedBehaviours;
224 
225  return true;
226  }
227 
228  return false;
229  }
230 
231  public bool RemoveBehaviour(string abbreviatedName)
232  {
233  if (Behaviours.Count <= 0)
234  return false;
235 
236  Dictionary<string, IBehaviour> updatedBehaviours = new Dictionary<string, IBehaviour>(Behaviours);
237  IBehaviour behaviour;
238 
239  if (!updatedBehaviours.TryGetValue(abbreviatedName, out behaviour))
240  return false;
241 
242  updatedBehaviours.Remove(abbreviatedName);
243  Behaviours = updatedBehaviours;
244 
245  behaviour.Close();
246 
247  return true;
248  }
249 
250  private void CreateLibOmvClient()
251  {
252  GridClient newClient = new GridClient();
253 
254  if (Client != null)
255  {
256  // Remove any registered debug handlers
257  Client.Network.UnregisterCallback(PacketType.Default, PacketReceivedDebugHandler);
258 
259  newClient.Settings.LOGIN_SERVER = Client.Settings.LOGIN_SERVER;
260  newClient.Settings.ALWAYS_DECODE_OBJECTS = Client.Settings.ALWAYS_DECODE_OBJECTS;
261  newClient.Settings.AVATAR_TRACKING = Client.Settings.AVATAR_TRACKING;
262  newClient.Settings.OBJECT_TRACKING = Client.Settings.OBJECT_TRACKING;
263  newClient.Settings.SEND_AGENT_THROTTLE = Client.Settings.SEND_AGENT_THROTTLE;
264  newClient.Settings.SEND_AGENT_UPDATES = Client.Settings.SEND_AGENT_UPDATES;
265  newClient.Settings.SEND_PINGS = Client.Settings.SEND_PINGS;
266  newClient.Settings.STORE_LAND_PATCHES = Client.Settings.STORE_LAND_PATCHES;
267  newClient.Settings.USE_ASSET_CACHE = Client.Settings.USE_ASSET_CACHE;
268  newClient.Settings.MULTIPLE_SIMS = Client.Settings.MULTIPLE_SIMS;
269  newClient.Throttle.Asset = Client.Throttle.Asset;
270  newClient.Throttle.Land = Client.Throttle.Land;
271  newClient.Throttle.Task = Client.Throttle.Task;
272  newClient.Throttle.Texture = Client.Throttle.Texture;
273  newClient.Throttle.Wind = Client.Throttle.Wind;
274  newClient.Throttle.Total = Client.Throttle.Total;
275  }
276  else
277  {
278  newClient.Settings.LOGIN_SERVER = LoginUri;
279  newClient.Settings.ALWAYS_DECODE_OBJECTS = false;
280  newClient.Settings.AVATAR_TRACKING = false;
281  newClient.Settings.OBJECT_TRACKING = false;
282  newClient.Settings.SEND_AGENT_THROTTLE = true;
283  newClient.Settings.SEND_PINGS = true;
284  newClient.Settings.STORE_LAND_PATCHES = false;
285  newClient.Settings.USE_ASSET_CACHE = false;
286  newClient.Settings.MULTIPLE_SIMS = true;
287  newClient.Throttle.Asset = 100000;
288  newClient.Throttle.Land = 100000;
289  newClient.Throttle.Task = 100000;
290  newClient.Throttle.Texture = 100000;
291  newClient.Throttle.Wind = 100000;
292  newClient.Throttle.Total = 400000;
293  }
294 
295  newClient.Network.LoginProgress += Network_LoginProgress;
296  newClient.Network.SimConnected += Network_SimConnected;
297  newClient.Network.SimDisconnected += Network_SimDisconnected;
298  newClient.Network.Disconnected += Network_OnDisconnected;
299  newClient.Objects.ObjectUpdate += Objects_NewPrim;
300 
301  if (m_packetDebugLevel > 0)
302  newClient.Network.RegisterCallback(PacketType.Default, PacketReceivedDebugHandler);
303 
304  Client = newClient;
305  }
306 
307  //We do our actions here. This is where one would
308  //add additional steps and/or things the bot should do
309  private void Action()
310  {
311  while (ConnectionState == ConnectionState.Connected)
312  {
313  foreach (IBehaviour behaviour in Behaviours.Values)
314  {
315 // Thread.Sleep(Random.Next(3000, 10000));
316 
317  // m_log.DebugFormat("[pCAMPBOT]: For {0} performing action {1}", Name, b.GetType());
318  behaviour.Action();
319  }
320  }
321 
322  foreach (IBehaviour b in Behaviours.Values)
323  b.Close();
324  }
325 
329  public void Disconnect()
330  {
331  ConnectionState = ConnectionState.Disconnecting;
332 
333  foreach (IBehaviour behaviour in Behaviours.Values)
334  behaviour.Close();
335 
336  Client.Network.Logout();
337  }
338 
339  public void Connect()
340  {
341  Thread connectThread = new Thread(ConnectInternal);
342  connectThread.Name = Name;
343  connectThread.IsBackground = true;
344 
345  connectThread.Start();
346  }
347 
351  private void ConnectInternal()
352  {
353  ConnectionState = ConnectionState.Connecting;
354 
355  // Current create a new client on each connect. libomv doesn't seem to process new sim
356  // information (e.g. EstablishAgentCommunication events) if connecting after a disceonnect with the same
357  // client
358  CreateLibOmvClient();
359 
360  if (Client.Network.Login(FirstName, LastName, Password, "pCampBot", StartLocation, "pCampBot"))
361  {
362  ConnectionState = ConnectionState.Connected;
363 
364  Thread.Sleep(Random.Next(1000, 10000));
365  m_actionThread = new Thread(Action);
366  m_actionThread.Start();
367 
368 // OnConnected(this, EventType.CONNECTED);
369  if (wear == "save")
370  {
372  }
373  else if (wear != "no")
374  {
376  }
377 
378  // Extract nearby region information.
379  Client.Grid.GridRegion += Manager.Grid_GridRegion;
380  uint xUint, yUint;
381  Utils.LongToUInts(Client.Network.CurrentSim.Handle, out xUint, out yUint);
382  ushort minX, minY, maxX, maxY;
383  minX = (ushort)Math.Min(0, xUint - 5);
384  minY = (ushort)Math.Min(0, yUint - 5);
385  maxX = (ushort)(xUint + 5);
386  maxY = (ushort)(yUint + 5);
387  Client.Grid.RequestMapBlocks(GridLayerType.Terrain, minX, minY, maxX, maxY, false);
388  }
389  else
390  {
391  ConnectionState = ConnectionState.Disconnected;
392 
393  m_log.ErrorFormat(
394  "{0} {1} cannot login: {2}", FirstName, LastName, Client.Network.LoginMessage);
395 
396  if (OnDisconnected != null)
397  {
398  OnDisconnected(this, EventType.DISCONNECTED);
399  }
400  }
401  }
402 
406  public void SitOnGround()
407  {
408  if (ConnectionState == ConnectionState.Connected)
409  Client.Self.SitOnGround();
410  }
411 
415  public void Stand()
416  {
417  if (ConnectionState == ConnectionState.Connected)
418  {
419  // Unlike sit on ground, here libomv checks whether we have SEND_AGENT_UPDATES enabled.
420  bool prevUpdatesSetting = Client.Settings.SEND_AGENT_UPDATES;
421  Client.Settings.SEND_AGENT_UPDATES = true;
422  Client.Self.Stand();
423  Client.Settings.SEND_AGENT_UPDATES = prevUpdatesSetting;
424  }
425  }
426 
427  public void SaveDefaultAppearance()
428  {
429  saveDir = "MyAppearance/" + FirstName + "_" + LastName;
430  if (!Directory.Exists(saveDir))
431  {
432  Directory.CreateDirectory(saveDir);
433  }
434 
435  Array wtypes = Enum.GetValues(typeof(WearableType));
436  foreach (WearableType wtype in wtypes)
437  {
438  UUID wearable = Client.Appearance.GetWearableAsset(wtype);
439  if (wearable != UUID.Zero)
440  {
441  Client.Assets.RequestAsset(wearable, AssetType.Clothing, false, Asset_ReceivedCallback);
442  Client.Assets.RequestAsset(wearable, AssetType.Bodypart, false, Asset_ReceivedCallback);
443  }
444  }
445  }
446 
447  public void SaveAsset(AssetWearable asset)
448  {
449  if (asset != null)
450  {
451  try
452  {
453  if (asset.Decode())
454  {
455  File.WriteAllBytes(Path.Combine(saveDir, String.Format("{1}.{0}",
456  asset.AssetType.ToString().ToLower(),
457  asset.WearableType)), asset.AssetData);
458  }
459  else
460  {
461  m_log.WarnFormat("Failed to decode {0} asset {1}", asset.AssetType, asset.AssetID);
462  }
463  }
464  catch (Exception e)
465  {
466  m_log.ErrorFormat("Exception: {0}{1}", e.Message, e.StackTrace);
467  }
468  }
469  }
470 
471  public WearableType GetWearableType(string path)
472  {
473  string type = ((((path.Split('/'))[2]).Split('.'))[0]).Trim();
474  switch (type)
475  {
476  case "Eyes":
477  return WearableType.Eyes;
478  case "Hair":
479  return WearableType.Hair;
480  case "Pants":
481  return WearableType.Pants;
482  case "Shape":
483  return WearableType.Shape;
484  case "Shirt":
485  return WearableType.Shirt;
486  case "Skin":
487  return WearableType.Skin;
488  default:
489  return WearableType.Shape;
490  }
491  }
492 
493  public void MakeDefaultAppearance(string wear)
494  {
495  try
496  {
497  if (wear == "yes")
498  {
499  //TODO: Implement random outfit picking
500  m_log.DebugFormat("Picks a random outfit. Not yet implemented.");
501  }
502  else if (wear != "save")
503  saveDir = "MyAppearance/" + wear;
504  saveDir = saveDir + "/";
505 
506  string[] clothing = Directory.GetFiles(saveDir, "*.clothing", SearchOption.TopDirectoryOnly);
507  string[] bodyparts = Directory.GetFiles(saveDir, "*.bodypart", SearchOption.TopDirectoryOnly);
508  InventoryFolder clothfolder = FindClothingFolder();
509  UUID transid = UUID.Random();
510  List<InventoryBase> listwearables = new List<InventoryBase>();
511 
512  for (int i = 0; i < clothing.Length; i++)
513  {
514  UUID assetID = UUID.Random();
515  AssetClothing asset = new AssetClothing(assetID, File.ReadAllBytes(clothing[i]));
516  asset.Decode();
517  asset.Owner = Client.Self.AgentID;
518  asset.WearableType = GetWearableType(clothing[i]);
519  asset.Encode();
520  transid = Client.Assets.RequestUpload(asset,true);
521  Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyClothing" + i.ToString(), "MyClothing", AssetType.Clothing,
522  transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item)
523  {
524  if (success)
525  {
526  listwearables.Add(item);
527  }
528  else
529  {
530  m_log.WarnFormat("Failed to create item {0}", item.Name);
531  }
532  }
533  );
534  }
535 
536  for (int i = 0; i < bodyparts.Length; i++)
537  {
538  UUID assetID = UUID.Random();
539  AssetBodypart asset = new AssetBodypart(assetID, File.ReadAllBytes(bodyparts[i]));
540  asset.Decode();
541  asset.Owner = Client.Self.AgentID;
542  asset.WearableType = GetWearableType(bodyparts[i]);
543  asset.Encode();
544  transid = Client.Assets.RequestUpload(asset,true);
545  Client.Inventory.RequestCreateItem(clothfolder.UUID, "MyBodyPart" + i.ToString(), "MyBodyPart", AssetType.Bodypart,
546  transid, InventoryType.Wearable, asset.WearableType, (OpenMetaverse.PermissionMask)PermissionMask.All, delegate(bool success, InventoryItem item)
547  {
548  if (success)
549  {
550  listwearables.Add(item);
551  }
552  else
553  {
554  m_log.WarnFormat("Failed to create item {0}", item.Name);
555  }
556  }
557  );
558  }
559 
560  Thread.Sleep(1000);
561 
562  if (listwearables == null || listwearables.Count == 0)
563  {
564  m_log.DebugFormat("Nothing to send on this folder!");
565  }
566  else
567  {
568  m_log.DebugFormat("Sending {0} wearables...", listwearables.Count);
569  Client.Appearance.WearOutfit(listwearables, false);
570  }
571  }
572  catch (Exception ex)
573  {
574  Console.WriteLine(ex.ToString());
575  }
576  }
577 
578  public InventoryFolder FindClothingFolder()
579  {
580  UUID rootfolder = Client.Inventory.Store.RootFolder.UUID;
581  List<InventoryBase> listfolders = Client.Inventory.Store.GetContents(rootfolder);
582  InventoryFolder clothfolder = new InventoryFolder(UUID.Random());
583  foreach (InventoryBase folder in listfolders)
584  {
585  if (folder.Name == "Clothing")
586  {
587  clothfolder = (InventoryFolder)folder;
588  break;
589  }
590  }
591  return clothfolder;
592  }
593 
594  public void Network_LoginProgress(object sender, LoginProgressEventArgs args)
595  {
596  m_log.DebugFormat("[BOT]: Bot {0} {1} in Network_LoginProcess", Name, args.Status);
597 
598  if (args.Status == LoginStatus.Success)
599  {
600  if (OnConnected != null)
601  {
602  OnConnected(this, EventType.CONNECTED);
603  }
604  }
605  }
606 
607  public void Network_SimConnected(object sender, SimConnectedEventArgs args)
608  {
609  m_log.DebugFormat(
610  "[BOT]: Bot {0} connected to region {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
611  }
612 
613  public void Network_SimDisconnected(object sender, SimDisconnectedEventArgs args)
614  {
615  m_log.DebugFormat(
616  "[BOT]: Bot {0} disconnected from region {1} at {2}", Name, args.Simulator.Name, args.Simulator.IPEndPoint);
617  }
618 
619  public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
620  {
621  ConnectionState = ConnectionState.Disconnected;
622 
623  m_log.DebugFormat(
624  "[BOT]: Bot {0} disconnected from grid, reason {1}, message {2}", Name, args.Reason, args.Message);
625 
626 // m_log.ErrorFormat("Fired Network_OnDisconnected");
627 
628 // if (
629 // (args.Reason == NetworkManager.DisconnectType.SimShutdown
630 // || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
631 // && OnDisconnected != null)
632 
633 
634 
635  if (
636  (args.Reason == NetworkManager.DisconnectType.ClientInitiated
637  || args.Reason == NetworkManager.DisconnectType.ServerInitiated
638  || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
639  && OnDisconnected != null)
640 // if (OnDisconnected != null)
641  {
642  OnDisconnected(this, EventType.DISCONNECTED);
643  }
644  }
645 
646  public void Objects_NewPrim(object sender, PrimEventArgs args)
647  {
649  return;
650 
651  Primitive prim = args.Prim;
652 
653  if (prim != null)
654  {
655  lock (m_objects)
656  m_objects[prim.ID] = prim;
657 
658  if (prim.Textures != null)
659  {
660  if (prim.Textures.DefaultTexture.TextureID != UUID.Zero)
661  {
662  GetTextureOrMesh(prim.Textures.DefaultTexture.TextureID, true);
663  }
664 
665  for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
666  {
667  Primitive.TextureEntryFace face = prim.Textures.FaceTextures[i];
668 
669  if (face != null)
670  {
671  UUID textureID = prim.Textures.FaceTextures[i].TextureID;
672 
673  if (textureID != UUID.Zero)
674  GetTextureOrMesh(textureID, true);
675  }
676  }
677  }
678 
679  if (prim.Sculpt != null && prim.Sculpt.SculptTexture != UUID.Zero)
680  {
681  bool mesh = (prim.Sculpt.Type == SculptType.Mesh);
682  GetTextureOrMesh(prim.Sculpt.SculptTexture, !mesh);
683  }
684  }
685  }
686 
687  private void GetTextureOrMesh(UUID assetID, bool texture)
688  {
689  lock (Manager.AssetsReceived)
690  {
691  // Don't request assets more than once.
692  if (Manager.AssetsReceived.ContainsKey(assetID))
693  return;
694 
695  Manager.AssetsReceived[assetID] = false;
696  }
697 
698  try
699  {
700  if (texture)
701  Client.Assets.RequestImage(assetID, ImageType.Normal, Asset_TextureCallback_Texture);
702  else
703  Client.Assets.RequestMesh(assetID, Asset_MeshCallback);
704  }
705  catch (Exception e)
706  {
707  m_log.Warn(string.Format("Error requesting {0} {1}", texture ? "texture" : "mesh", assetID), e);
708  }
709  }
710 
711  public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture)
712  {
713  if (state == TextureRequestState.Finished)
714  {
715  lock (Manager.AssetsReceived)
716  Manager.AssetsReceived[assetTexture.AssetID] = true;
717  }
718  }
719 
720  private void Asset_MeshCallback(bool success, AssetMesh assetMesh)
721  {
722  lock (Manager.AssetsReceived)
723  Manager.AssetsReceived[assetMesh.AssetID] = success;
724  }
725 
726  public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
727  {
728  lock (Manager.AssetsReceived)
729  Manager.AssetsReceived[asset.AssetID] = true;
730 
731 // if (wear == "save")
732 // {
733 // SaveAsset((AssetWearable) asset);
734 // }
735  }
736 
737  private void PacketReceivedDebugHandler(object o, PacketReceivedEventArgs args)
738  {
739  Packet p = args.Packet;
740  Header h = p.Header;
741  Simulator s = args.Simulator;
742 
743  m_log.DebugFormat(
744  "[BOT]: Bot {0} received from {1} packet {2} #{3}, rel {4}, res {5}",
745  Name, s.Name, p.Type, h.Sequence, h.Reliable, h.Resent);
746  }
747  }
748 }
string wear
Definition: Bot.cs:153
List< uint > objectIDs
Definition: Bot.cs:163
Random Random
Random number generator.
Definition: Bot.cs:168
void Network_LoginProgress(object sender, LoginProgressEventArgs args)
Definition: Bot.cs:594
void Connect()
Definition: Bot.cs:339
Dictionary< string, IBehaviour > Behaviours
Behaviours implemented by this bot.
Definition: Bot.cs:100
string FirstName
Definition: Bot.cs:145
void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
Definition: Bot.cs:726
Bot(BotManager bm, List< IBehaviour > behaviours, string firstName, string lastName, string password, string startLocation, string loginUri)
Constructor
Definition: Bot.cs:185
EventType
Event Types from the BOT. Add new events here
Definition: pCampBot.cs:43
List< Simulator > Simulators
Definition: Bot.cs:124
delegate void AnEvent(Bot callbot, EventType someevent)
int PacketDebugLevel
Definition: Bot.cs:61
void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture)
Definition: Bot.cs:711
void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
Definition: Bot.cs:619
void Disconnect()
Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes...
Definition: Bot.cs:329
string saveDir
Definition: Bot.cs:152
string Name
Definition: Bot.cs:147
System.Timers.Timer Timer
void Objects_NewPrim(object sender, PrimEventArgs args)
Definition: Bot.cs:646
OpenSim.Framework.PermissionMask PermissionMask
Definition: Bot.cs:44
Thread/Bot manager for the application
Definition: BotManager.cs:57
string AbbreviatedName
Abbreviated name of this behaviour.
Definition: IBehaviour.cs:37
WearableType GetWearableType(string path)
Definition: Bot.cs:471
Random Rng
Random number generator.
Definition: BotManager.cs:102
ConnectionState ConnectionState
Is this bot connected to the grid?
Definition: Bot.cs:121
bool TryGetBehaviour(string abbreviatedName, out IBehaviour behaviour)
Definition: Bot.cs:209
BotManager Manager
Bot manager.
Definition: Bot.cs:91
string StartLocation
Definition: Bot.cs:150
AnEvent OnDisconnected
Definition: Bot.cs:156
string LastName
Definition: Bot.cs:146
AnEvent OnConnected
Definition: Bot.cs:155
void Network_SimConnected(object sender, SimConnectedEventArgs args)
Definition: Bot.cs:607
void SaveAsset(AssetWearable asset)
Definition: Bot.cs:447
void Stand()
Stand this bot
Definition: Bot.cs:415
InventoryFolder FindClothingFolder()
Definition: Bot.cs:578
void SitOnGround()
Sit this bot on the ground.
Definition: Bot.cs:406
Dictionary< UUID, Primitive > Objects
Objects that the bot has discovered.
Definition: Bot.cs:109
System.Timers.Timer Timer
Definition: Bot.cs:43
void MakeDefaultAppearance(string wear)
Definition: Bot.cs:493
void Network_SimDisconnected(object sender, SimDisconnectedEventArgs args)
Definition: Bot.cs:613
int SimulatorsCount
The number of connections that this bot has to different simulators.
Definition: Bot.cs:137
string Password
Definition: Bot.cs:148
bool RemoveBehaviour(string abbreviatedName)
Definition: Bot.cs:231
void SaveDefaultAppearance()
Definition: Bot.cs:427
string LoginUri
Definition: Bot.cs:149
bool RequestObjectTextures
Controls whether bots request textures for the object information they receive
Definition: Bot.cs:86
ConnectionState
Definition: Bot.cs:48
Dictionary< UUID, bool > AssetsReceived
Track the assets we have and have not received so we don't endlessly repeat requests.
Definition: BotManager.cs:107
GridClient Client
New instance of a SecondLife client
Definition: Bot.cs:173
bool AddBehaviour(IBehaviour behaviour)
Definition: Bot.cs:215