From cfaa72b2a91360405d7a01a3bf5152e8d0b9126b Mon Sep 17 00:00:00 2001 From: Madpeter <57852827+Madpeterz@users.noreply.github.com> Date: Thu, 10 Feb 2022 07:20:05 +0000 Subject: [PATCH] if the AuthBuyerID is set to the bot the min price can now be zero --- Core/Commands/Parcel.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Core/Commands/Parcel.cs b/Core/Commands/Parcel.cs index c95908e..e8f31c0 100644 --- a/Core/Commands/Parcel.cs +++ b/Core/Commands/Parcel.cs @@ -457,11 +457,20 @@ namespace BetterSecondBot.HttpService { return Failure(tests.Value, "ParcelBuy", new [] { amount }); } + if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID)) + { + return Failure("Parcel sale locked to other avatars", "ParcelBuy", new[] { amount }); + } + int minAmount = 1; + if (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID) + { + minAmount = 0; + } if (int.TryParse(amount, out int amountvalue) == false) { return Failure("Invaild amount", "ParcelBuy", new [] { amount }); } - if (amountvalue < 1) + if (amountvalue < minAmount) { return Failure("Invaild amount", "ParcelBuy", new [] { amount }); }; @@ -469,10 +478,6 @@ namespace BetterSecondBot.HttpService { return Failure("Parcel not for sale", "ParcelBuy", new [] { amount }); } - if ((targetparcel.AuthBuyerID != UUID.Zero) && (targetparcel.AuthBuyerID != bot.GetClient.Self.AgentID)) - { - return Failure("Parcel sale locked to other avatars", "ParcelBuy", new [] { amount }); - } if (targetparcel.SalePrice != amountvalue) { return Failure("Parcel sale price and amount do not match", "ParcelBuy", new [] { amount });