corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | using System; |
2 | using System.Collections.Generic; |
||
3 | using OpenMetaverse; |
||
4 | |||
5 | namespace OpenMetaverse.TestClient |
||
6 | { |
||
7 | public class AttachmentsCommand : Command |
||
8 | { |
||
9 | public AttachmentsCommand(TestClient testClient) |
||
10 | { |
||
11 | Client = testClient; |
||
12 | Name = "attachments"; |
||
13 | Description = "Prints a list of the currently known agent attachments"; |
||
14 | Category = CommandCategory.Appearance; |
||
15 | } |
||
16 | |||
17 | public override string Execute(string[] args, UUID fromAgentID) |
||
18 | { |
||
19 | List<Primitive> attachments = Client.Network.CurrentSim.ObjectsPrimitives.FindAll( |
||
20 | delegate(Primitive prim) { return prim.ParentID == Client.Self.LocalID; } |
||
21 | ); |
||
22 | |||
23 | for (int i = 0; i < attachments.Count; i++) |
||
24 | { |
||
25 | Primitive prim = attachments[i]; |
||
26 | AttachmentPoint point = StateToAttachmentPoint(prim.PrimData.State); |
||
27 | |||
28 | // TODO: Fetch properties for the objects with missing property sets so we can show names |
||
29 | Logger.Log(String.Format("[Attachment @ {0}] LocalID: {1} UUID: {2} Offset: {3}", |
||
30 | point, prim.LocalID, prim.ID, prim.Position), Helpers.LogLevel.Info, Client); |
||
31 | } |
||
32 | |||
33 | return "Found " + attachments.Count + " attachments"; |
||
34 | } |
||
35 | |||
36 | public static AttachmentPoint StateToAttachmentPoint(uint state) |
||
37 | { |
||
38 | const uint ATTACHMENT_MASK = 0xF0; |
||
39 | uint fixedState = (((byte)state & ATTACHMENT_MASK) >> 4) | (((byte)state & ~ATTACHMENT_MASK) << 4); |
||
40 | return (AttachmentPoint)fixedState; |
||
41 | } |
||
42 | } |
||
43 | } |