Moving examples, mapgenerator, and VisualParamGenerator to Programs folder (SVN is seriously ruined still, don't check out yet)
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@1961 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
52
Programs/examples/TestClient/Commands/System/DebugCommand.cs
Normal file
52
Programs/examples/TestClient/Commands/System/DebugCommand.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class DebugCommand : Command
|
||||
{
|
||||
public DebugCommand(TestClient testClient)
|
||||
{
|
||||
Name = "debug";
|
||||
Description = "Turn debug messages on or off. Usage: debug [level] where level is one of None, Debug, Error, Info, Warn";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
return "Usage: debug [level] where level is one of None, Debug, Error, Info, Warn";
|
||||
|
||||
if (args[0].ToLower() == "debug")
|
||||
{
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.Debug;
|
||||
return "Logging is set to Debug";
|
||||
}
|
||||
else if (args[0].ToLower() == "none")
|
||||
{
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.None;
|
||||
return "Logging is set to None";
|
||||
}
|
||||
else if (args[0].ToLower() == "warn")
|
||||
{
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.Warning;
|
||||
return "Logging is set to level Warning";
|
||||
}
|
||||
else if (args[0].ToLower() == "info")
|
||||
{
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.Info;
|
||||
return "Logging is set to level Info";
|
||||
}
|
||||
else if (args[0].ToLower() == "error")
|
||||
{
|
||||
Settings.LOG_LEVEL = Helpers.LogLevel.Error;
|
||||
return "Logging is set to level Error";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Usage: debug [level] where level is one of None, Debug, Error, Info, Warn";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Programs/examples/TestClient/Commands/System/HelpCommand.cs
Normal file
29
Programs/examples/TestClient/Commands/System/HelpCommand.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class HelpCommand: Command
|
||||
{
|
||||
public HelpCommand(TestClient testClient)
|
||||
{
|
||||
Name = "help";
|
||||
Description = "Lists available commands.";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.AppendFormat("\n\nHELP\nClient accept teleport lures from master and group members.\n");
|
||||
foreach (Command c in Client.Commands.Values)
|
||||
{
|
||||
result.AppendFormat(" * {0} - {1}\n", c.Name, c.Description);
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
Programs/examples/TestClient/Commands/System/LoadCommand.cs
Normal file
28
Programs/examples/TestClient/Commands/System/LoadCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class LoadCommand: Command
|
||||
{
|
||||
public LoadCommand(TestClient testClient)
|
||||
{
|
||||
Name = "load";
|
||||
Description = "Loads commands from a dll. (Usage: load AssemblyNameWithoutExtension)";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length < 1)
|
||||
return "Usage: load AssemblyNameWithoutExtension";
|
||||
|
||||
string filename = AppDomain.CurrentDomain.BaseDirectory + args[0] + ".dll";
|
||||
Client.RegisterAllCommands(Assembly.LoadFile(filename));
|
||||
return "Assembly " + filename + " loaded.";
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Programs/examples/TestClient/Commands/System/LoginCommand.cs
Normal file
34
Programs/examples/TestClient/Commands/System/LoginCommand.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class LoginCommand : Command
|
||||
{
|
||||
public LoginCommand(TestClient testClient)
|
||||
{
|
||||
Name = "login";
|
||||
Description = "Logs in another avatar";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length != 3 && args.Length != 4)
|
||||
return "usage: login firstname lastname password [simname]";
|
||||
|
||||
GridClient newClient = Client.ClientManager.Login(args);
|
||||
|
||||
if (newClient.Network.Connected)
|
||||
{
|
||||
return "Logged in " + newClient.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Failed to login: " + newClient.Network.LoginMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class LogoutCommand : Command
|
||||
{
|
||||
public LogoutCommand(TestClient testClient)
|
||||
{
|
||||
Name = "logout";
|
||||
Description = "Log this avatar out";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
string name = Client.ToString();
|
||||
Client.ClientManager.Logout(Client);
|
||||
return "Logged " + name + " out";
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Programs/examples/TestClient/Commands/System/MD5Command.cs
Normal file
22
Programs/examples/TestClient/Commands/System/MD5Command.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class MD5Command : Command
|
||||
{
|
||||
public MD5Command(TestClient testClient)
|
||||
{
|
||||
Name = "md5";
|
||||
Description = "Creates an MD5 hash from a given password. Usage: md5 [password]";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length == 1)
|
||||
return Helpers.MD5(args[0]);
|
||||
else
|
||||
return "Usage: md5 [password]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class PacketLogCommand : Command
|
||||
{
|
||||
public PacketLogCommand(TestClient testClient)
|
||||
{
|
||||
Name = "packetlog";
|
||||
Description = "Logs a given number of packets to an xml file. Usage: packetlog 10 tenpackets.xml";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
return "Usage: packetlog 10 tenpackets.xml";
|
||||
|
||||
return "This function is currently unimplemented";
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Programs/examples/TestClient/Commands/System/QuitCommand.cs
Normal file
24
Programs/examples/TestClient/Commands/System/QuitCommand.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class QuitCommand: Command
|
||||
{
|
||||
public QuitCommand(TestClient testClient)
|
||||
{
|
||||
Name = "quit";
|
||||
Description = "Log all avatars out and shut down";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
Client.ClientManager.LogoutAll();
|
||||
Client.ClientManager.Running = false;
|
||||
return "All avatars logged out";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class SetMasterCommand: Command
|
||||
{
|
||||
public DateTime Created = DateTime.Now;
|
||||
private LLUUID resolvedMasterKey = LLUUID.Zero;
|
||||
private ManualResetEvent keyResolution = new ManualResetEvent(false);
|
||||
private LLUUID query = LLUUID.Zero;
|
||||
|
||||
public SetMasterCommand(TestClient testClient)
|
||||
{
|
||||
Name = "setmaster";
|
||||
Description = "Sets the user name of the master user. The master user can IM to run commands. Usage: setmaster [name]";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
string masterName = String.Empty;
|
||||
for (int ct = 0; ct < args.Length;ct++)
|
||||
masterName = masterName + args[ct] + " ";
|
||||
masterName = masterName.TrimEnd();
|
||||
|
||||
if (masterName.Length == 0)
|
||||
return "Usage: setmaster [name]";
|
||||
|
||||
DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler);
|
||||
Client.Directory.OnDirPeopleReply += callback;
|
||||
|
||||
query = Client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, masterName, 0);
|
||||
|
||||
if (keyResolution.WaitOne(TimeSpan.FromMinutes(1), false))
|
||||
{
|
||||
Client.MasterKey = resolvedMasterKey;
|
||||
keyResolution.Reset();
|
||||
Client.Directory.OnDirPeopleReply -= callback;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyResolution.Reset();
|
||||
Client.Directory.OnDirPeopleReply -= callback;
|
||||
return "Unable to obtain UUID for \"" + masterName + "\". Master unchanged.";
|
||||
}
|
||||
|
||||
// Send an Online-only IM to the new master
|
||||
Client.Self.InstantMessage(
|
||||
Client.MasterKey, "You are now my master. IM me with \"help\" for a command list.");
|
||||
|
||||
return String.Format("Master set to {0} ({1})", masterName, Client.MasterKey.ToString());
|
||||
}
|
||||
|
||||
private void KeyResolvHandler(LLUUID queryid, List<DirectoryManager.AgentSearchData> matches)
|
||||
{
|
||||
if (query != queryid)
|
||||
return;
|
||||
|
||||
resolvedMasterKey = matches[0].AgentID;
|
||||
keyResolution.Set();
|
||||
query = LLUUID.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.Packets;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class SetMasterKeyCommand : Command
|
||||
{
|
||||
public DateTime Created = DateTime.Now;
|
||||
|
||||
public SetMasterKeyCommand(TestClient testClient)
|
||||
{
|
||||
Name = "setMasterKey";
|
||||
Description = "Sets the key of the master user. The master user can IM to run commands.";
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
Client.MasterKey = LLUUID.Parse(args[0]);
|
||||
|
||||
lock (Client.Network.Simulators)
|
||||
{
|
||||
for (int i = 0; i < Client.Network.Simulators.Count; i++)
|
||||
{
|
||||
Avatar master = Client.Network.Simulators[i].ObjectsAvatars.Find(
|
||||
delegate(Avatar avatar)
|
||||
{
|
||||
return avatar.ID == Client.MasterKey;
|
||||
}
|
||||
);
|
||||
|
||||
if (master != null)
|
||||
{
|
||||
Client.Self.InstantMessage(master.ID,
|
||||
"You are now my master. IM me with \"help\" for a command list.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "Master set to " + Client.MasterKey.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenMetaverse.TestClient
|
||||
{
|
||||
public class ShowEffectsCommand : Command
|
||||
{
|
||||
bool ShowEffects = false;
|
||||
|
||||
public ShowEffectsCommand(TestClient testClient)
|
||||
{
|
||||
Name = "showeffects";
|
||||
Description = "Prints out information for every viewer effect that is received. Usage: showeffects [on/off]";
|
||||
|
||||
testClient.Avatars.OnEffect += new AvatarManager.EffectCallback(Avatars_OnEffect);
|
||||
testClient.Avatars.OnLookAt += new AvatarManager.LookAtCallback(Avatars_OnLookAt);
|
||||
testClient.Avatars.OnPointAt += new AvatarManager.PointAtCallback(Avatars_OnPointAt);
|
||||
}
|
||||
|
||||
public override string Execute(string[] args, LLUUID fromAgentID)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
ShowEffects = true;
|
||||
return "Viewer effects will be shown on the console";
|
||||
}
|
||||
else if (args.Length == 1)
|
||||
{
|
||||
if (args[0] == "on")
|
||||
{
|
||||
ShowEffects = true;
|
||||
return "Viewer effects will be shown on the console";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowEffects = false;
|
||||
return "Viewer effects will not be shown";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "Usage: showeffects [on/off]";
|
||||
}
|
||||
}
|
||||
|
||||
private void Avatars_OnPointAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos,
|
||||
PointAtType pointType, float duration, LLUUID id)
|
||||
{
|
||||
if (ShowEffects)
|
||||
Console.WriteLine(
|
||||
"ViewerEffect [PointAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
|
||||
sourceID.ToString(), targetID.ToString(), targetPos, pointType, duration,
|
||||
id.ToString());
|
||||
}
|
||||
|
||||
private void Avatars_OnLookAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos,
|
||||
LookAtType lookType, float duration, LLUUID id)
|
||||
{
|
||||
if (ShowEffects)
|
||||
Console.WriteLine(
|
||||
"ViewerEffect [LookAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}",
|
||||
sourceID.ToString(), targetID.ToString(), targetPos, lookType, duration,
|
||||
id.ToString());
|
||||
}
|
||||
|
||||
private void Avatars_OnEffect(EffectType type, LLUUID sourceID, LLUUID targetID,
|
||||
LLVector3d targetPos, float duration, LLUUID id)
|
||||
{
|
||||
if (ShowEffects)
|
||||
Console.WriteLine(
|
||||
"ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}",
|
||||
type, sourceID.ToString(), targetID.ToString(), targetPos, duration,
|
||||
id.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user