From a0a005490fa6f030ff87c8d80710ae45e373e967 Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Mon, 19 May 2025 12:15:41 +0100 Subject: [PATCH] add new rez commands --- SecondBotEvents/Commands/Inventory.cs | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/SecondBotEvents/Commands/Inventory.cs b/SecondBotEvents/Commands/Inventory.cs index 52de380..4e49670 100644 --- a/SecondBotEvents/Commands/Inventory.cs +++ b/SecondBotEvents/Commands/Inventory.cs @@ -64,6 +64,8 @@ namespace SecondBotEvents.Commands [ReturnHints("UUID of rezzed item")] [ReturnHintsFailure("Invaild item UUID")] [ReturnHintsFailure("Unable to find item")] + [ReturnHintsFailure("Error not in a sim")] + [ReturnHintsFailure("Parcel data not ready")] [ArgHints("item", "UUID of item to rez")] public object RezObject(string item) { @@ -71,6 +73,11 @@ namespace SecondBotEvents.Commands { return Failure("Invaild item UUID: "+ item, [item]); } + KeyValuePair tests = SetupCurrentParcel(); + if (tests.Key == false) + { + return Failure(tests.Value, [item]); + } InventoryItem itm = GetClient().Inventory.FetchItem(targetitem, GetClient().Self.AgentID, TimeSpan.FromSeconds(15)); if (itm == null) { @@ -80,6 +87,79 @@ namespace SecondBotEvents.Commands return BasicReply(rezedobject.ToString(), [item]); } + [About("rezs the item at the parcel center")] + [ReturnHints("UUID of rezzed item")] + [ReturnHintsFailure("Invaild item UUID")] + [ReturnHintsFailure("Unable to find item")] + [ReturnHintsFailure("Error not in a sim")] + [ReturnHintsFailure("Parcel data not ready")] + [ArgHints("item", "UUID of item to rez")] + public object RezObjectParcelCenter(string item) + { + if (UUID.TryParse(item, out UUID targetitem) == false) + { + return Failure("Invaild item UUID: " + item, [item]); + } + KeyValuePair tests = SetupCurrentParcel(); + if (tests.Key == false) + { + return Failure(tests.Value, [item]); + } + InventoryItem itm = GetClient().Inventory.FetchItem(targetitem, GetClient().Self.AgentID, TimeSpan.FromSeconds(15)); + if (itm == null) + { + return Failure("Unable to find item: " + item, [item]); + } + float x = targetparcel.AABBMax.X - (targetparcel.AABBMax.X / 2); + float y = targetparcel.AABBMax.Y - (targetparcel.AABBMax.Y / 2); + Vector3 resat = new Vector3(x,y, GetClient().Self.RelativePosition.Z); + UUID rezedobject = GetClient().Inventory.RequestRezFromInventory(GetClient().Network.CurrentSim, GetClient().Self.SimRotation, resat, itm); + return BasicReply(rezedobject.ToString(), [item]); + } + [About("rezs the item at the target location")] + [ReturnHints("UUID of rezzed item")] + [ReturnHintsFailure("Invaild item UUID")] + [ReturnHintsFailure("Unable to find item")] + [ReturnHintsFailure("Error not in a sim")] + [ReturnHintsFailure("Parcel data not ready")] + [ReturnHintsFailure("Unable to unpack [X,y,z] cord")] + [ArgHints("item", "UUID of item to rez")] + [ArgHints("x", "X cord to rez at")] + [ArgHints("y", "Y cord to rez at")] + [ArgHints("z", "Z cord to rez at")] + public object RezObjectOnPos(string item,string x,string y,string z) + { + if (UUID.TryParse(item, out UUID targetitem) == false) + { + return Failure("Invaild item UUID: " + item, [item]); + } + KeyValuePair tests = SetupCurrentParcel(); + if (tests.Key == false) + { + return Failure(tests.Value, [item]); + } + InventoryItem itm = GetClient().Inventory.FetchItem(targetitem, GetClient().Self.AgentID, TimeSpan.FromSeconds(15)); + if (itm == null) + { + return Failure("Unable to find item: " + item, [item]); + } + if(float.TryParse(x, out float x1) == false) + { + return Failure("Unable to unpack X cord", [item]); + } + if (float.TryParse(y, out float y1) == false) + { + return Failure("Unable to unpack X cord", [item]); + } + if (float.TryParse(z, out float z1) == false) + { + return Failure("Unable to unpack X cord", [item]); + } + Vector3 resat = new Vector3(x1, y1, z1); + UUID rezedobject = GetClient().Inventory.RequestRezFromInventory(GetClient().Network.CurrentSim, GetClient().Self.SimRotation, resat, itm); + return BasicReply(rezedobject.ToString(), [item]); + } + [About("renames a folder or inventory item")] [ReturnHints("ok")]