From 7bfc22ca1be12dc01fe96a2df0d86bf8526ceaff Mon Sep 17 00:00:00 2001 From: Madpeter Date: Sun, 10 May 2020 22:21:44 +0100 Subject: [PATCH] New command: UnRezObject --- Core/Commands/Prims/UnRezObject.cs | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Core/Commands/Prims/UnRezObject.cs diff --git a/Core/Commands/Prims/UnRezObject.cs b/Core/Commands/Prims/UnRezObject.cs new file mode 100644 index 0000000..0260ea3 --- /dev/null +++ b/Core/Commands/Prims/UnRezObject.cs @@ -0,0 +1,45 @@ +using OpenMetaverse; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BSB.Commands.Prims +{ + class UnRezObject : CoreCommand_1arg + { + public override string[] ArgTypes { get { return new[] { "UUID" }; } } + public override string[] ArgHints { get { return new[] { "The object to unrez"}; } } + public override string Helpfile { get { return "Returns a rezzed object"; } } + + public override bool CallFunction(string[] args) + { + if (base.CallFunction(args) == true) + { + if (UUID.TryParse(args[0], out UUID targetobject) == true) + { + bool found = false; + Dictionary objects_copy = bot.GetClient.Network.CurrentSim.ObjectsPrimitives.Copy(); + foreach (KeyValuePair Obj in objects_copy) + { + if (Obj.Value.ID == targetobject) + { + bot.GetClient.Inventory.RequestDeRezToInventory(Obj.Key); + found = true; + break; + } + } + if(found == true) + { + return true; + } + return Failed("Unable to see object"); + } + else + { + return Failed("Invaild object UUID"); + } + } + return false; + } + } +}