diff options
author | Jeff Ames | 2008-02-15 02:53:05 +0000 |
---|---|---|
committer | Jeff Ames | 2008-02-15 02:53:05 +0000 |
commit | 21b623b70e33b80dc8caae3b1730bcd8069e3caa (patch) | |
tree | 72e4640a56de3b8cfc03589d24b380da80984f7a /OpenSim | |
parent | Oops. Forgot about Windows users. (diff) | |
download | opensim-SC-21b623b70e33b80dc8caae3b1730bcd8069e3caa.zip opensim-SC-21b623b70e33b80dc8caae3b1730bcd8069e3caa.tar.gz opensim-SC-21b623b70e33b80dc8caae3b1730bcd8069e3caa.tar.bz2 opensim-SC-21b623b70e33b80dc8caae3b1730bcd8069e3caa.tar.xz |
Moved pCampBot to OpenSim/Tools
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 235 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsBot.cs | 191 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/PhysicsCamperBotREADME.txt | 36 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/pCampBot.cs | 76 | ||||
-rw-r--r-- | OpenSim/Tools/pCampBot/prebuild.xml | 63 | ||||
-rwxr-xr-x | OpenSim/Tools/pCampBot/runprebuild.bat | 2 | ||||
-rwxr-xr-x | OpenSim/Tools/pCampBot/runprebuild.sh | 4 |
7 files changed, 607 insertions, 0 deletions
diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs new file mode 100644 index 0000000..0c7fa4e --- /dev/null +++ b/OpenSim/Tools/pCampBot/BotManager.cs | |||
@@ -0,0 +1,235 @@ | |||
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 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | protected ConsoleBase m_console; | ||
50 | protected List<PhysicsBot> m_lBot; | ||
51 | protected Thread[] m_td; | ||
52 | protected bool m_verbose = true; | ||
53 | protected Random somthing = new Random(System.Environment.TickCount); | ||
54 | protected int numbots = 0; | ||
55 | protected IConfig Previous_config; | ||
56 | |||
57 | /// <summary> | ||
58 | /// Constructor Creates MainConsole.Instance to take commands and provide the place to write data | ||
59 | /// </summary> | ||
60 | public BotManager() | ||
61 | { | ||
62 | m_console = CreateConsole(); | ||
63 | MainConsole.Instance = m_console; | ||
64 | m_lBot = new List<PhysicsBot>(); | ||
65 | } | ||
66 | |||
67 | /// <summary> | ||
68 | /// Startup number of bots specified in the starting arguments | ||
69 | /// </summary> | ||
70 | /// <param name="botcount">How many bots to start up</param> | ||
71 | /// <param name="cs">The configuration for the bots to use</param> | ||
72 | public void dobotStartup(int botcount, IConfig cs) | ||
73 | { | ||
74 | Previous_config = cs; | ||
75 | m_td = new Thread[botcount]; | ||
76 | for (int i = 0; i < botcount; i++) | ||
77 | { | ||
78 | startupBot(i, cs); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | /// <summary> | ||
83 | /// Add additional bots (and threads) to our bot pool | ||
84 | /// </summary> | ||
85 | /// <param name="botcount">How Many of them to add</param> | ||
86 | public void addbots(int botcount) | ||
87 | { | ||
88 | int len = m_td.Length; | ||
89 | Thread[] m_td2 = new Thread[len + botcount]; | ||
90 | for (int i = 0; i < len; i++) | ||
91 | { | ||
92 | m_td2[i] = m_td[i]; | ||
93 | } | ||
94 | m_td = m_td2; | ||
95 | int newlen = len + botcount; | ||
96 | for (int i = len; i < newlen; i++) | ||
97 | { | ||
98 | startupBot(i, Previous_config); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// This starts up the bot and stores the thread for the bot in the thread array | ||
104 | /// </summary> | ||
105 | /// <param name="pos">The position in the thread array to stick the bot's thread</param> | ||
106 | /// <param name="cs">Configuration of the bot</param> | ||
107 | public void startupBot(int pos, IConfig cs) | ||
108 | { | ||
109 | PhysicsBot pb = new PhysicsBot(cs); | ||
110 | |||
111 | pb.OnConnected += handlebotEvent; | ||
112 | pb.OnDisconnected += handlebotEvent; | ||
113 | if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName(); | ||
114 | if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName(); | ||
115 | |||
116 | m_td[pos] = new Thread(pb.startup); | ||
117 | m_td[pos].Start(); | ||
118 | m_lBot.Add(pb); | ||
119 | } | ||
120 | |||
121 | /// <summary> | ||
122 | /// Creates a random name for the bot | ||
123 | /// </summary> | ||
124 | /// <returns></returns> | ||
125 | private string CreateRandomName() | ||
126 | { | ||
127 | string returnstring = ""; | ||
128 | string chars = "abcdefghijklmnopqrstuvwxyz0123456789"; | ||
129 | |||
130 | for (int i = 0; i < 7; i++) | ||
131 | { | ||
132 | returnstring += chars.Substring(somthing.Next(chars.Length),1); | ||
133 | } | ||
134 | return returnstring; | ||
135 | } | ||
136 | |||
137 | /// <summary> | ||
138 | /// High level connnected/disconnected events so we can keep track of our threads by proxy | ||
139 | /// </summary> | ||
140 | /// <param name="callbot"></param> | ||
141 | /// <param name="eventt"></param> | ||
142 | public void handlebotEvent(PhysicsBot callbot, EventType eventt) | ||
143 | { | ||
144 | switch (eventt) | ||
145 | { | ||
146 | case EventType.CONNECTED: | ||
147 | m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected"); | ||
148 | numbots++; | ||
149 | break; | ||
150 | case EventType.DISCONNECTED: | ||
151 | m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected"); | ||
152 | m_td[m_lBot.IndexOf(callbot)].Abort(); | ||
153 | numbots--; | ||
154 | if (numbots >1) | ||
155 | Environment.Exit(0); | ||
156 | break; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | /// <summary> | ||
161 | /// Shutting down all bots | ||
162 | /// </summary> | ||
163 | public void doBotShutdown() | ||
164 | { | ||
165 | foreach (PhysicsBot pb in m_lBot) | ||
166 | { | ||
167 | pb.shutdown(); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | /// <summary> | ||
172 | /// Standard CreateConsole routine | ||
173 | /// </summary> | ||
174 | /// <returns></returns> | ||
175 | protected ConsoleBase CreateConsole() | ||
176 | { | ||
177 | return new ConsoleBase("Region", this); | ||
178 | } | ||
179 | |||
180 | /// <summary> | ||
181 | /// I don't think the bots use this.. | ||
182 | /// </summary> | ||
183 | /// <param name="commandParams"></param> | ||
184 | /// <param name="pos"></param> | ||
185 | /// <returns></returns> | ||
186 | private string CombineParams(string[] commandParams, int pos) | ||
187 | { | ||
188 | string result = String.Empty; | ||
189 | for (int i = pos; i < commandParams.Length; i++) | ||
190 | { | ||
191 | result += commandParams[i] + " "; | ||
192 | } | ||
193 | result = result.TrimEnd(' '); | ||
194 | return result; | ||
195 | } | ||
196 | |||
197 | /// <summary> | ||
198 | /// Command runnint tool.. Currently use it to add bots, shutdown and (dangerous)Forcequit | ||
199 | /// </summary> | ||
200 | /// <param name="command"></param> | ||
201 | /// <param name="cmdparams"></param> | ||
202 | public void RunCmd(string command, string[] cmdparams) | ||
203 | { | ||
204 | switch (command) | ||
205 | { | ||
206 | case "shutdown": | ||
207 | m_console.Warn("BOTMANAGER", "Shutting down bots"); | ||
208 | doBotShutdown(); | ||
209 | break; | ||
210 | case "quit": | ||
211 | m_console.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"); | ||
212 | Environment.Exit(0); | ||
213 | break; | ||
214 | case "addbots": | ||
215 | int newbots = 0; | ||
216 | Helpers.TryParse(cmdparams[0], out newbots); | ||
217 | |||
218 | if (newbots > 0) | ||
219 | addbots(newbots); | ||
220 | break; | ||
221 | case "help": | ||
222 | m_console.Notice("HELP", "\nshutdown - graceful shutdown\naddbots <n> - adds n bots to the test\nquit - forcequits, dangerous if you have not already run shutdown"); | ||
223 | break; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Required method to implement the conscmd_callback interface | ||
229 | /// </summary> | ||
230 | /// <param name="ShowWhat"></param> | ||
231 | public void Show(string ShowWhat) | ||
232 | { | ||
233 | } | ||
234 | } | ||
235 | } | ||
diff --git a/OpenSim/Tools/pCampBot/PhysicsBot.cs b/OpenSim/Tools/pCampBot/PhysicsBot.cs new file mode 100644 index 0000000..500683a --- /dev/null +++ b/OpenSim/Tools/pCampBot/PhysicsBot.cs | |||
@@ -0,0 +1,191 @@ | |||
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 | namespace pCampBot | ||
42 | { | ||
43 | public class PhysicsBot | ||
44 | { | ||
45 | public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events | ||
46 | public IConfig startupConfig; // bot config, passed from BotManager | ||
47 | |||
48 | public string firstname; | ||
49 | public string lastname; | ||
50 | public string password; | ||
51 | public string loginURI; | ||
52 | |||
53 | public event AnEvent OnConnected; | ||
54 | public event AnEvent OnDisconnected; | ||
55 | |||
56 | protected Timer m_action; // Action Timer | ||
57 | |||
58 | protected Random somthing = new Random(System.Environment.TickCount);// We do stuff randomly here | ||
59 | |||
60 | //New instance of a SecondLife client | ||
61 | public SecondLife client = new SecondLife(); | ||
62 | |||
63 | protected string[] talkarray; | ||
64 | /// <summary> | ||
65 | /// | ||
66 | /// </summary> | ||
67 | /// <param name="bsconfig">nini config for the bot</param> | ||
68 | public PhysicsBot(IConfig bsconfig) | ||
69 | { | ||
70 | startupConfig = bsconfig; | ||
71 | readconfig(); | ||
72 | talkarray = readexcuses(); | ||
73 | } | ||
74 | |||
75 | //We do our actions here. This is where one would | ||
76 | //add additional steps and/or things the bot should do | ||
77 | |||
78 | void m_action_Elapsed(object sender, System.Timers.ElapsedEventArgs e) | ||
79 | { | ||
80 | //client.Throttle.Task = 500000f; | ||
81 | //client.Throttle.Set(); | ||
82 | |||
83 | client.Self.Movement.AlwaysRun = true; | ||
84 | LLVector3 pos = client.Self.SimPosition; | ||
85 | LLVector3 newpos = new LLVector3(somthing.Next(255),somthing.Next(255),somthing.Next(255)); | ||
86 | |||
87 | |||
88 | client.Self.Movement.TurnToward(newpos); | ||
89 | for (int i = 0; i < 2000; i++) | ||
90 | { | ||
91 | client.Self.Movement.AtPos = true; | ||
92 | } | ||
93 | client.Self.Jump(); | ||
94 | string randomf = talkarray[somthing.Next(talkarray.Length)]; | ||
95 | if (talkarray.Length > 1 && randomf.Length > 1) | ||
96 | client.Self.Chat("Can't do it, " + randomf, 0, ChatType.Normal); | ||
97 | |||
98 | Thread.Sleep(somthing.Next(1,20)); | ||
99 | |||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// Read the Nini config and initialize | ||
104 | /// </summary> | ||
105 | public void readconfig() | ||
106 | { | ||
107 | firstname = startupConfig.GetString("firstname", "random"); | ||
108 | lastname = startupConfig.GetString("lastname", "random"); | ||
109 | password = startupConfig.GetString("password", "12345"); | ||
110 | loginURI = startupConfig.GetString("loginuri", "http://10.1.1.5:9000"); | ||
111 | |||
112 | |||
113 | |||
114 | } | ||
115 | |||
116 | /// <summary> | ||
117 | /// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes. | ||
118 | /// </summary> | ||
119 | public void shutdown() | ||
120 | { | ||
121 | client.Network.Logout(); | ||
122 | } | ||
123 | |||
124 | /// <summary> | ||
125 | /// This is the bot startup loop. | ||
126 | /// </summary> | ||
127 | public void startup() | ||
128 | { | ||
129 | client.Settings.LOGIN_SERVER = loginURI; | ||
130 | client.Network.OnConnected += new NetworkManager.ConnectedCallback(this.Network_OnConnected); | ||
131 | client.Network.OnSimConnected += new NetworkManager.SimConnectedCallback(this.Network_OnConnected); | ||
132 | client.Network.OnDisconnected += new NetworkManager.DisconnectedCallback(this.Network_OnDisconnected); | ||
133 | if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name")) | ||
134 | { | ||
135 | |||
136 | if (OnConnected != null) | ||
137 | { | ||
138 | m_action = new Timer(somthing.Next(1000, 10000)); | ||
139 | m_action.Elapsed += new System.Timers.ElapsedEventHandler(m_action_Elapsed); | ||
140 | m_action.Start(); | ||
141 | OnConnected(this, EventType.CONNECTED); | ||
142 | client.Self.Jump(); | ||
143 | |||
144 | } | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | MainConsole.Instance.Error(firstname + " " + lastname, "Can't login: " + client.Network.LoginMessage); | ||
149 | if (OnDisconnected != null) | ||
150 | { | ||
151 | OnDisconnected(this, EventType.DISCONNECTED); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public void Network_OnConnected(object sender) | ||
157 | { | ||
158 | if (OnConnected != null) | ||
159 | { | ||
160 | OnConnected(this, EventType.CONNECTED); | ||
161 | } | ||
162 | } | ||
163 | |||
164 | public void Simulator_Connected(object sender) | ||
165 | { | ||
166 | } | ||
167 | |||
168 | public void Network_OnDisconnected(NetworkManager.DisconnectType reason, string message) | ||
169 | { | ||
170 | if (OnDisconnected != null) | ||
171 | { | ||
172 | OnDisconnected(this,EventType.DISCONNECTED); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | public string[] readexcuses() | ||
177 | { | ||
178 | string allexcuses = ""; | ||
179 | |||
180 | string file = Path.Combine(Util.configDir(), "excuses"); | ||
181 | if (File.Exists(file)) | ||
182 | { | ||
183 | StreamReader csr = File.OpenText(file); | ||
184 | allexcuses = csr.ReadToEnd(); | ||
185 | csr.Close(); | ||
186 | } | ||
187 | |||
188 | return allexcuses.Split(Environment.NewLine.ToCharArray()); | ||
189 | } | ||
190 | } | ||
191 | } | ||
diff --git a/OpenSim/Tools/pCampBot/PhysicsCamperBotREADME.txt b/OpenSim/Tools/pCampBot/PhysicsCamperBotREADME.txt new file mode 100644 index 0000000..afa5fbd --- /dev/null +++ b/OpenSim/Tools/pCampBot/PhysicsCamperBotREADME.txt | |||
@@ -0,0 +1,36 @@ | |||
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 | Linux: chmod the .sh runprebuild file, run it. Then run nant like; | ||
10 | |||
11 | nant -buildfile: pCampBot.build | ||
12 | |||
13 | and pCampBot.exe will end up in the regular opensim/bin folder | ||
14 | |||
15 | Windows: | ||
16 | Run the prebuild bat IN THIS FOLDER and then open the created solution and compile it. the Exe file will end up in the regular opensim bin folder. | ||
17 | |||
18 | |||
19 | -----Running the bot---- | ||
20 | |||
21 | windows: pCampBot.exe -botcount <N> -loginuri <URI> | ||
22 | *nix: mono pCampBot.exe -botcount <N> -loginuri <URI> | ||
23 | |||
24 | The names it produces are random by default, however, you can specify either a firstname or a lastname in the command line also. | ||
25 | ex: pCampBot.exe -botcount <N> -loginuri <URI> -lastname <lastname> | ||
26 | |||
27 | 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. | ||
28 | |||
29 | pCampBot.exe -botcount 1 -loginuri http://somegrid.com:8002 -firstname SomeDude -lastname SomeDude -password GobbleDeGook | ||
30 | ------- | ||
31 | |||
32 | The bot also has console commands | ||
33 | help - lists the console commands and what they do | ||
34 | shutdown - gracefully shuts down the bots | ||
35 | quit - forcefully shuts things down leaving stuff unclean | ||
36 | addbots N - adds N number of random bots. (replace 'N' with a number) \ No newline at end of file | ||
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs new file mode 100644 index 0000000..704a3f5 --- /dev/null +++ b/OpenSim/Tools/pCampBot/pCampBot.cs | |||
@@ -0,0 +1,76 @@ | |||
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 | namespace pCampBot | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Event Types from the BOT. Add new events here | ||
42 | /// </summary> | ||
43 | public enum EventType:int | ||
44 | { | ||
45 | NONE = 0, | ||
46 | CONNECTED = 1, | ||
47 | DISCONNECTED = 2 | ||
48 | } | ||
49 | |||
50 | public class pCampBot | ||
51 | { | ||
52 | [STAThread] | ||
53 | public static void Main(string[] args) | ||
54 | { | ||
55 | //Set up our nifty config.. thanks to nini | ||
56 | ArgvConfigSource cs = new ArgvConfigSource(args); | ||
57 | |||
58 | cs.AddSwitch("Startup", "botcount"); | ||
59 | cs.AddSwitch("Startup", "loginuri"); | ||
60 | cs.AddSwitch("Startup", "firstname"); | ||
61 | cs.AddSwitch("Startup", "lastname"); | ||
62 | cs.AddSwitch("Startup", "password"); | ||
63 | |||
64 | IConfig ol = cs.Configs["Startup"]; | ||
65 | int botcount = ol.GetInt("botcount", 1); | ||
66 | BotManager bm = new BotManager(); | ||
67 | |||
68 | //startup specified number of bots. 1 is the default | ||
69 | bm.dobotStartup(botcount, ol); | ||
70 | while (true) | ||
71 | { | ||
72 | MainConsole.Instance.Prompt(); | ||
73 | } | ||
74 | } | ||
75 | } | ||
76 | } | ||
diff --git a/OpenSim/Tools/pCampBot/prebuild.xml b/OpenSim/Tools/pCampBot/prebuild.xml new file mode 100644 index 0000000..bfaf408 --- /dev/null +++ b/OpenSim/Tools/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.5.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 | <Reference name="log4net"/> | ||
56 | |||
57 | <Files> | ||
58 | <Match pattern="*.cs" recurse="true"/> | ||
59 | </Files> | ||
60 | </Project> | ||
61 | |||
62 | </Solution> | ||
63 | </Prebuild> | ||
diff --git a/OpenSim/Tools/pCampBot/runprebuild.bat b/OpenSim/Tools/pCampBot/runprebuild.bat new file mode 100755 index 0000000..0427d2e --- /dev/null +++ b/OpenSim/Tools/pCampBot/runprebuild.bat | |||
@@ -0,0 +1,2 @@ | |||
1 | ..\..\..\bin\Prebuild.exe /target nant | ||
2 | ..\..\..\bin\Prebuild.exe /target vs2005 | ||
diff --git a/OpenSim/Tools/pCampBot/runprebuild.sh b/OpenSim/Tools/pCampBot/runprebuild.sh new file mode 100755 index 0000000..7215bc5 --- /dev/null +++ b/OpenSim/Tools/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 | ||