Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.csavinationmerge
commit
b69f679122
|
@ -1045,6 +1045,19 @@ namespace OpenSim
|
|||
MainConsole.Instance.Output("Shared Module: " + module.Name);
|
||||
}
|
||||
|
||||
m_sceneManager.ForEachScene(
|
||||
delegate(Scene scene)
|
||||
{
|
||||
m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
|
||||
foreach (IRegionModule module in scene.Modules.Values)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
m_log.Error("Region Module: " + module.Name);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MainConsole.Instance.Output("");
|
||||
break;
|
||||
|
||||
|
|
|
@ -1180,7 +1180,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||
else
|
||||
{
|
||||
OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount());
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
|
||||
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
OSDMap responsemapdata = new OSDMap();
|
||||
responsemapdata["X"] = OSD.FromInteger((int)(xstart + sp.AbsolutePosition.X));
|
||||
|
|
|
@ -86,7 +86,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public bool m_allowScriptCrossings;
|
||||
public bool m_useFlySlow;
|
||||
public bool m_usePreJump;
|
||||
public bool m_seeIntoRegionFromNeighbor;
|
||||
|
||||
protected float m_defaultDrawDistance = 255.0f;
|
||||
public float DefaultDrawDistance
|
||||
|
@ -660,14 +659,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
|
||||
|
||||
// Old
|
||||
/*
|
||||
m_simulatorVersion = simulatorVersion
|
||||
+ " (OS " + Util.GetOperatingSystemInformation() + ")"
|
||||
+ " ChilTasks:" + m_seeIntoRegionFromNeighbor.ToString()
|
||||
+ " PhysPrim:" + m_physicalPrim.ToString();
|
||||
*/
|
||||
|
||||
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
|
||||
|
||||
#region Region Config
|
||||
|
@ -714,7 +705,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_clampPrimSize = true;
|
||||
}
|
||||
|
||||
m_seeIntoRegionFromNeighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true);
|
||||
m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
|
||||
m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
|
||||
m_dontPersistBefore =
|
||||
|
@ -4201,33 +4191,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public override void Show(string[] showParams)
|
||||
{
|
||||
base.Show(showParams);
|
||||
|
||||
switch (showParams[0])
|
||||
{
|
||||
case "users":
|
||||
m_log.Error("Current Region: " + RegionInfo.RegionName);
|
||||
m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
|
||||
"Agent ID", "Session ID", "Circuit", "IP", "World");
|
||||
|
||||
ForEachScenePresence(delegate(ScenePresence sp)
|
||||
{
|
||||
m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
|
||||
sp.Firstname,
|
||||
sp.Lastname,
|
||||
sp.UUID,
|
||||
sp.ControllingClient.AgentId,
|
||||
"Unknown",
|
||||
"Unknown",
|
||||
RegionInfo.RegionName);
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#region Script Handling Methods
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -457,27 +457,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Shows various details about the sim based on the parameters supplied by the console command in openSimMain.
|
||||
/// </summary>
|
||||
/// <param name="showParams">What to show</param>
|
||||
public virtual void Show(string[] showParams)
|
||||
{
|
||||
switch (showParams[0])
|
||||
{
|
||||
case "modules":
|
||||
m_log.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
|
||||
foreach (IRegionModule module in Modules.Values)
|
||||
{
|
||||
if (!module.IsSharedModule)
|
||||
{
|
||||
m_log.Error("Region Module: " + module.Name);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this from a region module to add a command to the OpenSim console.
|
||||
/// </summary>
|
||||
|
|
|
@ -2927,7 +2927,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// only send update from root agents to other clients; children are only "listening posts"
|
||||
if (IsChildAgent)
|
||||
{
|
||||
m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent");
|
||||
m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2984,7 +2984,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// only send update from root agents to other clients; children are only "listening posts"
|
||||
if (IsChildAgent)
|
||||
{
|
||||
m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent");
|
||||
m_log.Warn("[SCENE PRESENCE]: Attempt to send avatar data from a child agent");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
if (m_pendingObjects == null)
|
||||
{
|
||||
if (!m_presence.IsChildAgent || (m_presence.Scene.m_seeIntoRegionFromNeighbor))
|
||||
if (!m_presence.IsChildAgent)
|
||||
{
|
||||
m_pendingObjects = new Queue<SceneObjectGroup>();
|
||||
|
||||
|
|
|
@ -98,6 +98,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
|
|||
"Show appearance information for each avatar in the simulator.",
|
||||
"At the moment this actually just checks that we have all the required baked textures. If not, then appearance is 'corrupt' and other avatars will continue to see a cloud.",
|
||||
ShowAppearanceInfo);
|
||||
|
||||
scene.AddCommand(
|
||||
this, "appearance send",
|
||||
"appearance send",
|
||||
"Send appearance data for each avatar in the simulator to viewers.",
|
||||
SendAppearance);
|
||||
}
|
||||
|
||||
private void SendAppearance(string module, string[] cmd)
|
||||
{
|
||||
lock (m_scenes)
|
||||
{
|
||||
foreach (Scene scene in m_scenes.Values)
|
||||
{
|
||||
scene.ForEachRootScenePresence(sp => scene.AvatarFactory.SendAppearance(sp.UUID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void ShowAppearanceInfo(string module, string[] cmd)
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.TestSuite
|
||||
{
|
||||
/// <summary>
|
||||
/// Thread/Bot manager for the application
|
||||
/// </summary>
|
||||
public class BotManager
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected CommandConsole m_console;
|
||||
protected List<PhysicsBot> m_lBot;
|
||||
protected Thread[] m_td;
|
||||
protected bool m_verbose = true;
|
||||
protected Random somthing = new Random(Environment.TickCount);
|
||||
protected int numbots = 0;
|
||||
protected IConfig Previous_config;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
|
||||
/// </summary>
|
||||
public BotManager()
|
||||
{
|
||||
m_log.Info("In bot manager");
|
||||
m_lBot = new List<PhysicsBot>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Startup number of bots specified in the starting arguments
|
||||
/// </summary>
|
||||
/// <param name="botcount">How many bots to start up</param>
|
||||
/// <param name="cs">The configuration for the bots to use</param>
|
||||
public void dobotStartup(int botcount, IConfig cs)
|
||||
{
|
||||
Previous_config = cs;
|
||||
m_td = new Thread[botcount];
|
||||
for (int i = 0; i < botcount; i++)
|
||||
{
|
||||
startupBot(i, cs);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add additional bots (and threads) to our bot pool
|
||||
/// </summary>
|
||||
/// <param name="botcount">How Many of them to add</param>
|
||||
public void addbots(int botcount)
|
||||
{
|
||||
int len = m_td.Length;
|
||||
Thread[] m_td2 = new Thread[len + botcount];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
m_td2[i] = m_td[i];
|
||||
}
|
||||
m_td = m_td2;
|
||||
int newlen = len + botcount;
|
||||
for (int i = len; i < newlen; i++)
|
||||
{
|
||||
startupBot(i, Previous_config);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This starts up the bot and stores the thread for the bot in the thread array
|
||||
/// </summary>
|
||||
/// <param name="pos">The position in the thread array to stick the bot's thread</param>
|
||||
/// <param name="cs">Configuration of the bot</param>
|
||||
public void startupBot(int pos, IConfig cs)
|
||||
{
|
||||
PhysicsBot pb = new PhysicsBot(cs);
|
||||
|
||||
pb.OnConnected += handlebotEvent;
|
||||
pb.OnDisconnected += handlebotEvent;
|
||||
if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName();
|
||||
if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName();
|
||||
|
||||
m_td[pos] = new Thread(pb.startup);
|
||||
m_td[pos].Name = "CampBot_" + pos;
|
||||
m_td[pos].IsBackground = true;
|
||||
m_td[pos].Start();
|
||||
m_lBot.Add(pb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random name for the bot
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string CreateRandomName()
|
||||
{
|
||||
string returnstring = "";
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
returnstring += chars.Substring(somthing.Next(chars.Length),1);
|
||||
}
|
||||
return returnstring;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// High level connnected/disconnected events so we can keep track of our threads by proxy
|
||||
/// </summary>
|
||||
/// <param name="callbot"></param>
|
||||
/// <param name="eventt"></param>
|
||||
public void handlebotEvent(PhysicsBot callbot, EventType eventt)
|
||||
{
|
||||
switch (eventt)
|
||||
{
|
||||
case EventType.CONNECTED:
|
||||
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected");
|
||||
numbots++;
|
||||
break;
|
||||
case EventType.DISCONNECTED:
|
||||
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected");
|
||||
m_td[m_lBot.IndexOf(callbot)].Abort();
|
||||
numbots--;
|
||||
if (numbots > 1)
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Shutting down all bots
|
||||
/// </summary>
|
||||
public void doBotShutdown()
|
||||
{
|
||||
foreach (PhysicsBot pb in m_lBot)
|
||||
{
|
||||
pb.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Nini.Config;
|
||||
|
||||
namespace OpenSim.TestSuite
|
||||
{
|
||||
/// <summary>
|
||||
/// Event Types from the BOT. Add new events here
|
||||
/// </summary>
|
||||
public enum EventType : int
|
||||
{
|
||||
NONE = 0,
|
||||
CONNECTED = 1,
|
||||
DISCONNECTED = 2
|
||||
}
|
||||
|
||||
public class TestSuite
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// TODO: config parser
|
||||
|
||||
// TODO: load tests from addings
|
||||
|
||||
// TODO: create base bot cloud for use in tests
|
||||
|
||||
IConfig config = ParseConfig(args);
|
||||
if (config.Get("help") != null || config.Get("loginuri") == null)
|
||||
{
|
||||
Help();
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: unused: int botcount = config.GetInt("botcount", 1);
|
||||
|
||||
// BotManager bm = new BotManager();
|
||||
|
||||
Utils.TestPass("Completed Startup");
|
||||
}
|
||||
}
|
||||
|
||||
private static IConfig ParseConfig(String[] args)
|
||||
{
|
||||
//Set up our nifty config.. thanks to nini
|
||||
ArgvConfigSource cs = new ArgvConfigSource(args);
|
||||
|
||||
// TODO: unused: cs.AddSwitch("Startup", "botcount","n");
|
||||
cs.AddSwitch("Startup", "loginuri","l");
|
||||
cs.AddSwitch("Startup", "firstname");
|
||||
cs.AddSwitch("Startup", "lastname");
|
||||
cs.AddSwitch("Startup", "password");
|
||||
cs.AddSwitch("Startup", "help","h");
|
||||
|
||||
IConfig ol = cs.Configs["Startup"];
|
||||
return ol;
|
||||
}
|
||||
|
||||
private static void Help()
|
||||
{
|
||||
Console.WriteLine(
|
||||
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +
|
||||
"Spawns a set of bots to test an OpenSim region\n\n" +
|
||||
" -l, -loginuri loginuri for sim to log into (required)\n" +
|
||||
// TODO: unused: " -n, -botcount number of bots to start (default: 1)\n" +
|
||||
" -firstname first name for the bot(s) (default: random string)\n" +
|
||||
" -lastname lastname for the bot(s) (default: random string)\n" +
|
||||
" -password password for the bots(s) (default: random string)\n" +
|
||||
" -h, -help show this message"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using Timer=System.Timers.Timer;
|
||||
|
||||
namespace OpenSim.TestSuite
|
||||
{
|
||||
public class PhysicsBot
|
||||
{
|
||||
public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events
|
||||
public IConfig startupConfig; // bot config, passed from BotManager
|
||||
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public string password;
|
||||
public string loginURI;
|
||||
|
||||
public event AnEvent OnConnected;
|
||||
public event AnEvent OnDisconnected;
|
||||
|
||||
protected Timer m_action; // Action Timer
|
||||
|
||||
protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here
|
||||
|
||||
//New instance of a SecondLife client
|
||||
public GridClient client = new GridClient();
|
||||
|
||||
protected string[] talkarray;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="bsconfig">nini config for the bot</param>
|
||||
public PhysicsBot(IConfig bsconfig)
|
||||
{
|
||||
startupConfig = bsconfig;
|
||||
readconfig();
|
||||
talkarray = readexcuses();
|
||||
}
|
||||
|
||||
//We do our actions here. This is where one would
|
||||
//add additional steps and/or things the bot should do
|
||||
|
||||
void m_action_Elapsed(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
//client.Throttle.Task = 500000f;
|
||||
//client.Throttle.Set();
|
||||
int walkorrun = somthing.Next(4); // Randomize between walking and running. The greater this number,
|
||||
// the greater the bot's chances to walk instead of run.
|
||||
if (walkorrun == 0)
|
||||
{
|
||||
client.Self.Movement.AlwaysRun = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
client.Self.Movement.AlwaysRun = false;
|
||||
}
|
||||
|
||||
// TODO: unused: Vector3 pos = client.Self.SimPosition;
|
||||
Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
|
||||
client.Self.Movement.TurnToward(newpos);
|
||||
|
||||
for (int i = 0; i < 2000; i++)
|
||||
{
|
||||
client.Self.Movement.AtPos = true;
|
||||
Thread.Sleep(somthing.Next(25, 75)); // Makes sure the bots keep walking for this time.
|
||||
}
|
||||
client.Self.Jump(true);
|
||||
|
||||
string randomf = talkarray[somthing.Next(talkarray.Length)];
|
||||
if (talkarray.Length > 1 && randomf.Length > 1)
|
||||
client.Self.Chat(randomf, 0, ChatType.Normal);
|
||||
|
||||
//Thread.Sleep(somthing.Next(1, 10)); // Apparently its better without it right now.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the Nini config and initialize
|
||||
/// </summary>
|
||||
public void readconfig()
|
||||
{
|
||||
firstname = startupConfig.GetString("firstname", "random");
|
||||
lastname = startupConfig.GetString("lastname", "random");
|
||||
password = startupConfig.GetString("password", "12345");
|
||||
loginURI = startupConfig.GetString("loginuri");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells LibSecondLife to logout and disconnect. Raises the disconnect events once it finishes.
|
||||
/// </summary>
|
||||
public void shutdown()
|
||||
{
|
||||
client.Network.Logout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is the bot startup loop.
|
||||
/// </summary>
|
||||
public void startup()
|
||||
{
|
||||
client.Settings.LOGIN_SERVER = loginURI;
|
||||
client.Network.LoginProgress += this.Network_LoginProgress;
|
||||
client.Network.SimConnected += this.Network_SimConnected;
|
||||
client.Network.Disconnected += this.Network_OnDisconnected;
|
||||
if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name"))
|
||||
{
|
||||
|
||||
if (OnConnected != null)
|
||||
{
|
||||
m_action = new Timer(somthing.Next(1000, 10000));
|
||||
m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
|
||||
m_action.Start();
|
||||
OnConnected(this, EventType.CONNECTED);
|
||||
client.Self.Jump(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output(firstname + " " + lastname + "Can't login: " + client.Network.LoginMessage);
|
||||
if (OnDisconnected != null)
|
||||
{
|
||||
OnDisconnected(this, EventType.DISCONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Network_LoginProgress(object sender, LoginProgressEventArgs args)
|
||||
{
|
||||
if (args.Status == LoginStatus.Success)
|
||||
{
|
||||
if (OnConnected != null)
|
||||
{
|
||||
OnConnected(this, EventType.CONNECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Network_SimConnected(object sender, SimConnectedEventArgs args)
|
||||
{
|
||||
}
|
||||
|
||||
public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
|
||||
{
|
||||
if (OnDisconnected != null)
|
||||
{
|
||||
OnDisconnected(this, EventType.DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
||||
public string[] readexcuses()
|
||||
{
|
||||
string allexcuses = "";
|
||||
|
||||
string file = Path.Combine(Util.configDir(), "pCampBotSentences.txt");
|
||||
if (File.Exists(file))
|
||||
{
|
||||
StreamReader csr = File.OpenText(file);
|
||||
allexcuses = csr.ReadToEnd();
|
||||
csr.Close();
|
||||
}
|
||||
|
||||
return allexcuses.Split(Environment.NewLine.ToCharArray());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
OpenSim Test Suite
|
||||
------------------------------------------------------------
|
||||
|
||||
The eventual goal of the OpenSim Test Suite is to provide a framework
|
||||
and a set of tests to do system level regression testing of OpenSim.
|
||||
In short:
|
||||
|
||||
OpenSim Test Suite will have Test Modules (Mono Addins?) that will
|
||||
verify certain paths in the code. Some early modules may be (subject
|
||||
to change):
|
||||
|
||||
* Login Tests
|
||||
- Attempt to Log in 1, 5, 20 bots.
|
||||
* Basic Walk Tests
|
||||
- Attempt to Log in and move about in well known tracks
|
||||
- Repeat with 5, 20 bots
|
||||
* Basic Construct Tests
|
||||
- Construct Simple Objects in World
|
||||
- Ensure bots can see other objects constructed
|
||||
* Basic Asset Tests
|
||||
- Construct Simple Objects in World with Textures
|
||||
- Pull Objects and Textures
|
||||
|
||||
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenSim.TestSuite
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
enum Result
|
||||
{
|
||||
Fail = 0,
|
||||
Pass = 1,
|
||||
Skip = 3
|
||||
}
|
||||
|
||||
private static String ResultToString(Result r)
|
||||
{
|
||||
if (r == Result.Pass)
|
||||
{
|
||||
return "PASS";
|
||||
}
|
||||
else if (r == Result.Fail)
|
||||
{
|
||||
return "FAIL";
|
||||
}
|
||||
else if (r == Result.Skip)
|
||||
{
|
||||
return "SKIP";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
private static void TestResult(Result r, String msg)
|
||||
{
|
||||
Console.WriteLine("[{0}]: {1}", ResultToString(r), msg);
|
||||
}
|
||||
|
||||
public static void TestFail(String msg)
|
||||
{
|
||||
TestResult(Result.Fail, msg);
|
||||
}
|
||||
|
||||
public static void TestPass(String msg)
|
||||
{
|
||||
TestResult(Result.Pass, msg);
|
||||
}
|
||||
|
||||
public static void TestSkip(String msg)
|
||||
{
|
||||
TestResult(Result.Skip, msg);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,17 +49,22 @@ namespace pCampBot
|
|||
|
||||
protected CommandConsole m_console;
|
||||
protected List<PhysicsBot> m_lBot;
|
||||
protected Thread[] m_td;
|
||||
protected bool m_verbose = true;
|
||||
protected Random somthing = new Random(Environment.TickCount);
|
||||
protected int numbots = 0;
|
||||
protected IConfig Previous_config;
|
||||
public IConfig Config { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Track the assets we have and have not received so we don't endlessly repeat requests.
|
||||
/// </summary>
|
||||
public Dictionary<UUID, bool> AssetsReceived { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor Creates MainConsole.Instance to take commands and provide the place to write data
|
||||
/// </summary>
|
||||
public BotManager()
|
||||
{
|
||||
AssetsReceived = new Dictionary<UUID, bool>();
|
||||
|
||||
m_console = CreateConsole();
|
||||
MainConsole.Instance = m_console;
|
||||
|
||||
|
@ -81,16 +86,21 @@ namespace pCampBot
|
|||
|
||||
m_console.Commands.AddCommand("bot", false, "shutdown",
|
||||
"shutdown",
|
||||
"Gracefully shut down bots", HandleShutdown);
|
||||
"Shutdown bots and exit", HandleShutdown);
|
||||
|
||||
m_console.Commands.AddCommand("bot", false, "quit",
|
||||
"quit",
|
||||
"Force quit (DANGEROUS, try shutdown first)",
|
||||
"Shutdown bots and exit",
|
||||
HandleShutdown);
|
||||
|
||||
m_console.Commands.AddCommand("bot", false, "add bots",
|
||||
"add bots <number>",
|
||||
"Add more bots", HandleAddBots);
|
||||
m_console.Commands.AddCommand("bot", false, "show status",
|
||||
"show status",
|
||||
"Shows the status of all bots",
|
||||
HandleShowStatus);
|
||||
|
||||
// m_console.Commands.AddCommand("bot", false, "add bots",
|
||||
// "add bots <number>",
|
||||
// "Add more bots", HandleAddBots);
|
||||
|
||||
m_lBot = new List<PhysicsBot>();
|
||||
}
|
||||
|
@ -102,69 +112,63 @@ namespace pCampBot
|
|||
/// <param name="cs">The configuration for the bots to use</param>
|
||||
public void dobotStartup(int botcount, IConfig cs)
|
||||
{
|
||||
Previous_config = cs;
|
||||
m_td = new Thread[botcount];
|
||||
Config = cs;
|
||||
|
||||
string firstName = cs.GetString("firstname");
|
||||
string lastNameStem = cs.GetString("lastname");
|
||||
string password = cs.GetString("password");
|
||||
string loginUri = cs.GetString("loginuri");
|
||||
|
||||
for (int i = 0; i < botcount; i++)
|
||||
{
|
||||
startupBot(i, cs);
|
||||
string lastName = string.Format("{0}_{1}", lastNameStem, i);
|
||||
startupBot(i, this, firstName, lastName, password, loginUri);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add additional bots (and threads) to our bot pool
|
||||
/// </summary>
|
||||
/// <param name="botcount">How Many of them to add</param>
|
||||
public void addbots(int botcount)
|
||||
{
|
||||
int len = m_td.Length;
|
||||
Thread[] m_td2 = new Thread[len + botcount];
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
m_td2[i] = m_td[i];
|
||||
}
|
||||
m_td = m_td2;
|
||||
int newlen = len + botcount;
|
||||
for (int i = len; i < newlen; i++)
|
||||
{
|
||||
startupBot(i, Previous_config);
|
||||
}
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Add additional bots (and threads) to our bot pool
|
||||
// /// </summary>
|
||||
// /// <param name="botcount">How Many of them to add</param>
|
||||
// public void addbots(int botcount)
|
||||
// {
|
||||
// int len = m_td.Length;
|
||||
// Thread[] m_td2 = new Thread[len + botcount];
|
||||
// for (int i = 0; i < len; i++)
|
||||
// {
|
||||
// m_td2[i] = m_td[i];
|
||||
// }
|
||||
// m_td = m_td2;
|
||||
// int newlen = len + botcount;
|
||||
// for (int i = len; i < newlen; i++)
|
||||
// {
|
||||
// startupBot(i, Config);
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// This starts up the bot and stores the thread for the bot in the thread array
|
||||
/// </summary>
|
||||
/// <param name="pos">The position in the thread array to stick the bot's thread</param>
|
||||
/// <param name="cs">Configuration of the bot</param>
|
||||
public void startupBot(int pos, IConfig cs)
|
||||
/// <param name="firstName">First name</param>
|
||||
/// <param name="lastName">Last name</param>
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="loginUri">Login URI</param>
|
||||
public void startupBot(int pos, BotManager bm, string firstName, string lastName, string password, string loginUri)
|
||||
{
|
||||
PhysicsBot pb = new PhysicsBot(cs);
|
||||
PhysicsBot pb = new PhysicsBot(bm, firstName, lastName, password, loginUri);
|
||||
|
||||
pb.OnConnected += handlebotEvent;
|
||||
pb.OnDisconnected += handlebotEvent;
|
||||
if (cs.GetString("firstname", "random") == "random") pb.firstname = CreateRandomName();
|
||||
if (cs.GetString("lastname", "random") == "random") pb.lastname = CreateRandomName();
|
||||
|
||||
m_td[pos] = new Thread(pb.startup);
|
||||
m_td[pos].Name = "CampBot_" + pos;
|
||||
m_td[pos].IsBackground = true;
|
||||
m_td[pos].Start();
|
||||
lock (m_lBot)
|
||||
m_lBot.Add(pb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a random name for the bot
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string CreateRandomName()
|
||||
{
|
||||
string returnstring = "";
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
returnstring += chars.Substring(somthing.Next(chars.Length),1);
|
||||
}
|
||||
return returnstring;
|
||||
Thread pbThread = new Thread(pb.startup);
|
||||
pbThread.Name = pb.Name;
|
||||
pbThread.IsBackground = true;
|
||||
pbThread.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -172,19 +176,20 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
/// <param name="callbot"></param>
|
||||
/// <param name="eventt"></param>
|
||||
public void handlebotEvent(PhysicsBot callbot, EventType eventt)
|
||||
private void handlebotEvent(PhysicsBot callbot, EventType eventt)
|
||||
{
|
||||
switch (eventt)
|
||||
{
|
||||
case EventType.CONNECTED:
|
||||
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Connected");
|
||||
m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Connected");
|
||||
numbots++;
|
||||
// m_log.InfoFormat("NUMBOTS {0}", numbots);
|
||||
break;
|
||||
case EventType.DISCONNECTED:
|
||||
m_log.Info("[ " + callbot.firstname + " " + callbot.lastname + "]: Disconnected");
|
||||
m_td[m_lBot.IndexOf(callbot)].Abort();
|
||||
m_log.Info("[" + callbot.FirstName + " " + callbot.LastName + "]: Disconnected");
|
||||
numbots--;
|
||||
if (numbots >1)
|
||||
// m_log.InfoFormat("NUMBOTS {0}", numbots);
|
||||
if (numbots <= 0)
|
||||
Environment.Exit(0);
|
||||
break;
|
||||
}
|
||||
|
@ -195,11 +200,10 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
public void doBotShutdown()
|
||||
{
|
||||
lock (m_lBot)
|
||||
foreach (PhysicsBot pb in m_lBot)
|
||||
{
|
||||
pb.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Standard CreateConsole routine
|
||||
|
@ -216,6 +220,21 @@ namespace pCampBot
|
|||
doBotShutdown();
|
||||
}
|
||||
|
||||
private void HandleShowStatus(string module, string[] cmd)
|
||||
{
|
||||
string outputFormat = "{0,-30} {1,-14}";
|
||||
MainConsole.Instance.OutputFormat(outputFormat, "Name", "Status");
|
||||
|
||||
lock (m_lBot)
|
||||
{
|
||||
foreach (PhysicsBot pb in m_lBot)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
outputFormat, pb.Name, (pb.IsConnected ? "Connected" : "Disconnected"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private void HandleQuit(string module, string[] cmd)
|
||||
{
|
||||
|
@ -223,17 +242,17 @@ namespace pCampBot
|
|||
Environment.Exit(0);
|
||||
}
|
||||
*/
|
||||
|
||||
private void HandleAddBots(string module, string[] cmd)
|
||||
{
|
||||
int newbots = 0;
|
||||
|
||||
if (cmd.Length > 2)
|
||||
{
|
||||
Int32.TryParse(cmd[2], out newbots);
|
||||
}
|
||||
if (newbots > 0)
|
||||
addbots(newbots);
|
||||
}
|
||||
//
|
||||
// private void HandleAddBots(string module, string[] cmd)
|
||||
// {
|
||||
// int newbots = 0;
|
||||
//
|
||||
// if (cmd.Length > 2)
|
||||
// {
|
||||
// Int32.TryParse(cmd[2], out newbots);
|
||||
// }
|
||||
// if (newbots > 0)
|
||||
// addbots(newbots);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,10 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Timers;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Assets;
|
||||
using Nini.Config;
|
||||
|
@ -42,43 +44,70 @@ namespace pCampBot
|
|||
{
|
||||
public class PhysicsBot
|
||||
{
|
||||
public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events
|
||||
public IConfig startupConfig; // bot config, passed from BotManager
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public string firstname;
|
||||
public string lastname;
|
||||
public string password;
|
||||
public string loginURI;
|
||||
public delegate void AnEvent(PhysicsBot callbot, EventType someevent); // event delegate for bot events
|
||||
|
||||
public BotManager BotManager { get; private set; }
|
||||
private IConfig startupConfig; // bot config, passed from BotManager
|
||||
|
||||
/// <summary>
|
||||
/// Is this bot connected to the grid?
|
||||
/// </summary>
|
||||
public bool IsConnected { get; private set; }
|
||||
|
||||
public string FirstName { get; private set; }
|
||||
public string LastName { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Password { get; private set; }
|
||||
public string LoginUri { get; private set; }
|
||||
public string saveDir;
|
||||
public string wear;
|
||||
|
||||
public event AnEvent OnConnected;
|
||||
public event AnEvent OnDisconnected;
|
||||
|
||||
protected Timer m_action; // Action Timer
|
||||
/// <summary>
|
||||
/// Keep a track of the continuously acting thread so that we can abort it.
|
||||
/// </summary>
|
||||
private Thread m_actionThread;
|
||||
|
||||
protected List<uint> objectIDs = new List<uint>();
|
||||
|
||||
protected Random somthing = new Random(Environment.TickCount);// We do stuff randomly here
|
||||
|
||||
//New instance of a SecondLife client
|
||||
/// <summary>
|
||||
/// New instance of a SecondLife client
|
||||
/// </summary>
|
||||
public GridClient client = new GridClient();
|
||||
|
||||
protected string[] talkarray;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="bsconfig">nini config for the bot</param>
|
||||
public PhysicsBot(IConfig bsconfig)
|
||||
/// <param name="bm"></param>
|
||||
/// <param name="firstName"></param>
|
||||
/// <param name="lastName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="loginUri"></param>
|
||||
public PhysicsBot(BotManager bm, string firstName, string lastName, string password, string loginUri)
|
||||
{
|
||||
startupConfig = bsconfig;
|
||||
FirstName = firstName;
|
||||
LastName = lastName;
|
||||
Name = string.Format("{0} {1}", FirstName, LastName);
|
||||
Password = password;
|
||||
LoginUri = loginUri;
|
||||
|
||||
BotManager = bm;
|
||||
startupConfig = bm.Config;
|
||||
readconfig();
|
||||
talkarray = readexcuses();
|
||||
}
|
||||
|
||||
//We do our actions here. This is where one would
|
||||
//add additional steps and/or things the bot should do
|
||||
|
||||
void m_action_Elapsed(object sender, ElapsedEventArgs e)
|
||||
private void Action()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
@ -95,7 +124,7 @@ namespace pCampBot
|
|||
}
|
||||
|
||||
// TODO: unused: Vector3 pos = client.Self.SimPosition;
|
||||
Vector3 newpos = new Vector3(somthing.Next(255), somthing.Next(255), somthing.Next(255));
|
||||
Vector3 newpos = new Vector3(somthing.Next(1, 254), somthing.Next(1, 254), somthing.Next(1, 254));
|
||||
client.Self.Movement.TurnToward(newpos);
|
||||
|
||||
client.Self.Movement.AtPos = true;
|
||||
|
@ -116,10 +145,6 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
public void readconfig()
|
||||
{
|
||||
firstname = startupConfig.GetString("firstname", "random");
|
||||
lastname = startupConfig.GetString("lastname", "random");
|
||||
password = startupConfig.GetString("password", "12345");
|
||||
loginURI = startupConfig.GetString("loginuri");
|
||||
wear = startupConfig.GetString("wear","no");
|
||||
}
|
||||
|
||||
|
@ -128,6 +153,9 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
public void shutdown()
|
||||
{
|
||||
if (m_actionThread != null)
|
||||
m_actionThread.Abort();
|
||||
|
||||
client.Network.Logout();
|
||||
}
|
||||
|
||||
|
@ -136,7 +164,7 @@ namespace pCampBot
|
|||
/// </summary>
|
||||
public void startup()
|
||||
{
|
||||
client.Settings.LOGIN_SERVER = loginURI;
|
||||
client.Settings.LOGIN_SERVER = LoginUri;
|
||||
client.Settings.ALWAYS_DECODE_OBJECTS = false;
|
||||
client.Settings.AVATAR_TRACKING = false;
|
||||
client.Settings.OBJECT_TRACKING = false;
|
||||
|
@ -155,17 +183,16 @@ namespace pCampBot
|
|||
client.Network.SimConnected += this.Network_SimConnected;
|
||||
client.Network.Disconnected += this.Network_OnDisconnected;
|
||||
client.Objects.ObjectUpdate += Objects_NewPrim;
|
||||
//client.Assets.OnAssetReceived += Asset_ReceivedCallback;
|
||||
if (client.Network.Login(firstname, lastname, password, "pCampBot", "Your name"))
|
||||
|
||||
if (client.Network.Login(FirstName, LastName, Password, "pCampBot", "Your name"))
|
||||
{
|
||||
if (OnConnected != null)
|
||||
{
|
||||
m_action = new Timer(somthing.Next(1000, 10000));
|
||||
m_action.Enabled = true;
|
||||
m_action.AutoReset = false;
|
||||
m_action.Elapsed += new ElapsedEventHandler(m_action_Elapsed);
|
||||
m_action.Start();
|
||||
OnConnected(this, EventType.CONNECTED);
|
||||
IsConnected = true;
|
||||
|
||||
Thread.Sleep(somthing.Next(1000, 10000));
|
||||
m_actionThread = new Thread(Action);
|
||||
m_actionThread.Start();
|
||||
|
||||
// OnConnected(this, EventType.CONNECTED);
|
||||
if (wear == "save")
|
||||
{
|
||||
client.Appearance.SetPreviousAppearance();
|
||||
|
@ -177,10 +204,11 @@ namespace pCampBot
|
|||
}
|
||||
client.Self.Jump(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output(firstname + " " + lastname + " Can't login: " + client.Network.LoginMessage);
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"{0} {1} cannot login: {2}", FirstName, LastName, client.Network.LoginMessage);
|
||||
|
||||
if (OnDisconnected != null)
|
||||
{
|
||||
OnDisconnected(this, EventType.DISCONNECTED);
|
||||
|
@ -190,7 +218,7 @@ namespace pCampBot
|
|||
|
||||
public void SaveDefaultAppearance()
|
||||
{
|
||||
saveDir = "MyAppearance/" + firstname + "_" + lastname;
|
||||
saveDir = "MyAppearance/" + FirstName + "_" + LastName;
|
||||
if (!Directory.Exists(saveDir))
|
||||
{
|
||||
Directory.CreateDirectory(saveDir);
|
||||
|
@ -366,8 +394,21 @@ namespace pCampBot
|
|||
|
||||
public void Network_OnDisconnected(object sender, DisconnectedEventArgs args)
|
||||
{
|
||||
if (OnDisconnected != null)
|
||||
// m_log.ErrorFormat("Fired Network_OnDisconnected");
|
||||
|
||||
// if (
|
||||
// (args.Reason == NetworkManager.DisconnectType.SimShutdown
|
||||
// || args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
|
||||
// && OnDisconnected != null)
|
||||
|
||||
if (
|
||||
(args.Reason == NetworkManager.DisconnectType.ClientInitiated
|
||||
|| args.Reason == NetworkManager.DisconnectType.ServerInitiated
|
||||
|| args.Reason == NetworkManager.DisconnectType.NetworkTimeout)
|
||||
&& OnDisconnected != null)
|
||||
// if (OnDisconnected != null)
|
||||
{
|
||||
IsConnected = false;
|
||||
OnDisconnected(this, EventType.DISCONNECTED);
|
||||
}
|
||||
}
|
||||
|
@ -382,27 +423,40 @@ namespace pCampBot
|
|||
{
|
||||
if (prim.Textures.DefaultTexture.TextureID != UUID.Zero)
|
||||
{
|
||||
client.Assets.RequestImage(prim.Textures.DefaultTexture.TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
|
||||
}
|
||||
for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
|
||||
{
|
||||
if (prim.Textures.FaceTextures[i] != null)
|
||||
{
|
||||
if (prim.Textures.FaceTextures[i].TextureID != UUID.Zero)
|
||||
{
|
||||
client.Assets.RequestImage(prim.Textures.FaceTextures[i].TextureID, ImageType.Normal, Asset_TextureCallback_Texture);
|
||||
GetTexture(prim.Textures.DefaultTexture.TextureID);
|
||||
}
|
||||
|
||||
for (int i = 0; i < prim.Textures.FaceTextures.Length; i++)
|
||||
{
|
||||
UUID textureID = prim.Textures.FaceTextures[i].TextureID;
|
||||
|
||||
if (textureID != null && textureID != UUID.Zero)
|
||||
{
|
||||
GetTexture(textureID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prim.Sculpt.SculptTexture != UUID.Zero)
|
||||
{
|
||||
client.Assets.RequestImage(prim.Sculpt.SculptTexture, ImageType.Normal, Asset_TextureCallback_Texture);
|
||||
GetTexture(prim.Sculpt.SculptTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GetTexture(UUID textureID)
|
||||
{
|
||||
lock (BotManager.AssetsReceived)
|
||||
{
|
||||
// Don't request assets more than once.
|
||||
if (BotManager.AssetsReceived.ContainsKey(textureID))
|
||||
return;
|
||||
|
||||
BotManager.AssetsReceived[textureID] = false;
|
||||
client.Assets.RequestImage(textureID, ImageType.Normal, Asset_TextureCallback_Texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Asset_TextureCallback_Texture(TextureRequestState state, AssetTexture assetTexture)
|
||||
{
|
||||
|
@ -411,10 +465,13 @@ namespace pCampBot
|
|||
|
||||
public void Asset_ReceivedCallback(AssetDownload transfer, Asset asset)
|
||||
{
|
||||
if (wear == "save")
|
||||
{
|
||||
SaveAsset((AssetWearable) asset);
|
||||
}
|
||||
lock (BotManager.AssetsReceived)
|
||||
BotManager.AssetsReceived[asset.AssetID] = true;
|
||||
|
||||
// if (wear == "save")
|
||||
// {
|
||||
// SaveAsset((AssetWearable) asset);
|
||||
// }
|
||||
}
|
||||
|
||||
public string[] readexcuses()
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
This is the PhysicsCamperbot libslBot tester.
|
||||
|
||||
This is designed to be run in standalone mode with authorize accounts
|
||||
turned off as a way to stress test the simulator. It creates <N>
|
||||
clients that log in, randomly jump/walk around, and say excuses from
|
||||
This is designed to stress test the simulator. It creates <N>
|
||||
clients that log in, randomly jump/walk around, and can say excuses from
|
||||
the BOFH.
|
||||
|
||||
Bots must have accounts already created. Each bot will have the same firstname and password
|
||||
but their lastname will be appended with _<bot-number> starting from 0. So if you have two bots called ima bot, their
|
||||
first names will be ima_bot_0 and ima_bot_1.
|
||||
|
||||
*** WARNING ***
|
||||
Using this bot on a public grid could get you banned permanently, so
|
||||
just say No! to griefing!
|
||||
|
@ -21,19 +24,8 @@ pCampBot.exe will end up in the regular opensim/bin folder
|
|||
|
||||
----- Running the bot -----
|
||||
|
||||
windows: pCampBot.exe -botcount <N> -loginuri <URI>
|
||||
*nix: mono pCampBot.exe -botcount <N> -loginuri <URI>
|
||||
|
||||
The names it produces are random by default, however, you can specify
|
||||
either a firstname or a lastname in the command line also.
|
||||
|
||||
ex: pCampBot.exe -botcount <N> -loginuri <URI> -lastname <lastname>
|
||||
|
||||
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.
|
||||
|
||||
pCampBot.exe -botcount 1 -loginuri http://somegrid.com:8002 -firstname SomeDude -lastname SomeDude -password GobbleDeGook
|
||||
windows: pCampBot.exe -botcount <N> -loginuri <URI> -firstname <bot-first-name> -lastname <bot-last-name-stem> -password <bot-password>
|
||||
*nix: mono pCampBot.exe -botcount <N> -loginuri <URI> -firstname <bot-first-name> -lastname <bot-last-name-stem> -password <bot-password>
|
||||
|
||||
----- Commands -----
|
||||
|
||||
|
@ -41,4 +33,3 @@ The bot has console commands:
|
|||
help - lists the console commands and what they do
|
||||
shutdown - gracefully shuts down the bots
|
||||
quit - forcefully shuts things down leaving stuff unclean
|
||||
addbots N - adds N number of random bots. (replace 'N' with a number)
|
||||
|
|
|
@ -95,9 +95,9 @@ namespace pCampBot
|
|||
"Spawns a set of bots to test an OpenSim region\n\n" +
|
||||
" -l, -loginuri loginuri for sim to log into (required)\n" +
|
||||
" -n, -botcount number of bots to start (default: 1)\n" +
|
||||
" -firstname first name for the bot(s) (default: random string)\n" +
|
||||
" -lastname lastname for the bot(s) (default: random string)\n" +
|
||||
" -password password for the bots(s) (default: random string)\n" +
|
||||
" -firstname first name for the bots\n" +
|
||||
" -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
|
||||
" -password password for the bots\n" +
|
||||
" -wear set appearance folder to load from (default: no)\n" +
|
||||
" -h, -help show this message"
|
||||
);
|
||||
|
|
|
@ -170,9 +170,6 @@
|
|||
; Objects will always be considered for persistance in the next sweep if the first change occurred this number of seconds ago
|
||||
MaximumTimeBeforePersistenceConsidered = 600
|
||||
|
||||
; Should avatars in neighbor sims see objects in this sim?
|
||||
see_into_this_sim_from_neighbor = true
|
||||
|
||||
; ##
|
||||
; ## PHYSICS
|
||||
; ##
|
||||
|
|
Binary file not shown.
28
prebuild.xml
28
prebuild.xml
|
@ -2581,34 +2581,6 @@
|
|||
</Files>
|
||||
</Project>
|
||||
|
||||
<!-- Test Suite -->
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.TestSuite" path="OpenSim/TestSuite" type="Exe">
|
||||
<Configuration name="Debug">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
<Configuration name="Release">
|
||||
<Options>
|
||||
<OutputPath>../../bin/</OutputPath>
|
||||
</Options>
|
||||
</Configuration>
|
||||
|
||||
<ReferencePath>../../bin/</ReferencePath>
|
||||
<Reference name="System"/>
|
||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="Nini" path="../../bin/"/>
|
||||
<Reference name="log4net" path="../../bin/"/>
|
||||
|
||||
<Files>
|
||||
<Match pattern="*.cs" recurse="true"/>
|
||||
</Files>
|
||||
</Project>
|
||||
|
||||
<!-- Test Clients -->
|
||||
<Project frameworkVersion="v3_5" name="OpenSim.Tests.Clients.GridClient" path="OpenSim/Tests/Clients/Grid" type="Exe">
|
||||
<Configuration name="Debug">
|
||||
|
|
Loading…
Reference in New Issue