diff options
author | Teravus Ovares | 2008-02-03 04:13:46 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-03 04:13:46 +0000 |
commit | b0c6baaeb05c5f15c951d3128419fac82b399911 (patch) | |
tree | 2ca4b26583e5371e2b3fa177574f0ffe76364cbd /pCampBot | |
parent | Implements LSL function llDialog(). (diff) | |
download | opensim-SC-b0c6baaeb05c5f15c951d3128419fac82b399911.zip opensim-SC-b0c6baaeb05c5f15c951d3128419fac82b399911.tar.gz opensim-SC-b0c6baaeb05c5f15c951d3128419fac82b399911.tar.bz2 opensim-SC-b0c6baaeb05c5f15c951d3128419fac82b399911.tar.xz |
* Adding the PhysicsCamperBot load testing app to the SVN in it's own folder. You'll have to build it separately to take advantage of it. *read the Readme file*. The bots created by this application roam around amusingly to simulate load.
* Be smart, Don't use this on a public grid, lest you get banned permanently.
Diffstat (limited to '')
-rw-r--r-- | pCampBot/BotManager.cs | 254 | ||||
-rw-r--r-- | pCampBot/PhysicsBot.cs | 208 | ||||
-rw-r--r-- | pCampBot/PhysicsCamperBotREADME.txt | 21 | ||||
-rw-r--r-- | pCampBot/pCampBot.cs | 80 | ||||
-rw-r--r-- | pCampBot/pCampBot.csproj | 102 | ||||
-rw-r--r-- | pCampBot/prebuild.xml | 63 | ||||
-rw-r--r-- | pCampBot/runprebuild.bat | 2 | ||||
-rw-r--r-- | pCampBot/runprebuild.sh | 4 |
8 files changed, 734 insertions, 0 deletions
diff --git a/pCampBot/BotManager.cs b/pCampBot/BotManager.cs new file mode 100644 index 0000000..a9cd643 --- /dev/null +++ b/pCampBot/BotManager.cs | |||
@@ -0,0 +1,254 @@ | |||
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 OpenSim 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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | ||
35 | using Nini.Config; | ||
36 | using System.Threading; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | |||
40 | namespace pCampBot | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Thread/Bot manager for the application | ||
44 | /// </summary> | ||
45 | public class BotManager : conscmd_callback | ||
46 | { | ||
47 | protected LogBase m_log; | ||
48 | protected List<PhysicsBot> m_lBot; | ||
49 | protected Thread[] m_td; | ||
50 | protected string m_logFilename = "botlog.log"; | ||
51 | protected bool m_verbose = true; | ||
52 | protected Random somthing = new Random(System.Environment.TickCount); | ||
53 | protected int numbots = 0; | ||
54 | protected IConfig Previous_config; | ||
55 | |||
56 | /// <summary> | ||
57 | /// Constructor Creates Mainlog.Instance to take commands and provide the place to write data | ||
58 | /// </summary> | ||
59 | public BotManager() | ||
60 | { | ||
61 | |||
62 | m_log = CreateLog(); | ||
63 | MainLog.Instance = m_log; | ||
64 | m_lBot = new List<PhysicsBot>(); | ||
65 | |||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Startup number of bots specified in the starting arguments | ||
70 | /// </summary> | ||
71 | /// <param name="botcount">How many bots to start up</param> | ||
72 | /// <param name="cs">The configuration for the bots to use</param> | ||
73 | public void dobotStartup(int botcount, IConfig cs) | ||
74 | { | ||
75 | Previous_config = cs; | ||
76 | m_td = new Thread[botcount]; | ||
77 | for (int i = 0; i < botcount; i++) | ||
78 | { | ||
79 | startupBot(i, cs); | ||
80 | |||
81 | |||
82 | } | ||
83 | |||
84 | } | ||
85 | /// <summary> | ||
86 | /// Add additional bots (and threads) to our bot pool | ||
87 | /// </summary> | ||
88 | /// <param name="botcount">How Many of them to add</param> | ||
89 | public void addbots(int botcount) | ||
90 | { | ||
91 | int len = m_td.Length; | ||
92 | Thread[] m_td2 = new Thread[len + botcount]; | ||
93 | int i; | ||
94 | for (i = 0; i < len; i++) | ||
95 | { | ||
96 | m_td2[i] = m_td[i]; | ||
97 | } | ||
98 | m_td = m_td2; | ||
99 | int newlen = len + botcount; | ||
100 | for (i = i; i < newlen; i++) | ||
101 | { | ||
102 | startupBot(i, Previous_config); | ||
103 | } | ||
104 | |||
105 | } | ||
106 | |||
107 | /// <summary> | ||
108 | /// This starts up the bot and stores the thread for the bot in the thread array | ||
109 | /// </summary> | ||
110 | /// <param name="pos">The position in the thread array to stick the bot's thread</param> | ||
111 | /// <param name="cs">Configuration of the bot</param> | ||
112 | public void startupBot(int pos, IConfig cs) | ||
113 | { | ||
114 | PhysicsBot pb = new PhysicsBot(cs); | ||
115 | |||
116 | pb.OnConnected += handlebotEvent; | ||
117 | pb.OnDisconnected += handlebotEvent; | ||
118 | if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName(); | ||
119 | if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName(); | ||
120 | |||
121 | m_td[pos] = new Thread(pb.startup); | ||
122 | m_td[pos].Start(); | ||
123 | m_lBot.Add(pb); | ||
124 | |||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// Creates a random name for the bot | ||
129 | /// </summary> | ||
130 | /// <returns></returns> | ||
131 | private string CreateRandomName() | ||
132 | { | ||
133 | string returnstring = ""; | ||
134 | string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | ||
135 | |||
136 | for (int i = 0; i < 7; i++) | ||
137 | { | ||
138 | returnstring += chars.Substring(somthing.Next(chars.Length),1); | ||
139 | } | ||
140 | return returnstring; | ||
141 | |||
142 | } | ||
143 | |||
144 | /// <summary> | ||
145 | /// High level connnected/disconnected events so we can keep track of our threads by proxy | ||
146 | /// </summary> | ||
147 | /// <param name="callbot"></param> | ||
148 | /// <param name="eventt"></param> | ||
149 | public void handlebotEvent(PhysicsBot callbot, EventType eventt) | ||
150 | { | ||
151 | switch (eventt) | ||
152 | { | ||
153 | case EventType.CONNECTED: | ||
154 | MainLog.Instance.Verbose(" " + callbot.firstname + " " + callbot.lastname, "Connected"); | ||
155 | numbots++; | ||
156 | break; | ||
157 | case EventType.DISCONNECTED: | ||
158 | MainLog.Instance.Verbose(" " + callbot.firstname + " " + callbot.lastname, "Disconnected"); | ||
159 | m_td[m_lBot.IndexOf(callbot)].Abort(); | ||
160 | numbots--; | ||
161 | if (numbots >1) | ||
162 | Environment.Exit(0); | ||
163 | break; | ||
164 | |||
165 | } | ||
166 | } | ||
167 | /// <summary> | ||
168 | /// Shutting down all bots | ||
169 | /// </summary> | ||
170 | public void doBotShutdown() | ||
171 | { | ||
172 | foreach (PhysicsBot pb in m_lBot) | ||
173 | { | ||
174 | pb.shutdown(); | ||
175 | } | ||
176 | |||
177 | |||
178 | |||
179 | } | ||
180 | |||
181 | /// <summary> | ||
182 | /// Standard Creatlog routine | ||
183 | /// </summary> | ||
184 | /// <returns></returns> | ||
185 | protected LogBase CreateLog() | ||
186 | { | ||
187 | if (!Directory.Exists(Util.logDir())) | ||
188 | { | ||
189 | Directory.CreateDirectory(Util.logDir()); | ||
190 | } | ||
191 | |||
192 | return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_verbose); | ||
193 | } | ||
194 | |||
195 | /// <summary> | ||
196 | /// I don't think the bots use this.. | ||
197 | /// </summary> | ||
198 | /// <param name="commandParams"></param> | ||
199 | /// <param name="pos"></param> | ||
200 | /// <returns></returns> | ||
201 | private string CombineParams(string[] commandParams, int pos) | ||
202 | { | ||
203 | string result = String.Empty; | ||
204 | for (int i = pos; i < commandParams.Length; i++) | ||
205 | { | ||
206 | result += commandParams[i] + " "; | ||
207 | } | ||
208 | result = result.TrimEnd(' '); | ||
209 | return result; | ||
210 | } | ||
211 | |||
212 | /// <summary> | ||
213 | /// Command runnint tool.. Currently use it to add bots, shutdown and (dangerous)Forcequit | ||
214 | /// </summary> | ||
215 | /// <param name="command"></param> | ||
216 | /// <param name="cmdparams"></param> | ||
217 | public void RunCmd(string command, string[] cmdparams) | ||
218 | { | ||
219 | switch (command) | ||
220 | { | ||
221 | case "shutdown": | ||
222 | MainLog.Instance.Warn("BOTMANAGER", "Shutting down bots"); | ||
223 | doBotShutdown(); | ||
224 | break; | ||
225 | case "quit": | ||
226 | MainLog.Instance.Warn("DANGER", "This should only be used to quit the program if you've already used the shutdown command and the program hasn't quit"); | ||
227 | Environment.Exit(0); | ||
228 | break; | ||
229 | case "addbots": | ||
230 | int newbots = 0; | ||
231 | Helpers.TryParse(cmdparams[0], out newbots); | ||
232 | |||
233 | if (newbots > 0) | ||
234 | addbots(newbots); | ||
235 | break; | ||
236 | case "help": | ||
237 | MainLog.Instance.Notice("HELP", "\nshutdown - graceful shutdown\naddbots <n> - adds n bots to the test\nquit - forcequits, dangerous if you have not already run shutdown"); | ||
238 | break; | ||
239 | |||
240 | |||
241 | } | ||
242 | } | ||
243 | |||
244 | /// <summary> | ||
245 | /// Required method to implement the conscmd_callback interface | ||
246 | /// </summary> | ||
247 | /// <param name="ShowWhat"></param> | ||
248 | public void Show(string ShowWhat) | ||
249 | { | ||
250 | |||
251 | } | ||
252 | } | ||
253 | |||
254 | } | ||
diff --git a/pCampBot/PhysicsBot.cs b/pCampBot/PhysicsBot.cs new file mode 100644 index 0000000..53a774a --- /dev/null +++ b/pCampBot/PhysicsBot.cs | |||
@@ -0,0 +1,208 @@ | |||
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 OpenSim 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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Text; | ||
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | ||
35 | using Nini.Config; | ||
36 | using System.Threading; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Console; | ||
39 | using Timer=System.Timers.Timer; | ||
40 | |||
41 | |||
42 | |||
43 | namespace pCampBot | ||
44 | { | ||
45 | public class PhysicsBot | ||
46 | { | ||
47 | public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events | ||
48 | public IConfig startupConfig; // bot config, passed from BotManager | ||
49 | |||
50 | public string firstname; | ||
51 | public string lastname; | ||
52 | public string password; | ||
53 | public string loginURI; | ||
54 | |||
55 | public event AnEvent OnConnected; | ||
56 | public event AnEvent OnDisconnected; | ||
57 | |||
58 | protected Timer m_action; // Action Timer | ||
59 | |||
60 | protected Random somthing = new Random(System.Environment.TickCount);// We do stuff randomly here | ||
61 | |||
62 | //New instance of a SecondLife client | ||
63 | public SecondLife client = new SecondLife(); | ||
64 | |||
65 | protected string[] talkarray; | ||
66 | /// <summary> | ||
67 | /// | ||
68 | /// </summary> | ||
69 | /// <param name="bsconfig">nini config for the bot</param> | ||
70 | public PhysicsBot(IConfig bsconfig) | ||
71 | { | ||
72 | startupConfig = bsconfig; | ||
73 | readconfig(); | ||
74 | talkarray = readexcuses(); | ||
75 | } | ||
76 | |||
77 | //We do our actions here. This is where one would | ||
78 | //add additional steps and/or things the bot should do | ||
79 | |||
80 | void m_action_Elapsed(object sender, System.Timers.ElapsedEventArgs e) | ||
81 | { | ||
82 | //client.Throttle.Task = 500000f; | ||
83 | //client.Throttle.Set(); | ||
84 | |||
85 | client.Self.Movement.AlwaysRun = true; | ||
86 | LLVector3 pos = client.Self.SimPosition; | ||
87 | LLVector3 newpos = new LLVector3(somthing.Next(255),somthing.Next(255),somthing.Next(255)); | ||
88 | |||
89 | |||
90 | client.Self.Movement.TurnToward(newpos); | ||
91 | for (int i = 0; i < 2000; i++) | ||
92 | { | ||
93 | client.Self.Movement.AtPos = true; | ||
94 | } | ||
95 | client.Self.Jump(); | ||
96 | string randomf = talkarray[somthing.Next(talkarray.Length)]; | ||
97 | if (talkarray.Length > 1 && randomf.Length > 1) | ||
98 | client.Self.Chat("Can't do it, " + randomf, 0, ChatType.Normal); | ||
99 | |||
100 | Thread.Sleep(somthing.Next(1,20)); | ||
101 | |||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Read the Nini config and initialize | ||
106 | /// </summary> | ||
107 | public void readconfig() | ||
108 | { | ||
109 | firstname = startupConfig.GetString("firstname", "random"); | ||
110 | lastname = startupConfig.GetString("lastname", "random"); | ||
111 | password = startupConfig.GetString("password", "12345"); | ||
112 | loginURI = startupConfig.GetString("loginuri", "http://10.1.1.5:9000"); | ||
113 | |||
114 | |||
115 | |||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. | ||
120 | /// </summary> | ||
121 | public void shutdown() | ||
122 | { | ||
123 | client.Network.Logout(); | ||
124 | } | ||
125 | /// <summary> | ||
126 | /// This is the bot startup loop. | ||
127 | /// </summary> | ||
128 | public void startup() | ||
129 | { | ||
130 | |||
131 | client.Settings.LOGIN_SERVER = loginURI; | ||
132 | client.Network.OnConnected += new NetworkManager.ConnectedCallback(this.Network_OnConnected); | ||
133 | client.Network.OnSimConnected += new NetworkManager.SimConnectedCallback(this.Network_OnConnected); | ||
134 | client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected); | ||
135 | if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) | ||
136 | { | ||
137 | |||
138 | if (OnConnected != null) | ||
139 | { | ||
140 | m_action = new Timer(somthing.Next(1000, 10000)); | ||
141 | m_action.Elapsed += new System.Timers.ElapsedEventHandler(m_action_Elapsed); | ||
142 | m_action.Start(); | ||
143 | OnConnected(this, EventType.CONNECTED); | ||
144 | client.Self.Jump(); | ||
145 | |||
146 | } | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | |||
151 | MainLog.Instance.Error(firstname + " " + lastname,"Can't Log in: " + client.Network.LoginMessage); | ||
152 | if (OnDisconnected != null) | ||
153 | { | ||
154 | OnDisconnected(this, EventType.DISCONNECTED); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | } | ||
159 | |||
160 | public void Network_OnConnected(object sender) | ||
161 | { | ||
162 | if (OnConnected != null) | ||
163 | { | ||
164 | OnConnected(this, EventType.CONNECTED); | ||
165 | } | ||
166 | |||
167 | } | ||
168 | public void Simulator_Connected(object sender) | ||
169 | { | ||
170 | |||
171 | |||
172 | } | ||
173 | |||
174 | public void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message) | ||
175 | { | ||
176 | if (OnDisconnected != null) | ||
177 | { | ||
178 | OnDisconnected(this,EventType.DISCONNECTED); | ||
179 | } | ||
180 | |||
181 | |||
182 | } | ||
183 | public string[] readexcuses() | ||
184 | { | ||
185 | |||
186 | |||
187 | |||
188 | string allexcuses = ""; | ||
189 | |||
190 | |||
191 | string file = Path.Combine(Util.configDir(), "excuses"); | ||
192 | if (File.Exists(file)) | ||
193 | { | ||
194 | StreamReader csr = File.OpenText(file); | ||
195 | allexcuses = csr.ReadToEnd(); | ||
196 | csr.Close(); | ||
197 | } | ||
198 | |||
199 | |||
200 | return allexcuses.Split(Environment.NewLine.ToCharArray()); | ||
201 | |||
202 | } | ||
203 | |||
204 | |||
205 | } | ||
206 | |||
207 | |||
208 | } | ||
diff --git a/pCampBot/PhysicsCamperBotREADME.txt b/pCampBot/PhysicsCamperBotREADME.txt new file mode 100644 index 0000000..988f589 --- /dev/null +++ b/pCampBot/PhysicsCamperBotREADME.txt | |||
@@ -0,0 +1,21 @@ | |||
1 | This is the PhysicsCamperbot libslBot tester. | ||
2 | |||
3 | This is designed to be run in standalone mode with authorize accounts turned off as a way to stress test the simulator. | ||
4 | It creates <N> clients that log in, randomly jump/walk around, and say excuses from the BOFH | ||
5 | |||
6 | **Warning:** Using this bot on a public grid could get you banned perminantly, so just say No! to greifing! | ||
7 | |||
8 | -----Setup ----- | ||
9 | Run the prebuilds for it IN THIS FOLDER and then open the created solution and compile it. It will end up in the regular opensim bin folder. | ||
10 | |||
11 | -----Running the bot---- | ||
12 | |||
13 | windows: pCampBot.exe -botcount <N> -loginuri <URI> | ||
14 | *nix: mono pCampBot.exe -botcount <N> -loginuri <URI> | ||
15 | |||
16 | The names it produces are random by default, however, you can specify either a firstname or a lastname in the command line also. | ||
17 | ex: pCampBot.exe -botcount <N> -loginuri <URI> -lastname <lastname> | ||
18 | |||
19 | If you specify both a firstname *and* a lastname, you'll likely run into trouble unless you're only running a single bot. In that case, there's also a password option. | ||
20 | |||
21 | pCampBot.exe -botcount 1 -loginuri http://somegrid.com:8002 -firstname SomeDude -lastname SomeDude -password GobbleDeGook | ||
diff --git a/pCampBot/pCampBot.cs b/pCampBot/pCampBot.cs new file mode 100644 index 0000000..983eaf0 --- /dev/null +++ b/pCampBot/pCampBot.cs | |||
@@ -0,0 +1,80 @@ | |||
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 OpenSim 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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using libsecondlife; | ||
33 | using libsecondlife.Packets; | ||
34 | using Nini.Config; | ||
35 | using System.Threading; | ||
36 | using OpenSim.Framework.Console; | ||
37 | |||
38 | |||
39 | namespace pCampBot | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Event Types from the BOT. Add new events here | ||
43 | /// </summary> | ||
44 | public enum EventType:int | ||
45 | { | ||
46 | NONE = 0, | ||
47 | CONNECTED = 1, | ||
48 | DISCONNECTED = 2 | ||
49 | } | ||
50 | public class pCampBot | ||
51 | { | ||
52 | |||
53 | |||
54 | [STAThread] | ||
55 | public static void Main(string[] args) | ||
56 | { | ||
57 | //Set up our nifty config.. thanks to nini | ||
58 | ArgvConfigSource cs = new ArgvConfigSource(args); | ||
59 | |||
60 | cs.AddSwitch("Startup", "botcount"); | ||
61 | cs.AddSwitch("Startup", "loginuri"); | ||
62 | cs.AddSwitch("Startup", "firstname"); | ||
63 | cs.AddSwitch("Startup", "lastname"); | ||
64 | cs.AddSwitch("Startup", "password"); | ||
65 | |||
66 | |||
67 | IConfig ol = cs.Configs["Startup"]; | ||
68 | int botcount = ol.GetInt("botcount", 1); | ||
69 | BotManager bm = new BotManager(); | ||
70 | |||
71 | //startup specified number of bots. 1 is the default | ||
72 | bm.dobotStartup(botcount, ol); | ||
73 | while (true) | ||
74 | { | ||
75 | MainLog.Instance.MainLogPrompt(); | ||
76 | } | ||
77 | |||
78 | } | ||
79 | } | ||
80 | } | ||
diff --git a/pCampBot/pCampBot.csproj b/pCampBot/pCampBot.csproj new file mode 100644 index 0000000..04b044c --- /dev/null +++ b/pCampBot/pCampBot.csproj | |||
@@ -0,0 +1,102 @@ | |||
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>{7F3A2F5C-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>pCampBot</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>pCampBot</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="libsecondlife.dll" > | ||
62 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="Nini.dll" > | ||
66 | <HintPath>..\bin\Nini.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="OpenSim.Framework.Console.dll" > | ||
70 | <HintPath>..\bin\OpenSim.Framework.Console.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="OpenSim.Framework.dll" > | ||
74 | <HintPath>..\bin\OpenSim.Framework.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System" > | ||
78 | <HintPath>System.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | </ItemGroup> | ||
84 | <ItemGroup> | ||
85 | <Compile Include="BotManager.cs"> | ||
86 | <SubType>Code</SubType> | ||
87 | </Compile> | ||
88 | <Compile Include="pCampBot.cs"> | ||
89 | <SubType>Code</SubType> | ||
90 | </Compile> | ||
91 | <Compile Include="PhysicsBot.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | </ItemGroup> | ||
95 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
96 | <PropertyGroup> | ||
97 | <PreBuildEvent> | ||
98 | </PreBuildEvent> | ||
99 | <PostBuildEvent> | ||
100 | </PostBuildEvent> | ||
101 | </PropertyGroup> | ||
102 | </Project> | ||
diff --git a/pCampBot/prebuild.xml b/pCampBot/prebuild.xml new file mode 100644 index 0000000..25219fd --- /dev/null +++ b/pCampBot/prebuild.xml | |||
@@ -0,0 +1,63 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7"> | ||
3 | <Solution name="pCampBot" activeConfig="Debug" path="./" version="0.4.0-svn"> | ||
4 | <Configuration name="Debug"> | ||
5 | <Options> | ||
6 | <CompilerDefines>TRACE;DEBUG</CompilerDefines> | ||
7 | <OptimizeCode>false</OptimizeCode> | ||
8 | <CheckUnderflowOverflow>false</CheckUnderflowOverflow> | ||
9 | <AllowUnsafe>false</AllowUnsafe> | ||
10 | <WarningLevel>4</WarningLevel> | ||
11 | <WarningsAsErrors>false</WarningsAsErrors> | ||
12 | <SuppressWarnings></SuppressWarnings> | ||
13 | <OutputPath>../bin</OutputPath> | ||
14 | <DebugInformation>true</DebugInformation> | ||
15 | <IncrementalBuild>true</IncrementalBuild> | ||
16 | <NoStdLib>false</NoStdLib> | ||
17 | </Options> | ||
18 | </Configuration> | ||
19 | <Configuration name="Release"> | ||
20 | <Options> | ||
21 | <CompilerDefines>TRACE</CompilerDefines> | ||
22 | <OptimizeCode>true</OptimizeCode> | ||
23 | <CheckUnderflowOverflow>false</CheckUnderflowOverflow> | ||
24 | <AllowUnsafe>false</AllowUnsafe> | ||
25 | <WarningLevel>4</WarningLevel> | ||
26 | <WarningsAsErrors>false</WarningsAsErrors> | ||
27 | <SuppressWarnings></SuppressWarnings> | ||
28 | <OutputPath>../bin</OutputPath> | ||
29 | <DebugInformation>false</DebugInformation> | ||
30 | <IncrementalBuild>true</IncrementalBuild> | ||
31 | <NoStdLib>false</NoStdLib> | ||
32 | </Options> | ||
33 | </Configuration> | ||
34 | |||
35 | <!-- Core OpenSim Projects --> | ||
36 | |||
37 | <Project name="pCampBot" path="./" type="Exe"> | ||
38 | <Configuration name="Debug"> | ||
39 | <Options> | ||
40 | <OutputPath>../bin/</OutputPath> | ||
41 | </Options> | ||
42 | </Configuration> | ||
43 | <Configuration name="Release"> | ||
44 | <Options> | ||
45 | <OutputPath>../bin/</OutputPath> | ||
46 | </Options> | ||
47 | </Configuration> | ||
48 | |||
49 | <ReferencePath>../bin/</ReferencePath> | ||
50 | <Reference name="System" localCopy="false"/> | ||
51 | <Reference name="libsecondlife.dll"/> | ||
52 | <Reference name="OpenSim.Framework.dll"/> | ||
53 | <Reference name="OpenSim.Framework.Console.dll"/> | ||
54 | <Reference name="Nini.dll" /> | ||
55 | |||
56 | |||
57 | <Files> | ||
58 | <Match pattern="*.cs" recurse="true"/> | ||
59 | </Files> | ||
60 | </Project> | ||
61 | |||
62 | </Solution> | ||
63 | </Prebuild> | ||
diff --git a/pCampBot/runprebuild.bat b/pCampBot/runprebuild.bat new file mode 100644 index 0000000..05dfe16 --- /dev/null +++ b/pCampBot/runprebuild.bat | |||
@@ -0,0 +1,2 @@ | |||
1 | ..\bin\Prebuild.exe /target nant | ||
2 | ..\bin\Prebuild.exe /target vs2005 \ No newline at end of file | ||
diff --git a/pCampBot/runprebuild.sh b/pCampBot/runprebuild.sh new file mode 100644 index 0000000..23fbfef --- /dev/null +++ b/pCampBot/runprebuild.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | mono ../bin/Prebuild.exe /target nant | ||
4 | mono ../bin/Prebuild.exe /target vs2005 | ||