2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
|
|
|
|
using OpenMetaverse.Packets;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
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.";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.TestClient;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-07-25 05:15:05 +00:00
|
|
|
Client.MasterKey = UUID.Parse(args[0]);
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2007-08-20 09:26:21 +00:00
|
|
|
lock (Client.Network.Simulators)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2007-08-20 09:26:21 +00:00
|
|
|
for (int i = 0; i < Client.Network.Simulators.Count; i++)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-01-03 21:55:49 +00:00
|
|
|
Avatar master = Client.Network.Simulators[i].ObjectsAvatars.Find(
|
2020-05-09 12:59:06 -05:00
|
|
|
avatar => avatar.ID == Client.MasterKey
|
2007-08-29 08:55:53 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (master != null)
|
|
|
|
|
{
|
|
|
|
|
Client.Self.InstantMessage(master.ID,
|
|
|
|
|
"You are now my master. IM me with \"help\" for a command list.");
|
|
|
|
|
break;
|
2007-08-20 09:26:21 +00:00
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-30 13:15:31 +00:00
|
|
|
return "Master set to " + Client.MasterKey.ToString();
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|