2007-11-30 00:25:08 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2007-11-30 00:25:08 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-11-30 00:25:08 +00:00
|
|
|
{
|
|
|
|
|
public class AttachmentsCommand : Command
|
|
|
|
|
{
|
|
|
|
|
public AttachmentsCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Client = testClient;
|
|
|
|
|
Name = "attachments";
|
|
|
|
|
Description = "Prints a list of the currently known agent attachments";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Appearance;
|
2007-11-30 00:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-11-30 00:25:08 +00:00
|
|
|
{
|
2008-01-03 21:55:49 +00:00
|
|
|
List<Primitive> attachments = Client.Network.CurrentSim.ObjectsPrimitives.FindAll(
|
2017-06-04 11:35:39 -05:00
|
|
|
prim => prim.ParentID == Client.Self.LocalID
|
2007-11-30 00:25:08 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < attachments.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Primitive prim = attachments[i];
|
2009-07-23 03:31:16 +00:00
|
|
|
AttachmentPoint point = StateToAttachmentPoint(prim.PrimData.State);
|
2007-11-30 00:25:08 +00:00
|
|
|
|
|
|
|
|
// TODO: Fetch properties for the objects with missing property sets so we can show names
|
2008-05-06 23:57:26 +00:00
|
|
|
Logger.Log(String.Format("[Attachment @ {0}] LocalID: {1} UUID: {2} Offset: {3}",
|
|
|
|
|
point, prim.LocalID, prim.ID, prim.Position), Helpers.LogLevel.Info, Client);
|
2007-11-30 00:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "Found " + attachments.Count + " attachments";
|
|
|
|
|
}
|
2009-07-23 03:31:16 +00:00
|
|
|
|
|
|
|
|
public static AttachmentPoint StateToAttachmentPoint(uint state)
|
|
|
|
|
{
|
|
|
|
|
const uint ATTACHMENT_MASK = 0xF0;
|
|
|
|
|
uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4);
|
|
|
|
|
return (AttachmentPoint)fixedState;
|
|
|
|
|
}
|
2007-11-30 00:25:08 +00:00
|
|
|
}
|
|
|
|
|
}
|