Added robust command line argument system to TestTool
Fixed FollowCommand so that it sorta works. git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@619 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
1444
libsecondlife-cs/examples/TestTool/CommandLineArguments.cs
Normal file
1444
libsecondlife-cs/examples/TestTool/CommandLineArguments.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -29,16 +29,15 @@ namespace libsecondlife.TestTool
|
||||
|
||||
const float DISTANCE_BUFFER = 3.0f;
|
||||
string followName;
|
||||
int regionX;
|
||||
int regionY;
|
||||
|
||||
bool Follow(string name)
|
||||
{
|
||||
followName = name;
|
||||
|
||||
ulong regionHandle = Client.Network.CurrentSim.Region.Handle;
|
||||
regionX = (int)(regionHandle >> 32);
|
||||
regionY = (int)(regionHandle & 0xFFFFFFFF);
|
||||
//ulong regionHandle = Client.Network.CurrentSim.Region.Handle;
|
||||
//regionX = (int)(regionHandle >> 32);
|
||||
//regionY = (int)(regionHandle & 0xFFFFFFFF);
|
||||
|
||||
|
||||
foreach (Avatar av in TestTool.Avatars.Values)
|
||||
{
|
||||
@@ -46,9 +45,9 @@ namespace libsecondlife.TestTool
|
||||
else if (vecDist(av.Position, Client.Self.Position) > DISTANCE_BUFFER)
|
||||
{
|
||||
//move toward target
|
||||
ulong x = (ulong)(av.Position.X + regionX);
|
||||
ulong y = (ulong)(av.Position.Y + regionY);
|
||||
Client.Self.AutoPilot(x, y, av.Position.Z);
|
||||
ulong x = (ulong)(av.Position.X + (av.CurrentRegion.GridRegionData.X * 256));
|
||||
ulong y = (ulong)(av.Position.Y + (av.CurrentRegion.GridRegionData.Y * 256));
|
||||
Client.Self.AutoPilotLocal(Convert.ToInt32(av.Position.X), Convert.ToInt32(av.Position.Y), av.Position.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,23 +2,31 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using CommandLine;
|
||||
|
||||
namespace libsecondlife.TestTool
|
||||
{
|
||||
class Program
|
||||
public class Program
|
||||
{
|
||||
[Argument(ArgumentType.Required, HelpText="First name of the SL account to log in with.")]
|
||||
public string FirstName;
|
||||
|
||||
[Argument(ArgumentType.Required, HelpText="Last name of the SL account to log in with.")]
|
||||
public string LastName;
|
||||
|
||||
[Argument(ArgumentType.Required, HelpText="Password of the SL account to log in with.")]
|
||||
public string Password;
|
||||
|
||||
[Argument(ArgumentType.AtMostOnce, HelpText="Full account name to recieve IM commands from.")]
|
||||
public string MasterName;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
Console.WriteLine("Usage: TestTool.exe firstname lastname password [Master Name]");
|
||||
return;
|
||||
}
|
||||
Program program = new Program();
|
||||
CommandLine.Parser.ParseArgumentsWithUsage(args, program);
|
||||
|
||||
string masterName = String.Empty;
|
||||
for (int ct = 3; ct < args.Length;ct++)
|
||||
masterName = masterName + args[ct] + " ";
|
||||
|
||||
TestTool testTool = new TestTool(args[0], args[1], args[2], masterName.TrimEnd());
|
||||
TestTool testTool = new TestTool(program.FirstName, program.LastName, program.Password);
|
||||
testTool.Master = program.MasterName;
|
||||
testTool.Run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,12 +21,10 @@ namespace libsecondlife.TestTool
|
||||
LLQuaternion bodyRotation;
|
||||
System.Timers.Timer updateTimer;
|
||||
|
||||
public TestTool(string first, string last, string password, string master)
|
||||
public TestTool(string first, string last, string password)
|
||||
{
|
||||
Client = new SecondLife();
|
||||
|
||||
Master = master;
|
||||
|
||||
GroupID = LLUUID.Zero;
|
||||
Client.Objects.RequestAllObjects = true;
|
||||
bodyRotation = LLQuaternion.Identity;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="CommandLineArguments.cs" />
|
||||
<Compile Include="Commands\BalanceCommand.cs" />
|
||||
<Compile Include="Commands\FollowCommand.cs" />
|
||||
<Compile Include="Commands\SayCommand.cs" />
|
||||
|
||||
Reference in New Issue
Block a user