diff --git a/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs b/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs index e19d2420..604340e1 100644 --- a/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs +++ b/Programs/examples/TestClient/Commands/Appearance/WearCommand.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using OpenMetaverse; namespace OpenMetaverse.TestClient @@ -9,32 +10,49 @@ namespace OpenMetaverse.TestClient { Client = testClient; Name = "wear"; - Description = "Wear an outfit folder from inventory. Usage: wear [outfit name] [nobake]"; + Description = "Wear an outfit folder from inventory. Usage: wear [outfit name]"; Category = CommandCategory.Appearance; } public override string Execute(string[] args, UUID fromAgentID) { if (args.Length < 1) - return "Usage: wear [outfit name] eg: 'wear /My Outfit/Dance Party"; + return "Usage: wear [outfit name] eg: 'wear Clothing/My Outfit"; string target = String.Empty; - bool bake = true; - for (int ct = 0; ct < args.Length; ct++) { - if (args[ct].Equals("nobake")) - bake = false; - else - target = target + args[ct] + " "; + target += args[ct] + " "; } target = target.TrimEnd(); - //Client.Appearance.WearOutfit(target.Split('/'), bake); + UUID folder = Client.Inventory.FindObjectByPath(Client.Inventory.Store.RootFolder.UUID, Client.Self.AgentID, target, 20 * 1000); + + if (folder == UUID.Zero) + { + return "Outfit path " + target + " not found"; + } + + List contents = Client.Inventory.FolderContents(folder, Client.Self.AgentID, true, true, InventorySortOrder.ByName, 20 * 1000); + List items = new List(); + + if (contents == null) + { + return "Failed to get contents of " + target; + } + + foreach (InventoryBase item in contents) + { + if (item is InventoryItem) + items.Add((InventoryItem)item); + } + + Client.Appearance.ReplaceOutfit(items); + + return "Starting to change outfit to " + target; - return "FIXME: Implement this"; } } }