2007-11-06 09:26:10 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2007-11-06 09:26:10 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-11-06 09:26:10 +00:00
|
|
|
{
|
2008-05-01 20:58:20 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Display a list of all agent locations in a specified region
|
|
|
|
|
/// </summary>
|
2007-11-06 09:26:10 +00:00
|
|
|
public class AgentLocationsCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public AgentLocationsCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "agentlocations";
|
|
|
|
|
Description = "Downloads all of the agent locations in a specified region. Usage: agentlocations [regionhandle]";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Simulator;
|
2007-11-06 09:26:10 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-11-06 09:26:10 +00:00
|
|
|
{
|
|
|
|
|
ulong regionHandle;
|
|
|
|
|
|
|
|
|
|
if (args.Length == 0)
|
|
|
|
|
regionHandle = Client.Network.CurrentSim.Handle;
|
|
|
|
|
else if (!(args.Length == 1 && UInt64.TryParse(args[0], out regionHandle)))
|
|
|
|
|
return "Usage: agentlocations [regionhandle]";
|
|
|
|
|
|
|
|
|
|
List<GridItem> items = Client.Grid.MapItems(regionHandle, GridItemType.AgentLocations,
|
|
|
|
|
GridLayerType.Objects, 1000 * 20);
|
|
|
|
|
|
|
|
|
|
if (items != null)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder ret = new StringBuilder();
|
|
|
|
|
ret.AppendLine("Agent locations:");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < items.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
GridAgentLocation location = (GridAgentLocation)items[i];
|
|
|
|
|
|
|
|
|
|
ret.AppendLine(String.Format("{0} avatar(s) at {1},{2}", location.AvatarCount, location.LocalX,
|
|
|
|
|
location.LocalY));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return "Failed to fetch agent locations";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|