Update Inventory.cs
This commit is contained in:
parent
e77ab1fb17
commit
5727359626
1 changed files with 24 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
using BetterSecondBot.Static;
|
using BetterSecondBot.Static;
|
||||||
|
using LibreMetaverse;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.Assets;
|
using OpenMetaverse.Assets;
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
@ -146,16 +147,35 @@ namespace SecondBotEvents.Commands
|
||||||
return BasicReply("Ok", new [] { item });
|
return BasicReply("Ok", new [] { item });
|
||||||
}
|
}
|
||||||
|
|
||||||
[About("Attempts to Remove the given inventory folder")]
|
[About("Attempts to Detach the given inventory item (or attachment point)")]
|
||||||
[ReturnHints("ok")]
|
[ReturnHints("ok")]
|
||||||
[ReturnHints("invaild item uuid")]
|
[ReturnHints("okMulti")]
|
||||||
[ArgHints("item", "UUID of item")]
|
[ReturnHints("invaild item uuid pr invaild attach point")]
|
||||||
|
[ArgHints("item", "UUID of item, or the attach point")]
|
||||||
public object Detach(string item)
|
public object Detach(string item)
|
||||||
{
|
{
|
||||||
if (UUID.TryParse(item, out UUID itemuuid) == false)
|
if (UUID.TryParse(item, out UUID itemuuid) == false)
|
||||||
{
|
{
|
||||||
return Failure("invaild item uuid", new [] { item });
|
List<InventoryItem> toBeRemoved = new List<InventoryItem>();
|
||||||
|
foreach (KeyValuePair<UUID, AttachmentPoint> pair in GetClient().Appearance.GetAttachmentsByItemId())
|
||||||
|
{
|
||||||
|
if(pair.Value.ToString() != item)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toBeRemoved.Add(HelperInventory.getItemByInventoryUUID(GetClient(), pair.Key));
|
||||||
|
}
|
||||||
|
if(toBeRemoved.Count == 0)
|
||||||
|
{
|
||||||
|
return Failure("invaild item uuid pr invaild attach point", new[] { item });
|
||||||
|
}
|
||||||
|
foreach(InventoryItem A in toBeRemoved)
|
||||||
|
{
|
||||||
|
GetClient().Appearance.RemoveFromOutfit(A);
|
||||||
|
}
|
||||||
|
return BasicReply("ok", new[] { item });
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(GetClient(), itemuuid);
|
InventoryItem realitem = HelperInventory.getItemByInventoryUUID(GetClient(), itemuuid);
|
||||||
GetClient().Appearance.RemoveFromOutfit(realitem);
|
GetClient().Appearance.RemoveFromOutfit(realitem);
|
||||||
return BasicReply("Ok", new [] { item });
|
return BasicReply("Ok", new [] { item });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue