2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using libsecondlife;
|
|
|
|
|
using libsecondlife.Packets;
|
|
|
|
|
|
|
|
|
|
namespace libsecondlife.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]);
|
|
|
|
|
|
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
|
|
|
{
|
2007-08-20 09:26:21 +00:00
|
|
|
lock (Client.Network.Simulators[i].Objects.Avatars)
|
|
|
|
|
{
|
|
|
|
|
foreach (Avatar avatar in Client.Network.Simulators[i].Objects.Avatars.Values)
|
|
|
|
|
{
|
|
|
|
|
if (avatar.ID == Client.MasterKey)
|
|
|
|
|
{
|
|
|
|
|
Client.Self.InstantMessage(avatar.ID,
|
|
|
|
|
"You are now my master. IM me with \"help\" for a command list.");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 09:26:21 +00:00
|
|
|
return "Master set to " + Client.MasterKey.ToStringHyphenated();
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|