Files
libremetaverse/Programs/examples/TestClient/Commands/Land/AgentLocationsCommand.cs
Jim Radford 6f11b53860 TC-45 New TestClient command selectobjects - will return a list of objects on a specific parcel owned by the specifed owner
TC-44 New TestClient command ownerprims to display prim counts
TC-43 Overhaul TestClient help menu system

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@2000 52acb1d6-8a22-11de-b505-999d5b087335
2008-07-25 08:55:36 +00:00

54 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using OpenMetaverse;
namespace OpenMetaverse.TestClient
{
/// <summary>
/// Display a list of all agent locations in a specified region
/// </summary>
public class AgentLocationsCommand : Command
{
public AgentLocationsCommand(TestClient testClient)
{
Name = "agentlocations";
Description = "Downloads all of the agent locations in a specified region. Usage: agentlocations [regionhandle]";
Category = CommandCategory.Simulator;
}
public override string Execute(string[] args, UUID fromAgentID)
{
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";
}
}
}
}