aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/PhysicsBot.cs
diff options
context:
space:
mode:
authorDan Lake2011-10-31 15:21:39 -0700
committerDan Lake2011-10-31 15:21:39 -0700
commit3a2dcc7298f91a04ffd71c01809fa9c54403566a (patch)
tree9f3e38490904be795f7c8f5a8e1c75f3444e6649 /OpenSim/Tools/pCampBot/PhysicsBot.cs
parentAdding green dots to map response should be for root agents only (diff)
parentadjust pCampbot so it starts up bots with the name format "<firstname> <lastn... (diff)
downloadopensim-SC_OLD-3a2dcc7298f91a04ffd71c01809fa9c54403566a.zip
opensim-SC_OLD-3a2dcc7298f91a04ffd71c01809fa9c54403566a.tar.gz
opensim-SC_OLD-3a2dcc7298f91a04ffd71c01809fa9c54403566a.tar.bz2
opensim-SC_OLD-3a2dcc7298f91a04ffd71c01809fa9c54403566a.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
Diffstat (limited to 'OpenSim/Tools/pCampBot/PhysicsBot.cs')
-rw-r--r--OpenSim/Tools/pCampBot/PhysicsBot.cs50
1 files changed, 31 insertions, 19 deletions
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs
index 5d4af31..1531b27 100644
--- a/OpenSim/Tools/pCampBot/PhysicsBot.cs
+++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs
@@ -45,10 +45,11 @@ namespace pCampBot
45 public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events 45 public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events
46 public IConfig startupConfig; // bot config, passed from BotManager 46 public IConfig startupConfig; // bot config, passed from BotManager
47 47
48 public string firstname; 48 public string FirstName { get; private set; }
49 public string lastname; 49 public string LastName { get; private set; }
50 public string password; 50 public string Name { get; private set; }
51 public string loginURI; 51 public string Password { get; private set; }
52 public string LoginUri { get; private set; }
52 public string saveDir; 53 public string saveDir;
53 public string wear; 54 public string wear;
54 55
@@ -60,16 +61,28 @@ namespace pCampBot
60 61
61 protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here 62 protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here
62 63
63 //New instance of a SecondLife client 64 /// <summary>
65 /// New instance of a SecondLife client
66 /// </summary>
64 public GridClient client = new GridClient(); 67 public GridClient client = new GridClient();
65 68
66 protected string[] talkarray; 69 protected string[] talkarray;
70
67 /// <summary> 71 /// <summary>
68 /// 72 /// Constructor
69 /// </summary> 73 /// </summary>
70 /// <param name="bsconfig">nini config for the bot</param> 74 /// <param name="bsconfig"></param>
71 public PhysicsBot(IConfig bsconfig) 75 /// <param name="firstName"></param>
76 /// <param name="lastName"></param>
77 /// <param name="password"></param>
78 /// <param name="loginUri"></param>
79 public PhysicsBot(IConfig bsconfig, string firstName, string lastName, string password, string loginUri)
72 { 80 {
81 FirstName = firstName;
82 LastName = lastName;
83 Name = string.Format("{0} {1}", FirstName, LastName);
84 Password = password;
85 LoginUri = loginUri;
73 startupConfig = bsconfig; 86 startupConfig = bsconfig;
74 readconfig(); 87 readconfig();
75 talkarray = readexcuses(); 88 talkarray = readexcuses();
@@ -116,10 +129,6 @@ namespace pCampBot
116 /// </summary> 129 /// </summary>
117 public void readconfig() 130 public void readconfig()
118 { 131 {
119 firstname = startupConfig.GetString("firstname", "random");
120 lastname = startupConfig.GetString("lastname", "random");
121 password = startupConfig.GetString("password", "12345");
122 loginURI = startupConfig.GetString("loginuri");
123 wear = startupConfig.GetString("wear","no"); 132 wear = startupConfig.GetString("wear","no");
124 } 133 }
125 134
@@ -136,7 +145,7 @@ namespace pCampBot
136 /// </summary> 145 /// </summary>
137 public void startup() 146 public void startup()
138 { 147 {
139 client.Settings.LOGIN_SERVER = loginURI; 148 client.Settings.LOGIN_SERVER = LoginUri;
140 client.Settings.ALWAYS_DECODE_OBJECTS = false; 149 client.Settings.ALWAYS_DECODE_OBJECTS = false;
141 client.Settings.AVATAR_TRACKING = false; 150 client.Settings.AVATAR_TRACKING = false;
142 client.Settings.OBJECT_TRACKING = false; 151 client.Settings.OBJECT_TRACKING = false;
@@ -153,10 +162,10 @@ namespace pCampBot
153 client.Throttle.Total = 400000; 162 client.Throttle.Total = 400000;
154 client.Network.LoginProgress += this.Network_LoginProgress; 163 client.Network.LoginProgress += this.Network_LoginProgress;
155 client.Network.SimConnected += this.Network_SimConnected; 164 client.Network.SimConnected += this.Network_SimConnected;
156 client.Network.Disconnected += this.Network_OnDisconnected; 165// client.Network.Disconnected += this.Network_OnDisconnected;
157 client.Objects.ObjectUpdate += Objects_NewPrim; 166 client.Objects.ObjectUpdate += Objects_NewPrim;
158 //client.Assets.OnAssetReceived += Asset_ReceivedCallback; 167 //client.Assets.OnAssetReceived += Asset_ReceivedCallback;
159 if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) 168 if (client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name"))
160 { 169 {
161 if (OnConnected != null) 170 if (OnConnected != null)
162 { 171 {
@@ -165,7 +174,7 @@ namespace pCampBot
165 m_action.AutoReset = false; 174 m_action.AutoReset = false;
166 m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed); 175 m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
167 m_action.Start(); 176 m_action.Start();
168 OnConnected(this, EventType.CONNECTED); 177// OnConnected(this, EventType.CONNECTED);
169 if (wear == "save") 178 if (wear == "save")
170 { 179 {
171 client.Appearance.SetPreviousAppearance(); 180 client.Appearance.SetPreviousAppearance();
@@ -180,7 +189,9 @@ namespace pCampBot
180 } 189 }
181 else 190 else
182 { 191 {
183 MainConsole.Instance.Output(firstname + " " + lastname + " Can't login: " + client.Network.LoginMessage); 192 MainConsole.Instance.OutputFormat(
193 "{0} {1} cannot login: {2}", FirstName, LastName, client.Network.LoginMessage);
194
184 if (OnDisconnected != null) 195 if (OnDisconnected != null)
185 { 196 {
186 OnDisconnected(this, EventType.DISCONNECTED); 197 OnDisconnected(this, EventType.DISCONNECTED);
@@ -190,7 +201,7 @@ namespace pCampBot
190 201
191 public void SaveDefaultAppearance() 202 public void SaveDefaultAppearance()
192 { 203 {
193 saveDir = "MyAppearance/" + firstname + "_" + lastname; 204 saveDir = "MyAppearance/" + FirstName + "_" + LastName;
194 if (!Directory.Exists(saveDir)) 205 if (!Directory.Exists(saveDir))
195 { 206 {
196 Directory.CreateDirectory(saveDir); 207 Directory.CreateDirectory(saveDir);
@@ -384,6 +395,7 @@ namespace pCampBot
384 { 395 {
385 client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture); 396 client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
386 } 397 }
398
387 for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) 399 for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
388 { 400 {
389 if (prim.Textures.FaceTextures[i] != null) 401 if (prim.Textures.FaceTextures[i] != null)
@@ -392,10 +404,10 @@ namespace pCampBot
392 { 404 {
393 client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture); 405 client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
394 } 406 }
395
396 } 407 }
397 } 408 }
398 } 409 }
410
399 if (prim.Sculpt.SculptTexture != UUID.Zero) 411 if (prim.Sculpt.SculptTexture != UUID.Zero)
400 { 412 {
401 client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture); 413 client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);