2025-05-27 14:16:03 -05:00
|
|
|
using System.Linq;
|
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
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
var attachments = (from kvp in Client.Network.CurrentSim.ObjectsPrimitives
|
|
|
|
|
where kvp.Value != null where kvp.Value.ParentID == Client.Self.LocalID select kvp.Value).ToList();
|
2007-11-30 00:25:08 +00:00
|
|
|
|
2022-02-25 19:38:11 -06:00
|
|
|
foreach (var prim in attachments)
|
2007-11-30 00:25:08 +00:00
|
|
|
{
|
2025-05-27 14:16:03 -05:00
|
|
|
var point = StateToAttachmentPoint(prim.PrimData.State);
|
2007-11-30 00:25:08 +00:00
|
|
|
|
2025-05-27 14:16:03 -05:00
|
|
|
// TODO: Fetch properties for the objects with missing property sets, so we can show names
|
2022-02-25 19:38:11 -06:00
|
|
|
Logger.Log($"[Attachment @ {point}] LocalID: {prim.LocalID} UUID: {prim.ID} Offset: {prim.Position}",
|
|
|
|
|
Helpers.LogLevel.Info, Client);
|
2007-11-30 00:25:08 +00:00
|
|
|
}
|
|
|
|
|
|
2025-05-27 14:16:03 -05:00
|
|
|
return $"Found {attachments.Count} attachments";
|
2007-11-30 00:25:08 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
}
|