diff options
author | Justin Clark-Casey (justincc) | 2011-10-31 22:14:49 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-31 22:14:49 +0000 |
commit | b1647f6d045a4ec0559d0f49d09f17f6e4cf2930 (patch) | |
tree | c20d6bac1dc58fdbc67053088ae424c1d28a4517 /OpenSim/Tools/pCampBot/PhysicsBot.cs | |
parent | Remove unused PumaCode.SvnDotNet library (diff) | |
download | opensim-SC-b1647f6d045a4ec0559d0f49d09f17f6e4cf2930.zip opensim-SC-b1647f6d045a4ec0559d0f49d09f17f6e4cf2930.tar.gz opensim-SC-b1647f6d045a4ec0559d0f49d09f17f6e4cf2930.tar.bz2 opensim-SC-b1647f6d045a4ec0559d0f49d09f17f6e4cf2930.tar.xz |
adjust pCampbot so it starts up bots with the name format "<firstname> <lastname>_<bot-number>"
e.g. starting up two bots called "Ima Bot" will give them the names "Ima Bot_0" and "Ima Bot_1"
This is necessary since bots with random names can no longer be created, as there's no easy way to turn off account authentication
Diffstat (limited to 'OpenSim/Tools/pCampBot/PhysicsBot.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsBot.cs | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs index de54836..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 | { |
@@ -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); |